@vouchfor/embeds 2.0.14 → 2.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,30 @@
1
- var playerEmbed=function(Ge){"use strict";var jy=Object.defineProperty;var Xy=(Ge,ci,Vt)=>ci in Ge?jy(Ge,ci,{enumerable:!0,configurable:!0,writable:!0,value:Vt}):Ge[ci]=Vt;var Ju=(Ge,ci,Vt)=>(Xy(Ge,typeof ci!="symbol"?ci+"":ci,Vt),Vt);var Pu;function ci(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
1
+ var playerEmbed=function(Ge){"use strict";var Zy=Object.defineProperty;var ev=(Ge,ci,Vt)=>ci in Ge?Zy(Ge,ci,{enumerable:!0,configurable:!0,writable:!0,value:Vt}):Ge[ci]=Vt;var Vu=(Ge,ci,Vt)=>(ev(Ge,typeof ci!="symbol"?ci+"":ci,Vt),Vt);var Mu;function ci(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const Vt=globalThis,Hn=Vt.ShadowRoot&&(Vt.ShadyCSS===void 0||Vt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$n=Symbol(),nA=new WeakMap;let oA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==$n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Hn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=nA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&nA.set(t,e))}return e}toString(){return this.cssText}};const ks=s=>new oA(typeof s=="string"?s:s+"",void 0,$n),ht=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new oA(t,s,$n)},Wu=(s,e)=>{if(Hn)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Vt.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},aA=Hn?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return ks(t)})(s):s;/**
5
+ */const Vt=globalThis,$n=Vt.ShadowRoot&&(Vt.ShadyCSS===void 0||Vt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yn=Symbol(),oA=new WeakMap;let aA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Yn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if($n&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=oA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&oA.set(t,e))}return e}toString(){return this.cssText}};const _s=s=>new aA(typeof s=="string"?s:s+"",void 0,Yn),ht=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new aA(t,s,Yn)},Ju=(s,e)=>{if($n)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Vt.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},AA=$n?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return _s(t)})(s):s;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:qu,defineProperty:ju,getOwnPropertyDescriptor:Xu,getOwnPropertyNames:zu,getOwnPropertySymbols:Zu,getPrototypeOf:ed}=Object,Si=globalThis,AA=Si.trustedTypes,td=AA?AA.emptyScript:"",Yn=Si.reactiveElementPolyfillSupport,Fs=(s,e)=>s,yr={toAttribute(s,e){switch(e){case Boolean:s=s?td:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},vr=(s,e)=>!qu(s,e),lA={attribute:!0,type:String,converter:yr,reflect:!1,hasChanged:vr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Si.litPropertyMetadata??(Si.litPropertyMetadata=new WeakMap);class ts extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=lA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&ju(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Xu(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??lA}static _$Ei(){if(this.hasOwnProperty(Fs("elementProperties")))return;const e=ed(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Fs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fs("properties"))){const t=this.properties,i=[...zu(t),...Zu(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(aA(r))}else e!==void 0&&t.push(aA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Wu(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:yr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:yr;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??vr)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}ts.elementStyles=[],ts.shadowRootOptions={mode:"open"},ts[Fs("elementProperties")]=new Map,ts[Fs("finalized")]=new Map,Yn==null||Yn({ReactiveElement:ts}),(Si.reactiveElementVersions??(Si.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:Wu,defineProperty:qu,getOwnPropertyDescriptor:ju,getOwnPropertyNames:Xu,getOwnPropertySymbols:zu,getPrototypeOf:Zu}=Object,Si=globalThis,lA=Si.trustedTypes,ed=lA?lA.emptyScript:"",Kn=Si.reactiveElementPolyfillSupport,ks=(s,e)=>s,mr={toAttribute(s,e){switch(e){case Boolean:s=s?ed:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Cr=(s,e)=>!Wu(s,e),cA={attribute:!0,type:String,converter:mr,reflect:!1,hasChanged:Cr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Si.litPropertyMetadata??(Si.litPropertyMetadata=new WeakMap);class is extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=cA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&qu(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=ju(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??cA}static _$Ei(){if(this.hasOwnProperty(ks("elementProperties")))return;const e=Zu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ks("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ks("properties"))){const t=this.properties,i=[...Xu(t),...zu(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(AA(r))}else e!==void 0&&t.push(AA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ju(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:mr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:mr;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Cr)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}is.elementStyles=[],is.shadowRootOptions={mode:"open"},is[ks("elementProperties")]=new Map,is[ks("finalized")]=new Map,Kn==null||Kn({ReactiveElement:is}),(Si.reactiveElementVersions??(Si.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Ns=globalThis,Br=Ns.trustedTypes,cA=Br?Br.createPolicy("lit-html",{createHTML:s=>s}):void 0,Kn="$lit$",hi=`lit$${(Math.random()+"").slice(9)}$`,Vn="?"+hi,id=`<${Vn}>`,Fi=document,Ms=()=>Fi.createComment(""),Ps=s=>s===null||typeof s!="object"&&typeof s!="function",hA=Array.isArray,uA=s=>hA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Jn=`[
14
- \f\r]`,Os=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,dA=/-->/g,gA=/>/g,Ni=RegExp(`>|${Jn}(?:([^\\s"'>=/]+)(${Jn}*=${Jn}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),fA=/'/g,pA=/"/g,EA=/^(?:script|style|textarea|title)$/i,sd=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),Ie=sd(1),Pt=Symbol.for("lit-noChange"),Xe=Symbol.for("lit-nothing"),IA=new WeakMap,Mi=Fi.createTreeWalker(Fi,129);function mA(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return cA!==void 0?cA.createHTML(e):e}const CA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Os;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Os?c[1]==="!--"?o=dA:c[1]!==void 0?o=gA:c[2]!==void 0?(EA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Ni):c[3]!==void 0&&(o=Ni):o===Ni?c[0]===">"?(o=r??Os,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Ni:c[3]==='"'?pA:fA):o===pA||o===fA?o=Ni:o===dA||o===gA?o=Os:(o=Ni,r=void 0);const d=o===Ni&&s[a+1].startsWith("/>")?" ":"";n+=o===Os?A+id:h>=0?(i.push(l),A.slice(0,h)+Kn+A.slice(h)+hi+d):A+hi+(h===-2?a:d)}return[mA(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Us{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=CA(e,t);if(this.el=Us.createElement(l,i),Mi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Mi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Kn)){const u=c[o++],d=r.getAttribute(h).split(hi),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?vA:g[1]==="?"?BA:g[1]==="@"?QA:Gs}),r.removeAttribute(h)}else h.startsWith(hi)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(EA.test(r.tagName)){const h=r.textContent.split(hi),u=h.length-1;if(u>0){r.textContent=Br?Br.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Ms()),Mi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Ms())}}}else if(r.nodeType===8)if(r.data===Vn)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(hi,h+1))!==-1;)A.push({type:7,index:n}),h+=hi.length-1}n++}}static createElement(e,t){const i=Fi.createElement("template");return i.innerHTML=e,i}}function Pi(s,e,t=s,i){var o,a;if(e===Pt)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Ps(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=Pi(s,r._$AS(s,e.values),r,i)),e}class yA{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){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Fi).importNode(t,!0);Mi.currentNode=r;let n=Mi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new is(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new SA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Mi.nextNode(),o++)}return Mi.currentNode=Fi,r}p(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 is{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Xe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}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=Pi(this,e,t),Ps(e)?e===Xe||e==null||e===""?(this._$AH!==Xe&&this._$AR(),this._$AH=Xe):e!==this._$AH&&e!==Pt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):uA(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==Xe&&Ps(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fi.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Us.createElement(mA(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new yA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=IA.get(e.strings);return t===void 0&&IA.set(e.strings,t=new Us(e)),t}k(e){hA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new is(this.S(Ms()),this.S(Ms()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Gs{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=Xe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Xe}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Pi(this,e,t,0),o=!Ps(e)||e!==this._$AH&&e!==Pt,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Pi(this,a[i+A],t,A),l===Pt&&(l=this._$AH[A]),o||(o=!Ps(l)||l!==this._$AH[A]),l===Xe?e=Xe:e!==Xe&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===Xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class vA extends Gs{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Xe?void 0:e}}class BA extends Gs{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Xe)}}class QA extends Gs{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Pi(this,e,t,0)??Xe)===Pt)return;const i=this._$AH,r=e===Xe&&i!==Xe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Xe&&(i===Xe||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class SA{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){Pi(this,e)}}const rd={P:Kn,A:hi,C:Vn,M:1,L:CA,R:yA,D:uA,V:Pi,I:is,H:Gs,N:BA,U:QA,B:vA,F:SA},Wn=Ns.litHtmlPolyfillSupport;Wn==null||Wn(Us,is),(Ns.litHtmlVersions??(Ns.litHtmlVersions=[])).push("3.1.2");const nd=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new is(e.insertBefore(Ms(),n),n,void 0,t??{})}return r._$AI(s),r};/**
13
+ */const Fs=globalThis,yr=Fs.trustedTypes,hA=yr?yr.createPolicy("lit-html",{createHTML:s=>s}):void 0,Vn="$lit$",hi=`lit$${(Math.random()+"").slice(9)}$`,Jn="?"+hi,td=`<${Jn}>`,Fi=document,Ns=()=>Fi.createComment(""),Ms=s=>s===null||typeof s!="object"&&typeof s!="function",uA=Array.isArray,dA=s=>uA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Wn=`[
14
+ \f\r]`,Ps=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gA=/-->/g,fA=/>/g,Ni=RegExp(`>|${Wn}(?:([^\\s"'>=/]+)(${Wn}*=${Wn}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),pA=/'/g,EA=/"/g,IA=/^(?:script|style|textarea|title)$/i,id=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),Ie=id(1),Pt=Symbol.for("lit-noChange"),Xe=Symbol.for("lit-nothing"),mA=new WeakMap,Mi=Fi.createTreeWalker(Fi,129);function CA(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return hA!==void 0?hA.createHTML(e):e}const yA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ps;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Ps?c[1]==="!--"?o=gA:c[1]!==void 0?o=fA:c[2]!==void 0?(IA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Ni):c[3]!==void 0&&(o=Ni):o===Ni?c[0]===">"?(o=r??Ps,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Ni:c[3]==='"'?EA:pA):o===EA||o===pA?o=Ni:o===gA||o===fA?o=Ps:(o=Ni,r=void 0);const d=o===Ni&&s[a+1].startsWith("/>")?" ":"";n+=o===Ps?A+td:h>=0?(i.push(l),A.slice(0,h)+Vn+A.slice(h)+hi+d):A+hi+(h===-2?a:d)}return[CA(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Os{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=yA(e,t);if(this.el=Os.createElement(l,i),Mi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Mi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Vn)){const u=c[o++],d=r.getAttribute(h).split(hi),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?BA:g[1]==="?"?QA:g[1]==="@"?SA:Us}),r.removeAttribute(h)}else h.startsWith(hi)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(IA.test(r.tagName)){const h=r.textContent.split(hi),u=h.length-1;if(u>0){r.textContent=yr?yr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Ns()),Mi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Ns())}}}else if(r.nodeType===8)if(r.data===Jn)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(hi,h+1))!==-1;)A.push({type:7,index:n}),h+=hi.length-1}n++}}static createElement(e,t){const i=Fi.createElement("template");return i.innerHTML=e,i}}function Pi(s,e,t=s,i){var o,a;if(e===Pt)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Ms(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=Pi(s,r._$AS(s,e.values),r,i)),e}class vA{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){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Fi).importNode(t,!0);Mi.currentNode=r;let n=Mi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new ss(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new bA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Mi.nextNode(),o++)}return Mi.currentNode=Fi,r}p(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 ss{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Xe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}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=Pi(this,e,t),Ms(e)?e===Xe||e==null||e===""?(this._$AH!==Xe&&this._$AR(),this._$AH=Xe):e!==this._$AH&&e!==Pt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):dA(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==Xe&&Ms(this._$AH)?this._$AA.nextSibling.data=e:this.T(Fi.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Os.createElement(CA(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new vA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=mA.get(e.strings);return t===void 0&&mA.set(e.strings,t=new Os(e)),t}k(e){uA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new ss(this.S(Ns()),this.S(Ns()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Us{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=Xe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Xe}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Pi(this,e,t,0),o=!Ms(e)||e!==this._$AH&&e!==Pt,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Pi(this,a[i+A],t,A),l===Pt&&(l=this._$AH[A]),o||(o=!Ms(l)||l!==this._$AH[A]),l===Xe?e=Xe:e!==Xe&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===Xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class BA extends Us{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Xe?void 0:e}}class QA extends Us{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Xe)}}class SA extends Us{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Pi(this,e,t,0)??Xe)===Pt)return;const i=this._$AH,r=e===Xe&&i!==Xe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Xe&&(i===Xe||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class bA{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){Pi(this,e)}}const sd={P:Vn,A:hi,C:Jn,M:1,L:yA,R:vA,D:dA,V:Pi,I:ss,H:Us,N:QA,U:SA,B:BA,F:bA},qn=Fs.litHtmlPolyfillSupport;qn==null||qn(Os,ss),(Fs.litHtmlVersions??(Fs.litHtmlVersions=[])).push("3.1.2");const rd=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new ss(e.insertBefore(Ns(),n),n,void 0,t??{})}return r._$AI(s),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let ss=class extends ts{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=nd(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Pt}};ss._$litElement$=!0,ss.finalized=!0,(Pu=globalThis.litElementHydrateSupport)==null||Pu.call(globalThis,{LitElement:ss});const qn=globalThis.litElementPolyfillSupport;qn==null||qn({LitElement:ss}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
19
+ */let rs=class extends is{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rd(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Pt}};rs._$litElement$=!0,rs.finalized=!0,(Mu=globalThis.litElementHydrateSupport)==null||Mu.call(globalThis,{LitElement:rs});const jn=globalThis.litElementPolyfillSupport;jn==null||jn({LitElement:rs}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const od=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
23
+ */const nd=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const ad={attribute:!0,type:String,converter:yr,reflect:!1,hasChanged:vr},Ad=(s=ad,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function z(s){return(e,t)=>typeof t=="object"?Ad(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
27
+ */const od={attribute:!0,type:String,converter:mr,reflect:!1,hasChanged:Cr},ad=(s=od,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function z(s){return(e,t)=>typeof t=="object"?ad(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
@@ -36,24 +36,24 @@ var playerEmbed=function(Ge){"use strict";var jy=Object.defineProperty;var Xy=(G
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
39
- */const{I:ld}=rd,cd=s=>s.strings===void 0,bA=()=>document.createComment(""),Hs=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(bA(),r),a=i.insertBefore(bA(),r);t=new ld(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},Oi=(s,e,t=s)=>(s._$AI(e,t),s),hd={},ud=(s,e=hd)=>s._$AH=e,dd=s=>s._$AH,jn=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
39
+ */const{I:Ad}=sd,ld=s=>s.strings===void 0,wA=()=>document.createComment(""),Gs=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(wA(),r),a=i.insertBefore(wA(),r);t=new Ad(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},Oi=(s,e,t=s)=>(s._$AI(e,t),s),cd={},hd=(s,e=cd)=>s._$AH=e,ud=s=>s._$AH,Xn=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */const rs={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ns=s=>(...e)=>({_$litDirective$:s,values:e});let $s=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
43
+ */const ns={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},os=s=>(...e)=>({_$litDirective$:s,values:e});let Hs=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const Ys=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),Ys(r,e);return!0},Qr=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},wA=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),pd(e)}};function gd(s){this._$AN!==void 0?(Qr(this),this._$AM=s,wA(this)):this._$AM=s}function fd(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)Ys(i[n],!1),Qr(i[n]);else i!=null&&(Ys(i,!1),Qr(i));else Ys(this,s)}const pd=s=>{s.type==rs.CHILD&&(s._$AP??(s._$AP=fd),s._$AQ??(s._$AQ=gd))};class RA extends $s{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),wA(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&(Ys(this,e),Qr(this))}setValue(e){if(cd(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
47
+ */const $s=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),$s(r,e);return!0},vr=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},RA=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),fd(e)}};function dd(s){this._$AN!==void 0?(vr(this),this._$AM=s,RA(this)):this._$AM=s}function gd(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)$s(i[n],!1),vr(i[n]);else i!=null&&($s(i,!1),vr(i));else $s(this,s)}const fd=s=>{s.type==ns.CHILD&&(s._$AP??(s._$AP=gd),s._$AQ??(s._$AQ=dd))};class xA extends Hs{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),RA(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&($s(this,e),vr(this))}setValue(e){if(ld(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
48
48
  * @license
49
49
  * Copyright 2020 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const ft=()=>new Ed;let Ed=class{};const Xn=new WeakMap,pt=ns(class extends RA{render(s){return Xe}update(s,[e]){var i;const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),Xe}rt(s){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=Xn.get(e);t===void 0&&(t=new WeakMap,Xn.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=Xn.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Id(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class md{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=ft(),this.host=e,this._events=t,e.addController(this)}register(){return pt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Id(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const ft=()=>new pd;let pd=class{};const zn=new WeakMap,pt=os(class extends xA{render(s){return Xe}update(s,[e]){var i;const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),Xe}rt(s){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=zn.get(e);t===void 0&&(t=new WeakMap,zn.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=zn.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Ed(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class Id{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=ft(),this.host=e,this._events=t,e.addController(this)}register(){return pt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Ed(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
52
52
  * @license
53
53
  * Copyright 2017 Google LLC
54
54
  * SPDX-License-Identifier: BSD-3-Clause
55
- */const Cd=Symbol();class Sr{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??yd,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(h){n=!0,i=h}if(this.u===r){if(t===Cd)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const yd=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!vr(t,e[i]));let br;const vd=new Uint8Array(16);function Bd(){if(!br&&(br=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!br))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return br(vd)}const ut=[];for(let s=0;s<256;++s)ut.push((s+256).toString(16).slice(1));function Qd(s,e=0){return ut[s[e+0]]+ut[s[e+1]]+ut[s[e+2]]+ut[s[e+3]]+"-"+ut[s[e+4]]+ut[s[e+5]]+"-"+ut[s[e+6]]+ut[s[e+7]]+"-"+ut[s[e+8]]+ut[s[e+9]]+"-"+ut[s[e+10]]+ut[s[e+11]]+ut[s[e+12]]+ut[s[e+13]]+ut[s[e+14]]+ut[s[e+15]]}const xA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ui(s,e,t){if(xA.randomUUID&&!e&&!s)return xA.randomUUID();s=s||{};const i=s.random||(s.rng||Bd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return Qd(i)}const TA="https://d2rxhdlm2q91uk.cloudfront.net",Sd="https://d1ix11aj5kfygl.cloudfront.net",bd="https://d157jlwnudd93d.cloudfront.net",DA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",wd="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Rd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",xd="http://localhost:6060/v2",Td="https://embed-dev.vouchfor.com/v2",Dd="https://embed-staging.vouchfor.com/v2",Ld="https://embed.vouchfor.com/v2";function wr(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:TA,publicApiUrl:DA,embedApiUrl:xd};if(s==="dev")return{videoUrl:TA,publicApiUrl:DA,embedApiUrl:Td};if(s==="staging")return{videoUrl:Sd,publicApiUrl:wd,embedApiUrl:Dd};if(s==="prod")return{videoUrl:bd,publicApiUrl:Rd,embedApiUrl:Ld}}class _d{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=wr(t),o=Ui(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=wr(t),o=Ui(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Sr(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let h;o&&(this.fetching=!0,h=await this.getTemplate(t,i,o)),this._vouch=r,e.template=h??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[h,u]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=h,e.template=u??((c=(l=h==null?void 0:h.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Sr(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const kd=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Fd(r,n)&&i||Object.defineProperty(s,t,n)},Fd=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Nd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Md=(s,e)=>`/* Wrapped ${s}*/
56
- ${e}`,Pd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Od=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Ud=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Md.bind(null,i,e.toString());Object.defineProperty(r,"name",Od);const{writable:n,enumerable:o,configurable:a}=Pd;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function Gd(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))kd(s,e,r,t);return Nd(s,e),Ud(s,e,i),s}const Hd=new WeakMap,LA=new WeakMap;function zn(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const h=LA.get(s)??new Set;h.add(c),LA.set(s,h)}return A};return Gd(r,s,{ignoreNonConfigurable:!0}),Hd.set(r,t),r}var _A=function(){};const $d=(s,e,t)=>Math.min(Math.max(t,s),e),kA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},Zn=(s,e,t)=>-t*s+t*e+s,FA=(s,e)=>t=>Math.max(Math.min(t,e),s),Ks=s=>s%1?Number(s.toFixed(5)):s,Rr=/(-)?([\d]*\.?[\d])+/g,eo=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Yd=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Vs(s){return typeof s=="string"}const xr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},NA=Object.assign(Object.assign({},xr),{transform:FA(0,1)});Object.assign(Object.assign({},xr),{default:1});const Js=(s=>({test:e=>Vs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},Js),{parse:s=>Js.parse(s)/100,transform:s=>Js.transform(s*100)});const to=(s,e)=>t=>!!(Vs(t)&&Yd.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),MA=(s,e,t)=>i=>{if(!Vs(i))return i;const[r,n,o,a]=i.match(Rr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Gi={test:to("hsl","hue"),parse:MA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+Js.transform(Ks(e))+", "+Js.transform(Ks(t))+", "+Ks(NA.transform(i))+")"},Kd=FA(0,255),io=Object.assign(Object.assign({},xr),{transform:s=>Math.round(Kd(s))}),wi={test:to("rgb","red"),parse:MA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+io.transform(s)+", "+io.transform(e)+", "+io.transform(t)+", "+Ks(NA.transform(i))+")"};function Vd(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const so={test:to("#"),parse:Vd,transform:wi.transform},Tr={test:s=>wi.test(s)||so.test(s)||Gi.test(s),parse:s=>wi.test(s)?wi.parse(s):Gi.test(s)?Gi.parse(s):so.parse(s),transform:s=>Vs(s)?s:s.hasOwnProperty("red")?wi.transform(s):Gi.transform(s)},PA="${c}",OA="${n}";function Jd(s){var e,t,i,r;return isNaN(s)&&Vs(s)&&((t=(e=s.match(Rr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(eo))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function UA(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(eo);i&&(t=i.length,s=s.replace(eo,PA),e.push(...i.map(Tr.parse)));const r=s.match(Rr);return r&&(s=s.replace(Rr,OA),e.push(...r.map(xr.parse))),{values:e,numColors:t,tokenised:s}}function GA(s){return UA(s).values}function HA(s){const{values:e,numColors:t,tokenised:i}=UA(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?PA:OA,a<t?Tr.transform(n[a]):Ks(n[a]));return o}}const Wd=s=>typeof s=="number"?0:s;function qd(s){const e=GA(s);return HA(s)(e.map(Wd))}const $A={test:Jd,parse:GA,createTransformer:HA,getAnimatableNone:qd};function ro(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function YA({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=ro(A,a,s+.3333333333333333),n=ro(A,a,s),o=ro(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const jd=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},Xd=[so,wi,Gi],KA=s=>Xd.find(e=>e.test(s)),VA=(s,e)=>{let t=KA(s),i=KA(e),r=t.parse(s),n=i.parse(e);t===Gi&&(r=YA(r),t=wi),i===Gi&&(n=YA(n),i=wi);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=jd(r[A],n[A],a));return o.alpha=Zn(r.alpha,n.alpha,a),t.transform(o)}},zd=s=>typeof s=="number",Zd=(s,e)=>t=>e(s(t)),JA=(...s)=>s.reduce(Zd);function WA(s,e){return zd(s)?t=>Zn(s,e,t):Tr.test(s)?VA(s,e):XA(s,e)}const qA=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>WA(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},eg=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=WA(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function jA(s){const e=$A.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const XA=(s,e)=>{const t=$A.createTransformer(e),i=jA(s),r=jA(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?JA(qA(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},tg=(s,e)=>t=>Zn(s,e,t);function ig(s){if(typeof s=="number")return tg;if(typeof s=="string")return Tr.test(s)?VA:XA;if(Array.isArray(s))return qA;if(typeof s=="object")return eg}function sg(s,e,t){const i=[],r=t||ig(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=JA(A,a)}i.push(a)}return i}function rg([s,e],[t]){return i=>t(kA(s,e,i))}function ng(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=kA(s[n],s[n+1],r);return e[n](a)}}function og(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;_A(n===e.length),_A(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=sg(e,i,r),a=n===2?rg(s,o):ng(s,o);return t?A=>a($d(s[0],s[n-1],A)):a}const Dr=s=>e=>1-s(1-e),no=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,ag=s=>e=>Math.pow(e,s),zA=s=>e=>e*e*((s+1)*e-s),Ag=s=>{const e=zA(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},ZA=1.525,lg=4/11,cg=8/11,hg=9/10,ug=s=>s,oo=ag(2),dg=Dr(oo),gg=no(oo),el=s=>1-Math.sin(Math.acos(s)),tl=Dr(el),fg=no(tl),ao=zA(ZA),pg=Dr(ao),Eg=no(ao),Ig=Ag(ZA),mg=4356/361,Cg=35442/1805,yg=16061/1805,Lr=s=>{if(s===1||s===0)return s;const e=s*s;return s<lg?7.5625*e:s<cg?9.075*e-9.9*s+3.4:s<hg?mg*e-Cg*s+yg:10.8*s*s-20.52*s+10.72},vg=Dr(Lr),Bg=s=>s<.5?.5*(1-Lr(1-s*2)):.5*Lr(s*2-1)+.5;var _r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function il(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ao={exports:{}};(function(s,e){(function(t,i){i(e)})(_r,function(t){function i(R){var b,T,K=new Error(R);return b=K,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(b,T):b.__proto__=T,K}function r(R,b,T){var K=b.slice(0,T).split(/\n/),M=K.length,W=K[M-1].length+1;throw i(R+=" at line "+M+" col "+W+`:
55
+ */const md=Symbol();class Br{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??Cd,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(h){n=!0,i=h}if(this.u===r){if(t===md)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const Cd=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!Cr(t,e[i]));let Qr;const yd=new Uint8Array(16);function vd(){if(!Qr&&(Qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qr(yd)}const ut=[];for(let s=0;s<256;++s)ut.push((s+256).toString(16).slice(1));function Bd(s,e=0){return ut[s[e+0]]+ut[s[e+1]]+ut[s[e+2]]+ut[s[e+3]]+"-"+ut[s[e+4]]+ut[s[e+5]]+"-"+ut[s[e+6]]+ut[s[e+7]]+"-"+ut[s[e+8]]+ut[s[e+9]]+"-"+ut[s[e+10]]+ut[s[e+11]]+ut[s[e+12]]+ut[s[e+13]]+ut[s[e+14]]+ut[s[e+15]]}const TA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ui(s,e,t){if(TA.randomUUID&&!e&&!s)return TA.randomUUID();s=s||{};const i=s.random||(s.rng||vd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return Bd(i)}const DA="https://d2rxhdlm2q91uk.cloudfront.net",Qd="https://d1ix11aj5kfygl.cloudfront.net",Sd="https://d157jlwnudd93d.cloudfront.net",LA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",bd="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",wd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",Rd="http://localhost:6060/v2",xd="https://embed-dev.vouchfor.com/v2",Td="https://embed-staging.vouchfor.com/v2",Dd="https://embed.vouchfor.com/v2";function Sr(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:DA,publicApiUrl:LA,embedApiUrl:Rd};if(s==="dev")return{videoUrl:DA,publicApiUrl:LA,embedApiUrl:xd};if(s==="staging")return{videoUrl:Qd,publicApiUrl:bd,embedApiUrl:Td};if(s==="prod")return{videoUrl:Sd,publicApiUrl:wd,embedApiUrl:Dd}}class Ld{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=Sr(t),o=Ui(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=Sr(t),o=Ui(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Br(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let h;o&&(this.fetching=!0,h=await this.getTemplate(t,i,o)),this._vouch=r,e.template=h??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[h,u]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=h,e.template=u??((c=(l=h==null?void 0:h.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Br(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const _d=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!kd(r,n)&&i||Object.defineProperty(s,t,n)},kd=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Fd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Nd=(s,e)=>`/* Wrapped ${s}*/
56
+ ${e}`,Md=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Pd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Od=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Nd.bind(null,i,e.toString());Object.defineProperty(r,"name",Pd);const{writable:n,enumerable:o,configurable:a}=Md;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function Ud(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))_d(s,e,r,t);return Fd(s,e),Od(s,e,i),s}const Gd=new WeakMap,_A=new WeakMap;function Zn(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const h=_A.get(s)??new Set;h.add(c),_A.set(s,h)}return A};return Ud(r,s,{ignoreNonConfigurable:!0}),Gd.set(r,t),r}var kA=function(){};const Hd=(s,e,t)=>Math.min(Math.max(t,s),e),FA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},eo=(s,e,t)=>-t*s+t*e+s,NA=(s,e)=>t=>Math.max(Math.min(t,e),s),Ys=s=>s%1?Number(s.toFixed(5)):s,br=/(-)?([\d]*\.?[\d])+/g,to=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,$d=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ks(s){return typeof s=="string"}const wr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},MA=Object.assign(Object.assign({},wr),{transform:NA(0,1)});Object.assign(Object.assign({},wr),{default:1});const Vs=(s=>({test:e=>Ks(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},Vs),{parse:s=>Vs.parse(s)/100,transform:s=>Vs.transform(s*100)});const io=(s,e)=>t=>!!(Ks(t)&&$d.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),PA=(s,e,t)=>i=>{if(!Ks(i))return i;const[r,n,o,a]=i.match(br);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Gi={test:io("hsl","hue"),parse:PA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+Vs.transform(Ys(e))+", "+Vs.transform(Ys(t))+", "+Ys(MA.transform(i))+")"},Yd=NA(0,255),so=Object.assign(Object.assign({},wr),{transform:s=>Math.round(Yd(s))}),wi={test:io("rgb","red"),parse:PA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+so.transform(s)+", "+so.transform(e)+", "+so.transform(t)+", "+Ys(MA.transform(i))+")"};function Kd(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const ro={test:io("#"),parse:Kd,transform:wi.transform},Rr={test:s=>wi.test(s)||ro.test(s)||Gi.test(s),parse:s=>wi.test(s)?wi.parse(s):Gi.test(s)?Gi.parse(s):ro.parse(s),transform:s=>Ks(s)?s:s.hasOwnProperty("red")?wi.transform(s):Gi.transform(s)},OA="${c}",UA="${n}";function Vd(s){var e,t,i,r;return isNaN(s)&&Ks(s)&&((t=(e=s.match(br))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(to))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function GA(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(to);i&&(t=i.length,s=s.replace(to,OA),e.push(...i.map(Rr.parse)));const r=s.match(br);return r&&(s=s.replace(br,UA),e.push(...r.map(wr.parse))),{values:e,numColors:t,tokenised:s}}function HA(s){return GA(s).values}function $A(s){const{values:e,numColors:t,tokenised:i}=GA(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?OA:UA,a<t?Rr.transform(n[a]):Ys(n[a]));return o}}const Jd=s=>typeof s=="number"?0:s;function Wd(s){const e=HA(s);return $A(s)(e.map(Jd))}const YA={test:Vd,parse:HA,createTransformer:$A,getAnimatableNone:Wd};function no(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function KA({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=no(A,a,s+.3333333333333333),n=no(A,a,s),o=no(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const qd=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},jd=[ro,wi,Gi],VA=s=>jd.find(e=>e.test(s)),JA=(s,e)=>{let t=VA(s),i=VA(e),r=t.parse(s),n=i.parse(e);t===Gi&&(r=KA(r),t=wi),i===Gi&&(n=KA(n),i=wi);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=qd(r[A],n[A],a));return o.alpha=eo(r.alpha,n.alpha,a),t.transform(o)}},Xd=s=>typeof s=="number",zd=(s,e)=>t=>e(s(t)),WA=(...s)=>s.reduce(zd);function qA(s,e){return Xd(s)?t=>eo(s,e,t):Rr.test(s)?JA(s,e):zA(s,e)}const jA=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>qA(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},Zd=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=qA(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function XA(s){const e=YA.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const zA=(s,e)=>{const t=YA.createTransformer(e),i=XA(s),r=XA(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?WA(jA(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},eg=(s,e)=>t=>eo(s,e,t);function tg(s){if(typeof s=="number")return eg;if(typeof s=="string")return Rr.test(s)?JA:zA;if(Array.isArray(s))return jA;if(typeof s=="object")return Zd}function ig(s,e,t){const i=[],r=t||tg(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=WA(A,a)}i.push(a)}return i}function sg([s,e],[t]){return i=>t(FA(s,e,i))}function rg(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=FA(s[n],s[n+1],r);return e[n](a)}}function ng(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;kA(n===e.length),kA(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=ig(e,i,r),a=n===2?sg(s,o):rg(s,o);return t?A=>a(Hd(s[0],s[n-1],A)):a}const xr=s=>e=>1-s(1-e),oo=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,og=s=>e=>Math.pow(e,s),ZA=s=>e=>e*e*((s+1)*e-s),ag=s=>{const e=ZA(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},el=1.525,Ag=4/11,lg=8/11,cg=9/10,hg=s=>s,ao=og(2),ug=xr(ao),dg=oo(ao),tl=s=>1-Math.sin(Math.acos(s)),il=xr(tl),gg=oo(il),Ao=ZA(el),fg=xr(Ao),pg=oo(Ao),Eg=ag(el),Ig=4356/361,mg=35442/1805,Cg=16061/1805,Tr=s=>{if(s===1||s===0)return s;const e=s*s;return s<Ag?7.5625*e:s<lg?9.075*e-9.9*s+3.4:s<cg?Ig*e-mg*s+Cg:10.8*s*s-20.52*s+10.72},yg=xr(Tr),vg=s=>s<.5?.5*(1-Tr(1-s*2)):.5*Tr(s*2-1)+.5;var Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var lo={exports:{}};(function(s,e){(function(t,i){i(e)})(Dr,function(t){function i(R){var b,T,K=new Error(R);return b=K,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(b,T):b.__proto__=T,K}function r(R,b,T){var K=b.slice(0,T).split(/\n/),M=K.length,W=K[M-1].length+1;throw i(R+=" at line "+M+" col "+W+`:
57
57
 
58
58
  `+b.split(/\n/)[M-1]+`
59
59
  `+Array(W).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(R){if(!(R instanceof SyntaxError))throw R}function a(R,b){return Object.prototype.hasOwnProperty.call(R,b)}function A(R,b,T){for(var K in b)a(b,K)&&(b[K]==null||typeof b[K]!="object"||K!=="storage"&&K!=="prefixes"||T?R[K]=b[K]:R[K]=A({},b[K]));return R}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(R){return d.test(R)?R.replace(d,"\\$&"):R}function f(R,b){b.rmWhitespace&&(R=R.replace(/[\r\n]+/g,`
@@ -62,13 +62,13 @@ ${e}`,Pd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Od=Objec
62
62
 
63
63
  `+M.message+`
64
64
  `+Array(M.message.length+1).join("=")+`
65
- `+p(R,T)):M}}function $(R,b){var T;return b.cache&&b.name&&b.storage.templates.get(b.name)?b.storage.templates.get(b.name):(T=typeof R=="function"?R:x(R,b),b.cache&&b.name&&b.storage.templates.define(b.name,T),T)}X.l.bind(X),t.compile=x,t.compileScope=Q,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=X,t.filters=V,t.getConfig=w,t.helpers=U,t.nativeHelpers=q,t.parse=f,t.render=function(R,b,T,K){var M=w(T||{});if(!M.async)return $(R,M)(b,M);if(!K){if(typeof n=="function")return new n(function(W,ie){try{W($(R,M)(b,M))}catch(ce){ie(ce)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{$(R,M)(b,M,K)}catch(W){return K(W)}},t.templates=F,Object.defineProperty(t,"__esModule",{value:!0})})})(Ao,Ao.exports);var lo=Ao.exports;const Qg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Sg(r,n)&&i||Object.defineProperty(s,t,n)},Sg=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},bg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},wg=(s,e)=>`/* Wrapped ${s}*/
66
- ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Tg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=wg.bind(null,i,e.toString());Object.defineProperty(r,"name",xg),Object.defineProperty(s,"toString",{...Rg,value:r})};function Dg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Qg(s,e,r,t);return bg(s,e),Tg(s,e,i),s}const Lg=new WeakMap;function ui(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Dg(r,s,{ignoreNonConfigurable:!0}),Lg.set(r,t),r}var sl={},co={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=Qe.Wrap=Qe.Unit=Qe.PrintOptions=Qe.PositionType=Qe.Overflow=Qe.NodeType=Qe.MeasureMode=Qe.LogLevel=Qe.Justify=Qe.Gutter=Qe.FlexDirection=Qe.ExperimentalFeature=Qe.Errata=Qe.Edge=Qe.Display=Qe.Direction=Qe.Dimension=Qe.Align=void 0;let di=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s}({});Qe.Align=di;let ho=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});Qe.Dimension=ho;let kr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});Qe.Direction=kr;let uo=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});Qe.Display=uo;let Jt=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({});Qe.Edge=Jt;let Ws=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({});Qe.Errata=Ws;let Fr=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});Qe.ExperimentalFeature=Fr;let qs=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});Qe.FlexDirection=qs;let Nr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});Qe.Gutter=Nr;let Hi=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({});Qe.Justify=Hi;let $i=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({});Qe.LogLevel=$i;let Mr=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});Qe.MeasureMode=Mr;let go=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});Qe.NodeType=go;let Pr=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});Qe.Overflow=Pr;let Or=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});Qe.PositionType=Or;let Ur=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});Qe.PrintOptions=Ur;let js=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});Qe.Unit=js;let Gr=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});Qe.Wrap=Gr;var _g={ALIGN_AUTO:di.Auto,ALIGN_FLEX_START:di.FlexStart,ALIGN_CENTER:di.Center,ALIGN_FLEX_END:di.FlexEnd,ALIGN_STRETCH:di.Stretch,ALIGN_BASELINE:di.Baseline,ALIGN_SPACE_BETWEEN:di.SpaceBetween,ALIGN_SPACE_AROUND:di.SpaceAround,DIMENSION_WIDTH:ho.Width,DIMENSION_HEIGHT:ho.Height,DIRECTION_INHERIT:kr.Inherit,DIRECTION_LTR:kr.LTR,DIRECTION_RTL:kr.RTL,DISPLAY_FLEX:uo.Flex,DISPLAY_NONE:uo.None,EDGE_LEFT:Jt.Left,EDGE_TOP:Jt.Top,EDGE_RIGHT:Jt.Right,EDGE_BOTTOM:Jt.Bottom,EDGE_START:Jt.Start,EDGE_END:Jt.End,EDGE_HORIZONTAL:Jt.Horizontal,EDGE_VERTICAL:Jt.Vertical,EDGE_ALL:Jt.All,ERRATA_NONE:Ws.None,ERRATA_STRETCH_FLEX_BASIS:Ws.StretchFlexBasis,ERRATA_ALL:Ws.All,ERRATA_CLASSIC:Ws.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Fr.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Fr.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Fr.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:qs.Column,FLEX_DIRECTION_COLUMN_REVERSE:qs.ColumnReverse,FLEX_DIRECTION_ROW:qs.Row,FLEX_DIRECTION_ROW_REVERSE:qs.RowReverse,GUTTER_COLUMN:Nr.Column,GUTTER_ROW:Nr.Row,GUTTER_ALL:Nr.All,JUSTIFY_FLEX_START:Hi.FlexStart,JUSTIFY_CENTER:Hi.Center,JUSTIFY_FLEX_END:Hi.FlexEnd,JUSTIFY_SPACE_BETWEEN:Hi.SpaceBetween,JUSTIFY_SPACE_AROUND:Hi.SpaceAround,JUSTIFY_SPACE_EVENLY:Hi.SpaceEvenly,LOG_LEVEL_ERROR:$i.Error,LOG_LEVEL_WARN:$i.Warn,LOG_LEVEL_INFO:$i.Info,LOG_LEVEL_DEBUG:$i.Debug,LOG_LEVEL_VERBOSE:$i.Verbose,LOG_LEVEL_FATAL:$i.Fatal,MEASURE_MODE_UNDEFINED:Mr.Undefined,MEASURE_MODE_EXACTLY:Mr.Exactly,MEASURE_MODE_AT_MOST:Mr.AtMost,NODE_TYPE_DEFAULT:go.Default,NODE_TYPE_TEXT:go.Text,OVERFLOW_VISIBLE:Pr.Visible,OVERFLOW_HIDDEN:Pr.Hidden,OVERFLOW_SCROLL:Pr.Scroll,POSITION_TYPE_STATIC:Or.Static,POSITION_TYPE_RELATIVE:Or.Relative,POSITION_TYPE_ABSOLUTE:Or.Absolute,PRINT_OPTIONS_LAYOUT:Ur.Layout,PRINT_OPTIONS_STYLE:Ur.Style,PRINT_OPTIONS_CHILDREN:Ur.Children,UNIT_UNDEFINED:js.Undefined,UNIT_POINT:js.Point,UNIT_PERCENT:js.Percent,UNIT_AUTO:js.Auto,WRAP_NO_WRAP:Gr.NoWrap,WRAP_WRAP:Gr.Wrap,WRAP_WRAP_REVERSE:Gr.WrapReverse};Qe.default=_g,Object.defineProperty(co,"__esModule",{value:!0}),co.default=Fg;var Ri=kg(Qe);function rl(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(rl=function(i){return i?t:e})(s)}function kg(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=rl(e);if(t&&t.has(s))return t.get(s);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in s)if(n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)){var o=r?Object.getOwnPropertyDescriptor(s,n):null;o&&(o.get||o.set)?Object.defineProperty(i,n,o):i[n]=s[n]}return i.default=s,t&&t.set(s,i),i}function Fg(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[Ri.Unit.Point]:s.Node.prototype[r],[Ri.Unit.Percent]:s.Node.prototype[`${r}Percent`],[Ri.Unit.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let h,u;if(c==="auto")h=Ri.Unit.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?Ri.Unit.Percent:Ri.Unit.Point,u=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(u))throw new Error(`Invalid value ${c} for ${r}`);if(!n[h])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return u!==void 0?n[h].call(this,...A,u):n[h].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ri.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Ri.default}}var nl={exports:{}};(function(s,e){var t=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(r){r=r||{};var n;n||(n=typeof r<"u"?r:{});var o,a;n.ready=new Promise(function(I,m){o=I,a=m});var A=Object.assign({},n),l="";typeof document<"u"&&document.currentScript&&(l=document.currentScript.src),i&&(l=i),l.indexOf("blob:")!==0?l=l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):l="";var c=n.print||console.log.bind(console),h=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var u;n.wasmBinary&&(u=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&$("no native wasm support detected");var d,g=!1;function f(I,m,D){D=m+D;for(var k="";!(m>=D);){var O=I[m++];if(!O)break;if(O&128){var J=I[m++]&63;if((O&224)==192)k+=String.fromCharCode((O&31)<<6|J);else{var Z=I[m++]&63;O=(O&240)==224?(O&15)<<12|J<<6|Z:(O&7)<<18|J<<12|Z<<6|I[m++]&63,65536>O?k+=String.fromCharCode(O):(O-=65536,k+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else k+=String.fromCharCode(O)}return k}var p,y,v,S,C,Q,B,_,L;function G(){var I=d.buffer;p=I,n.HEAP8=y=new Int8Array(I),n.HEAP16=S=new Int16Array(I),n.HEAP32=Q=new Int32Array(I),n.HEAPU8=v=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=B=new Uint32Array(I),n.HEAPF32=_=new Float32Array(I),n.HEAPF64=L=new Float64Array(I)}var F,U=[],q=[],V=[];function X(){var I=n.preRun.shift();U.unshift(I)}var w=0,x=null;function $(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",h(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function R(I){return I.startsWith("data:application/octet-stream;base64,")}var b;if(b="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gAABgA39/fABgAX8BfGADf399AX1gBX9/f39/AX9gAn9/AXxgAAF/YAZ/f31/fX8AYAR/f39/AX9gAn9/AX1gBn9/f39/fwF/YAV/f39/fwBgBH9/f38AYAN/fn8BfmAHf39/f39/fwBgBn9/f39/fwBgAn19AX1gAX0Bf2ABfwF9YAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA5/fX1/f399fX9/f39/fwF/YAZ/f319f38AYAJ+fwF/YAR/fX1/AX1gA399fQF9YAF8AXxgBH98fHwAYAV/f319fQF9YA5/fX1/f399fX9/f39/fwBgB39/fX99f38AYA1/fX99f31/fX19fX1/AX9gBX9/fX19AGAEf39+fgBgB39/f39/f38B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CyAGKgIAIQRDAADAfyEFIAYoAgRBAWsOAgIBAwsgAUH/////e3FBgICAgAJqviEEIAFBgICAgARxRQ0BCyAEIAOUQwrXIzyUIQUMAQsgBCEFC0MAAAAAIQQCQCAAKALYASIAQfDhg/wHRg0AIABBj568/AdGDQRB8CEhAQJAIABBqtWq/QdHBEAgAL4iBCAEWw0BQfghIQELIAEqAgAhBCABKAIEQQFrDgIEAQYLIABB/////3txQYCAgIACar4hBCAAQYCAgIAEcUUNAwsgBCADlEMK1yM8lCEEDAILIAQhBQtDAAAAACEEAkAgACgC3AEiAEHw4YP8B0YNACAAQY+evPwHRg0CQfAhIQECQCAAQarVqv0HRwRAIAC+IgQgBFsNAUH4ISEBCyABKgIAIQQgASgCBEEBaw4CAgEECyAAQf////97cUGAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINg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AgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoBEUNAgJAAkAgACoCICIBIAFbBEAgASECDAELIAAqAhwiAkMAAAAAXkUNAQsgAiACXARAIDghAgwECyAAKgIgIQELIAEgAVwEQCAzIQIgACoCHCIBQwAAAABeRQ0DCyA4IQIgAUMAAAAAXA0CIDMhAgwCCyA4IQILIAIgAlwNACACIDOTITUMAQsgM0MAAAAAXUUNACAzjCE1CyACITggKUUEQAJAIBggIUYEQEMAAAAAITQMAQtDAAAAACE5IBghBQNAIAUoAgAiDyATIA8qArQCIgEgQxAlITcCQCA1QwAAAABdBEAgNyAPED2MlCICQwAAAABeIAJDAAAAAF1yRQ0BAn0gDyATIDUgP5UgApQgN5IiNCA4ECUiMyAzXCIDIA8gEyA2ECQgDyATECCSIA8gEyA2ECMgDyATECGSkiICIAJcckUEQCAzIAIQHgwBCyACIDMgAxsLIQIgNCA0XCACIAJcciACIDRbcg0BIDkgAiA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cSABcjoACAsMACAAKAIAIAE2AhALFwAgACgCACIAIAAoAhBBfnEgAXI2AhAL/QEBA38jAEEQayICJAAgACgCACEAIAFDAAAAAGBFBEAgAkHXETYCACMAQRBrIgMkACADIAI2AgwCQCAADQBB6DYtAAAEQEHkNigCACEADAELQRwQHSIAQoCAgPwDNwIUIABCADcCDCAAQQA2AgAgAEEAOgAIIABBATYCBEHkNiAANgIAQeg2QQE6AABB4DZB4DYoAgBBAWo2AgALIAAoAgQhBAJAIAAtAAhBCHEEQCAAQQBBBUEAQbwhIAIgBBERABoMAQsgAEEAQQVBvCEgAiAEEQsAGgsgA0EQaiQAECwACyAAQwAAAAAgASABQwAAAABbGzgCFCACQRBqJAALPAAgAUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5gYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSETIAGaIgG9IRkMAQsgBEGAEHEEQEEBIRFBnAkhEwwBC0GfCUGaCSAEQQFxIhEbIRMgEUUhFQsCQCAZQoCAgICAgID4/wCDQoCAgICAgID4/wBRBEAgAEEgIAIgEUEDaiIDIARB//97cRAoIAAgEyARECcgAEGTE0GDGyAFQSBxIgUbQbQWQYcbIAUbIAEgAWIbQQMQJyAAQSAgAiADIARBgMAAcxAoIAMgAiACIANIGyEKDAELIAxBEGohEgJAAn8CQCABIAxBLGoQdCIBIAGgIgFEAAAAAAAAAABiBEAgDCAMKAIsIgZBAWs2AiwgBUEgciIOQeEARw0BDAMLIAVBIHIiDk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FxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIE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IgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsRACAAKAIAIAFBqtWq/QcQSwsQACAAKAIAIAEgArYQMRBLCxAAIAAoAgAgASACthAvEEsLcwEBfwJAIAAoAgAiACgCGCICQQR2QQdxIAFGDQAgACACQY9/cSABQQR0QfAAcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt1AQF/AkAgACgCACIAKAIYIgJBEnZBA3EgAUYNACAAIAJB//9PcSABQRJ0QYCAMHFyNgIYA0AgAC0ABCIBQQRxDQEgACABQQRyOgAEIAAoAhQiAQRAIAAgAREAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLC9IiIwBBgAgL5RlPbmx5IGxlYWYgbm9kZXMgd2l0aCBjdXN0b20gbWVhc3VyZSBmdW5jdGlvbnMgc2hvdWxkIG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ADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!R(b)){var T=b;b=n.locateFile?n.locateFile(T,l):l+T}function K(){var I=b;try{if(I==b&&u)return new Uint8Array(u);if(R(I))try{var m=Wy(I.slice(37)),D=new Uint8Array(m.length);for(I=0;I<m.length;++I)D[I]=m.charCodeAt(I);var k=D}catch{throw Error("Converting base64 string to bytes failed.")}else k=void 0;var O=k;if(O)return O;throw"both async and sync fetching of the wasm failed"}catch(J){$(J)}}function M(){return u||typeof fetch!="function"?Promise.resolve().then(function(){return K()}):fetch(b,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+b+"'";return I.arrayBuffer()}).catch(function(){return K()})}function W(I){for(;0<I.length;)I.shift()(n)}function ie(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function ce(I,m){return I=ie(I),function(){return m.apply(this,arguments)}}var ae=[{},{value:void 0},{value:null},{value:!0},{value:!1}],me=[];function Be(I){var m=Error,D=ce(I,function(k){this.name=I,this.message=k,k=Error(k).stack,k!==void 0&&(this.stack=this.toString()+`
67
- `+k.replace(/^Error(:[^\n]*)?\n/,""))});return D.prototype=Object.create(m.prototype),D.prototype.constructor=D,D.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},D}var xe=void 0;function re(I){throw new xe(I)}var Ce=I=>(I||re("Cannot use deleted val. handle = "+I),ae[I].value),ye=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=me.length?me.pop():ae.length;return ae[m]={fa:1,value:I},m}},ue=void 0,he=void 0;function Ae(I){for(var m="";v[I];)m+=he[v[I++]];return m}var we=[];function Oe(){for(;we.length;){var I=we.pop();I.L.Z=!1,I.delete()}}var De=void 0,ke={};function Ue(I,m){for(m===void 0&&re("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var Le={};function Se(I){I=$u(I);var m=Ae(I);return Bi(I),m}function Ve(I,m){var D=Le[I];return D===void 0&&re(m+" has unknown type "+Se(I)),D}function je(){}var ct=!1;function st(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function mt(I,m,D){return m===D?I:D.P===void 0?null:(I=mt(I,m,D.P),I===null?null:D.ma(I))}var yi={};function Ct(I,m){return m=Ue(I,m),ke[m]}var ai=void 0;function Ai(I){throw new ai(I)}function li(I,m){return m.O&&m.N||Ai("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&Ai("Both smartPtrType and smartPtr must be specified"),m.count={value:1},gt(Object.create(I,{L:{value:m}}))}function gt(I){return typeof FinalizationRegistry>"u"?(gt=m=>m,I):(ct=new FinalizationRegistry(m=>{st(m.L)}),gt=m=>{var D=m.L;return D.S&&ct.register(m,{L:D},m),m},je=m=>{ct.unregister(m)},gt(I))}var Y={};function le(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function ge(I){return this.fromWireType(Q[I>>2])}var Re={},be={};function Je(I,m,D){function k(ee){ee=D(ee),ee.length!==I.length&&Ai("Mismatched type converter count");for(var se=0;se<I.length;++se)vt(I[se],ee[se])}I.forEach(function(ee){be[ee]=m});var O=Array(m.length),J=[],Z=0;m.forEach((ee,se)=>{Le.hasOwnProperty(ee)?O[se]=Le[ee]:(J.push(ee),Re.hasOwnProperty(ee)||(Re[ee]=[]),Re[ee].push(()=>{O[se]=Le[ee],++Z,Z===J.length&&k(O)}))}),J.length===0&&k(O)}function yt(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function vt(I,m,D={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var k=m.name;if(I||re('type "'+k+'" must have a positive integer typeid pointer'),Le.hasOwnProperty(I)){if(D.ta)return;re("Cannot register type '"+k+"' twice")}Le[I]=m,delete be[I],Re.hasOwnProperty(I)&&(m=Re[I],delete Re[I],m.forEach(O=>O()))}function Ds(I){re(I.L.O.M.name+" instance already deleted")}function Bt(){}function es(I,m,D){if(I[m].R===void 0){var k=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||re("Function '"+D+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[k.Y]=k}}function Ls(I,m){n.hasOwnProperty(I)?(re("Cannot register public name '"+I+"' twice"),es(n,I,I),n.hasOwnProperty(void 0)&&re("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function ki(I,m,D,k,O,J,Z,ee){this.name=I,this.constructor=m,this.W=D,this.V=k,this.P=O,this.oa=J,this.aa=Z,this.ma=ee,this.ia=[]}function Ir(I,m,D){for(;m!==D;)m.aa||re("Expected null or instance of "+D.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function mr(I,m){return m===null?(this.da&&re("null is not a valid "+this.name),0):(m.L||re('Cannot pass "'+sA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),Ir(m.L.N,m.L.O.M,this.M))}function _s(I,m){if(m===null){if(this.da&&re("null is not a valid "+this.name),this.ca){var D=this.ea();return I!==null&&I.push(this.V,D),D}return 0}if(m.L||re('Cannot pass "'+sA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&re("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),D=Ir(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&re("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?D=m.L.S:re("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:D=m.L.S;break;case 2:if(m.L.T===this)D=m.L.S;else{var k=m.clone();D=this.wa(D,ye(function(){k.delete()})),I!==null&&I.push(this.V,D)}break;default:re("Unsupporting sharing policy")}return D}function _y(I,m){return m===null?(this.da&&re("null is not a valid "+this.name),0):(m.L||re('Cannot pass "'+sA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&re("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),Ir(m.L.N,m.L.O.M,this.M))}function vi(I,m,D,k){this.name=I,this.M=m,this.da=D,this.ba=k,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=_s:(this.toWireType=k?mr:_y,this.U=null)}function ky(I,m){n.hasOwnProperty(I)||Ai("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function Fy(I,m){var D=[];return function(){if(D.length=0,Object.assign(D,arguments),I.includes("j")){var k=n["dynCall_"+I];k=D&&D.length?k.apply(null,[m].concat(D)):k.call(null,m)}else k=F.get(m).apply(null,D);return k}}function Yt(I,m){I=Ae(I);var D=I.includes("j")?Fy(I,m):F.get(m);return typeof D!="function"&&re("unknown function pointer with signature "+I+": "+m),D}var Ou=void 0;function Pn(I,m){function D(J){O[J]||Le[J]||(be[J]?be[J].forEach(D):(k.push(J),O[J]=!0))}var k=[],O={};throw m.forEach(D),new Ou(I+": "+k.map(Se).join([", "]))}function eA(I,m,D,k,O){var J=m.length;2>J&&re("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=m[1]!==null&&D!==null,ee=!1;for(D=1;D<m.length;++D)if(m[D]!==null&&m[D].U===void 0){ee=!0;break}var se=m[0].name!=="void",te=J-2,ne=Array(te),Ee=[],_e=[];return function(){if(arguments.length!==te&&re("function "+I+" called with "+arguments.length+" arguments, expected "+te+" args!"),_e.length=0,Ee.length=Z?2:1,Ee[0]=O,Z){var rt=m[1].toWireType(_e,this);Ee[1]=rt}for(var Me=0;Me<te;++Me)ne[Me]=m[Me+2].toWireType(_e,arguments[Me]),Ee.push(ne[Me]);if(Me=k.apply(null,Ee),ee)le(_e);else for(var Tt=Z?1:2;Tt<m.length;Tt++){var Kt=Tt===1?rt:ne[Tt-2];m[Tt].U!==null&&m[Tt].U(Kt)}return rt=se?m[0].fromWireType(Me):void 0,rt}}function tA(I,m){for(var D=[],k=0;k<I;k++)D.push(B[m+4*k>>2]);return D}function iA(I){4<I&&--ae[I].fa===0&&(ae[I]=void 0,me.push(I))}function sA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function Ny(I,m){switch(m){case 2:return function(D){return this.fromWireType(_[D>>2])};case 3:return function(D){return this.fromWireType(L[D>>3])};default:throw new TypeError("Unknown float type: "+I)}}function My(I,m,D){switch(m){case 0:return D?function(k){return y[k]}:function(k){return v[k]};case 1:return D?function(k){return S[k>>1]}:function(k){return C[k>>1]};case 2:return D?function(k){return Q[k>>2]}:function(k){return B[k>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function Py(I,m){for(var D="",k=0;!(k>=m/2);++k){var O=S[I+2*k>>1];if(O==0)break;D+=String.fromCharCode(O)}return D}function Oy(I,m,D){if(D===void 0&&(D=2147483647),2>D)return 0;D-=2;var k=m;D=D<2*I.length?D/2:I.length;for(var O=0;O<D;++O)S[m>>1]=I.charCodeAt(O),m+=2;return S[m>>1]=0,m-k}function Uy(I){return 2*I.length}function Gy(I,m){for(var D=0,k="";!(D>=m/4);){var O=Q[I+4*D>>2];if(O==0)break;++D,65536<=O?(O-=65536,k+=String.fromCharCode(55296|O>>10,56320|O&1023)):k+=String.fromCharCode(O)}return k}function Hy(I,m,D){if(D===void 0&&(D=2147483647),4>D)return 0;var k=m;D=k+D-4;for(var O=0;O<I.length;++O){var J=I.charCodeAt(O);if(55296<=J&&57343>=J){var Z=I.charCodeAt(++O);J=65536+((J&1023)<<10)|Z&1023}if(Q[m>>2]=J,m+=4,m+4>D)break}return Q[m>>2]=0,m-k}function $y(I){for(var m=0,D=0;D<I.length;++D){var k=I.charCodeAt(D);55296<=k&&57343>=k&&++D,m+=4}return m}var Yy={};function Uu(I){var m=Yy[I];return m===void 0?Ae(I):m}var On=[];function Ky(I){var m=On.length;return On.push(I),m}function Vy(I,m){for(var D=Array(I),k=0;k<I;++k)D[k]=Ve(B[m+4*k>>2],"parameter "+k);return D}var Gu=[],Jy=[null,[],[]];xe=n.BindingError=Be("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<ae.length;++m)ae[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<ae.length;++I)if(ae[I]!==void 0)return ae[I];return null},ue=n.PureVirtualError=Be("PureVirtualError");for(var Hu=Array(256),Un=0;256>Un;++Un)Hu[Un]=String.fromCharCode(Un);he=Hu,n.getInheritedInstanceCount=function(){return Object.keys(ke).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in ke)ke.hasOwnProperty(m)&&I.push(ke[m]);return I},n.flushPendingDeletes=Oe,n.setDelayFunction=function(I){De=I,we.length&&De&&De(Oe)},ai=n.InternalError=Be("InternalError"),Bt.prototype.isAliasOf=function(I){if(!(this instanceof Bt&&I instanceof Bt))return!1;var m=this.L.O.M,D=this.L.N,k=I.L.O.M;for(I=I.L.N;m.P;)D=m.aa(D),m=m.P;for(;k.P;)I=k.aa(I),k=k.P;return m===k&&D===I},Bt.prototype.clone=function(){if(this.L.N||Ds(this),this.L.$)return this.L.count.value+=1,this;var I=gt,m=Object,D=m.create,k=Object.getPrototypeOf(this),O=this.L;return I=I(D.call(m,k,{L:{value:{count:O.count,Z:O.Z,$:O.$,N:O.N,O:O.O,S:O.S,T:O.T}}})),I.L.count.value+=1,I.L.Z=!1,I},Bt.prototype.delete=function(){this.L.N||Ds(this),this.L.Z&&!this.L.$&&re("Object already scheduled for deletion"),je(this),st(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},Bt.prototype.isDeleted=function(){return!this.L.N},Bt.prototype.deleteLater=function(){return this.L.N||Ds(this),this.L.Z&&!this.L.$&&re("Object already scheduled for deletion"),we.push(this),we.length===1&&De&&De(Oe),this.L.Z=!0,this},vi.prototype.pa=function(I){return this.ja&&(I=this.ja(I)),I},vi.prototype.ga=function(I){this.V&&this.V(I)},vi.prototype.argPackAdvance=8,vi.prototype.readValueFromPointer=ge,vi.prototype.deleteObject=function(I){I!==null&&I.delete()},vi.prototype.fromWireType=function(I){function m(){return this.ca?li(this.M.W,{O:this.va,N:D,T:this,S:I}):li(this.M.W,{O:this,N:I})}var D=this.pa(I);if(!D)return this.ga(I),null;var k=Ct(this.M,D);if(k!==void 0)return k.L.count.value===0?(k.L.N=D,k.L.S=I,k.clone()):(k=k.clone(),this.ga(I),k);if(k=this.M.oa(D),k=yi[k],!k)return m.call(this);k=this.ba?k.ka:k.pointerType;var O=mt(D,this.M,k.M);return O===null?m.call(this):this.ca?li(k.M.W,{O:k,N:O,T:this,S:I}):li(k.M.W,{O:k,N:O})},Ou=n.UnboundTypeError=Be("UnboundTypeError");var Wy=typeof atob=="function"?atob:function(I){var m="",D=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++));k=k<<2|O>>4,O=(O&15)<<4|J>>2;var ee=(J&3)<<6|Z;m+=String.fromCharCode(k),J!==64&&(m+=String.fromCharCode(O)),Z!==64&&(m+=String.fromCharCode(ee))}while(D<I.length);return m},qy={p:function(I,m,D){I=Ae(I),m=Ve(m,"wrapper"),D=Ce(D);var k=[].slice,O=m.M,J=O.W,Z=O.P.W,ee=O.P.constructor;I=ce(I,function(){O.P.ia.forEach((function(te){if(this[te]===Z[te])throw new ue("Pure virtual function "+te+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:J}),this.__construct.apply(this,k.call(arguments))}),J.__construct=function(){this===J&&re("Pass correct 'this' to __construct");var te=ee.implement.apply(void 0,[this].concat(k.call(arguments)));je(te);var ne=te.L;te.notifyOnDestruction(),ne.$=!0,Object.defineProperties(this,{L:{value:ne}}),gt(this),te=ne.N,te=Ue(O,te),ke.hasOwnProperty(te)?re("Tried to register registered instance: "+te):ke[te]=this},J.__destruct=function(){this===J&&re("Pass correct 'this' to __destruct"),je(this);var te=this.L.N;te=Ue(O,te),ke.hasOwnProperty(te)?delete ke[te]:re("Tried to unregister unregistered instance: "+te)},I.prototype=Object.create(J);for(var se in D)I.prototype[se]=D[se];return ye(I)},j:function(I){var m=Y[I];delete Y[I];var D=m.ea,k=m.V,O=m.ha,J=O.map(Z=>Z.sa).concat(O.map(Z=>Z.ya));Je([I],J,Z=>{var ee={};return O.forEach((se,te)=>{var ne=Z[te],Ee=se.qa,_e=se.ra,rt=Z[te+O.length],Me=se.xa,Tt=se.za;ee[se.na]={read:Kt=>ne.fromWireType(Ee(_e,Kt)),write:(Kt,Cr)=>{var Qi=[];Me(Tt,Kt,rt.toWireType(Qi,Cr)),le(Qi)}}}),[{name:m.name,fromWireType:function(se){var te={},ne;for(ne in ee)te[ne]=ee[ne].read(se);return k(se),te},toWireType:function(se,te){for(var ne in ee)if(!(ne in te))throw new TypeError('Missing field: "'+ne+'"');var Ee=D();for(ne in ee)ee[ne].write(Ee,te[ne]);return se!==null&&se.push(k,Ee),Ee},argPackAdvance:8,readValueFromPointer:ge,U:k}]})},v:function(){},B:function(I,m,D,k,O){var J=yt(D);m=Ae(m),vt(I,{name:m,fromWireType:function(Z){return!!Z},toWireType:function(Z,ee){return ee?k:O},argPackAdvance:8,readValueFromPointer:function(Z){if(D===1)var ee=y;else if(D===2)ee=S;else if(D===4)ee=Q;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(ee[Z>>J])},U:null})},f:function(I,m,D,k,O,J,Z,ee,se,te,ne,Ee,_e){ne=Ae(ne),J=Yt(O,J),ee&&(ee=Yt(Z,ee)),te&&(te=Yt(se,te)),_e=Yt(Ee,_e);var rt=ie(ne);Ls(rt,function(){Pn("Cannot construct "+ne+" due to unbound types",[k])}),Je([I,m,D],k?[k]:[],function(Me){if(Me=Me[0],k)var Tt=Me.M,Kt=Tt.W;else Kt=Bt.prototype;Me=ce(rt,function(){if(Object.getPrototypeOf(this)!==Cr)throw new xe("Use 'new' to construct "+ne);if(Qi.X===void 0)throw new xe(ne+" has no accessible constructor");var Vu=Qi.X[arguments.length];if(Vu===void 0)throw new xe("Tried to invoke ctor of "+ne+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Qi.X).toString()+") parameters instead!");return Vu.apply(this,arguments)});var Cr=Object.create(Kt,{constructor:{value:Me}});Me.prototype=Cr;var Qi=new ki(ne,Me,Cr,_e,Tt,J,ee,te);Tt=new vi(ne,Qi,!0,!1),Kt=new vi(ne+"*",Qi,!1,!1);var Ku=new vi(ne+" const*",Qi,!1,!0);return yi[I]={pointerType:Kt,ka:Ku},ky(rt,Me),[Tt,Kt,Ku]})},c:function(I,m,D,k,O,J,Z){var ee=tA(D,k);m=Ae(m),J=Yt(O,J),Je([],[I],function(se){function te(){Pn("Cannot call "+ne+" due to unbound types",ee)}se=se[0];var ne=se.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var Ee=se.M.constructor;return Ee[m]===void 0?(te.Y=D-1,Ee[m]=te):(es(Ee,m,ne),Ee[m].R[D-1]=te),Je([],ee,function(_e){return _e=eA(ne,[_e[0],null].concat(_e.slice(1)),null,J,Z),Ee[m].R===void 0?(_e.Y=D-1,Ee[m]=_e):Ee[m].R[D-1]=_e,[]}),[]})},o:function(I,m,D,k,O,J){0<m||$();var Z=tA(m,D);O=Yt(k,O),Je([],[I],function(ee){ee=ee[0];var se="constructor "+ee.name;if(ee.M.X===void 0&&(ee.M.X=[]),ee.M.X[m-1]!==void 0)throw new xe("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.M.X[m-1]=()=>{Pn("Cannot construct "+ee.name+" due to unbound types",Z)},Je([],Z,function(te){return te.splice(1,0,null),ee.M.X[m-1]=eA(se,te,null,O,J),[]}),[]})},a:function(I,m,D,k,O,J,Z,ee){var se=tA(D,k);m=Ae(m),J=Yt(O,J),Je([],[I],function(te){function ne(){Pn("Cannot call "+Ee+" due to unbound types",se)}te=te[0];var Ee=te.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),ee&&te.M.ia.push(m);var _e=te.M.W,rt=_e[m];return rt===void 0||rt.R===void 0&&rt.className!==te.name&&rt.Y===D-2?(ne.Y=D-2,ne.className=te.name,_e[m]=ne):(es(_e,m,Ee),_e[m].R[D-2]=ne),Je([],se,function(Me){return Me=eA(Ee,Me,te,J,Z),_e[m].R===void 0?(Me.Y=D-2,_e[m]=Me):_e[m].R[D-2]=Me,[]}),[]})},A:function(I,m){m=Ae(m),vt(I,{name:m,fromWireType:function(D){var k=Ce(D);return iA(D),k},toWireType:function(D,k){return ye(k)},argPackAdvance:8,readValueFromPointer:ge,U:null})},m:function(I,m,D){D=yt(D),m=Ae(m),vt(I,{name:m,fromWireType:function(k){return k},toWireType:function(k,O){return O},argPackAdvance:8,readValueFromPointer:Ny(m,D),U:null})},d:function(I,m,D,k,O){m=Ae(m),O===-1&&(O=4294967295),O=yt(D);var J=ee=>ee;if(k===0){var Z=32-8*D;J=ee=>ee<<Z>>>Z}D=m.includes("unsigned")?function(ee,se){return se>>>0}:function(ee,se){return se},vt(I,{name:m,fromWireType:J,toWireType:D,argPackAdvance:8,readValueFromPointer:My(m,O,k!==0),U:null})},b:function(I,m,D){function k(J){J>>=2;var Z=B;return new O(p,Z[J+1],Z[J])}var O=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];D=Ae(D),vt(I,{name:D,fromWireType:k,argPackAdvance:8,readValueFromPointer:k},{ta:!0})},n:function(I,m){m=Ae(m);var D=m==="std::string";vt(I,{name:m,fromWireType:function(k){var O=B[k>>2],J=k+4;if(D)for(var Z=J,ee=0;ee<=O;++ee){var se=J+ee;if(ee==O||v[se]==0){if(Z=Z?f(v,Z,se-Z):"",te===void 0)var te=Z;else te+="\0",te+=Z;Z=se+1}}else{for(te=Array(O),ee=0;ee<O;++ee)te[ee]=String.fromCharCode(v[J+ee]);te=te.join("")}return Bi(k),te},toWireType:function(k,O){O instanceof ArrayBuffer&&(O=new Uint8Array(O));var J,Z=typeof O=="string";if(Z||O instanceof Uint8Array||O instanceof Uint8ClampedArray||O instanceof Int8Array||re("Cannot pass non-string to std::string"),D&&Z){var ee=0;for(J=0;J<O.length;++J){var se=O.charCodeAt(J);127>=se?ee++:2047>=se?ee+=2:55296<=se&&57343>=se?(ee+=4,++J):ee+=3}J=ee}else J=O.length;if(ee=rA(4+J+1),se=ee+4,B[ee>>2]=J,D&&Z){if(Z=se,se=J+1,J=v,0<se){se=Z+se-1;for(var te=0;te<O.length;++te){var ne=O.charCodeAt(te);if(55296<=ne&&57343>=ne){var Ee=O.charCodeAt(++te);ne=65536+((ne&1023)<<10)|Ee&1023}if(127>=ne){if(Z>=se)break;J[Z++]=ne}else{if(2047>=ne){if(Z+1>=se)break;J[Z++]=192|ne>>6}else{if(65535>=ne){if(Z+2>=se)break;J[Z++]=224|ne>>12}else{if(Z+3>=se)break;J[Z++]=240|ne>>18,J[Z++]=128|ne>>12&63}J[Z++]=128|ne>>6&63}J[Z++]=128|ne&63}}J[Z]=0}}else if(Z)for(Z=0;Z<J;++Z)te=O.charCodeAt(Z),255<te&&(Bi(se),re("String has UTF-16 code units that do not fit in 8 bits")),v[se+Z]=te;else for(Z=0;Z<J;++Z)v[se+Z]=O[Z];return k!==null&&k.push(Bi,ee),ee},argPackAdvance:8,readValueFromPointer:ge,U:function(k){Bi(k)}})},i:function(I,m,D){if(D=Ae(D),m===2)var k=Py,O=Oy,J=Uy,Z=()=>C,ee=1;else m===4&&(k=Gy,O=Hy,J=$y,Z=()=>B,ee=2);vt(I,{name:D,fromWireType:function(se){for(var te=B[se>>2],ne=Z(),Ee,_e=se+4,rt=0;rt<=te;++rt){var Me=se+4+rt*m;(rt==te||ne[Me>>ee]==0)&&(_e=k(_e,Me-_e),Ee===void 0?Ee=_e:(Ee+="\0",Ee+=_e),_e=Me+m)}return Bi(se),Ee},toWireType:function(se,te){typeof te!="string"&&re("Cannot pass non-string to C++ string type "+D);var ne=J(te),Ee=rA(4+ne+m);return B[Ee>>2]=ne>>ee,O(te,Ee+4,ne+m),se!==null&&se.push(Bi,Ee),Ee},argPackAdvance:8,readValueFromPointer:ge,U:function(se){Bi(se)}})},k:function(I,m,D,k,O,J){Y[I]={name:Ae(m),ea:Yt(D,k),V:Yt(O,J),ha:[]}},h:function(I,m,D,k,O,J,Z,ee,se,te){Y[I].ha.push({na:Ae(m),sa:D,qa:Yt(k,O),ra:J,ya:Z,xa:Yt(ee,se),za:te})},C:function(I,m){m=Ae(m),vt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,D,k,O){I=On[I],m=Ce(m),D=Uu(D);var J=[];return B[k>>2]=ye(J),I(m,D,J,O)},t:function(I,m,D,k){I=On[I],m=Ce(m),D=Uu(D),I(m,D,null,k)},g:iA,l:function(I,m){var D=Vy(I,m),k=D[0];m=k.name+"_$"+D.slice(1).map(function(Z){return Z.name}).join("_")+"$";var O=Gu[m];if(O!==void 0)return O;var J=Array(I-1);return O=Ky((Z,ee,se,te)=>{for(var ne=0,Ee=0;Ee<I-1;++Ee)J[Ee]=D[Ee+1].readValueFromPointer(te+ne),ne+=D[Ee+1].argPackAdvance;for(Z=Z[ee].apply(Z,J),Ee=0;Ee<I-1;++Ee)D[Ee+1].la&&D[Ee+1].la(J[Ee]);if(!k.ua)return k.toWireType(se,Z)}),Gu[m]=O},q:function(I){4<I&&(ae[I].fa+=1)},r:function(I){var m=Ce(I);le(m),iA(I)},e:function(){$("")},x:function(I,m,D){v.copyWithin(I,m,m+D)},w:function(I){var m=v.length;if(I>>>=0,2147483648<I)return!1;for(var D=1;4>=D;D*=2){var k=m*(1+.2/D);k=Math.min(k,I+100663296);var O=Math;k=Math.max(I,k),O=O.min.call(O,2147483648,k+(65536-k%65536)%65536);e:{try{d.grow(O-p.byteLength+65535>>>16),G();var J=1;break e}catch{}J=void 0}if(J)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,m,D,k){for(var O=0,J=0;J<D;J++){var Z=B[m>>2],ee=B[m+4>>2];m+=8;for(var se=0;se<ee;se++){var te=v[Z+se],ne=Jy[I];te===0||te===10?((I===1?c:h)(f(ne,0)),ne.length=0):ne.push(te)}O+=ee}return B[k>>2]=O,0}};(function(){function I(O){n.asm=O.exports,d=n.asm.D,G(),F=n.asm.I,q.unshift(n.asm.E),w--,n.monitorRunDependencies&&n.monitorRunDependencies(w),w==0&&x&&(O=x,x=null,O())}function m(O){I(O.instance)}function D(O){return M().then(function(J){return WebAssembly.instantiate(J,k)}).then(function(J){return J}).then(O,function(J){h("failed to asynchronously prepare wasm: "+J),$(J)})}var k={a:qy};if(w++,n.monitorRunDependencies&&n.monitorRunDependencies(w),n.instantiateWasm)try{return n.instantiateWasm(k,I)}catch(O){h("Module.instantiateWasm callback failed with error: "+O),a(O)}return function(){return u||typeof WebAssembly.instantiateStreaming!="function"||R(b)||typeof fetch!="function"?D(m):fetch(b,{credentials:"same-origin"}).then(function(O){return WebAssembly.instantiateStreaming(O,k).then(m,function(J){return h("wasm streaming compile failed: "+J),h("falling back to ArrayBuffer instantiation"),D(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var $u=n.___getTypeName=function(){return($u=n.___getTypeName=n.asm.F).apply(null,arguments)};n.__embind_initialize_bindings=function(){return(n.__embind_initialize_bindings=n.asm.G).apply(null,arguments)};var rA=n._malloc=function(){return(rA=n._malloc=n.asm.H).apply(null,arguments)},Bi=n._free=function(){return(Bi=n._free=n.asm.J).apply(null,arguments)};n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.K).apply(null,arguments)};var Gn;x=function I(){Gn||Yu(),Gn||(x=I)};function Yu(){function I(){if(!Gn&&(Gn=!0,n.calledRun=!0,!g)){if(W(q),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();V.unshift(m)}W(V)}}if(!(0<w)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)X();W(U),0<w||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),I()},1)):I())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();return Yu(),r.ready}})();s.exports=t})(nl);var Ng=nl.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(co),i=Qe;Object.keys(i).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in s&&s[a]===i[a]||Object.defineProperty(s,a,{enumerable:!0,get:function(){return i[a]}})});function r(a){return a&&a.__esModule?a:{default:a}}const n=Ng;async function o(){return(0,t.default)(await n())}})(sl);function fo({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const u=a+A,d=a===0,g=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=u-n&&t<=u&&(r.globalAlpha=Math.max(0,Math.min(1,(u-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Mg(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Pg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function po({resolution:s,aspectRatio:e}){const t=Mg(s),i=Pg(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function Og({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=po({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,h=o/l,u=(i-c)/2,d=(r-h)/2;return{sx:u,sy:d,sWidth:c,sHeight:h,scale:l}}function Xs({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const h=Math.max(e,0),u=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,p=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(u-h)*f,(g-d)*p]}function ol({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:h}){const{x:u,y:d,width:g,height:f}=t??{},p=A*(u??0),y=l*(d??0),v=A*Math.min(1-(u??0),g??1),S=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=v,c.height=S;const x=Xs({source:e,sx:p,sy:y,sw:v,sh:S,dx:0,dy:0,dw:v,dh:S});C.drawImage(...x)}const Q=v/S,{sx:B,sy:_,sWidth:L,sHeight:G,scale:F}=Og({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:v,sourceHeight:S}),U=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!U){if(B<0){const x=Math.abs(B)*F;s.fillStyle="black",s.beginPath(),s.rect(r,n,x,a),s.rect(r+o-x,n,x,a),s.fill(),s.closePath()}if(_<0){const x=Math.abs(_)*F;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,x),s.rect(r,n+a-x,o,x),s.fill(),s.closePath()}}if(i==="letterbox-video"&&U){const x=h.getContext("2d");if(x){h.width=v,h.height=S,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const $=Xs({source:c,sx:B,sy:_,sw:L,sh:G,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...$),x.save();const R=1.2,b=-(v*R-v)/2,T=-(S*R-S)/2,K=Math.min(v/20,S/20);if(x.filter=`blur(${K}px) brightness(20%)`,x.translate(b,T),x.scale(R,R),x.drawImage(c,0,0,v,S),x.restore(),s.globalCompositeOperation="destination-over",B<0){const M=o/Q,W=a/M,ie=Xs({source:h,sy:(1-W)*S/2,sh:W*S,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}if(_<0){const M=a*Q,W=o/M,ie=Xs({source:h,sx:(1-W)*v/2,sw:W*v,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}s.restore()}}else{const x=Xs({source:c,sx:B,sy:_,sw:L,sh:G,dx:r,dy:n,dw:o,dh:a});s.drawImage(...x)}const q=B*-1*F,V=_*-1*F,X=o-q*2,w=a-V*2;return{dx:q,dy:V,dw:X,dh:w}}function al({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const Al=zn(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let u=0;for(;a*e>c+1;){c+=1;const d=Kr({context:t,font:s,fontSize:c,text:n,maxW:i});if(u=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),u>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(Yr))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`}),gi=1.8;function Eo({context:s,x:e,y:t,width:i,height:r,radii:n,clip:o=!1,debug:a=!1}){let A,l,c,h;typeof n=="number"?A=l=c=h=n:[A,l,c,h]=n,s.beginPath(),s.moveTo(e+Math.min(r/gi,A),t),s.lineTo(e+i-Math.min(r/gi,l),t),s.quadraticCurveTo(e+i,t,e+i,t+Math.min(r/gi,l)),s.lineTo(e+i,t+r-Math.min(r/gi,c)),s.quadraticCurveTo(e+i,t+r,e+i-Math.min(r/gi,c),t+r),s.lineTo(e+Math.min(r/gi,h),t+r),s.quadraticCurveTo(e,t+r,e,t+r-Math.min(r/gi,h)),s.lineTo(e,t+Math.min(r/gi,A)),s.quadraticCurveTo(e,t,e+Math.min(r/gi,A),t),s.closePath(),a&&(s.strokeStyle="blue",s.stroke()),o&&s.clip()}function Ug(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function ll(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function cl(s,e,{layout:t,scale:i=1}){const{position:r="relative",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:h,flex:u,gap:d,margin:g,padding:f,direction:p="column",align:y="start",alignSelf:v,justify:S="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:L,right:G,bottom:F,left:U}=Ug(n,i);L&&e.setPosition(s.EDGE_TOP,L),G&&e.setPosition(s.EDGE_RIGHT,G),F&&e.setPosition(s.EDGE_BOTTOM,F),U&&e.setPosition(s.EDGE_LEFT,U)}const Q={row:s.FLEX_DIRECTION_ROW,column:s.FLEX_DIRECTION_COLUMN,"row-reverse":s.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(Q[p]);const B={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(B[y]),v&&e.setAlignSelf(B[v]);const _={start:s.JUSTIFY_FLEX_START,end:s.JUSTIFY_FLEX_END,center:s.JUSTIFY_CENTER,"space-between":s.JUSTIFY_SPACE_BETWEEN,"space-around":s.JUSTIFY_SPACE_AROUND,"space-evenly":s.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(_[S]),g){const{top:L,right:G,bottom:F,left:U}=ll(g,i);e.setMargin(s.EDGE_TOP,L),e.setMargin(s.EDGE_RIGHT,G),e.setMargin(s.EDGE_BOTTOM,F),e.setMargin(s.EDGE_LEFT,U)}if(f){const{top:L,right:G,bottom:F,left:U}=ll(f,i);e.setPadding(s.EDGE_TOP,L),e.setPadding(s.EDGE_RIGHT,G),e.setPadding(s.EDGE_BOTTOM,F),e.setPadding(s.EDGE_LEFT,U)}u&&e.setFlex(u),e.setGap(s.GUTTER_ALL,(d??0)*i),o&&e.setWidth(typeof o=="number"?o*i:o),a&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*i:a)),A&&e.setMinWidth(typeof A=="number"?A*i:A),l&&e.setMinHeight(typeof l=="number"?l*i:l),c&&e.setMaxWidth(typeof c=="number"?c*i:c),h&&e.setMaxHeight(typeof h=="number"?h*i:h)}function hl({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:h}=l;h&&(c.save(),h({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),hl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function ul(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...h}=n;return cl(s,a,{layout:h,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:ul(s,a,l,i)}});return e.calculateLayout(),r}function dl(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:h,height:u}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:h,height:u,element:a,childNodes:dl(s,A,d,g)}})}function gl(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}gl(r,e)})}function Gg({yoga:s,canvas:e,origin:t,elements:i,...r}){const n={inset:{top:0,left:0},width:e.width,height:e.height,...t},o=s.Node.create();cl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=ul(s,o,i,l);gl(c,l),o.calculateLayout();const h=dl(o,c);return hl({...r,scale:l,canvas:e,position:h})}const Hg={linear:ug,easeIn:oo,easeInOut:gg,easeOut:dg,circIn:el,circInOut:fg,circOut:tl,backIn:ao,backInOut:Eg,backOut:pg,anticipate:Ig,bounceIn:vg,bounceInOut:Bg,bounceOut:Lr},Hr=zn((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>og(s,e,{...r,clamp:t,ease:Hg[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),fl=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function $r({text:s,font:e}){let t=e;return fl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const Yr=/(?<value>\d+\.?\d*)(?=px)/;function pl(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function El(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>El(r)))}function Il({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}){return o.map(d=>{var g,f,p,y,v,S,C,Q;const{node:B,transient:_=[{from:0,duration:1/0}]}=d,L=t.getContext("2d"),G={total:a,content:A,scene:l},F={total:c,content:h,scene:u},U=_.reduce((q,{type:V="scene",from:X,duration:w,animation:x})=>{const $=X<0?F[V]+X:X;return G[V]>=$&&G[V]<=$+w&&q.push({type:V,animation:x,duration:w,from:$}),q},[]);if(L&&U.length>0&&El(d)){let q=d.width,V=d.height;if((B==null?void 0:B.type)==="text"&&B.value){const{align:X="left"}=B,w=$r({text:B.value,font:B.font});L.save(),L.font=w,L.textBaseline="top",L.textAlign=X,B.wrap?V=({width:x,maxHeight:$,scale:R})=>{var b,T;const K=Al({font:w,scale:R,context:L,maxW:x,maxH:$,text:B.value??"",minSize:(b=B.fill)==null?void 0:b.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});return Kr({context:L,font:w,fontSize:K,text:B.value??"",maxW:x}).length*K}:(q=L.measureText(B.value).width,V=parseFloat(((f=(g=w.match(Yr))==null?void 0:g.groups)==null?void 0:f.value)??"0")),L.restore()}if((B==null?void 0:B.type)==="image"&&B.image&&B.size){const X=((p=B.image)==null?void 0:p.naturalWidth)??((y=B.image)==null?void 0:y.width),w=((v=B.image)==null?void 0:v.naturalHeight)??((S=B.image)==null?void 0:S.height),x=X/w,$=(C=B.size)==null?void 0:C.width,R=(Q=B.size)==null?void 0:Q.height;q=$??(R??0)*x,V=R??($??0)/x}return{...d,width:q,height:V,elements:Il({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}),draw:({dx:X,dy:w,dw:x,dh:$,scale:R})=>{var b,T,K,M,W,ie,ce,ae,me,Be,xe,re,Ce;if(U.forEach(ye=>{const{type:ue="scene",from:he,duration:Ae,animation:we={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=ye;if(we){const{type:Oe,duration:De,easing:{in:ke="easeOut",out:Ue="easeOut"}={}}=we;if(he>0&&G[ue]<=he+De)switch(Oe){case"fade":{const Le=Hr([he,he+De],[0,1],{ease:ke});L.globalAlpha=Le(G[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:$},{x:0,y:0}],right:[{x,y:0},{x:0,y:0}],down:[{x:0,y:-$},{x:0,y:0}],left:[{x:-x,y:0},{x:0,y:0}]},Ve=Hr([he,he+De],Se[Le.direction.in],{ease:ke}),{x:je,y:ct}=Ve(G[ue]);L.translate(je,ct);break}}if(he+Ae<F[ue]&&he+Ae-De<=G[ue])switch(Oe){case"fade":{const Le=Hr([he+Ae-De,he+Ae],[1,0],{ease:Ue});L.globalAlpha=Le(G[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:0},{x:0,y:-$}],right:[{x:0,y:0},{x,y:0}],down:[{x:0,y:0},{x:0,y:$}],left:[{x:0,y:0},{x:-x,y:0}]},Ve=Hr([he+Ae-De,he+Ae],Se[Le.direction.out],{ease:Ue}),{x:je,y:ct}=Ve(G[ue]);L.translate(je,ct);break}}}}),B){const{type:ye}=B;if(ye==="box"){const{shadow:{color:ue="rgba(0, 0, 0, 0.5)",blur:he=0,offset:{x:Ae=0,y:we=0}={}}={}}=B;if(L.save(),L.fillStyle=ue,L.shadowColor=ue,L.shadowBlur=he,L.shadowOffsetX=Ae+x+t.width,L.shadowOffsetY=we+$+t.height,L.beginPath(),!d.radius)L.rect(X-x-t.width,w-$-t.height,x,$);else{const{topLeft:Oe,topRight:De,bottomRight:ke,bottomLeft:Ue}=pl(d.radius,R);Eo({debug:e,context:L,x:X-x-t.width,y:w-$-t.height,width:x,height:$,radii:[Oe,De,ke,Ue]})}L.fill(),L.closePath(),L.restore()}if(d.radius){const{topLeft:ue,topRight:he,bottomRight:Ae,bottomLeft:we}=pl(d.radius,R);Eo({debug:e,context:L,x:X,y:w,width:x,height:$,radii:[ue,he,Ae,we],clip:!0})}if(ye==="box"&&(L.save(),L.fillStyle=B.background,L.fillRect(X,w,x,$),L.restore()),ye==="text"&&B.value){const{align:ue="left"}=B,he=$r({text:B.value,font:B.font}),Ae=Al({font:he,scale:R,context:L,maxW:x,maxH:$,text:B.value??"",minSize:(b=B.fill)==null?void 0:b.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});L.font=he.replace(Yr,Ae.toString()),L.textBaseline="top",L.fillStyle=B.color,L.textAlign=ue;const we={left:X,center:X+x/2,right:X+x};B.wrap?Kr({context:L,font:he,fontSize:Ae,text:B.value,maxW:x}).forEach((De,ke)=>{L.fillText(De.text,we[ue],w+Ae*ke)}):L.fillText(B.value,we[ue],w)}if(ye==="image"&&B.image&&L.drawImage(B.image,X,w,x,$),ye==="video"&&((K=B.video)!=null&&K.node||(M=B.video)!=null&&M.getSource)){const ue=B.format??"letterbox",he=((ie=(W=B.video)==null?void 0:W.getSource)==null?void 0:ie.call(W,l))??B.video.node,Ae=(he==null?void 0:he.videoWidth)??(he==null?void 0:he.naturalWidth)??(he==null?void 0:he.width),we=(he==null?void 0:he.videoHeight)??(he==null?void 0:he.naturalHeight)??(he==null?void 0:he.height);if(Ae&&we){const{dx:De,dy:ke,dw:Ue,dh:Le}=ol({context:L,cropCanvas:i,letterboxCanvas:n,source:he,format:ue,crop:(ce=B==null?void 0:B.value)==null?void 0:ce.crop,sourceWidth:Ae,sourceHeight:we,posX:X,posY:w,drawAreaWidth:x,drawAreaHeight:$});B.elements&&Io({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(w,w+ke),left:Math.max(X,X+De)},width:Math.min(x,Ue),height:Math.min($,Le)}})}const Oe=1/3;if(B.poster&&a>=0&&a<=Oe){L.save(),L.globalAlpha=1-a/Oe;const De=((ae=B.poster)==null?void 0:ae.naturalWidth)??((me=B.poster)==null?void 0:me.width),ke=((Be=B.poster)==null?void 0:Be.naturalHeight)??((xe=B.poster)==null?void 0:xe.height);r.width=r.height=0,r.width=x,r.height=$;const Ue=r.getContext("2d");if(Ue&&De&&ke){const{dx:Le,dy:Se,dw:Ve,dh:je}=ol({context:Ue,cropCanvas:i,letterboxCanvas:n,source:B.poster,format:ue,crop:(re=B==null?void 0:B.value)==null?void 0:re.crop,sourceWidth:De,sourceHeight:ke,posX:0,posY:0,drawAreaWidth:x,drawAreaHeight:$});B.elements&&Io({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(0,Se),left:Math.max(0,Le)},width:Math.min(x,Ve),height:Math.min($,je)}}),L.drawImage(r,X,w,x,$),L.restore()}}}if(ye==="gradient"&&B.value){const ue=L.createLinearGradient(X+x,w,X+x,w+$);(Ce=B.value)==null||Ce.forEach(he=>{ue.addColorStop(he.percent,he.color)}),L.fillStyle=ue,L.fillRect(X,w,x,$)}}}}}}).filter(Boolean)}function Io({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,...d}){return Gg({...d,yoga:s,debug:e,canvas:t,elements:Il({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u})})}const Kr=zn(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(Yr,t.toString()),i.split(`
68
- `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...al({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},al({context:s,word:a[0],maxW:r})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{font:s,fontSize:e,text:t,maxW:i}])=>`${s}_${e}_${t}_${i}`}),$g=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,Yg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function ml(s){if(!s)return[];const e=s.match($g);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
65
+ `+p(R,T)):M}}function $(R,b){var T;return b.cache&&b.name&&b.storage.templates.get(b.name)?b.storage.templates.get(b.name):(T=typeof R=="function"?R:x(R,b),b.cache&&b.name&&b.storage.templates.define(b.name,T),T)}X.l.bind(X),t.compile=x,t.compileScope=Q,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=X,t.filters=V,t.getConfig=w,t.helpers=U,t.nativeHelpers=q,t.parse=f,t.render=function(R,b,T,K){var M=w(T||{});if(!M.async)return $(R,M)(b,M);if(!K){if(typeof n=="function")return new n(function(W,ie){try{W($(R,M)(b,M))}catch(ce){ie(ce)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{$(R,M)(b,M,K)}catch(W){return K(W)}},t.templates=F,Object.defineProperty(t,"__esModule",{value:!0})})})(lo,lo.exports);var co=lo.exports;const Bg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Qg(r,n)&&i||Object.defineProperty(s,t,n)},Qg=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Sg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},bg=(s,e)=>`/* Wrapped ${s}*/
66
+ ${e}`,wg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Rg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),xg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=bg.bind(null,i,e.toString());Object.defineProperty(r,"name",Rg),Object.defineProperty(s,"toString",{...wg,value:r})};function Tg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Bg(s,e,r,t);return Sg(s,e),xg(s,e,i),s}const Dg=new WeakMap;function ui(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Tg(r,s,{ignoreNonConfigurable:!0}),Dg.set(r,t),r}var rl={},ho={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=Qe.Wrap=Qe.Unit=Qe.PrintOptions=Qe.PositionType=Qe.Overflow=Qe.NodeType=Qe.MeasureMode=Qe.LogLevel=Qe.Justify=Qe.Gutter=Qe.FlexDirection=Qe.ExperimentalFeature=Qe.Errata=Qe.Edge=Qe.Display=Qe.Direction=Qe.Dimension=Qe.Align=void 0;let di=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s}({});Qe.Align=di;let uo=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});Qe.Dimension=uo;let Lr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});Qe.Direction=Lr;let go=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});Qe.Display=go;let Jt=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({});Qe.Edge=Jt;let Js=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({});Qe.Errata=Js;let _r=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});Qe.ExperimentalFeature=_r;let Ws=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});Qe.FlexDirection=Ws;let kr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});Qe.Gutter=kr;let Hi=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({});Qe.Justify=Hi;let $i=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({});Qe.LogLevel=$i;let Fr=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});Qe.MeasureMode=Fr;let fo=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});Qe.NodeType=fo;let Nr=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});Qe.Overflow=Nr;let Mr=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});Qe.PositionType=Mr;let Pr=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});Qe.PrintOptions=Pr;let qs=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});Qe.Unit=qs;let Or=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});Qe.Wrap=Or;var Lg={ALIGN_AUTO:di.Auto,ALIGN_FLEX_START:di.FlexStart,ALIGN_CENTER:di.Center,ALIGN_FLEX_END:di.FlexEnd,ALIGN_STRETCH:di.Stretch,ALIGN_BASELINE:di.Baseline,ALIGN_SPACE_BETWEEN:di.SpaceBetween,ALIGN_SPACE_AROUND:di.SpaceAround,DIMENSION_WIDTH:uo.Width,DIMENSION_HEIGHT:uo.Height,DIRECTION_INHERIT:Lr.Inherit,DIRECTION_LTR:Lr.LTR,DIRECTION_RTL:Lr.RTL,DISPLAY_FLEX:go.Flex,DISPLAY_NONE:go.None,EDGE_LEFT:Jt.Left,EDGE_TOP:Jt.Top,EDGE_RIGHT:Jt.Right,EDGE_BOTTOM:Jt.Bottom,EDGE_START:Jt.Start,EDGE_END:Jt.End,EDGE_HORIZONTAL:Jt.Horizontal,EDGE_VERTICAL:Jt.Vertical,EDGE_ALL:Jt.All,ERRATA_NONE:Js.None,ERRATA_STRETCH_FLEX_BASIS:Js.StretchFlexBasis,ERRATA_ALL:Js.All,ERRATA_CLASSIC:Js.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:_r.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:_r.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:_r.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:Ws.Column,FLEX_DIRECTION_COLUMN_REVERSE:Ws.ColumnReverse,FLEX_DIRECTION_ROW:Ws.Row,FLEX_DIRECTION_ROW_REVERSE:Ws.RowReverse,GUTTER_COLUMN:kr.Column,GUTTER_ROW:kr.Row,GUTTER_ALL:kr.All,JUSTIFY_FLEX_START:Hi.FlexStart,JUSTIFY_CENTER:Hi.Center,JUSTIFY_FLEX_END:Hi.FlexEnd,JUSTIFY_SPACE_BETWEEN:Hi.SpaceBetween,JUSTIFY_SPACE_AROUND:Hi.SpaceAround,JUSTIFY_SPACE_EVENLY:Hi.SpaceEvenly,LOG_LEVEL_ERROR:$i.Error,LOG_LEVEL_WARN:$i.Warn,LOG_LEVEL_INFO:$i.Info,LOG_LEVEL_DEBUG:$i.Debug,LOG_LEVEL_VERBOSE:$i.Verbose,LOG_LEVEL_FATAL:$i.Fatal,MEASURE_MODE_UNDEFINED:Fr.Undefined,MEASURE_MODE_EXACTLY:Fr.Exactly,MEASURE_MODE_AT_MOST:Fr.AtMost,NODE_TYPE_DEFAULT:fo.Default,NODE_TYPE_TEXT:fo.Text,OVERFLOW_VISIBLE:Nr.Visible,OVERFLOW_HIDDEN:Nr.Hidden,OVERFLOW_SCROLL:Nr.Scroll,POSITION_TYPE_STATIC:Mr.Static,POSITION_TYPE_RELATIVE:Mr.Relative,POSITION_TYPE_ABSOLUTE:Mr.Absolute,PRINT_OPTIONS_LAYOUT:Pr.Layout,PRINT_OPTIONS_STYLE:Pr.Style,PRINT_OPTIONS_CHILDREN:Pr.Children,UNIT_UNDEFINED:qs.Undefined,UNIT_POINT:qs.Point,UNIT_PERCENT:qs.Percent,UNIT_AUTO:qs.Auto,WRAP_NO_WRAP:Or.NoWrap,WRAP_WRAP:Or.Wrap,WRAP_WRAP_REVERSE:Or.WrapReverse};Qe.default=Lg,Object.defineProperty(ho,"__esModule",{value:!0}),ho.default=kg;var Ri=_g(Qe);function nl(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(nl=function(i){return i?t:e})(s)}function _g(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=nl(e);if(t&&t.has(s))return t.get(s);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in s)if(n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)){var o=r?Object.getOwnPropertyDescriptor(s,n):null;o&&(o.get||o.set)?Object.defineProperty(i,n,o):i[n]=s[n]}return i.default=s,t&&t.set(s,i),i}function kg(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[Ri.Unit.Point]:s.Node.prototype[r],[Ri.Unit.Percent]:s.Node.prototype[`${r}Percent`],[Ri.Unit.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let h,u;if(c==="auto")h=Ri.Unit.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?Ri.Unit.Percent:Ri.Unit.Point,u=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(u))throw new Error(`Invalid value ${c} for ${r}`);if(!n[h])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return u!==void 0?n[h].call(this,...A,u):n[h].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Ri.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Ri.default}}var ol={exports:{}};(function(s,e){var t=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(r){r=r||{};var n;n||(n=typeof r<"u"?r:{});var o,a;n.ready=new Promise(function(I,m){o=I,a=m});var A=Object.assign({},n),l="";typeof document<"u"&&document.currentScript&&(l=document.currentScript.src),i&&(l=i),l.indexOf("blob:")!==0?l=l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):l="";var c=n.print||console.log.bind(console),h=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var u;n.wasmBinary&&(u=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&$("no native wasm support detected");var d,g=!1;function f(I,m,D){D=m+D;for(var k="";!(m>=D);){var O=I[m++];if(!O)break;if(O&128){var J=I[m++]&63;if((O&224)==192)k+=String.fromCharCode((O&31)<<6|J);else{var Z=I[m++]&63;O=(O&240)==224?(O&15)<<12|J<<6|Z:(O&7)<<18|J<<12|Z<<6|I[m++]&63,65536>O?k+=String.fromCharCode(O):(O-=65536,k+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else k+=String.fromCharCode(O)}return k}var p,y,v,S,C,Q,B,_,L;function G(){var I=d.buffer;p=I,n.HEAP8=y=new Int8Array(I),n.HEAP16=S=new Int16Array(I),n.HEAP32=Q=new Int32Array(I),n.HEAPU8=v=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=B=new Uint32Array(I),n.HEAPF32=_=new Float32Array(I),n.HEAPF64=L=new Float64Array(I)}var F,U=[],q=[],V=[];function X(){var I=n.preRun.shift();U.unshift(I)}var w=0,x=null;function $(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",h(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function R(I){return I.startsWith("data:application/octet-stream;base64,")}var b;if(b="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gAABgA39/fABgAX8BfGADf399AX1gBX9/f39/AX9gAn9/AXxgAAF/YAZ/f31/fX8AYAR/f39/AX9gAn9/AX1gBn9/f39/fwF/YAV/f39/fwBgBH9/f38AYAN/fn8BfmAHf39/f39/fwBgBn9/f39/fwBgAn19AX1gAX0Bf2ABfwF9YAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA5/fX1/f399fX9/f39/fwF/YAZ/f319f38AYAJ+fwF/YAR/fX1/AX1gA399fQF9YAF8AXxgBH98fHwAYAV/f319fQF9YA5/fX1/f399fX9/f39/fwBgB39/fX99f38AYA1/fX99f31/fX19fX1/AX9gBX9/fX19AGAEf39+fgBgB39/f39/f38Bf2ACfH8BfGAFf398fH8AYAN/f38BfWADf39/AXxgBH9/f3wAYAN/f30AYAZ/f31/fX8BfwKvAR0BYQFhAB0BYQFiAAMBYQFjABUBYQFkABIBYQFlAAcBYQFmAB4BYQFnAAABYQFoAB8BYQFpAAMBYQFqAAABYQFrABYBYQFsAAUBYQFtAAMBYQFuAAEBYQFvABYBYQFwAAYBYQFx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hBCABKAIEQQFrDgIEAQYLIABB/////3txQYCAgIACar4hBCAAQYCAgIAEcUUNAwsgBCADlEMK1yM8lCEEDAILIAQhBQtDAAAAACEEAkAgACgC3AEiAEHw4YP8B0YNACAAQY+evPwHRg0CQfAhIQECQCAAQarVqv0HRwRAIAC+IgQgBFsNAUH4ISEBCyABKgIAIQQgASgCBEEBaw4CAgEECyAAQf////97cUGAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBAXI2AgAgAgJ/IAIoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFBHSABZyIAa3ZBBHMgAEECdGtB7gBqIAFB/x9NDQAaQT8gAUEeIABrdkECcyAAQQF0a0HHAGoiACAAQT9PGwsiAUEEdCIAQdAuajYCBCACIABB2C5qIgAoAgA2AgggACACNgIAIAIoAgggAjYCBEHYNkHYNikDAEIBIAGthoQ3AwALC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIA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thgwBCyACQv////////8Hg0KAgICAgICACIQLIQEgBEH/B0oEQANAAkAgAUKAgICAgICACH0iA0IAUw0AIAMiAUIAUg0AIABEAAAAAAAAAACiDwsgAUIBhiEBIARBAWsiBEH/B0oNAAtB/wchBAsCQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQv////////8HWARAA0AgBEEBayEEIAFCgICAgICAgARUIQUgAUIBhiEBIAUNAAsLIAJCgICAgICAgICAf4MgAUKAgICAgICACH0gBK1CNIaEIAFBASAEa62IIARBAEobhL8LigEBA38DQCAAQQR0IgFB1C5qIAFB0C5qIgI2AgAgAUHYLmogAjYCACAAQQFqIgBBwABHDQALQTAQTxpB8DZBEDYCAEH0NkEANgIAEIQBQfQ2QaA3KAIANgIAQaA3QfA2NgIAQaQ3QcYBNgIAQag3QQA2AgAQdkGoN0GgNygCADYCAEGgN0GkNzYCAAukAwEHfyAABEAjAEEgayIGJAAgACgCACIBKAKoBCIDBEAgAyABEGsaIAFBADYCqAQLIAEoArAEIgIgASgCrAQiA0cEQEEBIAIgA2tBAnUiAiACQQFNGyEEQQAhAgNAIAMgAkECdGooAgBBADYCqAQgAkEBaiICIARHDQALCyABIAM2ArAEAkAgAyABQbQEaiICKAIARg0AIAZBCGpBAEEAIAIQQCICKAIEIAEoArAEIAEoAqwEIgRrIgVrIgMgBCAFEDYhBSABKAKsBCEEIAEgBTYCrAQgAiAENgIEIAEoArAEIQUgASACKAIINgKwBCACIAU2AgggASgCtAQhByABIAIoAgw2ArQEIAIgBDYCACACIAc2AgwgBCAFRwRAIAIgBSAEIAVrQQNqQXxxajYCCAsgBEUNACAEEEkgASgCrAQhAwsgAwRAIAEgAzYCsAQgAxBJCyABEEkgACgCCCEBIABBADYCCCABBEAgASABKAIAKAIEEQAACyAAKAIEIQEgAEEANgIEIAEEQCABIAEoAgAoAgQRAAALIAZBIGokACAAECkLC5ABAAJ/IAEEQCABKAIAEGQMAQsCQEHoNi0AAAR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ANgIADwsACyACIAIoAgAiAUEEajYCACAAIAEyAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEzAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEwAAA3AwAPCyACIAIoAgAiAUEEajYCACAAIAExAAA3AwAPCwALIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASsDADkDAA8LIAAgAiADEQEACw8LIAIgAigCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBGRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBGRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBAC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BATYCBEHkNiAANgIAQeg2QQE6AABB4DZB4DYoAgBBAWo2AgALIAAoAgQhBAJAIAAtAAhBCHEEQCAAQQBBBUEAQbwhIAIgBBERABoMAQsgAEEAQQVBvCEgAiAEEQsAGgsgA0EQaiQAECwACyAAQwAAAAAgASABQwAAAABbGzgCFCACQRBqJAALPAAgAUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAg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KAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJAAkACQCABQQRrDgIAAQILIABBpAJqIAAtAKwCQQNxQQJGDQIaI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FABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!R(b)){var T=b;b=n.locateFile?n.locateFile(T,l):l+T}function K(){var I=b;try{if(I==b&&u)return new Uint8Array(u);if(R(I))try{var m=Xy(I.slice(37)),D=new Uint8Array(m.length);for(I=0;I<m.length;++I)D[I]=m.charCodeAt(I);var k=D}catch{throw Error("Converting base64 string to bytes failed.")}else k=void 0;var O=k;if(O)return O;throw"both async and sync fetching of the wasm failed"}catch(J){$(J)}}function M(){return u||typeof fetch!="function"?Promise.resolve().then(function(){return K()}):fetch(b,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+b+"'";return I.arrayBuffer()}).catch(function(){return K()})}function W(I){for(;0<I.length;)I.shift()(n)}function ie(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function ce(I,m){return I=ie(I),function(){return m.apply(this,arguments)}}var ae=[{},{value:void 0},{value:null},{value:!0},{value:!1}],me=[];function Be(I){var m=Error,D=ce(I,function(k){this.name=I,this.message=k,k=Error(k).stack,k!==void 0&&(this.stack=this.toString()+`
67
+ `+k.replace(/^Error(:[^\n]*)?\n/,""))});return D.prototype=Object.create(m.prototype),D.prototype.constructor=D,D.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},D}var xe=void 0;function re(I){throw new xe(I)}var Ce=I=>(I||re("Cannot use deleted val. handle = "+I),ae[I].value),ye=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=me.length?me.pop():ae.length;return ae[m]={fa:1,value:I},m}},ue=void 0,he=void 0;function Ae(I){for(var m="";v[I];)m+=he[v[I++]];return m}var we=[];function Oe(){for(;we.length;){var I=we.pop();I.L.Z=!1,I.delete()}}var De=void 0,ke={};function Ue(I,m){for(m===void 0&&re("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var Le={};function Se(I){I=Hu(I);var m=Ae(I);return Bi(I),m}function Ve(I,m){var D=Le[I];return D===void 0&&re(m+" has unknown type "+Se(I)),D}function je(){}var ct=!1;function st(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function mt(I,m,D){return m===D?I:D.P===void 0?null:(I=mt(I,m,D.P),I===null?null:D.ma(I))}var yi={};function Ct(I,m){return m=Ue(I,m),ke[m]}var ai=void 0;function Ai(I){throw new ai(I)}function li(I,m){return m.O&&m.N||Ai("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&Ai("Both smartPtrType and smartPtr must be specified"),m.count={value:1},gt(Object.create(I,{L:{value:m}}))}function gt(I){return typeof FinalizationRegistry>"u"?(gt=m=>m,I):(ct=new FinalizationRegistry(m=>{st(m.L)}),gt=m=>{var D=m.L;return D.S&&ct.register(m,{L:D},m),m},je=m=>{ct.unregister(m)},gt(I))}var Y={};function le(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function fe(I){return this.fromWireType(Q[I>>2])}var Re={},be={};function Je(I,m,D){function k(ee){ee=D(ee),ee.length!==I.length&&Ai("Mismatched type converter count");for(var se=0;se<I.length;++se)vt(I[se],ee[se])}I.forEach(function(ee){be[ee]=m});var O=Array(m.length),J=[],Z=0;m.forEach((ee,se)=>{Le.hasOwnProperty(ee)?O[se]=Le[ee]:(J.push(ee),Re.hasOwnProperty(ee)||(Re[ee]=[]),Re[ee].push(()=>{O[se]=Le[ee],++Z,Z===J.length&&k(O)}))}),J.length===0&&k(O)}function yt(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function vt(I,m,D={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var k=m.name;if(I||re('type "'+k+'" must have a positive integer typeid pointer'),Le.hasOwnProperty(I)){if(D.ta)return;re("Cannot register type '"+k+"' twice")}Le[I]=m,delete be[I],Re.hasOwnProperty(I)&&(m=Re[I],delete Re[I],m.forEach(O=>O()))}function Ts(I){re(I.L.O.M.name+" instance already deleted")}function Bt(){}function ts(I,m,D){if(I[m].R===void 0){var k=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||re("Function '"+D+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[k.Y]=k}}function Ds(I,m){n.hasOwnProperty(I)?(re("Cannot register public name '"+I+"' twice"),ts(n,I,I),n.hasOwnProperty(void 0)&&re("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function ki(I,m,D,k,O,J,Z,ee){this.name=I,this.constructor=m,this.W=D,this.V=k,this.P=O,this.oa=J,this.aa=Z,this.ma=ee,this.ia=[]}function pr(I,m,D){for(;m!==D;)m.aa||re("Expected null or instance of "+D.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function Er(I,m){return m===null?(this.da&&re("null is not a valid "+this.name),0):(m.L||re('Cannot pass "'+rA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),pr(m.L.N,m.L.O.M,this.M))}function Ls(I,m){if(m===null){if(this.da&&re("null is not a valid "+this.name),this.ca){var D=this.ea();return I!==null&&I.push(this.V,D),D}return 0}if(m.L||re('Cannot pass "'+rA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&re("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),D=pr(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&re("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?D=m.L.S:re("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:D=m.L.S;break;case 2:if(m.L.T===this)D=m.L.S;else{var k=m.clone();D=this.wa(D,ye(function(){k.delete()})),I!==null&&I.push(this.V,D)}break;default:re("Unsupporting sharing policy")}return D}function Ny(I,m){return m===null?(this.da&&re("null is not a valid "+this.name),0):(m.L||re('Cannot pass "'+rA(m)+'" as a '+this.name),m.L.N||re("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&re("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),pr(m.L.N,m.L.O.M,this.M))}function vi(I,m,D,k){this.name=I,this.M=m,this.da=D,this.ba=k,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=Ls:(this.toWireType=k?Er:Ny,this.U=null)}function My(I,m){n.hasOwnProperty(I)||Ai("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function Py(I,m){var D=[];return function(){if(D.length=0,Object.assign(D,arguments),I.includes("j")){var k=n["dynCall_"+I];k=D&&D.length?k.apply(null,[m].concat(D)):k.call(null,m)}else k=F.get(m).apply(null,D);return k}}function Yt(I,m){I=Ae(I);var D=I.includes("j")?Py(I,m):F.get(m);return typeof D!="function"&&re("unknown function pointer with signature "+I+": "+m),D}var Pu=void 0;function On(I,m){function D(J){O[J]||Le[J]||(be[J]?be[J].forEach(D):(k.push(J),O[J]=!0))}var k=[],O={};throw m.forEach(D),new Pu(I+": "+k.map(Se).join([", "]))}function tA(I,m,D,k,O){var J=m.length;2>J&&re("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=m[1]!==null&&D!==null,ee=!1;for(D=1;D<m.length;++D)if(m[D]!==null&&m[D].U===void 0){ee=!0;break}var se=m[0].name!=="void",te=J-2,ne=Array(te),pe=[],_e=[];return function(){if(arguments.length!==te&&re("function "+I+" called with "+arguments.length+" arguments, expected "+te+" args!"),_e.length=0,pe.length=Z?2:1,pe[0]=O,Z){var rt=m[1].toWireType(_e,this);pe[1]=rt}for(var Me=0;Me<te;++Me)ne[Me]=m[Me+2].toWireType(_e,arguments[Me]),pe.push(ne[Me]);if(Me=k.apply(null,pe),ee)le(_e);else for(var Tt=Z?1:2;Tt<m.length;Tt++){var Kt=Tt===1?rt:ne[Tt-2];m[Tt].U!==null&&m[Tt].U(Kt)}return rt=se?m[0].fromWireType(Me):void 0,rt}}function iA(I,m){for(var D=[],k=0;k<I;k++)D.push(B[m+4*k>>2]);return D}function sA(I){4<I&&--ae[I].fa===0&&(ae[I]=void 0,me.push(I))}function rA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function Oy(I,m){switch(m){case 2:return function(D){return this.fromWireType(_[D>>2])};case 3:return function(D){return this.fromWireType(L[D>>3])};default:throw new TypeError("Unknown float type: "+I)}}function Uy(I,m,D){switch(m){case 0:return D?function(k){return y[k]}:function(k){return v[k]};case 1:return D?function(k){return S[k>>1]}:function(k){return C[k>>1]};case 2:return D?function(k){return Q[k>>2]}:function(k){return B[k>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function Gy(I,m){for(var D="",k=0;!(k>=m/2);++k){var O=S[I+2*k>>1];if(O==0)break;D+=String.fromCharCode(O)}return D}function Hy(I,m,D){if(D===void 0&&(D=2147483647),2>D)return 0;D-=2;var k=m;D=D<2*I.length?D/2:I.length;for(var O=0;O<D;++O)S[m>>1]=I.charCodeAt(O),m+=2;return S[m>>1]=0,m-k}function $y(I){return 2*I.length}function Yy(I,m){for(var D=0,k="";!(D>=m/4);){var O=Q[I+4*D>>2];if(O==0)break;++D,65536<=O?(O-=65536,k+=String.fromCharCode(55296|O>>10,56320|O&1023)):k+=String.fromCharCode(O)}return k}function Ky(I,m,D){if(D===void 0&&(D=2147483647),4>D)return 0;var k=m;D=k+D-4;for(var O=0;O<I.length;++O){var J=I.charCodeAt(O);if(55296<=J&&57343>=J){var Z=I.charCodeAt(++O);J=65536+((J&1023)<<10)|Z&1023}if(Q[m>>2]=J,m+=4,m+4>D)break}return Q[m>>2]=0,m-k}function Vy(I){for(var m=0,D=0;D<I.length;++D){var k=I.charCodeAt(D);55296<=k&&57343>=k&&++D,m+=4}return m}var Jy={};function Ou(I){var m=Jy[I];return m===void 0?Ae(I):m}var Un=[];function Wy(I){var m=Un.length;return Un.push(I),m}function qy(I,m){for(var D=Array(I),k=0;k<I;++k)D[k]=Ve(B[m+4*k>>2],"parameter "+k);return D}var Uu=[],jy=[null,[],[]];xe=n.BindingError=Be("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<ae.length;++m)ae[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<ae.length;++I)if(ae[I]!==void 0)return ae[I];return null},ue=n.PureVirtualError=Be("PureVirtualError");for(var Gu=Array(256),Gn=0;256>Gn;++Gn)Gu[Gn]=String.fromCharCode(Gn);he=Gu,n.getInheritedInstanceCount=function(){return Object.keys(ke).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in ke)ke.hasOwnProperty(m)&&I.push(ke[m]);return I},n.flushPendingDeletes=Oe,n.setDelayFunction=function(I){De=I,we.length&&De&&De(Oe)},ai=n.InternalError=Be("InternalError"),Bt.prototype.isAliasOf=function(I){if(!(this instanceof Bt&&I instanceof Bt))return!1;var m=this.L.O.M,D=this.L.N,k=I.L.O.M;for(I=I.L.N;m.P;)D=m.aa(D),m=m.P;for(;k.P;)I=k.aa(I),k=k.P;return m===k&&D===I},Bt.prototype.clone=function(){if(this.L.N||Ts(this),this.L.$)return this.L.count.value+=1,this;var I=gt,m=Object,D=m.create,k=Object.getPrototypeOf(this),O=this.L;return I=I(D.call(m,k,{L:{value:{count:O.count,Z:O.Z,$:O.$,N:O.N,O:O.O,S:O.S,T:O.T}}})),I.L.count.value+=1,I.L.Z=!1,I},Bt.prototype.delete=function(){this.L.N||Ts(this),this.L.Z&&!this.L.$&&re("Object already scheduled for deletion"),je(this),st(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},Bt.prototype.isDeleted=function(){return!this.L.N},Bt.prototype.deleteLater=function(){return this.L.N||Ts(this),this.L.Z&&!this.L.$&&re("Object already scheduled for deletion"),we.push(this),we.length===1&&De&&De(Oe),this.L.Z=!0,this},vi.prototype.pa=function(I){return this.ja&&(I=this.ja(I)),I},vi.prototype.ga=function(I){this.V&&this.V(I)},vi.prototype.argPackAdvance=8,vi.prototype.readValueFromPointer=fe,vi.prototype.deleteObject=function(I){I!==null&&I.delete()},vi.prototype.fromWireType=function(I){function m(){return this.ca?li(this.M.W,{O:this.va,N:D,T:this,S:I}):li(this.M.W,{O:this,N:I})}var D=this.pa(I);if(!D)return this.ga(I),null;var k=Ct(this.M,D);if(k!==void 0)return k.L.count.value===0?(k.L.N=D,k.L.S=I,k.clone()):(k=k.clone(),this.ga(I),k);if(k=this.M.oa(D),k=yi[k],!k)return m.call(this);k=this.ba?k.ka:k.pointerType;var O=mt(D,this.M,k.M);return O===null?m.call(this):this.ca?li(k.M.W,{O:k,N:O,T:this,S:I}):li(k.M.W,{O:k,N:O})},Pu=n.UnboundTypeError=Be("UnboundTypeError");var Xy=typeof atob=="function"?atob:function(I){var m="",D=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++));k=k<<2|O>>4,O=(O&15)<<4|J>>2;var ee=(J&3)<<6|Z;m+=String.fromCharCode(k),J!==64&&(m+=String.fromCharCode(O)),Z!==64&&(m+=String.fromCharCode(ee))}while(D<I.length);return m},zy={p:function(I,m,D){I=Ae(I),m=Ve(m,"wrapper"),D=Ce(D);var k=[].slice,O=m.M,J=O.W,Z=O.P.W,ee=O.P.constructor;I=ce(I,function(){O.P.ia.forEach((function(te){if(this[te]===Z[te])throw new ue("Pure virtual function "+te+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:J}),this.__construct.apply(this,k.call(arguments))}),J.__construct=function(){this===J&&re("Pass correct 'this' to __construct");var te=ee.implement.apply(void 0,[this].concat(k.call(arguments)));je(te);var ne=te.L;te.notifyOnDestruction(),ne.$=!0,Object.defineProperties(this,{L:{value:ne}}),gt(this),te=ne.N,te=Ue(O,te),ke.hasOwnProperty(te)?re("Tried to register registered instance: "+te):ke[te]=this},J.__destruct=function(){this===J&&re("Pass correct 'this' to __destruct"),je(this);var te=this.L.N;te=Ue(O,te),ke.hasOwnProperty(te)?delete ke[te]:re("Tried to unregister unregistered instance: "+te)},I.prototype=Object.create(J);for(var se in D)I.prototype[se]=D[se];return ye(I)},j:function(I){var m=Y[I];delete Y[I];var D=m.ea,k=m.V,O=m.ha,J=O.map(Z=>Z.sa).concat(O.map(Z=>Z.ya));Je([I],J,Z=>{var ee={};return O.forEach((se,te)=>{var ne=Z[te],pe=se.qa,_e=se.ra,rt=Z[te+O.length],Me=se.xa,Tt=se.za;ee[se.na]={read:Kt=>ne.fromWireType(pe(_e,Kt)),write:(Kt,Ir)=>{var Qi=[];Me(Tt,Kt,rt.toWireType(Qi,Ir)),le(Qi)}}}),[{name:m.name,fromWireType:function(se){var te={},ne;for(ne in ee)te[ne]=ee[ne].read(se);return k(se),te},toWireType:function(se,te){for(var ne in ee)if(!(ne in te))throw new TypeError('Missing field: "'+ne+'"');var pe=D();for(ne in ee)ee[ne].write(pe,te[ne]);return se!==null&&se.push(k,pe),pe},argPackAdvance:8,readValueFromPointer:fe,U:k}]})},v:function(){},B:function(I,m,D,k,O){var J=yt(D);m=Ae(m),vt(I,{name:m,fromWireType:function(Z){return!!Z},toWireType:function(Z,ee){return ee?k:O},argPackAdvance:8,readValueFromPointer:function(Z){if(D===1)var ee=y;else if(D===2)ee=S;else if(D===4)ee=Q;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(ee[Z>>J])},U:null})},f:function(I,m,D,k,O,J,Z,ee,se,te,ne,pe,_e){ne=Ae(ne),J=Yt(O,J),ee&&(ee=Yt(Z,ee)),te&&(te=Yt(se,te)),_e=Yt(pe,_e);var rt=ie(ne);Ds(rt,function(){On("Cannot construct "+ne+" due to unbound types",[k])}),Je([I,m,D],k?[k]:[],function(Me){if(Me=Me[0],k)var Tt=Me.M,Kt=Tt.W;else Kt=Bt.prototype;Me=ce(rt,function(){if(Object.getPrototypeOf(this)!==Ir)throw new xe("Use 'new' to construct "+ne);if(Qi.X===void 0)throw new xe(ne+" has no accessible constructor");var Ku=Qi.X[arguments.length];if(Ku===void 0)throw new xe("Tried to invoke ctor of "+ne+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Qi.X).toString()+") parameters instead!");return Ku.apply(this,arguments)});var Ir=Object.create(Kt,{constructor:{value:Me}});Me.prototype=Ir;var Qi=new ki(ne,Me,Ir,_e,Tt,J,ee,te);Tt=new vi(ne,Qi,!0,!1),Kt=new vi(ne+"*",Qi,!1,!1);var Yu=new vi(ne+" const*",Qi,!1,!0);return yi[I]={pointerType:Kt,ka:Yu},My(rt,Me),[Tt,Kt,Yu]})},c:function(I,m,D,k,O,J,Z){var ee=iA(D,k);m=Ae(m),J=Yt(O,J),Je([],[I],function(se){function te(){On("Cannot call "+ne+" due to unbound types",ee)}se=se[0];var ne=se.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var pe=se.M.constructor;return pe[m]===void 0?(te.Y=D-1,pe[m]=te):(ts(pe,m,ne),pe[m].R[D-1]=te),Je([],ee,function(_e){return _e=tA(ne,[_e[0],null].concat(_e.slice(1)),null,J,Z),pe[m].R===void 0?(_e.Y=D-1,pe[m]=_e):pe[m].R[D-1]=_e,[]}),[]})},o:function(I,m,D,k,O,J){0<m||$();var Z=iA(m,D);O=Yt(k,O),Je([],[I],function(ee){ee=ee[0];var se="constructor "+ee.name;if(ee.M.X===void 0&&(ee.M.X=[]),ee.M.X[m-1]!==void 0)throw new xe("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.M.X[m-1]=()=>{On("Cannot construct "+ee.name+" due to unbound types",Z)},Je([],Z,function(te){return te.splice(1,0,null),ee.M.X[m-1]=tA(se,te,null,O,J),[]}),[]})},a:function(I,m,D,k,O,J,Z,ee){var se=iA(D,k);m=Ae(m),J=Yt(O,J),Je([],[I],function(te){function ne(){On("Cannot call "+pe+" due to unbound types",se)}te=te[0];var pe=te.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),ee&&te.M.ia.push(m);var _e=te.M.W,rt=_e[m];return rt===void 0||rt.R===void 0&&rt.className!==te.name&&rt.Y===D-2?(ne.Y=D-2,ne.className=te.name,_e[m]=ne):(ts(_e,m,pe),_e[m].R[D-2]=ne),Je([],se,function(Me){return Me=tA(pe,Me,te,J,Z),_e[m].R===void 0?(Me.Y=D-2,_e[m]=Me):_e[m].R[D-2]=Me,[]}),[]})},A:function(I,m){m=Ae(m),vt(I,{name:m,fromWireType:function(D){var k=Ce(D);return sA(D),k},toWireType:function(D,k){return ye(k)},argPackAdvance:8,readValueFromPointer:fe,U:null})},m:function(I,m,D){D=yt(D),m=Ae(m),vt(I,{name:m,fromWireType:function(k){return k},toWireType:function(k,O){return O},argPackAdvance:8,readValueFromPointer:Oy(m,D),U:null})},d:function(I,m,D,k,O){m=Ae(m),O===-1&&(O=4294967295),O=yt(D);var J=ee=>ee;if(k===0){var Z=32-8*D;J=ee=>ee<<Z>>>Z}D=m.includes("unsigned")?function(ee,se){return se>>>0}:function(ee,se){return se},vt(I,{name:m,fromWireType:J,toWireType:D,argPackAdvance:8,readValueFromPointer:Uy(m,O,k!==0),U:null})},b:function(I,m,D){function k(J){J>>=2;var Z=B;return new O(p,Z[J+1],Z[J])}var O=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];D=Ae(D),vt(I,{name:D,fromWireType:k,argPackAdvance:8,readValueFromPointer:k},{ta:!0})},n:function(I,m){m=Ae(m);var D=m==="std::string";vt(I,{name:m,fromWireType:function(k){var O=B[k>>2],J=k+4;if(D)for(var Z=J,ee=0;ee<=O;++ee){var se=J+ee;if(ee==O||v[se]==0){if(Z=Z?f(v,Z,se-Z):"",te===void 0)var te=Z;else te+="\0",te+=Z;Z=se+1}}else{for(te=Array(O),ee=0;ee<O;++ee)te[ee]=String.fromCharCode(v[J+ee]);te=te.join("")}return Bi(k),te},toWireType:function(k,O){O instanceof ArrayBuffer&&(O=new Uint8Array(O));var J,Z=typeof O=="string";if(Z||O instanceof Uint8Array||O instanceof Uint8ClampedArray||O instanceof Int8Array||re("Cannot pass non-string to std::string"),D&&Z){var ee=0;for(J=0;J<O.length;++J){var se=O.charCodeAt(J);127>=se?ee++:2047>=se?ee+=2:55296<=se&&57343>=se?(ee+=4,++J):ee+=3}J=ee}else J=O.length;if(ee=nA(4+J+1),se=ee+4,B[ee>>2]=J,D&&Z){if(Z=se,se=J+1,J=v,0<se){se=Z+se-1;for(var te=0;te<O.length;++te){var ne=O.charCodeAt(te);if(55296<=ne&&57343>=ne){var pe=O.charCodeAt(++te);ne=65536+((ne&1023)<<10)|pe&1023}if(127>=ne){if(Z>=se)break;J[Z++]=ne}else{if(2047>=ne){if(Z+1>=se)break;J[Z++]=192|ne>>6}else{if(65535>=ne){if(Z+2>=se)break;J[Z++]=224|ne>>12}else{if(Z+3>=se)break;J[Z++]=240|ne>>18,J[Z++]=128|ne>>12&63}J[Z++]=128|ne>>6&63}J[Z++]=128|ne&63}}J[Z]=0}}else if(Z)for(Z=0;Z<J;++Z)te=O.charCodeAt(Z),255<te&&(Bi(se),re("String has UTF-16 code units that do not fit in 8 bits")),v[se+Z]=te;else for(Z=0;Z<J;++Z)v[se+Z]=O[Z];return k!==null&&k.push(Bi,ee),ee},argPackAdvance:8,readValueFromPointer:fe,U:function(k){Bi(k)}})},i:function(I,m,D){if(D=Ae(D),m===2)var k=Gy,O=Hy,J=$y,Z=()=>C,ee=1;else m===4&&(k=Yy,O=Ky,J=Vy,Z=()=>B,ee=2);vt(I,{name:D,fromWireType:function(se){for(var te=B[se>>2],ne=Z(),pe,_e=se+4,rt=0;rt<=te;++rt){var Me=se+4+rt*m;(rt==te||ne[Me>>ee]==0)&&(_e=k(_e,Me-_e),pe===void 0?pe=_e:(pe+="\0",pe+=_e),_e=Me+m)}return Bi(se),pe},toWireType:function(se,te){typeof te!="string"&&re("Cannot pass non-string to C++ string type "+D);var ne=J(te),pe=nA(4+ne+m);return B[pe>>2]=ne>>ee,O(te,pe+4,ne+m),se!==null&&se.push(Bi,pe),pe},argPackAdvance:8,readValueFromPointer:fe,U:function(se){Bi(se)}})},k:function(I,m,D,k,O,J){Y[I]={name:Ae(m),ea:Yt(D,k),V:Yt(O,J),ha:[]}},h:function(I,m,D,k,O,J,Z,ee,se,te){Y[I].ha.push({na:Ae(m),sa:D,qa:Yt(k,O),ra:J,ya:Z,xa:Yt(ee,se),za:te})},C:function(I,m){m=Ae(m),vt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,D,k,O){I=Un[I],m=Ce(m),D=Ou(D);var J=[];return B[k>>2]=ye(J),I(m,D,J,O)},t:function(I,m,D,k){I=Un[I],m=Ce(m),D=Ou(D),I(m,D,null,k)},g:sA,l:function(I,m){var D=qy(I,m),k=D[0];m=k.name+"_$"+D.slice(1).map(function(Z){return Z.name}).join("_")+"$";var O=Uu[m];if(O!==void 0)return O;var J=Array(I-1);return O=Wy((Z,ee,se,te)=>{for(var ne=0,pe=0;pe<I-1;++pe)J[pe]=D[pe+1].readValueFromPointer(te+ne),ne+=D[pe+1].argPackAdvance;for(Z=Z[ee].apply(Z,J),pe=0;pe<I-1;++pe)D[pe+1].la&&D[pe+1].la(J[pe]);if(!k.ua)return k.toWireType(se,Z)}),Uu[m]=O},q:function(I){4<I&&(ae[I].fa+=1)},r:function(I){var m=Ce(I);le(m),sA(I)},e:function(){$("")},x:function(I,m,D){v.copyWithin(I,m,m+D)},w:function(I){var m=v.length;if(I>>>=0,2147483648<I)return!1;for(var D=1;4>=D;D*=2){var k=m*(1+.2/D);k=Math.min(k,I+100663296);var O=Math;k=Math.max(I,k),O=O.min.call(O,2147483648,k+(65536-k%65536)%65536);e:{try{d.grow(O-p.byteLength+65535>>>16),G();var J=1;break e}catch{}J=void 0}if(J)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,m,D,k){for(var O=0,J=0;J<D;J++){var Z=B[m>>2],ee=B[m+4>>2];m+=8;for(var se=0;se<ee;se++){var te=v[Z+se],ne=jy[I];te===0||te===10?((I===1?c:h)(f(ne,0)),ne.length=0):ne.push(te)}O+=ee}return B[k>>2]=O,0}};(function(){function I(O){n.asm=O.exports,d=n.asm.D,G(),F=n.asm.I,q.unshift(n.asm.E),w--,n.monitorRunDependencies&&n.monitorRunDependencies(w),w==0&&x&&(O=x,x=null,O())}function m(O){I(O.instance)}function D(O){return M().then(function(J){return WebAssembly.instantiate(J,k)}).then(function(J){return J}).then(O,function(J){h("failed to asynchronously prepare wasm: "+J),$(J)})}var k={a:zy};if(w++,n.monitorRunDependencies&&n.monitorRunDependencies(w),n.instantiateWasm)try{return n.instantiateWasm(k,I)}catch(O){h("Module.instantiateWasm callback failed with error: "+O),a(O)}return function(){return u||typeof WebAssembly.instantiateStreaming!="function"||R(b)||typeof fetch!="function"?D(m):fetch(b,{credentials:"same-origin"}).then(function(O){return WebAssembly.instantiateStreaming(O,k).then(m,function(J){return h("wasm streaming compile failed: "+J),h("falling back to ArrayBuffer instantiation"),D(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var Hu=n.___getTypeName=function(){return(Hu=n.___getTypeName=n.asm.F).apply(null,arguments)};n.__embind_initialize_bindings=function(){return(n.__embind_initialize_bindings=n.asm.G).apply(null,arguments)};var nA=n._malloc=function(){return(nA=n._malloc=n.asm.H).apply(null,arguments)},Bi=n._free=function(){return(Bi=n._free=n.asm.J).apply(null,arguments)};n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.K).apply(null,arguments)};var Hn;x=function I(){Hn||$u(),Hn||(x=I)};function $u(){function I(){if(!Hn&&(Hn=!0,n.calledRun=!0,!g)){if(W(q),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();V.unshift(m)}W(V)}}if(!(0<w)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)X();W(U),0<w||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),I()},1)):I())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();return $u(),r.ready}})();s.exports=t})(ol);var Fg=ol.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(ho),i=Qe;Object.keys(i).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in s&&s[a]===i[a]||Object.defineProperty(s,a,{enumerable:!0,get:function(){return i[a]}})});function r(a){return a&&a.__esModule?a:{default:a}}const n=Fg;async function o(){return(0,t.default)(await n())}})(rl);function po({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const u=a+A,d=a===0,g=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=u-n&&t<=u&&(r.globalAlpha=Math.max(0,Math.min(1,(u-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Ng(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Mg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function Eo({resolution:s,aspectRatio:e}){const t=Ng(s),i=Mg(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function Pg({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=Eo({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,h=o/l,u=(i-c)/2,d=(r-h)/2;return{sx:u,sy:d,sWidth:c,sHeight:h,scale:l}}function js({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const h=Math.max(e,0),u=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,p=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(u-h)*f,(g-d)*p]}function al({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:h}){const{x:u,y:d,width:g,height:f}=t??{},p=A*(u??0),y=l*(d??0),v=A*Math.min(1-(u??0),g??1),S=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=v,c.height=S;const x=js({source:e,sx:p,sy:y,sw:v,sh:S,dx:0,dy:0,dw:v,dh:S});C.drawImage(...x)}const Q=v/S,{sx:B,sy:_,sWidth:L,sHeight:G,scale:F}=Pg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:v,sourceHeight:S}),U=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!U){if(B<0){const x=Math.abs(B)*F;s.fillStyle="black",s.beginPath(),s.rect(r,n,x,a),s.rect(r+o-x,n,x,a),s.fill(),s.closePath()}if(_<0){const x=Math.abs(_)*F;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,x),s.rect(r,n+a-x,o,x),s.fill(),s.closePath()}}if(i==="letterbox-video"&&U){const x=h.getContext("2d");if(x){h.width=v,h.height=S,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const $=js({source:c,sx:B,sy:_,sw:L,sh:G,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...$),x.save();const R=1.2,b=-(v*R-v)/2,T=-(S*R-S)/2,K=Math.min(v/20,S/20);if(x.filter=`blur(${K}px) brightness(20%)`,x.translate(b,T),x.scale(R,R),x.drawImage(c,0,0,v,S),x.restore(),s.globalCompositeOperation="destination-over",B<0){const M=o/Q,W=a/M,ie=js({source:h,sy:(1-W)*S/2,sh:W*S,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}if(_<0){const M=a*Q,W=o/M,ie=js({source:h,sx:(1-W)*v/2,sw:W*v,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}s.restore()}}else{const x=js({source:c,sx:B,sy:_,sw:L,sh:G,dx:r,dy:n,dw:o,dh:a});s.drawImage(...x)}const q=B*-1*F,V=_*-1*F,X=o-q*2,w=a-V*2;return{dx:q,dy:V,dw:X,dh:w}}function Al({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const ll=Zn(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let u=0;for(;a*e>c+1;){c+=1;const d=$r({context:t,font:s,fontSize:c,text:n,maxW:i});if(u=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),u>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(Hr))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`}),gi=1.8;function Io({context:s,x:e,y:t,width:i,height:r,radii:n,clip:o=!1,debug:a=!1}){let A,l,c,h;typeof n=="number"?A=l=c=h=n:[A,l,c,h]=n,s.beginPath(),s.moveTo(e+Math.min(r/gi,A),t),s.lineTo(e+i-Math.min(r/gi,l),t),s.quadraticCurveTo(e+i,t,e+i,t+Math.min(r/gi,l)),s.lineTo(e+i,t+r-Math.min(r/gi,c)),s.quadraticCurveTo(e+i,t+r,e+i-Math.min(r/gi,c),t+r),s.lineTo(e+Math.min(r/gi,h),t+r),s.quadraticCurveTo(e,t+r,e,t+r-Math.min(r/gi,h)),s.lineTo(e,t+Math.min(r/gi,A)),s.quadraticCurveTo(e,t,e+Math.min(r/gi,A),t),s.closePath(),a&&(s.strokeStyle="blue",s.stroke()),o&&s.clip()}function Og(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function cl(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function hl(s,e,{layout:t,scale:i=1}){const{position:r="relative",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:h,flex:u,gap:d,margin:g,padding:f,direction:p="column",align:y="start",alignSelf:v,justify:S="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:L,right:G,bottom:F,left:U}=Og(n,i);L&&e.setPosition(s.EDGE_TOP,L),G&&e.setPosition(s.EDGE_RIGHT,G),F&&e.setPosition(s.EDGE_BOTTOM,F),U&&e.setPosition(s.EDGE_LEFT,U)}const Q={row:s.FLEX_DIRECTION_ROW,column:s.FLEX_DIRECTION_COLUMN,"row-reverse":s.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(Q[p]);const B={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(B[y]),v&&e.setAlignSelf(B[v]);const _={start:s.JUSTIFY_FLEX_START,end:s.JUSTIFY_FLEX_END,center:s.JUSTIFY_CENTER,"space-between":s.JUSTIFY_SPACE_BETWEEN,"space-around":s.JUSTIFY_SPACE_AROUND,"space-evenly":s.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(_[S]),g){const{top:L,right:G,bottom:F,left:U}=cl(g,i);e.setMargin(s.EDGE_TOP,L),e.setMargin(s.EDGE_RIGHT,G),e.setMargin(s.EDGE_BOTTOM,F),e.setMargin(s.EDGE_LEFT,U)}if(f){const{top:L,right:G,bottom:F,left:U}=cl(f,i);e.setPadding(s.EDGE_TOP,L),e.setPadding(s.EDGE_RIGHT,G),e.setPadding(s.EDGE_BOTTOM,F),e.setPadding(s.EDGE_LEFT,U)}u&&e.setFlex(u),e.setGap(s.GUTTER_ALL,(d??0)*i),o&&e.setWidth(typeof o=="number"?o*i:o),a&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*i:a)),A&&e.setMinWidth(typeof A=="number"?A*i:A),l&&e.setMinHeight(typeof l=="number"?l*i:l),c&&e.setMaxWidth(typeof c=="number"?c*i:c),h&&e.setMaxHeight(typeof h=="number"?h*i:h)}function ul({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:h}=l;h&&(c.save(),h({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),ul({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function dl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...h}=n;return hl(s,a,{layout:h,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:dl(s,a,l,i)}});return e.calculateLayout(),r}function gl(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:h,height:u}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:h,height:u,element:a,childNodes:gl(s,A,d,g)}})}function fl(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}fl(r,e)})}function Ug({yoga:s,canvas:e,origin:t,elements:i,...r}){const n={inset:{top:0,left:0},width:e.width,height:e.height,...t},o=s.Node.create();hl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=dl(s,o,i,l);fl(c,l),o.calculateLayout();const h=gl(o,c);return o.freeRecursive(),ul({...r,scale:l,canvas:e,position:h})}const Gg={linear:hg,easeIn:ao,easeInOut:dg,easeOut:ug,circIn:tl,circInOut:gg,circOut:il,backIn:Ao,backInOut:pg,backOut:fg,anticipate:Eg,bounceIn:yg,bounceInOut:vg,bounceOut:Tr},Ur=Zn((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>ng(s,e,{...r,clamp:t,ease:Gg[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),pl=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function Gr({text:s,font:e}){let t=e;return pl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const Hr=/(?<value>\d+\.?\d*)(?=px)/;function El(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function Il(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>Il(r)))}function ml({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}){return o.map(d=>{var g,f,p,y,v,S,C,Q;const{node:B,transient:_=[{from:0,duration:1/0}]}=d,L=t.getContext("2d"),G={total:a,content:A,scene:l},F={total:c,content:h,scene:u},U=_.reduce((q,{type:V="scene",from:X,duration:w,animation:x})=>{const $=X<0?F[V]+X:X;return G[V]>=$&&G[V]<=$+w&&q.push({type:V,animation:x,duration:w,from:$}),q},[]);if(L&&U.length>0&&Il(d)){let q=d.width,V=d.height;if((B==null?void 0:B.type)==="text"&&B.value){const{align:X="left"}=B,w=Gr({text:B.value,font:B.font});L.save(),L.font=w,L.textBaseline="top",L.textAlign=X,B.wrap?V=({width:x,maxHeight:$,scale:R})=>{var b,T;const K=ll({font:w,scale:R,context:L,maxW:x,maxH:$,text:B.value??"",minSize:(b=B.fill)==null?void 0:b.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});return $r({context:L,font:w,fontSize:K,text:B.value??"",maxW:x}).length*K}:(q=L.measureText(B.value).width,V=parseFloat(((f=(g=w.match(Hr))==null?void 0:g.groups)==null?void 0:f.value)??"0")),L.restore()}if((B==null?void 0:B.type)==="image"&&B.image&&B.size){const X=((p=B.image)==null?void 0:p.naturalWidth)??((y=B.image)==null?void 0:y.width),w=((v=B.image)==null?void 0:v.naturalHeight)??((S=B.image)==null?void 0:S.height),x=X/w,$=(C=B.size)==null?void 0:C.width,R=(Q=B.size)==null?void 0:Q.height;q=$??(R??0)*x,V=R??($??0)/x}return{...d,width:q,height:V,elements:ml({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}),draw:({dx:X,dy:w,dw:x,dh:$,scale:R})=>{var b,T,K,M,W,ie,ce,ae,me,Be,xe,re,Ce;if(U.forEach(ye=>{const{type:ue="scene",from:he,duration:Ae,animation:we={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=ye;if(we){const{type:Oe,duration:De,easing:{in:ke="easeOut",out:Ue="easeOut"}={}}=we;if(he>0&&G[ue]<=he+De)switch(Oe){case"fade":{const Le=Ur([he,he+De],[0,1],{ease:ke});L.globalAlpha=Le(G[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:$},{x:0,y:0}],right:[{x,y:0},{x:0,y:0}],down:[{x:0,y:-$},{x:0,y:0}],left:[{x:-x,y:0},{x:0,y:0}]},Ve=Ur([he,he+De],Se[Le.direction.in],{ease:ke}),{x:je,y:ct}=Ve(G[ue]);L.translate(je,ct);break}}if(he+Ae<F[ue]&&he+Ae-De<=G[ue])switch(Oe){case"fade":{const Le=Ur([he+Ae-De,he+Ae],[1,0],{ease:Ue});L.globalAlpha=Le(G[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:0},{x:0,y:-$}],right:[{x:0,y:0},{x,y:0}],down:[{x:0,y:0},{x:0,y:$}],left:[{x:0,y:0},{x:-x,y:0}]},Ve=Ur([he+Ae-De,he+Ae],Se[Le.direction.out],{ease:Ue}),{x:je,y:ct}=Ve(G[ue]);L.translate(je,ct);break}}}}),B){const{type:ye}=B;if(ye==="box"){const{shadow:{color:ue="rgba(0, 0, 0, 0.5)",blur:he=0,offset:{x:Ae=0,y:we=0}={}}={}}=B;if(L.save(),L.fillStyle=ue,L.shadowColor=ue,L.shadowBlur=he,L.shadowOffsetX=Ae+x+t.width,L.shadowOffsetY=we+$+t.height,L.beginPath(),!d.radius)L.rect(X-x-t.width,w-$-t.height,x,$);else{const{topLeft:Oe,topRight:De,bottomRight:ke,bottomLeft:Ue}=El(d.radius,R);Io({debug:e,context:L,x:X-x-t.width,y:w-$-t.height,width:x,height:$,radii:[Oe,De,ke,Ue]})}L.fill(),L.closePath(),L.restore()}if(d.radius){const{topLeft:ue,topRight:he,bottomRight:Ae,bottomLeft:we}=El(d.radius,R);Io({debug:e,context:L,x:X,y:w,width:x,height:$,radii:[ue,he,Ae,we],clip:!0})}if(ye==="box"&&(L.save(),L.fillStyle=B.background,L.fillRect(X,w,x,$),L.restore()),ye==="text"&&B.value){const{align:ue="left"}=B,he=Gr({text:B.value,font:B.font}),Ae=ll({font:he,scale:R,context:L,maxW:x,maxH:$,text:B.value??"",minSize:(b=B.fill)==null?void 0:b.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});L.font=he.replace(Hr,Ae.toString()),L.textBaseline="top",L.fillStyle=B.color,L.textAlign=ue;const we={left:X,center:X+x/2,right:X+x};B.wrap?$r({context:L,font:he,fontSize:Ae,text:B.value,maxW:x}).forEach((De,ke)=>{L.fillText(De.text,we[ue],w+Ae*ke)}):L.fillText(B.value,we[ue],w)}if(ye==="image"&&B.image&&L.drawImage(B.image,X,w,x,$),ye==="video"&&((K=B.video)!=null&&K.node||(M=B.video)!=null&&M.getSource)){const ue=B.format??"letterbox",he=((ie=(W=B.video)==null?void 0:W.getSource)==null?void 0:ie.call(W,l))??B.video.node,Ae=(he==null?void 0:he.videoWidth)??(he==null?void 0:he.naturalWidth)??(he==null?void 0:he.width),we=(he==null?void 0:he.videoHeight)??(he==null?void 0:he.naturalHeight)??(he==null?void 0:he.height);if(Ae&&we){const{dx:De,dy:ke,dw:Ue,dh:Le}=al({context:L,cropCanvas:i,letterboxCanvas:n,source:he,format:ue,crop:(ce=B==null?void 0:B.value)==null?void 0:ce.crop,sourceWidth:Ae,sourceHeight:we,posX:X,posY:w,drawAreaWidth:x,drawAreaHeight:$});B.elements&&mo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(w,w+ke),left:Math.max(X,X+De)},width:Math.min(x,Ue),height:Math.min($,Le)}})}const Oe=1/3;if(B.poster&&a>=0&&a<=Oe){L.save(),L.globalAlpha=1-a/Oe;const De=((ae=B.poster)==null?void 0:ae.naturalWidth)??((me=B.poster)==null?void 0:me.width),ke=((Be=B.poster)==null?void 0:Be.naturalHeight)??((xe=B.poster)==null?void 0:xe.height);r.width=r.height=0,r.width=x,r.height=$;const Ue=r.getContext("2d");if(Ue&&De&&ke){const{dx:Le,dy:Se,dw:Ve,dh:je}=al({context:Ue,cropCanvas:i,letterboxCanvas:n,source:B.poster,format:ue,crop:(re=B==null?void 0:B.value)==null?void 0:re.crop,sourceWidth:De,sourceHeight:ke,posX:0,posY:0,drawAreaWidth:x,drawAreaHeight:$});B.elements&&mo({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(0,Se),left:Math.max(0,Le)},width:Math.min(x,Ve),height:Math.min($,je)}}),L.drawImage(r,X,w,x,$),L.restore()}}}if(ye==="gradient"&&B.value){const ue=L.createLinearGradient(X+x,w,X+x,w+$);(Ce=B.value)==null||Ce.forEach(he=>{ue.addColorStop(he.percent,he.color)}),L.fillStyle=ue,L.fillRect(X,w,x,$)}}}}}}).filter(Boolean)}function mo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,...d}){return Ug({...d,yoga:s,debug:e,canvas:t,elements:ml({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u})})}const $r=Zn(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(Hr,t.toString()),i.split(`
68
+ `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...Al({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},Al({context:s,word:a[0],maxW:r})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{font:s,fontSize:e,text:t,maxW:i}])=>`${s}_${e}_${t}_${i}`}),Hg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,$g=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function Cl(s){if(!s)return[];const e=s.match(Hg);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
69
69
  `,`
70
70
  `).split(`
71
- `),[n,o]=i.match(Yg)||[];return{start:n,end:o,text:r}}):[]}function Vr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Kg({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){var a;if(o){const l=ml(o).find(({start:c,end:h})=>c&&h&&n>=Vr(c)&&n<Vr(h));if((a=l==null?void 0:l.text)!=null&&a.trim()){const c=s.getContext("2d");if(c){const h=Math.min(i,r),u=h*.04,d=$r({text:o,font:`400 ${u}px Roobert Captions`});c.font=d,c.textBaseline="middle";const g=i*.9,f=Kr({context:c,font:d,fontSize:u,text:l.text,maxW:g});f.forEach(({text:p,metrics:y},v)=>{const S=e+(i-y.width)/2,C=t+(r*.85-(u+h*.03)*(f.length-1-v)),Q=u*.8,B=u/1.5,_=e+(i-y.width-B)/2,L=C-Q,G=y.width+B,F=Q*2,U=c.globalAlpha;c.save(),c.globalAlpha=.8*U,c.fillStyle="#000000",c.beginPath(),Eo({context:c,x:_,y:L,width:G,height:F,radii:h*.01}),c.fill(),c.closePath(),c.globalAlpha=U,c.fillStyle="#FFFFFF",c.fillText(p,S,C),c.restore()})}}}}const Vg={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"3",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
71
+ `),[n,o]=i.match($g)||[];return{start:n,end:o,text:r}}):[]}function Yr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Yg({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){var a;if(o){const l=Cl(o).find(({start:c,end:h})=>c&&h&&n>=Yr(c)&&n<Yr(h));if((a=l==null?void 0:l.text)!=null&&a.trim()){const c=s.getContext("2d");if(c){const h=Math.min(i,r),u=h*.04,d=Gr({text:o,font:`400 ${u}px Roobert Captions`});c.font=d,c.textBaseline="middle";const g=i*.9,f=$r({context:c,font:d,fontSize:u,text:l.text,maxW:g});f.forEach(({text:p,metrics:y},v)=>{const S=e+(i-y.width)/2,C=t+(r*.85-(u+h*.03)*(f.length-1-v)),Q=u*.8,B=u/1.5,_=e+(i-y.width-B)/2,L=C-Q,G=y.width+B,F=Q*2,U=c.globalAlpha;c.save(),c.globalAlpha=.8*U,c.fillStyle="#000000",c.beginPath(),Io({context:c,x:_,y:L,width:G,height:F,radii:h*.01}),c.fill(),c.closePath(),c.globalAlpha=U,c.fillStyle="#FFFFFF",c.fillText(p,S,C),c.restore()})}}}}const Kg={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"3",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
72
72
  {
73
73
  "width": "100%",
74
74
  "height": "100%",
@@ -145,45 +145,45 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
145
145
  "src": {{ it._derived?.src }},
146
146
  "playlist": {{ it._derived?.playlist }},
147
147
  "captions": {{ it._derived?.captions }}
148
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},options:{videoFormat:"letterbox-video"},default:0,system:!0};async function Jg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Mu);return new s.Image}return new Image}const Cl=ui(async function(e){return e?new Promise((t,i)=>{Jg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function mo({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await Cl(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await Cl(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>mo({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>mo({element:l,meta:e},t,i)))),a}async function Jr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Mu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function zs(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=zs(t==null?void 0:t.elements);if(i)return i}}function Wg(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function qg(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function jg(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Wr(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}const Xg=ui(()=>sl.loadYoga());lo.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${jg(s)}"`:qg(s)||Array.isArray(s)?JSON.stringify(s):s);const os=(s,e,t)=>lo.render(s,e,lo.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function as({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=await Xg(),u=e??Vg;if(!((a=u.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${u.id}`);let d=u.templates.find(({version:L})=>L===Co);if(!d){const L=u.templates.map(({version:G})=>`"${G}"`).join(", ");console.warn(`Template renderer expects template version "${Co}" but got ${L}`),d=u.templates[u.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:L,root:G})=>{const F={...u.options,...s,intro:u.intro,outro:u.outro};async function U(q,V){return Promise.all(L.map(async({layout:X,duration:w,data:x,derived:$,options:R})=>{var b,T,K;const M={...F,_index:V,_root:q,_derived:await r({data:s,rootData:q,index:V})},W=x?JSON.parse(await os(x,M)):{},ie=$?JSON.parse(await os($,M)):{},ce=R?JSON.parse(await os(R,M)):{},ae=w?parseFloat(await os(w,M)):NaN,me=(b=d.layouts.find(ye=>ye.name===X))==null?void 0:b.tree;if(!me)throw new Error(`Layout tree "${X}" not found in template "${d.id}" layouts.`);const Be=JSON.parse(await os(me,{...W,...ie,...ce})),xe=await Promise.all(Be.flatMap(ye=>mo({element:ye,meta:u.meta},n,o))),re=zs(xe);return{duration:(isNaN(ae)?null:ae)??((T=re==null?void 0:re.meta)==null?void 0:T.duration)??0,captions:(K=re==null?void 0:re.meta)==null?void 0:K.captions,elements:xe}}))}if(G){const q=JSON.parse(await os(G,F));return Array.isArray(q)?(await Promise.all(q.map(async(V,X)=>U(V,X)))).flatMap(V=>V):U(q,null)}return U(s,null)}));if(g.every(L=>L.every(G=>{const F=zs(G.elements);return!(F!=null&&F.value.src)&&!(F!=null&&F.value.playlist)}))){const L=g.flatMap(G=>G.map(F=>{const U=zs(F.elements);return!(U!=null&&U.value.src)&&!(U!=null&&U.value.playlist)&&(U==null?void 0:U.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${L} failed to load, video can not be processed`)}if(g.every(L=>L.every(G=>G.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const y=g.reduce((L,G)=>{const F=G.filter(U=>U.duration>0);return F.length>0&&(L=[...L,F]),L},[]),v=((A=u.meta)==null?void 0:A.frameRate)??30,S=((l=u.meta)==null?void 0:l.resolution)??720,C=((c=u.meta)==null?void 0:c.transitionDuration)??1/3,Q=Wg(y,C),B=Wr(Q);return{scenes:(await Promise.all(y.map((L,G)=>{const F=Wr(Q[G]),U=Wr(Q.slice(0,G));return Promise.all(L.map(async({duration:q,captions:V,elements:X},w)=>{var x,$;const R=await Jr(),b=await Jr(),T=await Jr(),K=await Jr(),M=zs(X),W=Wr([...Q.slice(0,G),...Q[G].slice(0,w)]);return{draw:({canvas:ce,currentTime:ae})=>{const me=Math.max(0,ae-U),Be=Math.max(0,ae-W);Io({yoga:h,debug:i,canvas:ce,cropCanvas:R,posterCanvas:K,letterboxCanvas:b,elements:X,currentTime:ae,contentTime:me,sceneTime:Be,totalDuration:B,contentDuration:F,sceneDuration:q}),V&&t&&Kg({canvas:ce,dx:0,dy:0,dw:ce.width,dh:ce.height,vttCaptions:V,sceneTime:Be+((M==null?void 0:M.meta.start)??0)})},duration:q,transitionCanvas:T,start:W,video:M==null?void 0:M.video,videoMeta:M==null?void 0:M.meta,audio:{duration:q,src:(x=M==null?void 0:M.value)==null?void 0:x.src,start:($=M==null?void 0:M.meta)==null?void 0:$.start}}}))}))).flatMap(L=>L),frameRate:v,resolution:S,transitionDuration:C,fonts:d.fonts??[],duration:B}}const Co="3",zg={name:"@vouchfor/embeds",version:"2.0.14",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"^8.0.3","@vouchfor/media-player":"^3.0.14",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^1.0.8","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function Zg(s){const{publicApiUrl:e}=wr(s),t=Ui();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function ef(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:Ui()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=Ui();return e||(e=Zg(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Ui(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=Ui(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function tf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function sf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:zg.version,templateVersion:Co,...i}}const yl=1;class rf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=tf(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=wr(this.host.env),{client:i,tab:r,request:n,visitor:o}=ef(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":sf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+yl&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+yl&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var yo={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof _r<"u"&&_r,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(w){return w&&DataView.prototype.isPrototypeOf(w)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(w){return w&&c.indexOf(Object.prototype.toString.call(w))>-1};function u(w){if(typeof w!="string"&&(w=String(w)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(w)||w==="")throw new TypeError('Invalid character in header field name: "'+w+'"');return w.toLowerCase()}function d(w){return typeof w!="string"&&(w=String(w)),w}function g(w){var x={next:function(){var $=w.shift();return{done:$===void 0,value:$}}};return A.iterable&&(x[Symbol.iterator]=function(){return x}),x}function f(w){this.map={},w instanceof f?w.forEach(function(x,$){this.append($,x)},this):Array.isArray(w)?w.forEach(function(x){this.append(x[0],x[1])},this):w&&Object.getOwnPropertyNames(w).forEach(function(x){this.append(x,w[x])},this)}f.prototype.append=function(w,x){w=u(w),x=d(x);var $=this.map[w];this.map[w]=$?$+", "+x:x},f.prototype.delete=function(w){delete this.map[u(w)]},f.prototype.get=function(w){return w=u(w),this.has(w)?this.map[w]:null},f.prototype.has=function(w){return this.map.hasOwnProperty(u(w))},f.prototype.set=function(w,x){this.map[u(w)]=d(x)},f.prototype.forEach=function(w,x){for(var $ in this.map)this.map.hasOwnProperty($)&&w.call(x,this.map[$],$,this)},f.prototype.keys=function(){var w=[];return this.forEach(function(x,$){w.push($)}),g(w)},f.prototype.values=function(){var w=[];return this.forEach(function(x){w.push(x)}),g(w)},f.prototype.entries=function(){var w=[];return this.forEach(function(x,$){w.push([$,x])}),g(w)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(w){if(w.bodyUsed)return Promise.reject(new TypeError("Already read"));w.bodyUsed=!0}function y(w){return new Promise(function(x,$){w.onload=function(){x(w.result)},w.onerror=function(){$(w.error)}})}function v(w){var x=new FileReader,$=y(x);return x.readAsArrayBuffer(w),$}function S(w){var x=new FileReader,$=y(x);return x.readAsText(w),$}function C(w){for(var x=new Uint8Array(w),$=new Array(x.length),R=0;R<x.length;R++)$[R]=String.fromCharCode(x[R]);return $.join("")}function Q(w){if(w.slice)return w.slice(0);var x=new Uint8Array(w.byteLength);return x.set(new Uint8Array(w)),x.buffer}function B(){return this.bodyUsed=!1,this._initBody=function(w){this.bodyUsed=this.bodyUsed,this._bodyInit=w,w?typeof w=="string"?this._bodyText=w:A.blob&&Blob.prototype.isPrototypeOf(w)?this._bodyBlob=w:A.formData&&FormData.prototype.isPrototypeOf(w)?this._bodyFormData=w:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)?this._bodyText=w.toString():A.arrayBuffer&&A.blob&&l(w)?(this._bodyArrayBuffer=Q(w.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(w)||h(w))?this._bodyArrayBuffer=Q(w):this._bodyText=w=Object.prototype.toString.call(w):this._bodyText="",this.headers.get("content-type")||(typeof w=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var w=p(this);if(w)return w;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var w=p(this);return w||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var w=p(this);if(w)return w;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function L(w){var x=w.toUpperCase();return _.indexOf(x)>-1?x:w}function G(w,x){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var $=x.body;if(w instanceof G){if(w.bodyUsed)throw new TypeError("Already read");this.url=w.url,this.credentials=w.credentials,x.headers||(this.headers=new f(w.headers)),this.method=w.method,this.mode=w.mode,this.signal=w.signal,!$&&w._bodyInit!=null&&($=w._bodyInit,w.bodyUsed=!0)}else this.url=String(w);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new f(x.headers)),this.method=L(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&$)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody($),(this.method==="GET"||this.method==="HEAD")&&(x.cache==="no-store"||x.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}G.prototype.clone=function(){return new G(this,{body:this._bodyInit})};function F(w){var x=new FormData;return w.trim().split("&").forEach(function($){if($){var R=$.split("="),b=R.shift().replace(/\+/g," "),T=R.join("=").replace(/\+/g," ");x.append(decodeURIComponent(b),decodeURIComponent(T))}}),x}function U(w){var x=new f,$=w.replace(/\r?\n[\t ]+/g," ");return $.split("\r").map(function(R){return R.indexOf(`
149
- `)===0?R.substr(1,R.length):R}).forEach(function(R){var b=R.split(":"),T=b.shift().trim();if(T){var K=b.join(":").trim();x.append(T,K)}}),x}B.call(G.prototype);function q(w,x){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x||(x={}),this.type="default",this.status=x.status===void 0?200:x.status,this.ok=this.status>=200&&this.status<300,this.statusText=x.statusText===void 0?"":""+x.statusText,this.headers=new f(x.headers),this.url=x.url||"",this._initBody(w)}B.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},q.error=function(){var w=new q(null,{status:0,statusText:""});return w.type="error",w};var V=[301,302,303,307,308];q.redirect=function(w,x){if(V.indexOf(x)===-1)throw new RangeError("Invalid status code");return new q(null,{status:x,headers:{location:w}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(x,$){this.message=x,this.name=$;var R=Error(x);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(w,x){return new Promise(function($,R){var b=new G(w,x);if(b.signal&&b.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function K(){T.abort()}T.onload=function(){var W={status:T.status,statusText:T.statusText,headers:U(T.getAllResponseHeaders()||"")};W.url="responseURL"in T?T.responseURL:W.headers.get("X-Request-URL");var ie="response"in T?T.response:T.responseText;setTimeout(function(){$(new q(ie,W))},0)},T.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function M(W){try{return W===""&&a.location.href?a.location.href:W}catch{return W}}T.open(b.method,M(b.url),!0),b.credentials==="include"?T.withCredentials=!0:b.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&b.headers.get("Content-Type")&&b.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),x&&typeof x.headers=="object"&&!(x.headers instanceof f)?Object.getOwnPropertyNames(x.headers).forEach(function(W){T.setRequestHeader(W,d(x.headers[W]))}):b.headers.forEach(function(W,ie){T.setRequestHeader(ie,W)}),b.signal&&(b.signal.addEventListener("abort",K),T.onreadystatechange=function(){T.readyState===4&&b.signal.removeEventListener("abort",K)}),T.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return X.polyfill=!0,a.fetch||(a.fetch=X,a.Headers=f,a.Request=G,a.Response=q),o.Headers=f,o.Request=G,o.Response=q,o.fetch=X,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(yo,yo.exports);var nf=yo.exports;const vl=il(nf);async function of(s){var e;try{if((e=await vl(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Bl({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>of(o));e=(await Promise.all(n)).find(Boolean)}return e}async function af(s){try{return(await vl(s)).text()}catch{return null}}async function Af(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?af(s):s}const lf=ui(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},A=(r&&a[r])??s;return A?Af(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});async function cf(s){var e,t,i,r,n,o;const a=(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,A=(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,l=(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist;return{src:await Bl({sources:[a,A]}),playlist:await Bl({sources:[l]})}}function hf(s){var e,t,i,r,n,o,a,A,l,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",g=((A=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:A.name)==="Not Supplied"?"":((u=(h=(c=(l=s==null?void 0:s.answer)==null?void 0:l.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[f,p]=d.split(" ");return{name:d,firstName:f,lastName:p,companyName:g}}async function vo({rootData:s,index:e},t){var i,r,n,o,a,A,l,c,h,u,d,g,f,p;return{...hf(s),...await cf(s),key:`${s==null?void 0:s.id}-${e}`,captions:await lf({original:((r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.captions)??((o=(n=s==null?void 0:s.answer)==null?void 0:n.captions)==null?void 0:o.current),translation:((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.translation)??((c=(l=s==null?void 0:s.answer)==null?void 0:l.captions)==null?void 0:c.translation),originalLanguage:(u=(h=s==null?void 0:s.answer)==null?void 0:h.transcription)==null?void 0:u.language,translationLanguage:(f=(g=(d=s==null?void 0:s.answer)==null?void 0:d.transcription)==null?void 0:g.translation)==null?void 0:f.language},t),answerLabel:((p=s==null?void 0:s.answer)==null?void 0:p.label)??(s==null?void 0:s.title)}}const qr={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese (Simplified)",zh_TW:"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",fa:"Farsi",tl:"Filipino",ka:"Georgian",de:"German",el:"Greek",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",kk:"Kazakh",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",ml:"Malayalam",mt:"Maltese",mr:"Marathi",mn:"Mongolian",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",sr:"Serbian",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh"};function uf({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(l=(A=r==null?void 0:r.answer)==null?void 0:A.transcription)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&qr[u]&&!i.find(g=>g.value===u)&&i.push({value:u,label:qr[u]}),d&&qr[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:qr[d]}),i},[]))??[]}/**
148
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},options:{videoFormat:"letterbox-video"},default:0,system:!0};async function Vg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Nu);return new s.Image}return new Image}const yl=ui(async function(e){return e?new Promise((t,i)=>{Vg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Co({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await yl(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await yl(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Co({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Co({element:l,meta:e},t,i)))),a}async function Kr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Nu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function Xs(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Xs(t==null?void 0:t.elements);if(i)return i}}function Jg(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function Wg(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function qg(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function Vr(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}const jg=ui(()=>rl.loadYoga());co.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${qg(s)}"`:Wg(s)||Array.isArray(s)?JSON.stringify(s):s);const as=(s,e,t)=>co.render(s,e,co.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function As({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=await jg(),u=e??Kg;if(!((a=u.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${u.id}`);let d=u.templates.find(({version:L})=>L===yo);if(!d){const L=u.templates.map(({version:G})=>`"${G}"`).join(", ");console.warn(`Template renderer expects template version "${yo}" but got ${L}`),d=u.templates[u.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:L,root:G})=>{const F={...u.options,...s,intro:u.intro,outro:u.outro};async function U(q,V){return Promise.all(L.map(async({layout:X,duration:w,data:x,derived:$,options:R})=>{var b,T,K;const M={...F,_index:V,_root:q,_derived:await r({data:s,rootData:q,index:V})},W=x?JSON.parse(await as(x,M)):{},ie=$?JSON.parse(await as($,M)):{},ce=R?JSON.parse(await as(R,M)):{},ae=w?parseFloat(await as(w,M)):NaN,me=(b=d.layouts.find(ye=>ye.name===X))==null?void 0:b.tree;if(!me)throw new Error(`Layout tree "${X}" not found in template "${d.id}" layouts.`);const Be=JSON.parse(await as(me,{...W,...ie,...ce})),xe=await Promise.all(Be.flatMap(ye=>Co({element:ye,meta:u.meta},n,o))),re=Xs(xe);return{duration:(isNaN(ae)?null:ae)??((T=re==null?void 0:re.meta)==null?void 0:T.duration)??0,captions:(K=re==null?void 0:re.meta)==null?void 0:K.captions,elements:xe}}))}if(G){const q=JSON.parse(await as(G,F));return Array.isArray(q)?(await Promise.all(q.map(async(V,X)=>U(V,X)))).flatMap(V=>V):U(q,null)}return U(s,null)}));if(g.every(L=>L.every(G=>{const F=Xs(G.elements);return!(F!=null&&F.value.src)&&!(F!=null&&F.value.playlist)}))){const L=g.flatMap(G=>G.map(F=>{const U=Xs(F.elements);return!(U!=null&&U.value.src)&&!(U!=null&&U.value.playlist)&&(U==null?void 0:U.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${L} failed to load, video can not be processed`)}if(g.every(L=>L.every(G=>G.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const y=g.reduce((L,G)=>{const F=G.filter(U=>U.duration>0);return F.length>0&&(L=[...L,F]),L},[]),v=((A=u.meta)==null?void 0:A.frameRate)??30,S=((l=u.meta)==null?void 0:l.resolution)??720,C=((c=u.meta)==null?void 0:c.transitionDuration)??1/3,Q=Jg(y,C),B=Vr(Q);return{scenes:(await Promise.all(y.map((L,G)=>{const F=Vr(Q[G]),U=Vr(Q.slice(0,G));return Promise.all(L.map(async({duration:q,captions:V,elements:X},w)=>{var x,$;const R=await Kr(),b=await Kr(),T=await Kr(),K=await Kr(),M=Xs(X),W=Vr([...Q.slice(0,G),...Q[G].slice(0,w)]);return{draw:({canvas:ce,currentTime:ae})=>{const me=Math.max(0,ae-U),Be=Math.max(0,ae-W);mo({yoga:h,debug:i,canvas:ce,cropCanvas:R,posterCanvas:K,letterboxCanvas:b,elements:X,currentTime:ae,contentTime:me,sceneTime:Be,totalDuration:B,contentDuration:F,sceneDuration:q}),V&&t&&Yg({canvas:ce,dx:0,dy:0,dw:ce.width,dh:ce.height,vttCaptions:V,sceneTime:Be+((M==null?void 0:M.meta.start)??0)})},duration:q,transitionCanvas:T,start:W,video:M==null?void 0:M.video,videoMeta:M==null?void 0:M.meta,audio:{duration:q,src:(x=M==null?void 0:M.value)==null?void 0:x.src,start:($=M==null?void 0:M.meta)==null?void 0:$.start}}}))}))).flatMap(L=>L),frameRate:v,resolution:S,transitionDuration:C,fonts:d.fonts??[],duration:B}}const yo="3",Xg={name:"@vouchfor/embeds",version:"2.0.17",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"^8.0.4","@vouchfor/media-player":"^3.0.17",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"^1.0.9","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function zg(s){const{publicApiUrl:e}=Sr(s),t=Ui();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Zg(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:Ui()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=Ui();return e||(e=zg(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Ui(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=Ui(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function ef(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function tf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:Xg.version,templateVersion:yo,...i}}const vl=1;class sf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=ef(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=Sr(this.host.env),{client:i,tab:r,request:n,visitor:o}=Zg(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":tf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+vl&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+vl&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var vo={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Dr<"u"&&Dr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(w){return w&&DataView.prototype.isPrototypeOf(w)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(w){return w&&c.indexOf(Object.prototype.toString.call(w))>-1};function u(w){if(typeof w!="string"&&(w=String(w)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(w)||w==="")throw new TypeError('Invalid character in header field name: "'+w+'"');return w.toLowerCase()}function d(w){return typeof w!="string"&&(w=String(w)),w}function g(w){var x={next:function(){var $=w.shift();return{done:$===void 0,value:$}}};return A.iterable&&(x[Symbol.iterator]=function(){return x}),x}function f(w){this.map={},w instanceof f?w.forEach(function(x,$){this.append($,x)},this):Array.isArray(w)?w.forEach(function(x){this.append(x[0],x[1])},this):w&&Object.getOwnPropertyNames(w).forEach(function(x){this.append(x,w[x])},this)}f.prototype.append=function(w,x){w=u(w),x=d(x);var $=this.map[w];this.map[w]=$?$+", "+x:x},f.prototype.delete=function(w){delete this.map[u(w)]},f.prototype.get=function(w){return w=u(w),this.has(w)?this.map[w]:null},f.prototype.has=function(w){return this.map.hasOwnProperty(u(w))},f.prototype.set=function(w,x){this.map[u(w)]=d(x)},f.prototype.forEach=function(w,x){for(var $ in this.map)this.map.hasOwnProperty($)&&w.call(x,this.map[$],$,this)},f.prototype.keys=function(){var w=[];return this.forEach(function(x,$){w.push($)}),g(w)},f.prototype.values=function(){var w=[];return this.forEach(function(x){w.push(x)}),g(w)},f.prototype.entries=function(){var w=[];return this.forEach(function(x,$){w.push([$,x])}),g(w)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(w){if(w.bodyUsed)return Promise.reject(new TypeError("Already read"));w.bodyUsed=!0}function y(w){return new Promise(function(x,$){w.onload=function(){x(w.result)},w.onerror=function(){$(w.error)}})}function v(w){var x=new FileReader,$=y(x);return x.readAsArrayBuffer(w),$}function S(w){var x=new FileReader,$=y(x);return x.readAsText(w),$}function C(w){for(var x=new Uint8Array(w),$=new Array(x.length),R=0;R<x.length;R++)$[R]=String.fromCharCode(x[R]);return $.join("")}function Q(w){if(w.slice)return w.slice(0);var x=new Uint8Array(w.byteLength);return x.set(new Uint8Array(w)),x.buffer}function B(){return this.bodyUsed=!1,this._initBody=function(w){this.bodyUsed=this.bodyUsed,this._bodyInit=w,w?typeof w=="string"?this._bodyText=w:A.blob&&Blob.prototype.isPrototypeOf(w)?this._bodyBlob=w:A.formData&&FormData.prototype.isPrototypeOf(w)?this._bodyFormData=w:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)?this._bodyText=w.toString():A.arrayBuffer&&A.blob&&l(w)?(this._bodyArrayBuffer=Q(w.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(w)||h(w))?this._bodyArrayBuffer=Q(w):this._bodyText=w=Object.prototype.toString.call(w):this._bodyText="",this.headers.get("content-type")||(typeof w=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var w=p(this);if(w)return w;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var w=p(this);return w||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var w=p(this);if(w)return w;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(F)}),this.json=function(){return this.text().then(JSON.parse)},this}var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function L(w){var x=w.toUpperCase();return _.indexOf(x)>-1?x:w}function G(w,x){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var $=x.body;if(w instanceof G){if(w.bodyUsed)throw new TypeError("Already read");this.url=w.url,this.credentials=w.credentials,x.headers||(this.headers=new f(w.headers)),this.method=w.method,this.mode=w.mode,this.signal=w.signal,!$&&w._bodyInit!=null&&($=w._bodyInit,w.bodyUsed=!0)}else this.url=String(w);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new f(x.headers)),this.method=L(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&$)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody($),(this.method==="GET"||this.method==="HEAD")&&(x.cache==="no-store"||x.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}G.prototype.clone=function(){return new G(this,{body:this._bodyInit})};function F(w){var x=new FormData;return w.trim().split("&").forEach(function($){if($){var R=$.split("="),b=R.shift().replace(/\+/g," "),T=R.join("=").replace(/\+/g," ");x.append(decodeURIComponent(b),decodeURIComponent(T))}}),x}function U(w){var x=new f,$=w.replace(/\r?\n[\t ]+/g," ");return $.split("\r").map(function(R){return R.indexOf(`
149
+ `)===0?R.substr(1,R.length):R}).forEach(function(R){var b=R.split(":"),T=b.shift().trim();if(T){var K=b.join(":").trim();x.append(T,K)}}),x}B.call(G.prototype);function q(w,x){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x||(x={}),this.type="default",this.status=x.status===void 0?200:x.status,this.ok=this.status>=200&&this.status<300,this.statusText=x.statusText===void 0?"":""+x.statusText,this.headers=new f(x.headers),this.url=x.url||"",this._initBody(w)}B.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},q.error=function(){var w=new q(null,{status:0,statusText:""});return w.type="error",w};var V=[301,302,303,307,308];q.redirect=function(w,x){if(V.indexOf(x)===-1)throw new RangeError("Invalid status code");return new q(null,{status:x,headers:{location:w}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(x,$){this.message=x,this.name=$;var R=Error(x);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(w,x){return new Promise(function($,R){var b=new G(w,x);if(b.signal&&b.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function K(){T.abort()}T.onload=function(){var W={status:T.status,statusText:T.statusText,headers:U(T.getAllResponseHeaders()||"")};W.url="responseURL"in T?T.responseURL:W.headers.get("X-Request-URL");var ie="response"in T?T.response:T.responseText;setTimeout(function(){$(new q(ie,W))},0)},T.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function M(W){try{return W===""&&a.location.href?a.location.href:W}catch{return W}}T.open(b.method,M(b.url),!0),b.credentials==="include"?T.withCredentials=!0:b.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&b.headers.get("Content-Type")&&b.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),x&&typeof x.headers=="object"&&!(x.headers instanceof f)?Object.getOwnPropertyNames(x.headers).forEach(function(W){T.setRequestHeader(W,d(x.headers[W]))}):b.headers.forEach(function(W,ie){T.setRequestHeader(ie,W)}),b.signal&&(b.signal.addEventListener("abort",K),T.onreadystatechange=function(){T.readyState===4&&b.signal.removeEventListener("abort",K)}),T.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return X.polyfill=!0,a.fetch||(a.fetch=X,a.Headers=f,a.Request=G,a.Response=q),o.Headers=f,o.Request=G,o.Response=q,o.fetch=X,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(vo,vo.exports);var rf=vo.exports;const Bl=sl(rf);async function nf(s){var e;try{if((e=await Bl(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Ql({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>nf(o));e=(await Promise.all(n)).find(Boolean)}return e}async function of(s){try{return(await Bl(s)).text()}catch{return null}}async function af(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?of(s):s}const Af=ui(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},A=(r&&a[r])??s;return A?af(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});async function lf(s){var e,t,i,r,n,o;const a=(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,A=(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,l=(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist;return{src:await Ql({sources:[a,A]}),playlist:await Ql({sources:[l]})}}function cf(s){var e,t,i,r,n,o,a,A,l,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",g=((A=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:A.name)==="Not Supplied"?"":((u=(h=(c=(l=s==null?void 0:s.answer)==null?void 0:l.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[f,p]=d.split(" ");return{name:d,firstName:f,lastName:p,companyName:g}}async function Bo({rootData:s,index:e},t){var i,r,n,o,a,A,l,c,h,u,d,g,f,p;return{...cf(s),...await lf(s),key:`${s==null?void 0:s.id}-${e}`,captions:await Af({original:((r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.captions)??((o=(n=s==null?void 0:s.answer)==null?void 0:n.captions)==null?void 0:o.current),translation:((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.translation)??((c=(l=s==null?void 0:s.answer)==null?void 0:l.captions)==null?void 0:c.translation),originalLanguage:(u=(h=s==null?void 0:s.answer)==null?void 0:h.transcription)==null?void 0:u.language,translationLanguage:(f=(g=(d=s==null?void 0:s.answer)==null?void 0:d.transcription)==null?void 0:g.translation)==null?void 0:f.language},t),answerLabel:((p=s==null?void 0:s.answer)==null?void 0:p.label)??(s==null?void 0:s.title)}}const Jr={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese (Simplified)",zh_TW:"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",fa:"Farsi",tl:"Filipino",ka:"Georgian",de:"German",el:"Greek",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",kk:"Kazakh",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",ml:"Malayalam",mt:"Maltese",mr:"Marathi",mn:"Mongolian",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",sr:"Serbian",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh"};function hf({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(l=(A=r==null?void 0:r.answer)==null?void 0:A.transcription)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Jr[u]&&!i.find(g=>g.value===u)&&i.push({value:u,label:Jr[u]}),d&&Jr[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:Jr[d]}),i},[]))??[]}/**
150
150
  * @license
151
151
  * Copyright 2018 Google LLC
152
152
  * SPDX-License-Identifier: BSD-3-Clause
153
- */const Ye=ns(class extends $s{constructor(s){var e;if(super(s),s.type!==rs.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.nt)!=null&&i.has(n))&&this.st.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.st)n in e||(t.remove(n),this.st.delete(n));for(const n in e){const o=!!e[n];o===this.st.has(n)||(r=this.nt)!=null&&r.has(n)||(o?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return Pt}});/**
153
+ */const Ye=os(class extends Hs{constructor(s){var e;if(super(s),s.type!==ns.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.nt)!=null&&i.has(n))&&this.st.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.st)n in e||(t.remove(n),this.st.delete(n));for(const n in e){const o=!!e[n];o===this.st.has(n)||(r=this.nt)!=null&&r.has(n)||(o?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return Pt}});/**
154
154
  * @license
155
155
  * Copyright 2018 Google LLC
156
156
  * SPDX-License-Identifier: BSD-3-Clause
157
- */const Ql="important",df=" !"+Ql,Bo=ns(class extends $s{constructor(s){var e;if(super(s),s.type!==rs.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(df);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Ql:""):t[i]=r}}return Pt}});function gf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Sl={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse base URL.");return h.path=a.normalizePath(h.path),a.buildURLFromParts(h)}var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=a.normalizePath(u.path),a.buildURLFromParts(u)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(f.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)f.path=d.path,u.params||(f.params=d.params,u.query||(f.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(y)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(Sl);var Qo=Sl.exports;function bl(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function ot(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bl(Object(t),!0).forEach(function(i){Ef(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):bl(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function ff(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function pf(s){var e=ff(s,"string");return typeof e=="symbol"?e:String(e)}function Ef(s,e,t){return e=pf(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Ze(){return Ze=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},Ze.apply(this,arguments)}const oe=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},If=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=mf},mf=Number.MAX_SAFE_INTEGER||9007199254740991;let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),pe=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),H=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const Yi=function(){},So={trace:Yi,debug:Yi,log:Yi,warn:Yi,info:Yi,error:Yi};let Zs=So;function Cf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Yi}function yf(s,...e){e.forEach(function(t){Zs[t]=s[t]?s[t].bind(s):Cf(t)})}function vf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){yf(s,"debug","log","info","warn","error");try{Zs.log(`Debug logs enabled for "${e}" in hls.js version 1.5.7`)}catch{Zs=So}}else Zs=So}const N=Zs,Bf=/^(\d+)x(\d+)$/,wl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class We{constructor(e){typeof e=="string"&&(e=We.parseAttrList(e)),Ze(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 r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else 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]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Bf.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(wl.lastIndex=0;(t=wl.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function Qf(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function Sf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Rl{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){N.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=Ze(new We({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);oe(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(oe(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 isValid(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class jr{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 Fe={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class xl{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Fe.AUDIO]:null,[Fe.VIDEO]:null,[Fe.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Qo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class bo extends xl{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=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.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new jr,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 decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!oe(this.programDateTime))return null;const e=oe(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){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Fe.AUDIO]=null,e[Fe.VIDEO]=null,e[Fe.AUDIOVIDEO]=null}}class bf extends xl{constructor(e,t,i,r,n){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.stats=new jr,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.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)}}const wf=10;class Rf{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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,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,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?oe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||wf}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(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end: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 lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function wo(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function xf(s){const e=Ro(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Tf(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function Df(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=wo(o)):t=xf(o)}}return t}function Ro(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const As=typeof self<"u"?self:void 0;var Ke={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},St={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Tl(s){switch(s){case St.FAIRPLAY:return Ke.FAIRPLAY;case St.PLAYREADY:return Ke.PLAYREADY;case St.WIDEVINE:return Ke.WIDEVINE;case St.CLEARKEY:return Ke.CLEARKEY}}var Dl={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Lf(s){if(s===Dl.WIDEVINE)return Ke.WIDEVINE}function Ll(s){switch(s){case Ke.FAIRPLAY:return St.FAIRPLAY;case Ke.PLAYREADY:return St.PLAYREADY;case Ke.WIDEVINE:return St.WIDEVINE;case Ke.CLEARKEY:return St.CLEARKEY}}function xo(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ke.FAIRPLAY,Ke.WIDEVINE,Ke.PLAYREADY,Ke.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ke.WIDEVINE]&&t&&i.push(Ke.WIDEVINE),i}const _l=function(s){return As!=null&&(s=As.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function _f(s,e,t,i){let r;switch(s){case Ke.FAIRPLAY:r=["cenc","sinf"];break;case Ke.WIDEVINE:case Ke.PLAYREADY:r=["cenc"];break;case Ke.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return kf(r,e,t,i)}function kf(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Ki(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const To=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,kl=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,er=(s,e)=>{const t=e;let i=0;for(;To(s,e);){i+=10;const r=Xr(s,e+6);i+=r,kl(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},Xr=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},Ff=(s,e)=>To(s,e)&&Xr(s,e+6)+10<=s.length-e,Do=s=>{const e=Nl(s);for(let t=0;t<e.length;t++){const i=e[t];if(Fl(i))return Gf(i)}},Fl=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",Nf=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Xr(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},Nl=s=>{let e=0;const t=[];for(;To(s,e);){const i=Xr(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=Nf(s.subarray(e)),o=Mf(n);o&&t.push(o),e+=n.size+10}kl(s,e)&&(e+=10)}return t},Mf=s=>s.type==="PRIV"?Pf(s):s.type[0]==="W"?Uf(s):Of(s),Pf=s=>{if(s.size<2)return;const e=Wt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},Of=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Wt(s.data.subarray(t),!0);t+=i.length+1;const r=Wt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Wt(s.data.subarray(1));return{key:s.type,data:e}},Uf=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Wt(s.data.subarray(t),!0);t+=i.length+1;const r=Wt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Wt(s.data);return{key:s.type,data:e}},Gf=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.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)}},Wt=(s,e=!1)=>{const t=Hf();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let Lo;function Hf(){if(!navigator.userAgent.includes("PlayStation 4"))return!Lo&&typeof self.TextDecoder<"u"&&(Lo=new self.TextDecoder("utf-8")),Lo}const qt={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},zr=Math.pow(2,32)-1,$f=[].push,Ml={video:1,audio:2,id3:3,text:4};function nt(s){return String.fromCharCode.apply(null,s)}function Pl(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function de(s,e){const t=Ul(s,e);return t<0?4294967296+t:t}function Ol(s,e){let t=de(s,e);return t*=Math.pow(2,32),t+=de(s,e+4),t}function Ul(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function _o(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function Yf(s){const e=s.byteLength;for(let t=0;t<e;){const i=de(s,t);if(i>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ve(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=de(s,r),o=nt(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=ve(s.subarray(r+8,a),e.slice(1));A.length&&$f.apply(t,A)}r=a}return t}function Kf(s){const e=[],t=s[0];let i=8;const r=de(s,i);i+=4;let n=0,o=0;t===0?(n=de(s,i),o=de(s,i+4),i+=8):(n=Ol(s,i),o=Ol(s,i+8),i+=16),i+=2;let a=s.length+o;const A=Pl(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=de(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return N.warn("SIDX has hierarchical references (not supported)"),null;const g=de(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+u-1}}),a+=u,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function Gl(s){const e=[],t=ve(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=ve(n,["tkhd"])[0];if(o){let a=o[0];const A=de(o,a===0?12:20),l=ve(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=de(l,a===0?12:20),h=ve(n,["mdia","hdlr"])[0];if(h){const u=nt(h.subarray(8,12)),d={soun:Fe.AUDIO,vide:Fe.VIDEO}[u];if(d){const g=ve(n,["mdia","minf","stbl","stsd"])[0],f=Vf(g);e[A]={timescale:c,type:d},e[d]=ot({timescale:c,id:A},f)}}}}}return ve(s,["moov","mvex","trex"]).forEach(r=>{const n=de(r,4),o=e[n];o&&(o.default={duration:de(r,12),flags:de(r,20)})}),e}function Vf(s){const e=s.subarray(8),t=e.subarray(86),i=nt(e.subarray(4,8));let r=i;const n=i==="enca"||i==="encv";if(n){const a=ve(e,[i])[0].subarray(i==="enca"?28:78);ve(a,["sinf"]).forEach(l=>{const c=ve(l,["schm"])[0];if(c){const h=nt(c.subarray(4,8));if(h==="cbcs"||h==="cenc"){const u=ve(l,["frma"])[0];u&&(r=nt(u))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=ve(t,["avcC"])[0];r+="."+Zr(o[1])+Zr(o[2])+Zr(o[3]);break}case"mp4a":{const o=ve(e,[i])[0],a=ve(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=ko(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=ko(a,A);const c=a[A++];if(c===64)r+="."+Zr(c);else break;if(A+=12,a[A++]!==5)break;A=ko(a,A);const h=a[A++];let u=(h&248)>>3;u===31&&(u+=1+((h&7)<<3)+((a[A]&224)>>5)),r+="."+u}break}case"hvc1":case"hev1":{const o=ve(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=de(o,2),h=(a&32)>>5?"H":"L",u=o[12],d=o.subarray(6,12);r+="."+A+l,r+="."+c.toString(16).toUpperCase(),r+="."+h+u;let g="";for(let f=d.length;f--;){const p=d[f];(p||g)&&(g="."+p.toString(16).toUpperCase()+g)}r+=g;break}case"dvh1":case"dvhe":{const o=ve(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+jt(a)+"."+jt(A);break}case"vp09":{const o=ve(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+jt(a)+"."+jt(A)+"."+jt(l);break}case"av01":{const o=ve(t,["av1C"])[0],a=o[1]>>>5,A=o[1]&31,l=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,h=(o[2]&32)>>5,u=a===2&&c?h?12:10:c?10:8,d=(o[2]&16)>>4,g=(o[2]&8)>>3,f=(o[2]&4)>>2,p=o[2]&3;r+="."+a+"."+jt(A)+l+"."+jt(u)+"."+d+"."+g+f+p+"."+jt(1)+"."+jt(1)+"."+jt(1)+"."+0;break}}return{codec:r,encrypted:n}}function ko(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Zr(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function jt(s){return(s<10?"0":"")+s}function Jf(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ve(s,["moov","trak"]).forEach(r=>{const o=ve(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ve(o,["enca"]);const A=a.length>0;A||(a=ve(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);ve(c,["sinf"]).forEach(u=>{const d=Hl(u);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(N.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${qt.hexDump(g)} -> ${qt.hexDump(t)}`),d.set(t,8))}})})}),s}function Hl(s){const e=ve(s,["schm"])[0];if(e){const t=nt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ve(s,["schi","tenc"])[0]}return N.error("[eme] missing 'schm' box"),null}function Wf(s,e){return ve(e,["moof","traf"]).reduce((t,i)=>{const r=ve(i,["tfdt"])[0],n=r[0],o=ve(i,["tfhd"]).reduce((a,A)=>{const l=de(A,4),c=s[l];if(c){let h=de(r,4);if(n===1){if(h===zr)return N.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=zr+1,h+=de(r,8)}const u=c.timescale||9e4,d=h/u;if(oe(d)&&(a===null||d<a))return d}return a},null);return o!==null&&oe(o)&&(t===null||o<t)?o:t},null)}function qf(s,e){let t=0,i=0,r=0;const n=ve(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=ve(a,["tfhd"])[0],l=de(A,4),c=e[l];if(!c)continue;const h=c.default,u=de(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=de(A,12):d=de(A,8));const g=c.timescale||9e4,f=ve(a,["trun"]);for(let p=0;p<f.length;p++){if(t=jf(f[p]),!t&&d){const y=de(f[p],4);t=d*y}c.type===Fe.VIDEO?i+=t/g:c.type===Fe.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=ve(s,["sidx"]);for(let c=0;c<l.length;c++){const h=Kf(l[c]);if(h!=null&&h.references){o=Math.min(o,h.earliestPresentationTime/h.timescale);const u=h.references.reduce((d,g)=>d+g.info.duration||0,0);a=Math.max(a,u+h.earliestPresentationTime/h.timescale),A=a-o}}if(A&&oe(A))return A}return i||r}function jf(s){const e=de(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=de(s,4);for(let n=0;n<r;n++){if(e&256){const o=de(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Xf(s,e,t){ve(e,["moof","traf"]).forEach(i=>{ve(i,["tfhd"]).forEach(r=>{const n=de(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;ve(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let h=de(A,4);if(l===0)h-=c,h=Math.max(h,0),_o(A,4,h);else{h*=Math.pow(2,32),h+=de(A,8),h-=c,h=Math.max(h,0);const u=Math.floor(h/(zr+1)),d=Math.floor(h%(zr+1));_o(A,4,u),_o(A,8,d)}}})})})}function zf(s){const e={valid:null,remainder:null},t=ve(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=Ki(s,0,i.byteOffset-8),e.remainder=Ki(s,i.byteOffset-8),e}function Dt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function $l(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return ve(i,["moof"]).map(A=>{const l=A.byteOffset-8;ve(A,["traf"]).map(h=>{const u=ve(h,["tfdt"]).map(d=>{const g=d[0];let f=de(d,4);return g===1&&(f*=Math.pow(2,32),f+=de(d,8)),f/r})[0];return u!==void 0&&(s=u),ve(h,["tfhd"]).map(d=>{const g=de(d,4),f=de(d,0)&16777215,p=(f&1)!==0,y=(f&2)!==0,v=(f&8)!==0;let S=0;const C=(f&16)!==0;let Q=0;const B=(f&32)!==0;let _=8;g===n&&(p&&(_+=8),y&&(_+=4),v&&(S=de(d,_),_+=4),C&&(Q=de(d,_),_+=4),B&&(_+=4),e.type==="video"&&(o=Zf(e.codec)),ve(h,["trun"]).map(L=>{const G=L[0],F=de(L,0)&16777215,U=(F&1)!==0;let q=0;const V=(F&4)!==0,X=(F&256)!==0;let w=0;const x=(F&512)!==0;let $=0;const R=(F&1024)!==0,b=(F&2048)!==0;let T=0;const K=de(L,4);let M=8;U&&(q=de(L,M),M+=4),V&&(M+=4);let W=q+l;for(let ie=0;ie<K;ie++){if(X?(w=de(L,M),M+=4):w=S,x?($=de(L,M),M+=4):$=Q,R&&(M+=4),b&&(G===0?T=de(L,M):T=Ul(L,M),M+=4),e.type===Fe.VIDEO){let ce=0;for(;ce<$;){const ae=de(i,W);if(W+=4,e0(o,i[W])){const me=i.subarray(W,W+ae);Yl(me,o?2:1,s+T/r,t)}W+=ae,ce+=ae+4}}s+=w/r}}))})})}),t}function Zf(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function e0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Yl(s,e,t,i){const r=Kl(s);let n=0;n+=e;let o=0,a=0,A=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;A=r[n++],o+=A}while(A===255);a=0;do{if(n>=r.length)break;A=r[n++],a+=A}while(A===255);const l=r.length-n;let c=n;if(a<l)n+=a;else if(a>l){N.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(r[c++]===181){const u=Pl(r,c);if(c+=2,u===49){const d=de(r,c);if(c+=4,d===1195456820){const g=r[c++];if(g===3){const f=r[c++],p=31&f,y=64&f,v=y?2+p*3:0,S=new Uint8Array(v);if(y){S[0]=f;for(let C=1;C<v;C++)S[C]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:S})}}}}}else if(o===5&&a>16){const h=[];for(let g=0;g<16;g++){const f=r[c++].toString(16);h.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let g=0;g<u;g++)d[g]=r[c++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Wt(d),userDataBytes:d})}}}function Kl(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function t0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;nt(s.subarray(l,l+1))!=="\0";)t+=nt(s.subarray(l,l+1)),l+=1;for(t+=nt(s.subarray(l,l+1)),l+=1;nt(s.subarray(l,l+1))!=="\0";)i+=nt(s.subarray(l,l+1)),l+=1;i+=nt(s.subarray(l,l+1)),l+=1,r=de(s,12),n=de(s,16),a=de(s,20),A=de(s,24),l=28}else if(e===1){l+=4,r=de(s,l),l+=4;const h=de(s,l);l+=4;const u=de(s,l);for(l+=4,o=4294967296*h+u,If(o)||(o=Number.MAX_SAFE_INTEGER,N.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=de(s,l),l+=4,A=de(s,l),l+=4;nt(s.subarray(l,l+1))!=="\0";)t+=nt(s.subarray(l,l+1)),l+=1;for(t+=nt(s.subarray(l,l+1)),l+=1;nt(s.subarray(l,l+1))!=="\0";)i+=nt(s.subarray(l,l+1)),l+=1;i+=nt(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function i0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function s0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),i0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function r0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=qt.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let en={};class tr{static clearKeyUriToKeyIdMap(){en={}}constructor(e,t,i,r=[1],n=null){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=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case St.FAIRPLAY:case St.WIDEVINE:case St.PLAYREADY:case St.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&N.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=n0(e);return new tr(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Df(this.uri);if(t)switch(this.keyFormat){case St.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case St.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=s0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const h=wo(c).subarray(0,16);Tf(h),this.keyId=h}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=en[this.uri];if(!i){const r=Object.keys(en).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),en[this.uri]=i}this.keyId=i}return this}}function n0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Vl=/\{\$([a-zA-Z0-9-_]+)\}/g;function Jl(s){return Vl.test(s)}function bt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=Fo(s,n))}}function Fo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Vl,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function Wl(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function o0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function ls(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const tn={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,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 a0(s,e){const t=tn[e];return!!t&&!!t[s.slice(0,4)]}function No(s,e,t=!0){return!s.split(",").some(i=>!ql(i,e,t))}function ql(s,e,t=!0){var i;const r=ls(t);return(i=r==null?void 0:r.isTypeSupported(ir(s,e)))!=null?i:!1}function ir(s,e){return`${e}/mp4;codecs="${s}"`}function jl(s){if(s){const e=s.substring(0,4);return tn.video[e]}return 2}function sn(s){return s.split(",").reduce((e,t)=>{const i=tn.video[t];return i?(i*2+e)/(e?3:2):(tn.audio[t]+e)/(e?2:1)},0)}const Mo={};function A0(s,e=!0){if(Mo[s])return Mo[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(ql(t[i],"audio",e))return Mo[s]=t[i],t[i];return s}const l0=/flac|opus/i;function rn(s,e=!0){return s.replace(l0,t=>A0(t.toLowerCase(),e))}function Xl(s,e){return s&&s!=="mp4a"?s:e}function c0(s){const e=s.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return s}const zl=/#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,Zl=/#EXT-X-MEDIA:(.*)/g,h0=/^#EXT(?:INF|-X-TARGETDURATION):/m,ec=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),u0=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 Xt{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return Qo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return h0.test(e)}static parseMasterPlaylist(e,t){const i=Jl(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];zl.lastIndex=0;let o;for(;(o=zl.exec(e))!=null;)if(o[1]){var a;const l=new We(o[1]);bt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Fo(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:Xt.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),d0(l.CODECS,h),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new We(c);bt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=tc(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):N.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new We(c);bt(r,h,["NAME","VALUE","QUERYPARAM"]),Wl(r,h,t)}break}case"CONTENT-STEERING":{const h=new We(c);bt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:Xt.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=ic(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(Zl.lastIndex=0;(r=Zl.exec(e))!==null;){const l=new We(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,bt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=l.LANGUAGE,g=l["ASSOC-LANGUAGE"],f=l.CHANNELS,p=l.CHARACTERISTICS,y=l["INSTREAM-ID"],v={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?Xt.resolve(l.URI,t):""};if(g&&(v.assocLang=g),f&&(v.channels=f),p&&(v.characteristics=p),y&&(v.instreamId=y),h!=null&&h.length){const S=Xt.findGroup(h,v.groupId)||h[0];sc(v,S,"audioCodec"),sc(v,S,"textCodec")}u.push(v)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new Rf(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new bo(r,t),p,y,v,S=-1,C=!1,Q=null;for(ec.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Jl(e);(p=ec.exec(e))!==null;){C&&(C=!1,f=new bo(r,t),f.start=u,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null,Q&&(f.setByteRange(Q),Q=null)));const G=p[1];if(G){f.duration=parseFloat(G);const F=(" "+p[2]).slice(1);f.title=F||null,f.tagList.push(F?["INF",G,F]:["INF",G])}else if(p[3]){if(oe(f.duration)){f.start=u,v&&oc(f,v,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const F=(" "+p[3]).slice(1);f.relurl=Fo(a,F),rc(f,g),g=f,u+=f.duration,c++,h=0,C=!0}}else if(p[4]){const F=(" "+p[4]).slice(1);g?f.setByteRange(F,g):f.setByteRange(F)}else if(p[5])f.rawProgramDateTime=(" "+p[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),S===-1&&(S=A.length);else{if(p=p[0].match(u0),!p){N.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const F=(" "+p[y]).slice(1),U=(" "+p[y+1]).slice(1),q=p[y+2]?(" "+p[y+2]).slice(1):"";switch(F){case"PLAYLIST-TYPE":a.type=U.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(U);break;case"SKIP":{const V=new We(U);bt(a,V,["RECENTLY-REMOVED-DATERANGES"]);const X=V.decimalInteger("SKIPPED-SEGMENTS");if(oe(X)){a.skippedSegments=X;for(let x=X;x--;)A.unshift(null);c+=X}const w=V.enumeratedString("RECENTLY-REMOVED-DATERANGES");w&&(a.recentlyRemovedDateranges=w.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(U),1);break;case"VERSION":a.version=parseInt(U);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(U||q)&&f.tagList.push(q?[U,q]:[U]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([F]);break;case"BITRATE":f.tagList.push([F,U]);break;case"DATERANGE":{const V=new We(U);bt(a,V,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),bt(a,V,V.clientAttrs);const X=new Rl(V,a.dateRanges[V.ID]);X.isValid||a.skippedSegments?a.dateRanges[X.id]=X:N.warn(`Ignoring invalid DATERANGE tag: "${U}"`),f.tagList.push(["EXT-X-DATERANGE",U]);break}case"DEFINE":{{const V=new We(U);bt(a,V,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in V?o0(a,V,o):Wl(a,V,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(U);break;case"KEY":{const V=tc(U,t,a);if(V.isSupported()){if(V.method==="NONE"){v=void 0;break}v||(v={}),v[V.keyFormat]&&(v=Ze({},v)),v[V.keyFormat]=V}else N.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${U}"`);break}case"START":a.startTimeOffset=ic(U);break;case"MAP":{const V=new We(U);if(bt(a,V,["BYTERANGE","URI"]),f.duration){const X=new bo(r,t);nc(X,V,i,v),l=X,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else{const X=f.byteRangeEndOffset;if(X){const w=f.byteRangeStartOffset;Q=`${X-w}@${w}`}else Q=null;nc(f,V,i,v),l=f,C=!0}break}case"SERVER-CONTROL":{const V=new We(U);a.canBlockReload=V.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=V.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&V.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=V.optionalFloat("PART-HOLD-BACK",0),a.holdBack=V.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const V=new We(U);a.partTarget=V.decimalFloatingPoint("PART-TARGET");break}case"PART":{let V=a.partList;V||(V=a.partList=[]);const X=h>0?V[V.length-1]:void 0,w=h++,x=new We(U);bt(a,x,["BYTERANGE","URI"]);const $=new bf(x,f,t,w,X);V.push($),f.duration+=$.duration;break}case"PRELOAD-HINT":{const V=new We(U);bt(a,V,["URI"]),a.preloadHint=V;break}case"RENDITION-REPORT":{const V=new We(U);bt(a,V,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(V);break}default:N.warn(`line parsed but not handled: ${p}`);break}}}g&&!g.relurl?(A.pop(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(rc(f,g),f.cc=d,a.fragmentHint=f,v&&oc(f,v,a));const B=A.length,_=A[0],L=A[B-1];if(u+=a.skippedSegments*a.targetduration,u>0&&B&&L){a.averagetargetduration=u/B;const G=L.sn;a.endSN=G!=="initSegment"?G:0,a.live||(L.endList=!0),_&&(a.startCC=_.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,S>0&&g0(A,S),a}}function tc(s,e,t){var i,r;const n=new We(s);bt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&N.error(`Invalid IV: ${n.IV}`);const h=a?Xt.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new tr(o,h,c,u,A)}function ic(s){const t=new We(s).decimalFloatingPoint("TIME-OFFSET");return oe(t)?t:null}function d0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>a0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function sc(s,e,t){const i=e[t];i&&(s[t]=i)}function g0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function rc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),oe(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function nc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function oc(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var Te={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},fe={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function ac(s){const{type:e}=s;switch(e){case Te.AUDIO_TRACK:return fe.AUDIO;case Te.SUBTITLE_TRACK:return fe.SUBTITLE;default:return fe.MAIN}}function Po(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class f0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}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:Te.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:o,deliveryDirectives:a}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:Te.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Te.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Te.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url&&l.level===e.level){N.trace("[playlist-loader]: playlist request ongoing");return}N.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===Te.MANIFEST?n=i.manifestLoadPolicy.default:n=Ze({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),oe((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===Te.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===Te.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===Te.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,h=l.targetduration;if(c&&h){const u=Math.max(c*3,h*.8)*1e3;n=Ze({},n,{maxTimeToFirstByteMs:Math.min(u,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,h,u)=>{const d=this.getInternalLoader(h);this.resetInternalLoader(h.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),Xt.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,h,u||null,d):this.handleMasterPlaylist(l,c,h,u)},onError:(l,c,h,u)=>{this.handleNetworkError(c,h,!1,l,u)},onTimeout:(l,c,h)=>{this.handleNetworkError(c,h,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Po(e,i),A=Xt.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=Xt.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(S=>!S.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(N.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new We({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:p,captions:y,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Po(e,i),h=0,u=oe(A)?A:oe(a)?a:0,d=ac(i),g=Xt.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===Te.MANIFEST){const f={attrs:new We({}),bitrate:0,details:g,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:pe.NETWORK_ERROR,details:H.MANIFEST_PARSING_ERROR,fatal:t.type===Te.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Te.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Te.AUDIO_TRACK||e.type===Te.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);N.warn(`[playlist-loader]: ${o}`);let A=H.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case Te.MANIFEST:A=i?H.MANIFEST_LOAD_TIMEOUT:H.MANIFEST_LOAD_ERROR,l=!0;break;case Te.LEVEL:A=i?H.LEVEL_LOAD_TIMEOUT:H.LEVEL_LOAD_ERROR,l=!1;break;case Te.AUDIO_TRACK:A=i?H.AUDIO_TRACK_LOAD_TIMEOUT:H.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Te.SUBTITLE_TRACK:A=i?H.SUBTITLE_TRACK_LOAD_TIMEOUT:H.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:pe.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=(t==null?void 0:t.url)||e.url;h.response=ot({url:u,data:void 0},r)}this.hls.trigger(E.ERROR,h)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:h,deliveryDirectives:u}=r,d=Po(t,r),g=ac(r),f=typeof r.level=="number"&&g===fe.MAIN?l:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:pe.NETWORK_ERROR,details:H.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(E.ERROR,{type:pe.NETWORK_ERROR,details:H.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case Te.MANIFEST:case Te.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case Te.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case Te.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function Ac(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function lc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){N.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){N.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function cs(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function Oo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=E0(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function p0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function E0(s,e,t){const i=[],r=p0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}function nn(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}var Ot={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const I0=.25;function Uo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function cc(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?ot({type:r},i):i))}return n}const on=(()=>{const s=Uo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Go(s,e){return s.getTime()/1e3-e}function m0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class C0{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(cs(this.id3Track),this.id3Track=null,this.media=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 Ac(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Uo();if(o)for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Ot.emsg&&!i||!r)continue;const l=Nl(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>on&&(h=on),h-c<=0&&(h=c+I0);for(let d=0;d<l.length;d++){const g=l[d];if(!Fl(g)){this.updateId3CueEnds(c,A);const f=cc(o,c,h,g,A);f&&this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===on&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Ot.audioId3&&A:r==="video"?l=c=>c.type===Ot.emsg&&a:l=c=>c.type===Ot.audioId3&&A||c.type===Ot.emsg&&a,Oo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!oe(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Uo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=Go(u.startDate,A),g=i[h],f=(g==null?void 0:g.cues)||{};let p=(g==null?void 0:g.durationKnown)||!1,y=on;const v=u.endDate;if(v)y=Go(v,A),p=!0;else if(u.endOnNext&&!p){const C=o.reduce((Q,B)=>{if(B!==u.id){const _=n[B];if(_.class===u.class&&_.startDate>u.startDate&&(!Q||u.startDate<Q.startDate))return _}return Q},null);C&&(y=Go(C.startDate,A),p=!0)}const S=Object.keys(u.attr);for(let C=0;C<S.length;C++){const Q=S[C];if(!Qf(Q))continue;const B=f[Q];if(B)p&&!g.durationKnown&&(B.endTime=y);else if(l){let _=u.attr[Q];Sf(Q)&&(_=m0(_));const L=cc(l,d,y,{key:Q,data:_},Ot.dateRange);L&&(L.id=h,this.id3Track.addCue(L),f[Q]=L)}}i[h]={cues:f,dateRange:u,durationKnown:p}}}}class y0{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r;return l+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;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,levelDetails:t}=this;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.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===H.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&N.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration);if(a<A&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const Ho=["NONE","TYPE-0","TYPE-1",null];function v0(s){return Ho.indexOf(s)>-1}const an=["SDR","PQ","HLG"];function B0(s){return!!s&&an.indexOf(s)>-1}var sr={No:"",Yes:"YES",v2:"v2"};function Q0(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?sr.v2:sr.Yes:sr.No}class hc{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 hs{constructor(e){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.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(t=>!!t).map(t=>t.substring(0,4)).join(","),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 uc(this._audioGroups,e)}hasSubtitleGroup(e){return uc(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 uc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function $o(s,e){const t=e.startPTS;if(oe(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function dc(s,e,t,i,r,n){i-t<=0&&(N.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(oe(l)){const p=Math.abs(l-t);oe(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const h=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const u=e.sn;if(!s||u<s.startSN||u>s.endSN)return 0;let d;const g=u-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)$o(f[d],f[d-1]);for(d=g;d<f.length-1;d++)$o(f[d],f[d+1]);return s.fragmentHint&&$o(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function S0(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(R0(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),oe(A.startPTS)&&oe(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;l&&(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){N.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=b0(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){N.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),w0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?dc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):gc(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function b0(s,e,t){const i=Ze({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Rl(e[r].attr,i[r]);n.isValid?i[r]=n:N.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function w0(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function R0(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let h=a[l];i&&!h&&l<i&&(h=e.fragments[l]=c),c&&h&&t(c,h)}}function gc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||Yo(e,i[t].start)}function Yo(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function x0(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function T0(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function fc(s,e,t){var i;return s!=null&&s.details?pc((i=s.details)==null?void 0:i.partList,e,t):null}function pc(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function Ec(s){s.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(r=>{r.level=t})})}function An(s){switch(s.details){case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_TIMEOUT:case H.LEVEL_LOAD_TIMEOUT:case H.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ic(s,e){const t=An(e);return s.default[`${t?"timeout":"error"}Retry`]}function Ko(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function mc(s){return ot(ot({},s),{errorRetry:null,timeoutRetry:null})}function ln(s,e,t,i){if(!s)return!1;const r=i==null?void 0:i.code,n=e<s.maxNumRetry&&(D0(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function D0(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Cc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function L0(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!oe(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(_0(e,t,o))return o}return null}function cn(s,e,t=0,i=0){let r=null;if(s){r=e[s.sn-e[0].sn+1]||null;const o=s.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&(!s||s.level===r.level)&&Vo(t,i,r)===0)return r;const n=Cc.search(e,Vo.bind(null,t,i));return n&&(n!==s||!r)?n:r}function Vo(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function _0(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function k0(s,e){return Cc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var dt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ut={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class F0{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=N.log.bind(N,"[info]:"),this.warn=N.warn.bind(N,"[warning]:"),this.error=N.error.bind(N,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===fe.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case H.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:dt.DoNothing,flags:Ut.None};return}case H.FRAG_GAP:case H.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=dt.SendAlternateToPenaltyBox;return}case H.LEVEL_EMPTY_ERROR:case H.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===fe.MAIN?t.level:n.loadLevel;t.details===H.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 H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.SUBTITLE_LOAD_ERROR:case H.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===Te.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===Te.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=dt.SendAlternateToPenaltyBox,t.errorAction.flags=Ut.MoveAllAlternatesMatchingHost;return}}return;case H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c?t.errorAction={action:dt.SendAlternateToPenaltyBox,flags:Ut.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case H.BUFFER_ADD_CODEC_ERROR:case H.REMUX_ALLOC_ERROR:case H.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case H.INTERNAL_EXCEPTION:case H.BUFFER_APPENDING_ERROR:case H.BUFFER_FULL_ERROR:case H.LEVEL_SWITCH_ERROR:case H.BUFFER_STALLED_ERROR:case H.BUFFER_SEEK_OVER_HOLE:case H.BUFFER_NUDGE_ON_STALL:t.errorAction={action:dt.DoNothing,flags:Ut.None};return}t.type===pe.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Ic(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(ln(r,n,An(e),e.response))return{action:dt.RetryRequest,flags:Ut.None,retryConfig:r,retryCount:n};const a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=Ic(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,h)=>c+h.fragmentError,0);if(r&&(e.details!==H.FRAG_GAP&&r.fragmentError++,ln(a,A,An(e),e.response)))return{action:dt.RetryRequest,flags:Ut.None,retryConfig:a,retryCount:A};const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=A),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,o;const l=e.details;r.loadError++,l===H.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:h,loadLevel:u,minAutoLevel:d,maxAutoLevel:g}=i;i.autoLevelEnabled||(i.loadLevel=-1);const f=(n=e.frag)==null?void 0:n.type,y=(f===fe.AUDIO&&l===H.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:B})=>r.audioCodec!==B),S=e.sourceBufferName==="video"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR)&&h.some(({codecSet:B,audioCodec:_})=>r.codecSet!==B&&r.audioCodec===_),{type:C,groupId:Q}=(o=e.context)!=null?o:{};for(let B=h.length;B--;){const _=(B+u)%h.length;if(_!==u&&_>=d&&_<=g&&h[_].loadError===0){var a,A;const L=h[_];if(l===H.FRAG_GAP&&e.frag){const G=h[_].details;if(G){const F=cn(e.frag,G.fragments,e.frag.start);if(F!=null&&F.gap)continue}}else{if(C===Te.AUDIO_TRACK&&L.hasAudioGroup(Q)||C===Te.SUBTITLE_TRACK&&L.hasSubtitleGroup(Q))continue;if(f===fe.AUDIO&&(a=r.audioGroups)!=null&&a.some(G=>L.hasAudioGroup(G))||f===fe.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(G=>L.hasSubtitleGroup(G))||y&&r.audioCodec===L.audioCodec||!y&&r.audioCodec!==L.audioCodec||S&&r.codecSet===L.codecSet)continue}c=_;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:dt.SendAlternateToPenaltyBox,flags:Ut.None,nextAutoLevel:c}}return{action:dt.SendAlternateToPenaltyBox,flags:Ut.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case dt.DoNothing:break;case dt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==H.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Ut.None:this.switchLevel(e,o);break;case Ut.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=Ho[Ho.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){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)}}class Jo{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=N.log.bind(N,`${t}:`),this.warn=N.warn.bind(N,`${t}:`),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.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const o=i[n];let a;try{a=new self.URL(o.URI,t.url).href}catch(A){N.warn(`Could not construct new URL for Rendition Report: ${A}`),a=o.URI||""}if(a===e){r=n;break}else a===e.substring(0,a.length)&&(r=n)}if(r!==-1){const n=i[r],o=parseInt(n["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let a=parseInt(n["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const A=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&A>t.partTarget&&(a+=1)}return new hc(o,a>=0?a:void 0,sr.No)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&S0(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const p=this.hls.config.lowLatencyMode,y=r.lastPartSn,v=r.endSN,S=r.lastPartIndex,C=S!==-1,Q=y===v,B=p?0:S;C?(l=Q?v+1:y,c=Q?B:S+1):l=v+1;const _=r.age,L=_+r.ageHeader;let G=Math.min(L-r.partTarget,r.targetduration*1.5);if(G>0){if(i&&G>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${G} with playlist age: ${r.age}`),G=0;else{const F=Math.floor(G/r.targetduration);if(l+=F,c!==void 0){const U=Math.round(G%r.targetduration/r.partTarget);c+=U}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${_.toFixed(2)}s goal: ${G} skip sn ${F} to part ${c}`)}r.tuneInGoal=G}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!Q){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const h=this.hls.mainForwardBufferInfo,u=h?h.end-h.len:0,d=(r.edge-u)*1e3,g=x0(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=Q0(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=sr.No),new hc(i,r,n)}checkRetry(e){const t=e.details,i=An(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===dt.RetryRequest||!r.resolved&&n===dt.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=Ko(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}class us{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}getTotalWeight(){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 N0{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new us(e),this.fast_=new us(t),this.defaultTTFB_=r,this.ttfb_=new us(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new us(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new us(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new us(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}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_}destroy(){}}const yc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},vc={};function M0(s,e,t,i,r,n){const o=s.audioCodec?s.audioGroups:null,a=n==null?void 0:n.audioCodec,A=n==null?void 0:n.channels,l=A?parseInt(A):a?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,u)=>{if(u){const d=e.groups[u];if(!d)throw new Error(`Audio track group ${u} not found`);Object.keys(d.channels).forEach(g=>{h[g]=(h[g]||0)+d.channels[g]})}return h},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(r,8e6))||!!c&&oe(l)&&Object.keys(c).some(h=>parseInt(h)>l)}function P0(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(yc);const n={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},o=s.videoRange;o!=="SDR"&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map(A=>({type:"media-source",video:ot(ot({},n),{},{contentType:ir(A,"video")})}));return r&&s.audioGroups&&s.audioGroups.forEach(A=>{var l;A&&((l=e.groups[A])==null||l.tracks.forEach(c=>{if(c.groupId===A){const h=c.channels||"",u=parseFloat(h);oe(u)&&u>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:ir(d,"audio"),channels:""+u}})))}}))}),Promise.all(a.map(A=>{const l=O0(A);return vc[l]||(vc[l]=t.decodingInfo(A))})).then(A=>({supported:!A.some(l=>!l.supported),configurations:a,decodingInfoResults:A})).catch(A=>({supported:!1,configurations:a,decodingInfoResults:[],error:A}))}function O0(s){const{audio:e,video:t}=s,i=t||e;if(i){const r=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function U0(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function G0(s,e){let t=!1,i=[];return s&&(t=s!=="SDR",i=[s]),e&&(i=e.allowedVideoRanges||an.slice(0),t=e.preferHDR!==void 0?e.preferHDR:U0(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function H0(s,e,t,i,r){const n=Object.keys(s),o=i==null?void 0:i.channels,a=i==null?void 0:i.audioCodec,A=o&&parseInt(o)===2;let l=!0,c=!1,h=1/0,u=1/0,d=1/0,g=0,f=[];const{preferHDR:p,allowedVideoRanges:y}=G0(e,r);for(let Q=n.length;Q--;){const B=s[n[Q]];l=B.channels[2]>0,h=Math.min(h,B.minHeight),u=Math.min(u,B.minFramerate),d=Math.min(d,B.minBitrate);const _=y.filter(L=>B.videoRanges[L]>0);_.length>0&&(c=!0,f=_)}h=oe(h)?h:0,u=oe(u)?u:0;const v=Math.max(1080,h),S=Math.max(30,u);return d=oe(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((Q,B)=>{const _=s[B];if(B===Q)return Q;if(_.minBitrate>t)return fi(B,`min bitrate of ${_.minBitrate} > current estimate of ${t}`),Q;if(!_.hasDefaultAudio)return fi(B,"no renditions with default or auto-select sound found"),Q;if(a&&B.indexOf(a.substring(0,4))%5!==0)return fi(B,`audio codec preference "${a}" not found`),Q;if(o&&!A){if(!_.channels[o])return fi(B,`no renditions with ${o} channel sound found (channels options: ${Object.keys(_.channels)})`),Q}else if((!a||A)&&l&&_.channels[2]===0)return fi(B,"no renditions with stereo sound found"),Q;return _.minHeight>v?(fi(B,`min resolution of ${_.minHeight} > maximum of ${v}`),Q):_.minFramerate>S?(fi(B,`min framerate of ${_.minFramerate} > maximum of ${S}`),Q):f.some(L=>_.videoRanges[L]>0)?_.maxScore<g?(fi(B,`max score of ${_.maxScore} < selected max of ${g}`),Q):Q&&(sn(B)>=sn(Q)||_.fragmentError>s[Q].fragmentError)?Q:(g=_.maxScore,B):(fi(B,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),Q)},void 0),videoRanges:f,preferHDR:p,minFramerate:u,minBitrate:d}}function fi(s,e){N.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function $0(s){return s.reduce((e,t)=>{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 r=t.channels||"2";return i.channels[r]=(i.channels[r]||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 Y0(s,e,t,i){return s.slice(t,i+1).reduce((r,n)=>{if(!n.codecSet)return r;const o=n.audioGroups;let a=r[n.codecSet];a||(r[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);const A=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,A),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,o&&o.forEach(l=>{if(!l)return;const c=e.groups[l];a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{a.channels[h]=(a.channels[h]||0)+c.channels[h]})}),r},{})}function zt(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(ds(s,r,t))return i}return-1}function ds(s,e,t){const{groupId:i,name:r,lang:n,assocLang:o,characteristics:a,default:A}=s,l=s.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===o)&&(A===void 0||e.default===A)&&(l===void 0||e.forced===l)&&(a===void 0||K0(a,e.characteristics))&&(t===void 0||t(s,e))}function K0(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function gs(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function V0(s,e,t,i,r){const n=e[i],a=e.reduce((u,d,g)=>{const f=d.uri;return(u[f]||(u[f]=[])).push(g),u},{})[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const A=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),h=Bc(e,i,u=>{if(u.videoRange!==A||u.frameRate!==l||u.codecSet.substring(0,4)!==c)return!1;const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return zt(s,g,r)>-1});return h>-1?h:Bc(e,i,u=>{const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return zt(s,g,r)>-1})}function Bc(s,e,t){for(let i=e;i;i--)if(t(s[i]))return i;for(let i=e+1;i<s.length;i++)if(t(s[i]))return i;return-1}class J0{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:n,media:o}=r;if(!t||!o)return;const a=performance.now(),A=i?i.stats:t.stats,l=i?i.duration:t.duration,c=a-A.loading.start,h=r.minAutoLevel;if(A.aborted||A.loaded&&A.loaded===A.total||t.level<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||o.paused||!o.playbackRate||!o.readyState)return;const u=r.mainForwardBufferInfo;if(u===null)return;const d=this.bwEstimator.getEstimateTTFB(),g=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(l/(g*2))))return;const f=u.len/g,p=A.loading.first?A.loading.first-A.loading.start:-1,y=A.loaded&&p>-1,v=this.getBwEstimate(),S=r.levels,C=S[t.level],Q=A.total||Math.max(A.loaded,Math.round(l*C.averageBitrate/8));let B=y?c-p:c;B<1&&y&&(B=Math.min(c,A.loaded*8/v));const _=y?A.loaded*1e3/B:0,L=_?(Q-A.loaded)/_:Q*8/v+d/1e3;if(L<=f)return;const G=_?_*8:v;let F=Number.POSITIVE_INFINITY,U;for(U=t.level-1;U>h;U--){const V=S[U].maxBitrate;if(F=this.getTimeToLoadFrag(d/1e3,G,l*V,!S[U].details),F<f)break}if(F>=L||F>l*10)return;r.nextLoadLevel=r.nextAutoLevel=U,y?this.bwEstimator.sample(c-Math.min(d,p),A.loaded):this.bwEstimator.sampleTTFB(c);const q=S[U].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>q&&this.resetEstimator(q),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
157
+ */const Sl="important",uf=" !"+Sl,Qo=os(class extends Hs{constructor(s){var e;if(super(s),s.type!==ns.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(uf);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Sl:""):t[i]=r}}return Pt}});function df(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var bl={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse base URL.");return h.path=a.normalizePath(h.path),a.buildURLFromParts(h)}var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=a.normalizePath(u.path),a.buildURLFromParts(u)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(f.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)f.path=d.path,u.params||(f.params=d.params,u.query||(f.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(y)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(bl);var So=bl.exports;function wl(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function ot(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wl(Object(t),!0).forEach(function(i){pf(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):wl(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function gf(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function ff(s){var e=gf(s,"string");return typeof e=="symbol"?e:String(e)}function pf(s,e,t){return e=ff(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Ze(){return Ze=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},Ze.apply(this,arguments)}const oe=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Ef=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=If},If=Number.MAX_SAFE_INTEGER||9007199254740991;let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),Ee=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),H=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const Yi=function(){},bo={trace:Yi,debug:Yi,log:Yi,warn:Yi,info:Yi,error:Yi};let zs=bo;function mf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Yi}function Cf(s,...e){e.forEach(function(t){zs[t]=s[t]?s[t].bind(s):mf(t)})}function yf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){Cf(s,"debug","log","info","warn","error");try{zs.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{zs=bo}}else zs=bo}const N=zs,vf=/^(\d+)x(\d+)$/,Rl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class We{constructor(e){typeof e=="string"&&(e=We.parseAttrList(e)),Ze(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 r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else 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]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=vf.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(Rl.lastIndex=0;(t=Rl.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function Bf(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function Qf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class xl{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){N.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=Ze(new We({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);oe(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(oe(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 isValid(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Wr{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 Fe={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Tl{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Fe.AUDIO]:null,[Fe.VIDEO]:null,[Fe.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=So.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class wo extends Tl{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=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.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Wr,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 decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!oe(this.programDateTime))return null;const e=oe(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){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Fe.AUDIO]=null,e[Fe.VIDEO]=null,e[Fe.AUDIOVIDEO]=null}}class Sf extends Tl{constructor(e,t,i,r,n){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.stats=new Wr,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.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)}}const bf=10;class wf{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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,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,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?oe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||bf}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(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end: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 lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Ro(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Rf(s){const e=xo(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function xf(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function Tf(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=Ro(o)):t=Rf(o)}}return t}function xo(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const ls=typeof self<"u"?self:void 0;var Ke={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},St={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Dl(s){switch(s){case St.FAIRPLAY:return Ke.FAIRPLAY;case St.PLAYREADY:return Ke.PLAYREADY;case St.WIDEVINE:return Ke.WIDEVINE;case St.CLEARKEY:return Ke.CLEARKEY}}var Ll={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Df(s){if(s===Ll.WIDEVINE)return Ke.WIDEVINE}function _l(s){switch(s){case Ke.FAIRPLAY:return St.FAIRPLAY;case Ke.PLAYREADY:return St.PLAYREADY;case Ke.WIDEVINE:return St.WIDEVINE;case Ke.CLEARKEY:return St.CLEARKEY}}function To(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ke.FAIRPLAY,Ke.WIDEVINE,Ke.PLAYREADY,Ke.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ke.WIDEVINE]&&t&&i.push(Ke.WIDEVINE),i}const kl=function(s){return ls!=null&&(s=ls.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Lf(s,e,t,i){let r;switch(s){case Ke.FAIRPLAY:r=["cenc","sinf"];break;case Ke.WIDEVINE:case Ke.PLAYREADY:r=["cenc"];break;case Ke.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return _f(r,e,t,i)}function _f(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Ki(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const Do=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,Fl=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,Zs=(s,e)=>{const t=e;let i=0;for(;Do(s,e);){i+=10;const r=qr(s,e+6);i+=r,Fl(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},qr=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},kf=(s,e)=>Do(s,e)&&qr(s,e+6)+10<=s.length-e,Lo=s=>{const e=Ml(s);for(let t=0;t<e.length;t++){const i=e[t];if(Nl(i))return Uf(i)}},Nl=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",Ff=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=qr(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},Ml=s=>{let e=0;const t=[];for(;Do(s,e);){const i=qr(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=Ff(s.subarray(e)),o=Nf(n);o&&t.push(o),e+=n.size+10}Fl(s,e)&&(e+=10)}return t},Nf=s=>s.type==="PRIV"?Mf(s):s.type[0]==="W"?Of(s):Pf(s),Mf=s=>{if(s.size<2)return;const e=Wt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},Pf=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Wt(s.data.subarray(t),!0);t+=i.length+1;const r=Wt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Wt(s.data.subarray(1));return{key:s.type,data:e}},Of=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Wt(s.data.subarray(t),!0);t+=i.length+1;const r=Wt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Wt(s.data);return{key:s.type,data:e}},Uf=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.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)}},Wt=(s,e=!1)=>{const t=Gf();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let _o;function Gf(){if(!navigator.userAgent.includes("PlayStation 4"))return!_o&&typeof self.TextDecoder<"u"&&(_o=new self.TextDecoder("utf-8")),_o}const qt={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},jr=Math.pow(2,32)-1,Hf=[].push,Pl={video:1,audio:2,id3:3,text:4};function nt(s){return String.fromCharCode.apply(null,s)}function Ol(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function de(s,e){const t=Gl(s,e);return t<0?4294967296+t:t}function Ul(s,e){let t=de(s,e);return t*=Math.pow(2,32),t+=de(s,e+4),t}function Gl(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function ko(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function $f(s){const e=s.byteLength;for(let t=0;t<e;){const i=de(s,t);if(i>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ve(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=de(s,r),o=nt(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=ve(s.subarray(r+8,a),e.slice(1));A.length&&Hf.apply(t,A)}r=a}return t}function Yf(s){const e=[],t=s[0];let i=8;const r=de(s,i);i+=4;let n=0,o=0;t===0?(n=de(s,i),o=de(s,i+4),i+=8):(n=Ul(s,i),o=Ul(s,i+8),i+=16),i+=2;let a=s.length+o;const A=Ol(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=de(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return N.warn("SIDX has hierarchical references (not supported)"),null;const g=de(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+u-1}}),a+=u,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function Hl(s){const e=[],t=ve(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=ve(n,["tkhd"])[0];if(o){let a=o[0];const A=de(o,a===0?12:20),l=ve(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=de(l,a===0?12:20),h=ve(n,["mdia","hdlr"])[0];if(h){const u=nt(h.subarray(8,12)),d={soun:Fe.AUDIO,vide:Fe.VIDEO}[u];if(d){const g=ve(n,["mdia","minf","stbl","stsd"])[0],f=Kf(g);e[A]={timescale:c,type:d},e[d]=ot({timescale:c,id:A},f)}}}}}return ve(s,["moov","mvex","trex"]).forEach(r=>{const n=de(r,4),o=e[n];o&&(o.default={duration:de(r,12),flags:de(r,20)})}),e}function Kf(s){const e=s.subarray(8),t=e.subarray(86),i=nt(e.subarray(4,8));let r=i;const n=i==="enca"||i==="encv";if(n){const a=ve(e,[i])[0].subarray(i==="enca"?28:78);ve(a,["sinf"]).forEach(l=>{const c=ve(l,["schm"])[0];if(c){const h=nt(c.subarray(4,8));if(h==="cbcs"||h==="cenc"){const u=ve(l,["frma"])[0];u&&(r=nt(u))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=ve(t,["avcC"])[0];r+="."+Xr(o[1])+Xr(o[2])+Xr(o[3]);break}case"mp4a":{const o=ve(e,[i])[0],a=ve(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=Fo(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=Fo(a,A);const c=a[A++];if(c===64)r+="."+Xr(c);else break;if(A+=12,a[A++]!==5)break;A=Fo(a,A);const h=a[A++];let u=(h&248)>>3;u===31&&(u+=1+((h&7)<<3)+((a[A]&224)>>5)),r+="."+u}break}case"hvc1":case"hev1":{const o=ve(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=de(o,2),h=(a&32)>>5?"H":"L",u=o[12],d=o.subarray(6,12);r+="."+A+l,r+="."+c.toString(16).toUpperCase(),r+="."+h+u;let g="";for(let f=d.length;f--;){const p=d[f];(p||g)&&(g="."+p.toString(16).toUpperCase()+g)}r+=g;break}case"dvh1":case"dvhe":{const o=ve(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+jt(a)+"."+jt(A);break}case"vp09":{const o=ve(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+jt(a)+"."+jt(A)+"."+jt(l);break}case"av01":{const o=ve(t,["av1C"])[0],a=o[1]>>>5,A=o[1]&31,l=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,h=(o[2]&32)>>5,u=a===2&&c?h?12:10:c?10:8,d=(o[2]&16)>>4,g=(o[2]&8)>>3,f=(o[2]&4)>>2,p=o[2]&3;r+="."+a+"."+jt(A)+l+"."+jt(u)+"."+d+"."+g+f+p+"."+jt(1)+"."+jt(1)+"."+jt(1)+"."+0;break}}return{codec:r,encrypted:n}}function Fo(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Xr(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function jt(s){return(s<10?"0":"")+s}function Vf(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ve(s,["moov","trak"]).forEach(r=>{const o=ve(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ve(o,["enca"]);const A=a.length>0;A||(a=ve(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);ve(c,["sinf"]).forEach(u=>{const d=$l(u);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(N.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${qt.hexDump(g)} -> ${qt.hexDump(t)}`),d.set(t,8))}})})}),s}function $l(s){const e=ve(s,["schm"])[0];if(e){const t=nt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ve(s,["schi","tenc"])[0]}return N.error("[eme] missing 'schm' box"),null}function Jf(s,e){return ve(e,["moof","traf"]).reduce((t,i)=>{const r=ve(i,["tfdt"])[0],n=r[0],o=ve(i,["tfhd"]).reduce((a,A)=>{const l=de(A,4),c=s[l];if(c){let h=de(r,4);if(n===1){if(h===jr)return N.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=jr+1,h+=de(r,8)}const u=c.timescale||9e4,d=h/u;if(oe(d)&&(a===null||d<a))return d}return a},null);return o!==null&&oe(o)&&(t===null||o<t)?o:t},null)}function Wf(s,e){let t=0,i=0,r=0;const n=ve(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=ve(a,["tfhd"])[0],l=de(A,4),c=e[l];if(!c)continue;const h=c.default,u=de(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=de(A,12):d=de(A,8));const g=c.timescale||9e4,f=ve(a,["trun"]);for(let p=0;p<f.length;p++){if(t=qf(f[p]),!t&&d){const y=de(f[p],4);t=d*y}c.type===Fe.VIDEO?i+=t/g:c.type===Fe.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=ve(s,["sidx"]);for(let c=0;c<l.length;c++){const h=Yf(l[c]);if(h!=null&&h.references){o=Math.min(o,h.earliestPresentationTime/h.timescale);const u=h.references.reduce((d,g)=>d+g.info.duration||0,0);a=Math.max(a,u+h.earliestPresentationTime/h.timescale),A=a-o}}if(A&&oe(A))return A}return i||r}function qf(s){const e=de(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=de(s,4);for(let n=0;n<r;n++){if(e&256){const o=de(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function jf(s,e,t){ve(e,["moof","traf"]).forEach(i=>{ve(i,["tfhd"]).forEach(r=>{const n=de(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;ve(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let h=de(A,4);if(l===0)h-=c,h=Math.max(h,0),ko(A,4,h);else{h*=Math.pow(2,32),h+=de(A,8),h-=c,h=Math.max(h,0);const u=Math.floor(h/(jr+1)),d=Math.floor(h%(jr+1));ko(A,4,u),ko(A,8,d)}}})})})}function Xf(s){const e={valid:null,remainder:null},t=ve(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=Ki(s,0,i.byteOffset-8),e.remainder=Ki(s,i.byteOffset-8),e}function Dt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Yl(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return ve(i,["moof"]).map(A=>{const l=A.byteOffset-8;ve(A,["traf"]).map(h=>{const u=ve(h,["tfdt"]).map(d=>{const g=d[0];let f=de(d,4);return g===1&&(f*=Math.pow(2,32),f+=de(d,8)),f/r})[0];return u!==void 0&&(s=u),ve(h,["tfhd"]).map(d=>{const g=de(d,4),f=de(d,0)&16777215,p=(f&1)!==0,y=(f&2)!==0,v=(f&8)!==0;let S=0;const C=(f&16)!==0;let Q=0;const B=(f&32)!==0;let _=8;g===n&&(p&&(_+=8),y&&(_+=4),v&&(S=de(d,_),_+=4),C&&(Q=de(d,_),_+=4),B&&(_+=4),e.type==="video"&&(o=zf(e.codec)),ve(h,["trun"]).map(L=>{const G=L[0],F=de(L,0)&16777215,U=(F&1)!==0;let q=0;const V=(F&4)!==0,X=(F&256)!==0;let w=0;const x=(F&512)!==0;let $=0;const R=(F&1024)!==0,b=(F&2048)!==0;let T=0;const K=de(L,4);let M=8;U&&(q=de(L,M),M+=4),V&&(M+=4);let W=q+l;for(let ie=0;ie<K;ie++){if(X?(w=de(L,M),M+=4):w=S,x?($=de(L,M),M+=4):$=Q,R&&(M+=4),b&&(G===0?T=de(L,M):T=Gl(L,M),M+=4),e.type===Fe.VIDEO){let ce=0;for(;ce<$;){const ae=de(i,W);if(W+=4,Zf(o,i[W])){const me=i.subarray(W,W+ae);Kl(me,o?2:1,s+T/r,t)}W+=ae,ce+=ae+4}}s+=w/r}}))})})}),t}function zf(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Zf(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Kl(s,e,t,i){const r=Vl(s);let n=0;n+=e;let o=0,a=0,A=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;A=r[n++],o+=A}while(A===255);a=0;do{if(n>=r.length)break;A=r[n++],a+=A}while(A===255);const l=r.length-n;let c=n;if(a<l)n+=a;else if(a>l){N.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(r[c++]===181){const u=Ol(r,c);if(c+=2,u===49){const d=de(r,c);if(c+=4,d===1195456820){const g=r[c++];if(g===3){const f=r[c++],p=31&f,y=64&f,v=y?2+p*3:0,S=new Uint8Array(v);if(y){S[0]=f;for(let C=1;C<v;C++)S[C]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:S})}}}}}else if(o===5&&a>16){const h=[];for(let g=0;g<16;g++){const f=r[c++].toString(16);h.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let g=0;g<u;g++)d[g]=r[c++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Wt(d),userDataBytes:d})}}}function Vl(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function e0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;nt(s.subarray(l,l+1))!=="\0";)t+=nt(s.subarray(l,l+1)),l+=1;for(t+=nt(s.subarray(l,l+1)),l+=1;nt(s.subarray(l,l+1))!=="\0";)i+=nt(s.subarray(l,l+1)),l+=1;i+=nt(s.subarray(l,l+1)),l+=1,r=de(s,12),n=de(s,16),a=de(s,20),A=de(s,24),l=28}else if(e===1){l+=4,r=de(s,l),l+=4;const h=de(s,l);l+=4;const u=de(s,l);for(l+=4,o=4294967296*h+u,Ef(o)||(o=Number.MAX_SAFE_INTEGER,N.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=de(s,l),l+=4,A=de(s,l),l+=4;nt(s.subarray(l,l+1))!=="\0";)t+=nt(s.subarray(l,l+1)),l+=1;for(t+=nt(s.subarray(l,l+1)),l+=1;nt(s.subarray(l,l+1))!=="\0";)i+=nt(s.subarray(l,l+1)),l+=1;i+=nt(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function t0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function i0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),t0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function s0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=qt.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let zr={};class er{static clearKeyUriToKeyIdMap(){zr={}}constructor(e,t,i,r=[1],n=null){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=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case St.FAIRPLAY:case St.WIDEVINE:case St.PLAYREADY:case St.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&N.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=r0(e);return new er(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Tf(this.uri);if(t)switch(this.keyFormat){case St.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case St.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=i0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const h=Ro(c).subarray(0,16);xf(h),this.keyId=h}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=zr[this.uri];if(!i){const r=Object.keys(zr).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),zr[this.uri]=i}this.keyId=i}return this}}function r0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Jl=/\{\$([a-zA-Z0-9-_]+)\}/g;function Wl(s){return Jl.test(s)}function bt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=No(s,n))}}function No(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Jl,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function ql(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function n0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function Vi(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function o0(s){return typeof self<"u"&&s===self.ManagedMediaSource}const Zr={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,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 a0(s,e){const t=Zr[e];return!!t&&!!t[s.slice(0,4)]}function Mo(s,e,t=!0){return!s.split(",").some(i=>!jl(i,e,t))}function jl(s,e,t=!0){var i;const r=Vi(t);return(i=r==null?void 0:r.isTypeSupported(tr(s,e)))!=null?i:!1}function tr(s,e){return`${e}/mp4;codecs="${s}"`}function Xl(s){if(s){const e=s.substring(0,4);return Zr.video[e]}return 2}function en(s){return s.split(",").reduce((e,t)=>{const i=Zr.video[t];return i?(i*2+e)/(e?3:2):(Zr.audio[t]+e)/(e?2:1)},0)}const Po={};function A0(s,e=!0){if(Po[s])return Po[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(jl(t[i],"audio",e))return Po[s]=t[i],t[i];return s}const l0=/flac|opus/i;function tn(s,e=!0){return s.replace(l0,t=>A0(t.toLowerCase(),e))}function zl(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function c0(s){const e=s.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return s}const Zl=/#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,ec=/#EXT-X-MEDIA:(.*)/g,h0=/^#EXT(?:INF|-X-TARGETDURATION):/m,tc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),u0=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 Xt{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return So.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return h0.test(e)}static parseMasterPlaylist(e,t){const i=Wl(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];Zl.lastIndex=0;let o;for(;(o=Zl.exec(e))!=null;)if(o[1]){var a;const l=new We(o[1]);bt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=No(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:Xt.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),d0(l.CODECS,h),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new We(c);bt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=ic(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):N.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new We(c);bt(r,h,["NAME","VALUE","QUERYPARAM"]),ql(r,h,t)}break}case"CONTENT-STEERING":{const h=new We(c);bt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:Xt.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=sc(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(ec.lastIndex=0;(r=ec.exec(e))!==null;){const l=new We(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,bt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=l.LANGUAGE,g=l["ASSOC-LANGUAGE"],f=l.CHANNELS,p=l.CHARACTERISTICS,y=l["INSTREAM-ID"],v={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?Xt.resolve(l.URI,t):""};if(g&&(v.assocLang=g),f&&(v.channels=f),p&&(v.characteristics=p),y&&(v.instreamId=y),h!=null&&h.length){const S=Xt.findGroup(h,v.groupId)||h[0];rc(v,S,"audioCodec"),rc(v,S,"textCodec")}u.push(v)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new wf(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new wo(r,t),p,y,v,S=-1,C=!1,Q=null;for(tc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Wl(e);(p=tc.exec(e))!==null;){C&&(C=!1,f=new wo(r,t),f.start=u,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null,Q&&(f.setByteRange(Q),Q=null)));const G=p[1];if(G){f.duration=parseFloat(G);const F=(" "+p[2]).slice(1);f.title=F||null,f.tagList.push(F?["INF",G,F]:["INF",G])}else if(p[3]){if(oe(f.duration)){f.start=u,v&&ac(f,v,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const F=(" "+p[3]).slice(1);f.relurl=No(a,F),nc(f,g),g=f,u+=f.duration,c++,h=0,C=!0}}else if(p[4]){const F=(" "+p[4]).slice(1);g?f.setByteRange(F,g):f.setByteRange(F)}else if(p[5])f.rawProgramDateTime=(" "+p[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),S===-1&&(S=A.length);else{if(p=p[0].match(u0),!p){N.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const F=(" "+p[y]).slice(1),U=(" "+p[y+1]).slice(1),q=p[y+2]?(" "+p[y+2]).slice(1):"";switch(F){case"PLAYLIST-TYPE":a.type=U.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(U);break;case"SKIP":{const V=new We(U);bt(a,V,["RECENTLY-REMOVED-DATERANGES"]);const X=V.decimalInteger("SKIPPED-SEGMENTS");if(oe(X)){a.skippedSegments=X;for(let x=X;x--;)A.unshift(null);c+=X}const w=V.enumeratedString("RECENTLY-REMOVED-DATERANGES");w&&(a.recentlyRemovedDateranges=w.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(U),1);break;case"VERSION":a.version=parseInt(U);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(U||q)&&f.tagList.push(q?[U,q]:[U]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([F]);break;case"BITRATE":f.tagList.push([F,U]);break;case"DATERANGE":{const V=new We(U);bt(a,V,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),bt(a,V,V.clientAttrs);const X=new xl(V,a.dateRanges[V.ID]);X.isValid||a.skippedSegments?a.dateRanges[X.id]=X:N.warn(`Ignoring invalid DATERANGE tag: "${U}"`),f.tagList.push(["EXT-X-DATERANGE",U]);break}case"DEFINE":{{const V=new We(U);bt(a,V,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in V?n0(a,V,o):ql(a,V,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(U);break;case"KEY":{const V=ic(U,t,a);if(V.isSupported()){if(V.method==="NONE"){v=void 0;break}v||(v={}),v[V.keyFormat]&&(v=Ze({},v)),v[V.keyFormat]=V}else N.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${U}"`);break}case"START":a.startTimeOffset=sc(U);break;case"MAP":{const V=new We(U);if(bt(a,V,["BYTERANGE","URI"]),f.duration){const X=new wo(r,t);oc(X,V,i,v),l=X,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else{const X=f.byteRangeEndOffset;if(X){const w=f.byteRangeStartOffset;Q=`${X-w}@${w}`}else Q=null;oc(f,V,i,v),l=f,C=!0}break}case"SERVER-CONTROL":{const V=new We(U);a.canBlockReload=V.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=V.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&V.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=V.optionalFloat("PART-HOLD-BACK",0),a.holdBack=V.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const V=new We(U);a.partTarget=V.decimalFloatingPoint("PART-TARGET");break}case"PART":{let V=a.partList;V||(V=a.partList=[]);const X=h>0?V[V.length-1]:void 0,w=h++,x=new We(U);bt(a,x,["BYTERANGE","URI"]);const $=new Sf(x,f,t,w,X);V.push($),f.duration+=$.duration;break}case"PRELOAD-HINT":{const V=new We(U);bt(a,V,["URI"]),a.preloadHint=V;break}case"RENDITION-REPORT":{const V=new We(U);bt(a,V,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(V);break}default:N.warn(`line parsed but not handled: ${p}`);break}}}g&&!g.relurl?(A.pop(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(nc(f,g),f.cc=d,a.fragmentHint=f,v&&ac(f,v,a));const B=A.length,_=A[0],L=A[B-1];if(u+=a.skippedSegments*a.targetduration,u>0&&B&&L){a.averagetargetduration=u/B;const G=L.sn;a.endSN=G!=="initSegment"?G:0,a.live||(L.endList=!0),_&&(a.startCC=_.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,S>0&&g0(A,S),a}}function ic(s,e,t){var i,r;const n=new We(s);bt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&N.error(`Invalid IV: ${n.IV}`);const h=a?Xt.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new er(o,h,c,u,A)}function sc(s){const t=new We(s).decimalFloatingPoint("TIME-OFFSET");return oe(t)?t:null}function d0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>a0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function rc(s,e,t){const i=e[t];i&&(s[t]=i)}function g0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function nc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),oe(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function oc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function ac(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var Te={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ge={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Ac(s){const{type:e}=s;switch(e){case Te.AUDIO_TRACK:return ge.AUDIO;case Te.SUBTITLE_TRACK:return ge.SUBTITLE;default:return ge.MAIN}}function Oo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class f0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}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:Te.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:o,deliveryDirectives:a}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:Te.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Te.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Te.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url&&l.level===e.level){N.trace("[playlist-loader]: playlist request ongoing");return}N.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===Te.MANIFEST?n=i.manifestLoadPolicy.default:n=Ze({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),oe((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===Te.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===Te.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===Te.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,h=l.targetduration;if(c&&h){const u=Math.max(c*3,h*.8)*1e3;n=Ze({},n,{maxTimeToFirstByteMs:Math.min(u,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,h,u)=>{const d=this.getInternalLoader(h);this.resetInternalLoader(h.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),Xt.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,h,u||null,d):this.handleMasterPlaylist(l,c,h,u)},onError:(l,c,h,u)=>{this.handleNetworkError(c,h,!1,l,u)},onTimeout:(l,c,h)=>{this.handleNetworkError(c,h,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Oo(e,i),A=Xt.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=Xt.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(S=>!S.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(N.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new We({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:p,captions:y,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Oo(e,i),h=0,u=oe(A)?A:oe(a)?a:0,d=Ac(i),g=Xt.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===Te.MANIFEST){const f={attrs:new We({}),bitrate:0,details:g,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:H.MANIFEST_PARSING_ERROR,fatal:t.type===Te.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Te.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Te.AUDIO_TRACK||e.type===Te.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);N.warn(`[playlist-loader]: ${o}`);let A=H.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case Te.MANIFEST:A=i?H.MANIFEST_LOAD_TIMEOUT:H.MANIFEST_LOAD_ERROR,l=!0;break;case Te.LEVEL:A=i?H.LEVEL_LOAD_TIMEOUT:H.LEVEL_LOAD_ERROR,l=!1;break;case Te.AUDIO_TRACK:A=i?H.AUDIO_TRACK_LOAD_TIMEOUT:H.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Te.SUBTITLE_TRACK:A=i?H.SUBTITLE_TRACK_LOAD_TIMEOUT:H.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:Ee.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=(t==null?void 0:t.url)||e.url;h.response=ot({url:u,data:void 0},r)}this.hls.trigger(E.ERROR,h)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:h,deliveryDirectives:u}=r,d=Oo(t,r),g=Ac(r),f=typeof r.level=="number"&&g===ge.MAIN?l:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:H.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:H.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case Te.MANIFEST:case Te.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case Te.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case Te.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function lc(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function cc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){N.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){N.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function cs(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function Uo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=E0(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function p0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function E0(s,e,t){const i=[],r=p0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}function sn(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}var Ot={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const I0=.25;function Go(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function hc(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?ot({type:r},i):i))}return n}const rn=(()=>{const s=Go();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Ho(s,e){return s.getTime()/1e3-e}function m0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class C0{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(cs(this.id3Track),this.id3Track=null,this.media=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 lc(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Go();if(o)for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Ot.emsg&&!i||!r)continue;const l=Ml(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>rn&&(h=rn),h-c<=0&&(h=c+I0);for(let d=0;d<l.length;d++){const g=l[d];if(!Nl(g)){this.updateId3CueEnds(c,A);const f=hc(o,c,h,g,A);f&&this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===rn&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Ot.audioId3&&A:r==="video"?l=c=>c.type===Ot.emsg&&a:l=c=>c.type===Ot.audioId3&&A||c.type===Ot.emsg&&a,Uo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!oe(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Go();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=Ho(u.startDate,A),g=i[h],f=(g==null?void 0:g.cues)||{};let p=(g==null?void 0:g.durationKnown)||!1,y=rn;const v=u.endDate;if(v)y=Ho(v,A),p=!0;else if(u.endOnNext&&!p){const C=o.reduce((Q,B)=>{if(B!==u.id){const _=n[B];if(_.class===u.class&&_.startDate>u.startDate&&(!Q||u.startDate<Q.startDate))return _}return Q},null);C&&(y=Ho(C.startDate,A),p=!0)}const S=Object.keys(u.attr);for(let C=0;C<S.length;C++){const Q=S[C];if(!Bf(Q))continue;const B=f[Q];if(B)p&&!g.durationKnown&&(B.endTime=y);else if(l){let _=u.attr[Q];Qf(Q)&&(_=m0(_));const L=hc(l,d,y,{key:Q,data:_},Ot.dateRange);L&&(L.id=h,this.id3Track.addCue(L),f[Q]=L)}}i[h]={cues:f,dateRange:u,durationKnown:p}}}}class y0{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r;return l+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;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,levelDetails:t}=this;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.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===H.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&N.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration);if(a<A&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const $o=["NONE","TYPE-0","TYPE-1",null];function v0(s){return $o.indexOf(s)>-1}const nn=["SDR","PQ","HLG"];function B0(s){return!!s&&nn.indexOf(s)>-1}var on={No:"",Yes:"YES",v2:"v2"};function uc(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,r=i<e/2;return e&&r?t?on.v2:on.Yes:on.No}class dc{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 hs{constructor(e){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.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(t=>!!t).map(t=>t.substring(0,4)).join(","),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 gc(this._audioGroups,e)}hasSubtitleGroup(e){return gc(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 gc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function Yo(s,e){const t=e.startPTS;if(oe(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function fc(s,e,t,i,r,n){i-t<=0&&(N.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(oe(l)){const p=Math.abs(l-t);oe(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const h=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const u=e.sn;if(!s||u<s.startSN||u>s.endSN)return 0;let d;const g=u-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)Yo(f[d],f[d-1]);for(d=g;d<f.length-1;d++)Yo(f[d],f[d+1]);return s.fragmentHint&&Yo(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function Q0(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(w0(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),oe(A.startPTS)&&oe(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;l&&(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){N.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=S0(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){N.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),b0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?fc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):pc(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function S0(s,e,t){const i=Ze({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new xl(e[r].attr,i[r]);n.isValid?i[r]=n:N.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function b0(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function w0(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let h=a[l];i&&!h&&l<i&&(h=e.fragments[l]=c),c&&h&&t(c,h)}}function pc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||Ko(e,i[t].start)}function Ko(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function R0(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function x0(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function Ec(s,e,t){var i;return s!=null&&s.details?Ic((i=s.details)==null?void 0:i.partList,e,t):null}function Ic(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function mc(s){s.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(r=>{r.level=t})})}function an(s){switch(s.details){case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_TIMEOUT:case H.LEVEL_LOAD_TIMEOUT:case H.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Cc(s,e){const t=an(e);return s.default[`${t?"timeout":"error"}Retry`]}function Vo(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function yc(s){return ot(ot({},s),{errorRetry:null,timeoutRetry:null})}function An(s,e,t,i){if(!s)return!1;const r=i==null?void 0:i.code,n=e<s.maxNumRetry&&(T0(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function T0(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const vc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function D0(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!oe(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(_0(e,t,o))return o}return null}function ln(s,e,t=0,i=0,r=.005){let n=null;if(s){n=e[s.sn-e[0].sn+1]||null;const a=s.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!s||s.level===n.level)&&Jo(t,i,n)===0||L0(n,s,Math.min(r,i))))return n;const o=vc.search(e,Jo.bind(null,t,i));return o&&(o!==s||!n)?o:n}function L0(s,e,t){if(e&&e.start===0&&e.level<s.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return s.start<=i}return!1}function Jo(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function _0(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function k0(s,e){return vc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var dt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ut={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class F0{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=N.log.bind(N,"[info]:"),this.warn=N.warn.bind(N,"[warning]:"),this.error=N.error.bind(N,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ge.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case H.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:dt.DoNothing,flags:Ut.None};return}case H.FRAG_GAP:case H.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=dt.SendAlternateToPenaltyBox;return}case H.LEVEL_EMPTY_ERROR:case H.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===ge.MAIN?t.level:n.loadLevel;t.details===H.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 H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.SUBTITLE_LOAD_ERROR:case H.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===Te.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===Te.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=dt.SendAlternateToPenaltyBox,t.errorAction.flags=Ut.MoveAllAlternatesMatchingHost;return}}return;case H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c?t.errorAction={action:dt.SendAlternateToPenaltyBox,flags:Ut.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case H.BUFFER_ADD_CODEC_ERROR:case H.REMUX_ALLOC_ERROR:case H.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case H.INTERNAL_EXCEPTION:case H.BUFFER_APPENDING_ERROR:case H.BUFFER_FULL_ERROR:case H.LEVEL_SWITCH_ERROR:case H.BUFFER_STALLED_ERROR:case H.BUFFER_SEEK_OVER_HOLE:case H.BUFFER_NUDGE_ON_STALL:t.errorAction={action:dt.DoNothing,flags:Ut.None};return}t.type===Ee.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Cc(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(An(r,n,an(e),e.response))return{action:dt.RetryRequest,flags:Ut.None,retryConfig:r,retryCount:n};const a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=Cc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,h)=>c+h.fragmentError,0);if(r&&(e.details!==H.FRAG_GAP&&r.fragmentError++,An(a,A,an(e),e.response)))return{action:dt.RetryRequest,flags:Ut.None,retryConfig:a,retryCount:A};const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=A),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,o;const l=e.details;r.loadError++,l===H.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:h,loadLevel:u,minAutoLevel:d,maxAutoLevel:g}=i;i.autoLevelEnabled||(i.loadLevel=-1);const f=(n=e.frag)==null?void 0:n.type,y=(f===ge.AUDIO&&l===H.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:B})=>r.audioCodec!==B),S=e.sourceBufferName==="video"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR)&&h.some(({codecSet:B,audioCodec:_})=>r.codecSet!==B&&r.audioCodec===_),{type:C,groupId:Q}=(o=e.context)!=null?o:{};for(let B=h.length;B--;){const _=(B+u)%h.length;if(_!==u&&_>=d&&_<=g&&h[_].loadError===0){var a,A;const L=h[_];if(l===H.FRAG_GAP&&f===ge.MAIN&&e.frag){const G=h[_].details;if(G){const F=ln(e.frag,G.fragments,e.frag.start);if(F!=null&&F.gap)continue}}else{if(C===Te.AUDIO_TRACK&&L.hasAudioGroup(Q)||C===Te.SUBTITLE_TRACK&&L.hasSubtitleGroup(Q))continue;if(f===ge.AUDIO&&(a=r.audioGroups)!=null&&a.some(G=>L.hasAudioGroup(G))||f===ge.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(G=>L.hasSubtitleGroup(G))||y&&r.audioCodec===L.audioCodec||!y&&r.audioCodec!==L.audioCodec||S&&r.codecSet===L.codecSet)continue}c=_;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:dt.SendAlternateToPenaltyBox,flags:Ut.None,nextAutoLevel:c}}return{action:dt.SendAlternateToPenaltyBox,flags:Ut.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case dt.DoNothing:break;case dt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==H.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Ut.None:this.switchLevel(e,o);break;case Ut.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=$o[$o.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){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)}}class Wo{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=N.log.bind(N,`${t}:`),this.warn=N.warn.bind(N,`${t}:`),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.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let o=0;o<r.length;o++){const a=r[o];let A;try{A=new self.URL(a.URI,t.url).href}catch(l){N.warn(`Could not construct new URL for Rendition Report: ${l}`),A=a.URI||""}if(A===e){n=o;break}else A===e.substring(0,A.length)&&(n=o)}if(n!==-1){const o=r[n],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let A=parseInt(o["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const c=Math.min(t.age-t.partTarget,t.targetduration);A>=0&&c>t.partTarget&&(A+=1)}const l=i&&uc(i);return new dc(a,A>=0?A:void 0,l)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&Q0(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const p=this.hls.config.lowLatencyMode,y=r.lastPartSn,v=r.endSN,S=r.lastPartIndex,C=S!==-1,Q=y===v,B=p?0:S;C?(l=Q?v+1:y,c=Q?B:S+1):l=v+1;const _=r.age,L=_+r.ageHeader;let G=Math.min(L-r.partTarget,r.targetduration*1.5);if(G>0){if(i&&G>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${G} with playlist age: ${r.age}`),G=0;else{const F=Math.floor(G/r.targetduration);if(l+=F,c!==void 0){const U=Math.round(G%r.targetduration/r.partTarget);c+=U}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${_.toFixed(2)}s goal: ${G} skip sn ${F} to part ${c}`)}r.tuneInGoal=G}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!Q){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const h=this.hls.mainForwardBufferInfo,u=h?h.end-h.len:0,d=(r.edge-u)*1e3,g=R0(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=uc(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=on.No),new dc(i,r,n)}checkRetry(e){const t=e.details,i=an(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===dt.RetryRequest||!r.resolved&&n===dt.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=Vo(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}class us{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}getTotalWeight(){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 N0{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new us(e),this.fast_=new us(t),this.defaultTTFB_=r,this.ttfb_=new us(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new us(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new us(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new us(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}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_}destroy(){}}const Bc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Qc={};function M0(s,e,t,i,r,n){const o=s.audioCodec?s.audioGroups:null,a=n==null?void 0:n.audioCodec,A=n==null?void 0:n.channels,l=A?parseInt(A):a?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,u)=>{if(u){const d=e.groups[u];if(!d)throw new Error(`Audio track group ${u} not found`);Object.keys(d.channels).forEach(g=>{h[g]=(h[g]||0)+d.channels[g]})}return h},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(r,8e6))||!!c&&oe(l)&&Object.keys(c).some(h=>parseInt(h)>l)}function P0(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(Bc);const n={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},o=s.videoRange;o!=="SDR"&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map(A=>({type:"media-source",video:ot(ot({},n),{},{contentType:tr(A,"video")})}));return r&&s.audioGroups&&s.audioGroups.forEach(A=>{var l;A&&((l=e.groups[A])==null||l.tracks.forEach(c=>{if(c.groupId===A){const h=c.channels||"",u=parseFloat(h);oe(u)&&u>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:tr(d,"audio"),channels:""+u}})))}}))}),Promise.all(a.map(A=>{const l=O0(A);return Qc[l]||(Qc[l]=t.decodingInfo(A))})).then(A=>({supported:!A.some(l=>!l.supported),configurations:a,decodingInfoResults:A})).catch(A=>({supported:!1,configurations:a,decodingInfoResults:[],error:A}))}function O0(s){const{audio:e,video:t}=s,i=t||e;if(i){const r=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function U0(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function G0(s,e){let t=!1,i=[];return s&&(t=s!=="SDR",i=[s]),e&&(i=e.allowedVideoRanges||nn.slice(0),t=e.preferHDR!==void 0?e.preferHDR:U0(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function H0(s,e,t,i,r){const n=Object.keys(s),o=i==null?void 0:i.channels,a=i==null?void 0:i.audioCodec,A=o&&parseInt(o)===2;let l=!0,c=!1,h=1/0,u=1/0,d=1/0,g=0,f=[];const{preferHDR:p,allowedVideoRanges:y}=G0(e,r);for(let Q=n.length;Q--;){const B=s[n[Q]];l=B.channels[2]>0,h=Math.min(h,B.minHeight),u=Math.min(u,B.minFramerate),d=Math.min(d,B.minBitrate);const _=y.filter(L=>B.videoRanges[L]>0);_.length>0&&(c=!0,f=_)}h=oe(h)?h:0,u=oe(u)?u:0;const v=Math.max(1080,h),S=Math.max(30,u);return d=oe(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((Q,B)=>{const _=s[B];if(B===Q)return Q;if(_.minBitrate>t)return fi(B,`min bitrate of ${_.minBitrate} > current estimate of ${t}`),Q;if(!_.hasDefaultAudio)return fi(B,"no renditions with default or auto-select sound found"),Q;if(a&&B.indexOf(a.substring(0,4))%5!==0)return fi(B,`audio codec preference "${a}" not found`),Q;if(o&&!A){if(!_.channels[o])return fi(B,`no renditions with ${o} channel sound found (channels options: ${Object.keys(_.channels)})`),Q}else if((!a||A)&&l&&_.channels[2]===0)return fi(B,"no renditions with stereo sound found"),Q;return _.minHeight>v?(fi(B,`min resolution of ${_.minHeight} > maximum of ${v}`),Q):_.minFramerate>S?(fi(B,`min framerate of ${_.minFramerate} > maximum of ${S}`),Q):f.some(L=>_.videoRanges[L]>0)?_.maxScore<g?(fi(B,`max score of ${_.maxScore} < selected max of ${g}`),Q):Q&&(en(B)>=en(Q)||_.fragmentError>s[Q].fragmentError)?Q:(g=_.maxScore,B):(fi(B,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),Q)},void 0),videoRanges:f,preferHDR:p,minFramerate:u,minBitrate:d}}function fi(s,e){N.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function $0(s){return s.reduce((e,t)=>{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 r=t.channels||"2";return i.channels[r]=(i.channels[r]||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 Y0(s,e,t,i){return s.slice(t,i+1).reduce((r,n)=>{if(!n.codecSet)return r;const o=n.audioGroups;let a=r[n.codecSet];a||(r[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);const A=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,A),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,o&&o.forEach(l=>{if(!l)return;const c=e.groups[l];c&&(a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{a.channels[h]=(a.channels[h]||0)+c.channels[h]}))}),r},{})}function zt(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(ds(s,r,t))return i}return-1}function ds(s,e,t){const{groupId:i,name:r,lang:n,assocLang:o,characteristics:a,default:A}=s,l=s.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===o)&&(A===void 0||e.default===A)&&(l===void 0||e.forced===l)&&(a===void 0||K0(a,e.characteristics))&&(t===void 0||t(s,e))}function K0(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function gs(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function V0(s,e,t,i,r){const n=e[i],a=e.reduce((u,d,g)=>{const f=d.uri;return(u[f]||(u[f]=[])).push(g),u},{})[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const A=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),h=Sc(e,i,u=>{if(u.videoRange!==A||u.frameRate!==l||u.codecSet.substring(0,4)!==c)return!1;const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return zt(s,g,r)>-1});return h>-1?h:Sc(e,i,u=>{const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return zt(s,g,r)>-1})}function Sc(s,e,t){for(let i=e;i;i--)if(t(s[i]))return i;for(let i=e+1;i<s.length;i++)if(t(s[i]))return i;return-1}class J0{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:n,media:o}=r;if(!t||!o)return;const a=performance.now(),A=i?i.stats:t.stats,l=i?i.duration:t.duration,c=a-A.loading.start,h=r.minAutoLevel;if(A.aborted||A.loaded&&A.loaded===A.total||t.level<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||o.paused||!o.playbackRate||!o.readyState)return;const u=r.mainForwardBufferInfo;if(u===null)return;const d=this.bwEstimator.getEstimateTTFB(),g=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(l/(g*2))))return;const f=u.len/g,p=A.loading.first?A.loading.first-A.loading.start:-1,y=A.loaded&&p>-1,v=this.getBwEstimate(),S=r.levels,C=S[t.level],Q=A.total||Math.max(A.loaded,Math.round(l*C.averageBitrate/8));let B=y?c-p:c;B<1&&y&&(B=Math.min(c,A.loaded*8/v));const _=y?A.loaded*1e3/B:0,L=_?(Q-A.loaded)/_:Q*8/v+d/1e3;if(L<=f)return;const G=_?_*8:v;let F=Number.POSITIVE_INFINITY,U;for(U=t.level-1;U>h;U--){const V=S[U].maxBitrate;if(F=this.getTimeToLoadFrag(d/1e3,G,l*V,!S[U].details),F<f)break}if(F>=L||F>l*10)return;r.nextLoadLevel=r.nextAutoLevel=U,y?this.bwEstimator.sample(c-Math.min(d,p),A.loaded):this.bwEstimator.sampleTTFB(c);const q=S[U].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>q&&this.resetEstimator(q),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
158
158
  Time to underbuffer: ${f.toFixed(3)} s
159
159
  Estimated load time for current fragment: ${L.toFixed(3)} s
160
160
  Estimated load time for down switch fragment: ${F.toFixed(3)} s
161
161
  TTFB estimate: ${p|0} ms
162
162
  Current BW estimate: ${oe(v)?v|0:"Unknown"} bps
163
163
  New BW estimate: ${this.getBwEstimate()|0} bps
164
- Switching to level ${U} @ ${q|0} bps`),r.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:A})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(N.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 N0(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,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;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r: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 H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case H.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const o=performance.now(),a=n?n.stats:i.stats,A=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(A-Math.min(h,l),a.loaded)}else this.bwEstimator.sampleTTFB(A)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;oe(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===fe.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==fe.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(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return N.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,n)&&o[e].loadError<=o[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,A=this.getBwEstimate(),l=this.getStarvationDelay();let c=n.abrBandWidthFactor,h=n.abrBandWidthUpFactor;if(l){const p=this.findBestLevel(A,o,r,l,0,c,h);if(p>=0)return p}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const p=this.bitrateTestDelay;p&&(u=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-p,N.info(`[abr] bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),c=h=1)}const d=this.findBestLevel(A,o,r,l,u,c,h);if(N.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const g=i.levels[o],f=i.levels[i.loadLevel];return(g==null?void 0:g.bitrate)<(f==null?void 0:f.bitrate)?o: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,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,o,a){var A;const l=r+n,c=this.lastLoadedFragLevel,h=c===-1?this.hls.firstLevel:c,{fragCurrent:u,partCurrent:d}=this,{levels:g,allAudioTracks:f,loadLevel:p,config:y}=this.hls;if(g.length===1)return 0;const v=g[h],S=!!(v!=null&&(A=v.details)!=null&&A.live),C=p===-1||c===-1;let Q,B="SDR",_=(v==null?void 0:v.frameRate)||0;const{audioPreference:L,videoPreference:G}=y,F=this.audioTracksByGroup||(this.audioTracksByGroup=$0(f));if(C){if(this.firstSelection!==-1)return this.firstSelection;const w=this.codecTiers||(this.codecTiers=Y0(g,F,t,i)),x=H0(w,B,e,L,G),{codecSet:$,videoRanges:R,minFramerate:b,minBitrate:T,preferHDR:K}=x;Q=$,B=K?R[R.length-1]:R[0],_=b,e=Math.max(e,T),N.log(`[abr] picked start tier ${JSON.stringify(x)}`)}else Q=v==null?void 0:v.codecSet,B=v==null?void 0:v.videoRange;const U=d?d.duration:u?u.duration:0,q=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let w=i;w>=t;w--){var X;const x=g[w],$=w>h;if(!x)continue;if(y.useMediaCapabilities&&!x.supportedResult&&!x.supportedPromise){const ie=navigator.mediaCapabilities;typeof(ie==null?void 0:ie.decodingInfo)=="function"&&M0(x,F,B,_,e,L)?(x.supportedPromise=P0(x,F,ie),x.supportedPromise.then(ce=>{if(!this.hls)return;x.supportedResult=ce;const ae=this.hls.levels,me=ae.indexOf(x);ce.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${ce.error}" for level ${me} ${JSON.stringify(ce)}`):ce.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${me} ${JSON.stringify(ce)}`),me>-1&&ae.length>1&&(N.log(`[abr] Removing unsupported level ${me}`),this.hls.removeLevel(me)))})):x.supportedResult=yc}if(Q&&x.codecSet!==Q||B&&x.videoRange!==B||$&&_>x.frameRate||!$&&_>0&&_<x.frameRate||x.supportedResult&&!((X=x.supportedResult.decodingInfoResults)!=null&&X[0].smooth)){V.push(w);continue}const R=x.details,b=(d?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||U;let T;$?T=a*e:T=o*e;const K=U&&r>=U*2&&n===0?g[w].averageBitrate:g[w].maxBitrate,M=this.getTimeToLoadFrag(q,T,K*b,R===void 0);if(T>=K&&(w===c||x.loadError===0&&x.fragmentError===0)&&(M<=q||!oe(M)||S&&!this.bitrateTestDelay||M<l)){const ie=this.forcedAutoLevel;return w!==p&&(ie===-1||ie!==p)&&(V.length&&N.trace(`[abr] Skipped level(s) ${V.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[V[0]].codecs}" ${g[V[0]].videoRange}; not compatible with "${v.codecs}" ${B}`),N.info(`[abr] switch candidate:${h}->${w} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-K)} ttfb:${q.toFixed(1)} avgDuration:${b.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${M.toFixed(1)} firstSelection:${C} codecSet:${Q} videoRange:${B} hls.loadLevel:${p}`)),C&&(this.firstSelection=w),w}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class W0{constructor(){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(){}}var at={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class q0{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.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=fs(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],h=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,h,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),hn(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=fs(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h){const d=Math.max(o,r.start(c)),g=Math.min(a,r.end(c));g>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:g}))}else if(a<=h)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&hn(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||hn(t))}getState(e){const t=fs(e),i=this.fragments[t];return i?i.buffered?hn(i)?at.PARTIAL:at.OK:at.APPENDING:at.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=fs(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=fs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=fs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function hn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function fs(s){return`${s.type}_${s.level}_${s.sn}`}const j0={length:0,start:()=>0,end:()=>0};class He{static isBuffered(e,t){try{if(e){const i=He.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=He.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const h=l.start-c.start;return h||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const h=r[c-1].end;e[l].start-h<i?e[l].end>h&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,h=r[l].end;if(t+i>=c&&t<h)a=c,A=h,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return N.log("failed to get media.buffered",t),j0}}}class Wo{constructor(e,t,i,r=0,n=-1,o=!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=un(),this.buffering={audio:un(),video:un(),audiovideo:un()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function un(){return{start:0,executeStart:0,executeEnd:0,end:0}}function dn(s,e){for(let i=0,r=s.length;i<r;i++){var t;if(((t=s[i])==null?void 0:t.cc)===e)return s[i]}return null}function X0(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function z0(s,e){const t=s.fragments,i=e.fragments;if(!i.length||!t.length){N.log("No fragments to align");return}const r=dn(t,i[0].cc);if(!r||r&&!r.startPTS){N.log("No frag in previous level to align on");return}return r}function Qc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Sc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Qc(t[i],s);e.fragmentHint&&Qc(e.fragmentHint,s),e.alignedSliding=!0}function Z0(s,e,t){e&&(ep(s,t,e),!t.alignedSliding&&e&&gn(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&gc(e,t))}function ep(s,e,t){if(X0(s,t,e)){const i=z0(t,e);i&&oe(i.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Sc(i.start,e))}}function gn(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(r=dn(i,o),n=dn(t,o)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=dn(t,r.cc)||t[Math.floor(t.length/2)]);const a=r.programDateTime,A=n.programDateTime;if(!a||!A)return;const l=(A-a)/1e3-(n.start-r.start);Sc(l,s)}const bc=Math.pow(2,17);class tp{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 pi({type:pe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(Rc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=wc(e),h=mc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:bc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l);let y=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),a({frag:e,part:null,payload:y,networkDetails:p})},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ot({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,p)=>{t&&t({frag:e,part:null,payload:f,networkDetails:p})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(Rc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=wc(e,t),h=mc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:bc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};i(y),a(y)},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ot({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:pe.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),h=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function wc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(oe(r)&&oe(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Rc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:pe.MEDIA_ERROR,details:H.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new pi(i)}class pi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class ip{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class sp{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function rp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Ki(s,0,e-t):s}class np{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 r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],h=A[2],u=A[3],d=new Uint32Array(256);let g=0,f=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){let y=f^f<<1^f<<2^f<<3^f<<4;y=y>>>8^y&255^99,e[g]=y,t[y]=g;const v=d[g],S=d[v],C=d[S];let Q=d[y]*257^y*16843008;r[g]=Q<<24|Q>>>8,n[g]=Q<<16|Q>>>16,o[g]=Q<<8|Q>>>24,a[g]=Q,Q=C*16843009^S*65537^v*257^g*16843008,l[y]=Q<<24|Q>>>8,c[y]=Q<<16|Q>>>16,h[y]=Q<<8|Q>>>24,u[y]=Q,g?(g=v^d[d[d[C^v]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],y=d[3];let v,S;for(a=0;a<o;a++){if(a<n){v=l[a]=t[a];continue}S=v,a%n===0?(S=S<<8|S>>>24,S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255],S^=u[a/n|0]<<24):n>6&&a%n===4&&(S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255]),l[a]=v=(l[a-n]^S)>>>0}for(A=0;A<o;A++)a=o-A,A&3?S=l[a]:S=l[a-4],A<4||a<=4?c[A]=S:c[A]=g[h[S>>>24]]^f[h[S>>>16&255]]^p[h[S>>>8&255]]^y[h[S&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],h=a[3],u=this.uint8ArrayToUint32Array_(i);let d=u[0],g=u[1],f=u[2],p=u[3];const y=new Int32Array(e),v=new Int32Array(y.length);let S,C,Q,B,_,L,G,F,U,q,V,X,w,x;const $=this.networkToHostOrderSwap;for(;t<y.length;){for(U=$(y[t]),q=$(y[t+1]),V=$(y[t+2]),X=$(y[t+3]),_=U^n[0],L=X^n[1],G=V^n[2],F=q^n[3],w=4,x=1;x<r;x++)S=A[_>>>24]^l[L>>16&255]^c[G>>8&255]^h[F&255]^n[w],C=A[L>>>24]^l[G>>16&255]^c[F>>8&255]^h[_&255]^n[w+1],Q=A[G>>>24]^l[F>>16&255]^c[_>>8&255]^h[L&255]^n[w+2],B=A[F>>>24]^l[_>>16&255]^c[L>>8&255]^h[G&255]^n[w+3],_=S,L=C,G=Q,F=B,w=w+4;S=o[_>>>24]<<24^o[L>>16&255]<<16^o[G>>8&255]<<8^o[F&255]^n[w],C=o[L>>>24]<<24^o[G>>16&255]<<16^o[F>>8&255]<<8^o[_&255]^n[w+1],Q=o[G>>>24]<<24^o[F>>16&255]<<16^o[_>>8&255]<<8^o[L&255]^n[w+2],B=o[F>>>24]<<24^o[_>>16&255]<<16^o[L>>8&255]<<8^o[G&255]^n[w+3],v[t]=$(S^d),v[t+1]=$(B^g),v[t+2]=$(Q^f),v[t+3]=$(C^p),d=U,g=q,f=V,p=X,t=t+4}return v.buffer}}const op=16;class qo{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.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}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?rp(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=Dt(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new np),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=Ki(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new sp(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new ip(r,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(N.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%op;return i!==e.length&&(t=Ki(e,0,i),this.remainderData=Ki(e,i)),t}logOnce(e){this.logEnabled&&(N.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const ap={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},j={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 jo extends W0{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=j.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.loadedmetadata=!1,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.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=N.log.bind(N,`${r}:`),this.warn=N.warn.bind(N,`${r}:`),this.hls=e,this.fragmentLoader=new tp(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new qo(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){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=j.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return He.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===j.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=He.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${oe(o)?o.toFixed(3):o}, state: ${n}`),this.state===j.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=j.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._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=j.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===at.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&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)===at.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)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===j.STOPPED||this.state===j.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=j.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()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===fe.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?ap.toString(He.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==fe.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(h=>!!c[h])){this.state=j.IDLE;return}}const l=(A=this.levels)==null?void 0:A[e.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=j.IDLE,a&&(!this.loadedmetadata&&e.type==fe.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new Wo(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=j.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===j.KEY_LOADING&&(this.state=j.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=j.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,u,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),oe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(E.FRAG_LOADED,u);const g=fc(i,e.sn,h.index+1)||pc(l,e.sn,h.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===H.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:pe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?fc(a,n,o):null,l=A?A.fragment:T0(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==j.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=Dt(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!He.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=He.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return oe(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=He.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return He.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}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){const t=this.config,i=e||t.maxBufferLength;return t.maxMaxBufferLength>=i?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=fe.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,fe.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===at.OK||i===at.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=L0(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=k0(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,l=r.maxFragLookUpTolerance,c=i.partList,h=!!(r.lowLatencyMode&&c!=null&&c.length&&A);h&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let u;if(e<t){const d=e>t-l?0:l;u=cn(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,g=this.fragmentTracker.getState(u);if((g===at.OK||g===at.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const p=o[d+1];u.sn<a&&this.fragmentTracker.getState(p)!==at.OK?u=p:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,o=!t,a=e.alignedSliding&&oe(n);if(o||!a&&!n){const{fragPrevious:A}=this;Z0(A,i,e);const l=e.fragments[0].start;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${A?A.sn:"na"} fragments: ${r}`),l}return n}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;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&oe(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===H.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===dt.RetryRequest&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Ko(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=j.FRAG_LOADING_WAITING_RETRY}else if(l&&o)if(this.resetFragmentErrors(e),A<l.maxNumRetry)!n&&a!==dt.RemoveAlternatePermanently&&(o.resolved=!0);else{N.warn(`${t.details} reached or exceeded max retry (${A})`);return}else(o==null?void 0:o.action)===dt.SendAlternateToPenaltyBox?this.state=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===fe.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=He.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=j.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:dc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=j.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class xc{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=Ap(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Ap(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}function lp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function cp(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function hp(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Zt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Xo{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,r){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=Dt(this.cachedData,e),this.cachedData=null);let i=er(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?Do(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(A))&&(this.basePTS=up(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ot.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else Ff(e,r)?(i=er(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ot.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=Ki(e,n);this.cachedData?this.cachedData=Dt(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:Zt(),id3Track:a,textTrack:Zt()}}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:Zt(),id3Track:this._id3Track,textTrack:Zt()}}destroy(){}}const up=(s,e,t)=>{if(oe(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function dp(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){const u=new Error(`invalid ADTS sampling index:${h}`);s.emit(E.ERROR,E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!0,error:u,reason:u.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,N.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${h}`),/firefox/i.test(A)?h>=6?(r=5,a=new Array(4),n=h-3):(r=2,a=new Array(2),n=h):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=h):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&h>=6?n=h-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(h>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=h)),a[0]=r<<3,a[0]|=(h&14)>>1,a[1]|=(h&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[h],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function Tc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Dc(s,e){return s[e+1]&1?7:9}function zo(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function gp(s,e){return e+5<s.length}function fn(s,e){return e+1<s.length&&Tc(s,e)}function fp(s,e){return gp(s,e)&&Tc(s,e)&&zo(s,e)<=s.length-e}function pp(s,e){if(fn(s,e)){const t=Dc(s,e);if(e+t>=s.length)return!1;const i=zo(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||fn(s,r)}return!1}function Lc(s,e,t,i,r){if(!s.samplerate){const n=dp(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,N.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function _c(s){return 9216e4/s}function Ep(s,e){const t=Dc(s,e);if(e+t<=s.length){const i=zo(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function kc(s,e,t,i,r){const n=_c(s.samplerate),o=i+r*n,a=Ep(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}let pn=null;const Ip=[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],mp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Cp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],yp=[0,1,1,4];function Fc(s,e,t,i,r){if(t+24>e.length)return;const n=Nc(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function Nc(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=Ip[A*14+r-1]*1e3,h=mp[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=Cp[t][i],g=yp[i],f=d*8*g,p=Math.floor(d*l/h+o)*g;if(pn===null){const S=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);pn=S?parseInt(S[1]):0}return!!pn&&pn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:p,samplesPerFrame:f}}}function Zo(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Mc(s,e){return e+1<s.length&&Zo(s,e)}function vp(s,e){return Zo(s,e)&&4<=s.length-e}function Pc(s,e){if(e+1<s.length&&Zo(s,e)){const i=Nc(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Mc(s,n)}return!1}class Bp extends Xo{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=er(e,0);let i=(t==null?void 0:t.length)||0;if(Pc(e,i))return!1;for(let r=e.length;i<r;i++)if(pp(e,i))return N.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return fp(e,t)}appendFrame(e,t,i){Lc(e,this.observer,t,i,e.manifestCodec);const r=kc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Qp=/\/emsg[-/]ID3/i;class Sp{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,r){const n=this.videoTrack=Zt("video",1),o=this.audioTrack=Zt("audio",1),a=this.txtTrack=Zt("text",1);if(this.id3Track=Zt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=Gl(e);if(A.video){const{id:l,timescale:c,codec:h}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=h}if(A.audio){const{id:l,timescale:c,codec:h}=A.audio;o.id=l,o.timescale=c,o.codec=h}a.id=Ml.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return Yf(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Dt(this.remainderData,e));const a=zf(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=$l(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=$l(e,t),{videoTrack:t,audioTrack:Zt(),id3Track:r,textTrack:Zt()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ve(e.samples,["emsg"]);r&&r.forEach(n=>{const o=t0(n);if(Qp.test(o.schemeIdUri)){const a=oe(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Ot.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Oc=(s,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=s[e];const a=Math.min(i,8),A=8-a;n[0]=4278190080>>>24+A<<A,r[0]=(o[0]&n[0])>>A,t=t?t<<a|r[0]:r[0],e+=1,i-=a}return t};class bp extends Xo{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=Uc(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=er(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Do(t)!==void 0&&Oc(e,i)<16}}function Uc(s,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],A=e[t+4]&63,c=[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][A*3+n]*2;if(t+c>e.length)return-1;const h=e[t+6]>>5;let u=0;h===2?u+=2:(h&1&&h!==1&&(u+=2),h&4&&(u+=2));const d=(e[t+6]<<8|e[t+7])>>12-u&1,f=[2,1,2,3,3,4,4,5][h]+d,p=e[t+5]>>3,y=e[t+5]&7,v=new Uint8Array([n<<6|p<<1|y>>2,(y&3)<<6|h<<3|d<<2|A>>4,A<<4&224]),S=1536/a*9e4,C=i+r*S,Q=e.subarray(t,t+c);return s.config=v,s.channelCount=f,s.samplerate=a,s.samples.push({unit:Q,pts:C}),c}class wp{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&N.log(e.pts+"/"+e.dts+":"+e.debug)}}class Gc{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,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(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&&N.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)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const p=A();if(l(5),u(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const B=c();if(B===3&&u(1),g(),g(),u(1),h())for(o=B!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const y=c();if(y===0)c();else if(y===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const v=c(),S=c(),C=l(1);C===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let Q=[1,1];if(h()&&h())switch(A()){case 1:Q=[1,1];break;case 2:Q=[12,11];break;case 3:Q=[10,11];break;case 4:Q=[16,11];break;case 5:Q=[40,33];break;case 6:Q=[24,11];break;case 7:Q=[20,11];break;case 8:Q=[32,11];break;case 9:Q=[80,33];break;case 10:Q=[18,11];break;case 11:Q=[15,11];break;case 12:Q=[64,33];break;case 13:Q=[160,99];break;case 14:Q=[4,3];break;case 15:Q=[3,2];break;case 16:Q=[2,1];break;case 255:{Q=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((v+1)*16-e*2-t*2),height:(2-C)*(S+1)*16-(C?2:4)*(i+r),pixelRatio:Q}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Rp extends wp{parseAVCPES(e,t,i,r,n){const o=this.parseAVCNALu(e,i.data);let a=this.VideoSample,A,l=!1;i.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(c=>{var h;switch(c.type){case 1:{let f=!1;A=!0;const p=c.data;if(l&&p.length>4){const y=new Gc(p).readSliceType();(y===2||y===4||y===7||y===9)&&(f=!0)}if(f){var u;(u=a)!=null&&u.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=f;break}case 5:A=!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:{A=!0,Yl(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,y=new Gc(f).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||((d=e.pixelRatio)==null?void 0:d[0])!==y.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[f],e.duration=n;const v=f.subarray(1,4);let S="avc1.";for(let C=0;C<3;C++){let Q=v[C].toString(16);Q.length<2&&(Q="0"+Q),S+=Q}e.codec=S}break}case 8:A=!0,e.pps=[c.data];break;case 9:A=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:A=!0;break;default:A=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&A&&a.units.push(c)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(l=a-r-1,h>=0){const d={data:t.subarray(h,l),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l>0&&(d.data=Dt(d.data,t.subarray(0,l)),d.state=0))}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=Dt(d.data,t))}return e.naluState=r,o}}class xp{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new qo(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,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 r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=Kl(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const At=188;class xi{constructor(e,t,i){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._duration=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.videoParser=new Rp}static probe(e){const t=xi.syncOffset(e);return t>0&&N.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(At*5,t-At)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=At)if(e[A]===71&&(t-A===At||e[A+At]===71)){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+At*99,e.length-At)+1)),n||(n=ea(e,A)===0),n&&a>1&&(o===0&&a>2||A+At>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Ml[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=xi.createTrack("video"),this._audioTrack=xi.createTrack("audio",r),this._id3Track=xi.createTrack("id3"),this._txtTrack=xi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}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,r=!1){i||(this.sampleAes=null);let n;const o=this._videoTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,y=this.pmtParsed,v=this._pmtId,S=e.length;if(this.remainderData&&(e=Dt(this.remainderData,e),S=e.length,this.remainderData=null),S<At&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,xi.syncOffset(e));S-=(S-C)%At,S<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));let Q=0;for(let _=C;_<S;_+=At)if(e[_]===71){const L=!!(e[_+1]&64),G=ea(e,_),F=(e[_+3]&48)>>4;let U;if(F>1){if(U=_+5+e[_+4],U===_+At)continue}else U=_+4;switch(G){case c:L&&(h&&(n=ps(h))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(U,_+At)),h.size+=_+At-U);break;case u:if(L){if(g&&(n=ps(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(U,_+At)),g.size+=_+At-U);break;case d:L&&(f&&(n=ps(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(U,_+At)),f.size+=_+At-U);break;case 0:L&&(U+=e[U]+1),v=this._pmtId=Tp(e,U);break;case v:{L&&(U+=e[U]+1);const q=Dp(e,U,this.typeSupported,i);c=q.videoPid,c>0&&(o.pid=c,o.segmentCodec=q.segmentVideoCodec),u=q.audioPid,u>0&&(a.pid=u,a.segmentCodec=q.segmentAudioCodec),d=q.id3Pid,d>0&&(A.pid=d),p!==null&&!y&&(N.warn(`MPEG-TS PMT found at ${_} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,_=C-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=G;break}}else Q++;if(Q>0){const _=new Error(`Found ${Q} TS packet/s that do not start with 0x47`);this.observer.emit(E.ERROR,E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:_,reason:_.message})}o.pesData=h,a.pesData=g,A.pesData=f;const B={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(B),B}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:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=ps(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=ps(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&N.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=ps(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new xp(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1)n=Dt(r.sample.unit,n);else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!fn(n,o);o++);if(o!==i){let h;const u=o<a-1;u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES";const d=new Error(h);if(N.warn(`parsing error: ${h}`),this.observer.emit(E.ERROR,E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,levelRetry:u,error:d,reason:h}),!u)return}Lc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=_c(e.samplerate);A=r.sample.pts+h}else{N.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=kc(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!fn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){N.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(Mc(i,o)){const A=Fc(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){N.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let o=0,a=0,A;for(;a<n&&(A=Uc(e,i,a,r,o++))>0;)a+=A}}parseID3PES(e,t){if(t.pts===void 0){N.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ze({},t,{type:this._videoTrack?Ot.emsg:Ot.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ea(s,e){return((s[e+1]&31)<<8)+s[e+2]}function Tp(s,e){return(s[e+10]&31)<<8|s[e+11]}function Dp(s,e,t,i){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],o=e+3+n-4,a=(s[e+10]&15)<<8|s[e+11];for(e+=12+a;e<o;){const A=ea(s,e),l=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){ta("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=A);break;case 21:r.id3Pid===-1&&(r.id3Pid=A);break;case 219:if(!i){ta("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=A,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?N.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="mp3");break;case 193:if(!i){ta("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="ac3"):N.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&l>0){let c=e+5,h=l;for(;h>2;){switch(s[c]){case 106:t.ac3!==!0?N.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=A,r.segmentAudioCodec="ac3");break}const d=s[c+1]+2;c+=d,h-=d}}break;case 194:case 135:N.warn("Unsupported EC-3 in M2TS found");break;case 36:N.warn("Unsupported HEVC in M2TS found");break}e+=l+5}return r}function ta(s){N.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function ps(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=Dt(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(N.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const h=new Uint8Array(s.size);for(let u=0,d=a.length;u<d;u++){t=a[u];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;h.set(t,e),e+=g}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}class Lp extends Xo{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=er(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Do(t)!==void 0&&Oc(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Pc(e,i))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return vp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Fc(e,t,i,this.basePTS,this.frameIndex)}}class Hc{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 Ti=Math.pow(2,32)-1;class P{static init(){P.types={avc1:[],avcC:[],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 P.types)P.types.hasOwnProperty(e)&&(P.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]);P.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=n,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,o,A,o,a),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return P.box(P.types.hdlr,P.HDLR_TYPES[e])}static mdat(e){return P.box(P.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Ti+1)),r=Math.floor(t%(Ti+1));return P.box(P.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,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return P.box(P.types.mdia,P.mdhd(e.timescale,e.duration),P.hdlr(e.type),P.minf(e))}static mfhd(e){return P.box(P.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"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(e)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(e))}static moof(e,t,i){return P.box(P.types.moof,P.mfhd(e),P.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=P.trak(e[t]);return P.box.apply(null,[P.types.moov,P.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(P.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=P.trex(e[t]);return P.box.apply(null,[P.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Ti+1)),r=Math.floor(t%(Ti+1)),n=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,r>>24,r>>16&255,r>>8&255,r&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 P.box(P.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return P.box(P.types.sdtp,i)}static stbl(e){return P.box(P.types.stbl,P.stsd(e),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=P.box(P.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return P.box(P.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,A>>8&255,A&255,l>>8&255,l&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]),a,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return P.box(P.types.mp4a,P.audioStsd(e),P.box(P.types.esds,P.esds(e)))}static mp3(e){return P.box(P.types[".mp3"],P.audioStsd(e))}static ac3(e){return P.box(P.types["ac-3"],P.audioStsd(e),P.box(P.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(e)):e.segmentCodec==="ac3"?P.box(P.types.stsd,P.STSD,P.ac3(e)):P.box(P.types.stsd,P.STSD,P.mp4a(e)):P.box(P.types.stsd,P.STSD,P.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Ti+1)),a=Math.floor(i%(Ti+1));return P.box(P.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,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=P.sdtp(e),r=e.id,n=Math.floor(t/(Ti+1)),o=Math.floor(t%(Ti+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),P.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,P.box(P.types.trak,P.tkhd(e),P.mdia(e))}static trex(e){const t=e.id;return P.box(P.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||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,h,u;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,h=A.flags,u=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*a);return P.box(P.types.trun,o)}static initSegment(e){P.types||P.init();const t=P.moov(e);return Dt(P.FTYP,t)}}P.types=void 0,P.HDLR_TYPES=void 0,P.STTS=void 0,P.STSC=void 0,P.STCO=void 0,P.STSZ=void 0,P.VMHD=void 0,P.SMHD=void 0,P.STSD=void 0,P.FTYP=void 0,P.DINF=void 0;const $c=9e4;function ia(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function _p(s,e,t=1,i=!1){return ia(s,e,1/t,i)}function rr(s,e=!1){return ia(s,1e3,1/$c,e)}function kp(s,e=1){return ia(s,$c,1/e)}const Fp=10*1e3,Yc=1024,Np=1152,Mp=1536;let Es=null,sa=null;class En{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=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,Es===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Es=o?parseInt(o[1]):0}if(sa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);sa=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){N.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){N.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){N.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Lt(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&N.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,h,u,d,g,f=n,p=n;const y=e.pid>-1,v=t.pid>-1,S=t.samples.length,C=e.samples.length>0,Q=a&&S>0||S>1;if((!y||C)&&(!v||Q)||this.ISGenerated||a){if(this.ISGenerated){var _,L,G,F;const X=this.videoTrackConfig;X&&(t.width!==X.width||t.height!==X.height||((_=t.pixelRatio)==null?void 0:_[0])!==((L=X.pixelRatio)==null?void 0:L[0])||((G=t.pixelRatio)==null?void 0:G[1])!==((F=X.pixelRatio)==null?void 0:F[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,n,o);const U=this.isVideoContiguous;let q=-1,V;if(Q&&(q=Pp(t.samples),!U&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,q>0){N.warn(`[mp4-remuxer]: Dropped ${q} out of ${S} video samples due to a missing keyframe`);const X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(q),t.dropped+=q,p+=(t.samples[0].pts-X)/t.inputTimeScale,V=p}else q===-1&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${S} video samples`),g=!1);if(this.ISGenerated){if(C&&Q){const X=this.getVideoStartPts(t.samples),x=(Lt(e.samples[0].pts,X)-X)/t.inputTimeScale;f+=Math.max(0,x),p+=Math.max(0,-x)}if(C){if(e.samplerate||(N.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,v||Q||A===fe.AUDIO?p:void 0),Q){const X=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(N.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,U,X)}}else Q&&(l=this.remuxVideo(t,p,U,0));l&&(l.firstKeyFrame=q,l.independent=q!==-1,l.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=Kc(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=Vc(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:g,text:u,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,h="audio/mp4",u,d,g;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):P.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?u=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:P.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),p=Math.round(g*i);d=Math.min(d,Lt(o[0].dts,f)-p),u=Math.min(u,f-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:g},this._initDTS={baseTime:d,timescale:g}):u=g=void 0,{tracks:A,initPTS:u,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,h=8,u=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!i||c===null){const b=t*n,T=o[0].pts-Lt(o[0].dts,o[0].pts);Es&&c!==null&&Math.abs(b-T-c)<15e3?i=!0:c=b-T}const v=l.baseTime*n/l.timescale;for(let b=0;b<A;b++){const T=o[b];T.pts=Lt(T.pts-v,c),T.dts=Lt(T.dts-v,c),T.dts<o[b>0?b-1:b].dts&&(y=!0)}y&&o.sort(function(b,T){const K=b.dts-T.dts,M=b.pts-T.pts;return K||M}),d=o[0].dts,g=o[o.length-1].dts;const S=g-d,C=S?Math.round(S/(A-1)):u||e.inputTimeScale/30;if(i){const b=d-c,T=b>C,K=b<-1;if((T||K)&&(T?N.warn(`AVC: ${rr(b,!0)} ms (${b}dts) hole between fragments detected at ${t.toFixed(3)}`):N.warn(`AVC: ${rr(-b,!0)} ms (${b}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!K||c>=o[0].pts||Es)){d=c;const M=o[0].pts-b;if(T)o[0].dts=d,o[0].pts=M;else for(let W=0;W<o.length&&!(o[W].dts>M);W++)o[W].dts-=b,o[W].pts-=b;N.log(`Video: Initial PTS/DTS adjusted: ${rr(M,!0)}/${rr(d,!0)}, delta: ${rr(b,!0)} ms`)}}d=Math.max(0,d);let Q=0,B=0,_=d;for(let b=0;b<A;b++){const T=o[b],K=T.units,M=K.length;let W=0;for(let ie=0;ie<M;ie++)W+=K[ie].data.length;B+=W,Q+=M,T.length=W,T.dts<_?(T.dts=_,_+=C/4|0||1):_=T.dts,f=Math.min(T.pts,f),p=Math.max(T.pts,p)}g=o[A-1].dts;const L=B+4*Q+8;let G;try{G=new Uint8Array(L)}catch(b){this.observer.emit(E.ERROR,E.ERROR,{type:pe.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:b,bytes:L,reason:`fail allocating video mdat ${L}`});return}const F=new DataView(G.buffer);F.setUint32(0,L),G.set(P.types.mdat,4);let U=!1,q=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,w=Number.NEGATIVE_INFINITY;for(let b=0;b<A;b++){const T=o[b],K=T.units;let M=0;for(let ce=0,ae=K.length;ce<ae;ce++){const me=K[ce],Be=me.data,xe=me.data.byteLength;F.setUint32(h,xe),h+=4,G.set(Be,h),h+=xe,M+=4+xe}let W;if(b<A-1)u=o[b+1].dts-T.dts,W=o[b+1].pts-T.pts;else{const ce=this.config,ae=b>0?T.dts-o[b-1].dts:C;if(W=b>0?T.pts-o[b-1].pts:C,ce.stretchShortVideoTrack&&this.nextAudioPts!==null){const me=Math.floor(ce.maxBufferHole*n),Be=(r?f+r*n:this.nextAudioPts)-T.pts;Be>me?(u=Be-ae,u<0?u=ae:U=!0,N.log(`[mp4-remuxer]: It is approximately ${Be/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=ae}else u=ae}const ie=Math.round(T.pts-T.dts);q=Math.min(q,u),X=Math.max(X,u),V=Math.min(V,W),w=Math.max(w,W),a.push(new Jc(T.key,u,M,ie))}if(a.length){if(Es){if(Es<70){const b=a[0].flags;b.dependsOn=2,b.isNonSync=0}}else if(sa&&w-V<X-q&&C/X<.025&&a[0].cts===0){N.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let b=d;for(let T=0,K=a.length;T<K;T++){const M=b+a[T].duration,W=b+a[T].cts;if(T<K-1){const ie=M+a[T+1].cts;a[T].duration=ie-W}else a[T].duration=T?a[T-1].duration:C;a[T].cts=0,b=M}}}u=U||!u?C:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const R={data1:P.moof(e.sequenceNumber++,d,Ze({},e,{samples:a})),data2:G,startPTS:f/n,endPTS:(p+u)/n,startDTS:d/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,R}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Np;case"ac3":return Mp;default:return Yc}}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=this.getSamplesPerFrame(e),c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,p=u?0:8,y=this.nextAudioPts||-1;const v=t*o,S=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&y>0&&(r&&Math.abs(v-y)<9e3||Math.abs(Lt(f[0].pts-S,v)-y)<20*c),f.forEach(function(x){x.pts=Lt(x.pts-S,v)}),!i||y<0){if(f=f.filter(x=>x.pts>=0),!f.length)return;n===0?y=0:r&&!g?y=Math.max(0,v):y=f[0].pts}if(e.segmentCodec==="aac"){const x=this.config.maxAudioFramesDrift;for(let $=0,R=y;$<f.length;$++){const b=f[$],T=b.pts,K=T-R,M=Math.abs(1e3*K/o);if(K<=-x*c&&g)$===0&&(N.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*K/o)} ms.`),this.nextAudioPts=y=R=T);else if(K>=x*c&&M<Fp&&g){let W=Math.round(K/c);R=T-W*c,R<0&&(W--,R+=c),$===0&&(this.nextAudioPts=y=R),N.warn(`[mp4-remuxer]: Injecting ${W} audio frame @ ${(R/o).toFixed(3)}s due to ${Math.round(1e3*K/o)} ms gap.`);for(let ie=0;ie<W;ie++){const ce=Math.max(R,0);let ae=Hc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ae||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=b.unit.subarray()),f.splice($,0,{unit:ae,pts:ce}),R+=c,$++}}b.pts=R,R+=c}}let C=null,Q=null,B,_=0,L=f.length;for(;L--;)_+=f[L].unit.byteLength;for(let x=0,$=f.length;x<$;x++){const R=f[x],b=R.unit;let T=R.pts;if(Q!==null){const M=d[x-1];M.duration=Math.round((T-Q)/A)}else if(i&&e.segmentCodec==="aac"&&(T=y),C=T,_>0){_+=p;try{B=new Uint8Array(_)}catch(M){this.observer.emit(E.ERROR,E.ERROR,{type:pe.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:M,bytes:_,reason:`fail allocating audio mdat ${_}`});return}u||(new DataView(B.buffer).setUint32(0,_),B.set(P.types.mdat,4))}else return;B.set(b,p);const K=b.byteLength;p+=K,d.push(new Jc(!0,l,K,0)),Q=T}const G=d.length;if(!G)return;const F=d[d.length-1];this.nextAudioPts=y=Q+A*F.duration;const U=u?new Uint8Array(0):P.moof(e.sequenceNumber++,C/A,Ze({},e,{samples:d}));e.samples=[];const q=C/o,V=y/o,w={data1:U,data2:B,startPTS:q,endPTS:V,startDTS:q,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:G};return this.isAudioContiguous=!0,w}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*Yc,g=Math.ceil((u-h)/d),f=Hc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(N.warn("[mp4-remuxer]: remux empty Audio"),!f){N.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let y=0;y<g;y++){const v=h+y*d;p.push({unit:f,pts:v,dts:v})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Lt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function Pp(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Kc(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Lt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Lt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Vc(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=Lt(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class Jc{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Op{constructor(){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}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(Jf(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Gl(e);r.audio&&(t=Wc(r.audio,Fe.AUDIO)),r.video&&(i=Wc(r.video,Fe.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:N.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(u),g=this.initData),!((A=g)!=null&&A.length))return N.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=qf(u,g),p=Wf(g,u),y=p===null?n:p;(Up(l,y,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=y-n,l&&l.timescale===1&&N.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const v=e?y-l.baseTime/l.timescale:c,S=v+f;Xf(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=S:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,Q=!!g.video;let B="";C&&(B+="audio"),Q&&(B+="video");const _={data1:u,startPTS:v,startDTS:v,endPTS:S,endDTS:S,type:B,hasAudio:C,hasVideo:Q,nb:1,dropped:0};return h.audio=_.type==="audio"?_:void 0,h.video=_.type!=="audio"?_:void 0,h.initSegment=d,h.id3=Kc(i,n,l,l),r.samples.length&&(h.text=Vc(r,n,l)),h}}function Up(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function Wc(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Fe.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return rn(t,!1);const i="mp4a.40.5";return N.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return N.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Ei;try{Ei=self.performance.now.bind(self.performance)}catch{N.debug("Unable to use Performance API on this environment"),Ei=As==null?void 0:As.Date.now}const In=[{demux:Sp,remux:Op},{demux:xi,remux:En},{demux:Bp,remux:En},{demux:Lp,remux:En}];In.splice(2,0,{demux:bp,remux:En});class qc{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Ei();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:y,duration:v,initSegmentData:S}=A,C=Gp(o,t);if(C&&C.method==="AES-128"){const L=this.getDecrypter();if(L.isSync()){let G=L.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&(G=L.flush()),!G)return n.executeEnd=Ei(),ra(i);o=new Uint8Array(G)}else return this.decryptionPromise=L.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(G=>{const F=this.push(G,null,i);return this.decryptionPromise=null,F}),this.decryptionPromise}const Q=this.needsProbing(c,h);if(Q){const L=this.configureTransmuxer(o);if(L)return N.warn(`[transmuxer] ${L.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:L,reason:L.message}),n.executeEnd=Ei(),ra(i)}(c||h||g||Q)&&this.resetInitSegment(S,f,p,v,t),(c||g||Q)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const B=this.transmux(o,C,d,u,i),_=this.currentTransmuxState;return _.contiguous=!0,_.discontinuity=!1,_.trackSwitch=!1,n.executeEnd=Ei(),B}flush(e){const t=e.transmuxing;t.executeStart=Ei();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=Ei(),[ra(e)];const c=A.flush(a);return mn(c)?c.then(h=>(this.flushRemux(o,h,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;N.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=Ei()}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,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let u=0,d=In.length;u<d;u++){var a;if((a=In[u].demux)!=null&&a.probe(e)){o=In[u];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const A=this.demuxer,l=this.remuxer,c=o.remux,h=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!A||!(A instanceof h))&&(this.demuxer=new h(i,t,r),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 qo(this.config)),e}}function Gp(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ra=s=>({remuxResult:{},chunkMeta:s});function mn(s){return"then"in s&&s.then instanceof Function}class Hp{constructor(e,t,i,r,n){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=r,this.defaultInitPts=n||null}}class $p{constructor(e,t,i,r,n,o){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=r,this.timeOffset=n,this.initSegmentChange=o}}var jc={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,h,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,h||A,u),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)e.call(c,h)&&l.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,d=h.length,g=new Array(d);u<d;u++)g[u]=h[u].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,u,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var p=this._events[f],y=arguments.length,v,S;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,h),!0;case 4:return p.fn.call(p.context,c,h,u),!0;case 5:return p.fn.call(p.context,c,h,u,d),!0;case 6:return p.fn.call(p.context,c,h,u,d,g),!0}for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];p.fn.apply(p.context,v)}else{var C=p.length,Q;for(S=0;S<C;S++)switch(p[S].once&&this.removeListener(l,p[S].fn,void 0,!0),y){case 1:p[S].fn.call(p[S].context);break;case 2:p[S].fn.call(p[S].context,c);break;case 3:p[S].fn.call(p[S].context,c,h);break;case 4:p[S].fn.call(p[S].context,c,h,u);break;default:if(!v)for(Q=1,v=new Array(y-1);Q<y;Q++)v[Q-1]=arguments[Q];p[S].fn.apply(p[S].context,v)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,u){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!u||g.once)&&(!h||g.context===h)&&o(this,d);else{for(var f=0,p=[],y=g.length;f<y;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&p.push(g[f]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(jc);var Yp=jc.exports,na=gf(Yp);class Xc{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===E.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new na,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a=ls(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},A={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')},l=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||lp())){try{n.workerPath?(N.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=hp(n.workerPath)):(N.log(`injecting Web Worker for "${t}"`),this.workerContext=cp()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const d=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,N.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:pe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})},h.postMessage({cmd:"init",typeSupported:A,vendor:l,id:t,config:JSON.stringify(n)})}catch(h){N.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new qc(this.observer,A,n,l,t)}return}this.transmuxer=new qc(this.observer,A,n,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,p=this.frag,y=!(p&&n.cc===p.cc),v=!(p&&l.level===p.level),S=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,Q=S===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),B=!v&&(S===1||S===0&&(C===1||Q&&C<=0)),_=self.performance.now();(v||S||n.stats.parsing.start===0)&&(n.stats.parsing.start=_),o&&(C||!B)&&(o.stats.parsing.start=_);const L=!(p&&((h=n.initSegment)==null?void 0:h.url)===((u=p.initSegment)==null?void 0:u.url)),G=new $p(y,B,A,v,g,L);if(!B||y||L){N.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
164
+ Switching to level ${U} @ ${q|0} bps`),r.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:A})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(N.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 N0(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,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;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r: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 H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case H.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const o=performance.now(),a=n?n.stats:i.stats,A=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(A-Math.min(h,l),a.loaded)}else this.bwEstimator.sampleTTFB(A)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;oe(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===ge.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ge.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(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return N.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,n)&&o[e].loadError<=o[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,A=this.getBwEstimate(),l=this.getStarvationDelay();let c=n.abrBandWidthFactor,h=n.abrBandWidthUpFactor;if(l){const p=this.findBestLevel(A,o,r,l,0,c,h);if(p>=0)return p}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const p=this.bitrateTestDelay;p&&(u=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-p,N.info(`[abr] bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),c=h=1)}const d=this.findBestLevel(A,o,r,l,u,c,h);if(N.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const g=i.levels[o],f=i.levels[i.loadLevel];return(g==null?void 0:g.bitrate)<(f==null?void 0:f.bitrate)?o: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,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,o,a){var A;const l=r+n,c=this.lastLoadedFragLevel,h=c===-1?this.hls.firstLevel:c,{fragCurrent:u,partCurrent:d}=this,{levels:g,allAudioTracks:f,loadLevel:p,config:y}=this.hls;if(g.length===1)return 0;const v=g[h],S=!!(v!=null&&(A=v.details)!=null&&A.live),C=p===-1||c===-1;let Q,B="SDR",_=(v==null?void 0:v.frameRate)||0;const{audioPreference:L,videoPreference:G}=y,F=this.audioTracksByGroup||(this.audioTracksByGroup=$0(f));if(C){if(this.firstSelection!==-1)return this.firstSelection;const w=this.codecTiers||(this.codecTiers=Y0(g,F,t,i)),x=H0(w,B,e,L,G),{codecSet:$,videoRanges:R,minFramerate:b,minBitrate:T,preferHDR:K}=x;Q=$,B=K?R[R.length-1]:R[0],_=b,e=Math.max(e,T),N.log(`[abr] picked start tier ${JSON.stringify(x)}`)}else Q=v==null?void 0:v.codecSet,B=v==null?void 0:v.videoRange;const U=d?d.duration:u?u.duration:0,q=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let w=i;w>=t;w--){var X;const x=g[w],$=w>h;if(!x)continue;if(y.useMediaCapabilities&&!x.supportedResult&&!x.supportedPromise){const ie=navigator.mediaCapabilities;typeof(ie==null?void 0:ie.decodingInfo)=="function"&&M0(x,F,B,_,e,L)?(x.supportedPromise=P0(x,F,ie),x.supportedPromise.then(ce=>{if(!this.hls)return;x.supportedResult=ce;const ae=this.hls.levels,me=ae.indexOf(x);ce.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${ce.error}" for level ${me} ${JSON.stringify(ce)}`):ce.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${me} ${JSON.stringify(ce)}`),me>-1&&ae.length>1&&(N.log(`[abr] Removing unsupported level ${me}`),this.hls.removeLevel(me)))})):x.supportedResult=Bc}if(Q&&x.codecSet!==Q||B&&x.videoRange!==B||$&&_>x.frameRate||!$&&_>0&&_<x.frameRate||x.supportedResult&&!((X=x.supportedResult.decodingInfoResults)!=null&&X[0].smooth)){V.push(w);continue}const R=x.details,b=(d?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||U;let T;$?T=a*e:T=o*e;const K=U&&r>=U*2&&n===0?g[w].averageBitrate:g[w].maxBitrate,M=this.getTimeToLoadFrag(q,T,K*b,R===void 0);if(T>=K&&(w===c||x.loadError===0&&x.fragmentError===0)&&(M<=q||!oe(M)||S&&!this.bitrateTestDelay||M<l)){const ie=this.forcedAutoLevel;return w!==p&&(ie===-1||ie!==p)&&(V.length&&N.trace(`[abr] Skipped level(s) ${V.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[V[0]].codecs}" ${g[V[0]].videoRange}; not compatible with "${v.codecs}" ${B}`),N.info(`[abr] switch candidate:${h}->${w} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-K)} ttfb:${q.toFixed(1)} avgDuration:${b.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${M.toFixed(1)} firstSelection:${C} codecSet:${Q} videoRange:${B} hls.loadLevel:${p}`)),C&&(this.firstSelection=w),w}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class W0{constructor(){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(){}}var at={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class q0{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.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=fs(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],h=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,h,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),cn(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=fs(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h){const d=Math.max(o,r.start(c)),g=Math.min(a,r.end(c));g>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:g}))}else if(a<=h)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&cn(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||cn(t))}getState(e){const t=fs(e),i=this.fragments[t];return i?i.buffered?cn(i)?at.PARTIAL:at.OK:at.APPENDING:at.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=fs(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=fs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=fs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function cn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function fs(s){return`${s.type}_${s.level}_${s.sn}`}const j0={length:0,start:()=>0,end:()=>0};class He{static isBuffered(e,t){try{if(e){const i=He.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=He.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const h=l.start-c.start;return h||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const h=r[c-1].end;e[l].start-h<i?e[l].end>h&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,h=r[l].end;if(t+i>=c&&t<h)a=c,A=h,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return N.log("failed to get media.buffered",t),j0}}}class qo{constructor(e,t,i,r=0,n=-1,o=!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=hn(),this.buffering={audio:hn(),video:hn(),audiovideo:hn()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function hn(){return{start:0,executeStart:0,executeEnd:0,end:0}}function un(s,e){for(let i=0,r=s.length;i<r;i++){var t;if(((t=s[i])==null?void 0:t.cc)===e)return s[i]}return null}function X0(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function z0(s,e){const t=s.fragments,i=e.fragments;if(!i.length||!t.length){N.log("No fragments to align");return}const r=un(t,i[0].cc);if(!r||r&&!r.startPTS){N.log("No frag in previous level to align on");return}return r}function bc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function wc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)bc(t[i],s);e.fragmentHint&&bc(e.fragmentHint,s),e.alignedSliding=!0}function Z0(s,e,t){e&&(ep(s,t,e),!t.alignedSliding&&e&&dn(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&pc(e,t))}function ep(s,e,t){if(X0(s,t,e)){const i=z0(t,e);i&&oe(i.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),wc(i.start,e))}}function dn(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(r=un(i,o),n=un(t,o)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=un(t,r.cc)||t[Math.floor(t.length/2)]);const a=r.programDateTime,A=n.programDateTime;if(!a||!A)return;const l=(A-a)/1e3-(n.start-r.start);wc(l,s)}const Rc=Math.pow(2,17);class tp{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 pi({type:Ee.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(Tc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=xc(e),h=yc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Rc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l);let y=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),a({frag:e,part:null,payload:y,networkDetails:p})},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ot({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,p)=>{t&&t({frag:e,part:null,payload:f,networkDetails:p})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(Tc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=xc(e,t),h=yc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Rc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};i(y),a(y)},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ot({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new pi({type:Ee.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),h=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function xc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(oe(r)&&oe(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Tc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:Ee.MEDIA_ERROR,details:H.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new pi(i)}class pi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class ip{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class sp{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function rp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Ki(s,0,e-t):s}class np{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 r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],h=A[2],u=A[3],d=new Uint32Array(256);let g=0,f=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){let y=f^f<<1^f<<2^f<<3^f<<4;y=y>>>8^y&255^99,e[g]=y,t[y]=g;const v=d[g],S=d[v],C=d[S];let Q=d[y]*257^y*16843008;r[g]=Q<<24|Q>>>8,n[g]=Q<<16|Q>>>16,o[g]=Q<<8|Q>>>24,a[g]=Q,Q=C*16843009^S*65537^v*257^g*16843008,l[y]=Q<<24|Q>>>8,c[y]=Q<<16|Q>>>16,h[y]=Q<<8|Q>>>24,u[y]=Q,g?(g=v^d[d[d[C^v]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],y=d[3];let v,S;for(a=0;a<o;a++){if(a<n){v=l[a]=t[a];continue}S=v,a%n===0?(S=S<<8|S>>>24,S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255],S^=u[a/n|0]<<24):n>6&&a%n===4&&(S=h[S>>>24]<<24|h[S>>>16&255]<<16|h[S>>>8&255]<<8|h[S&255]),l[a]=v=(l[a-n]^S)>>>0}for(A=0;A<o;A++)a=o-A,A&3?S=l[a]:S=l[a-4],A<4||a<=4?c[A]=S:c[A]=g[h[S>>>24]]^f[h[S>>>16&255]]^p[h[S>>>8&255]]^y[h[S&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],h=a[3],u=this.uint8ArrayToUint32Array_(i);let d=u[0],g=u[1],f=u[2],p=u[3];const y=new Int32Array(e),v=new Int32Array(y.length);let S,C,Q,B,_,L,G,F,U,q,V,X,w,x;const $=this.networkToHostOrderSwap;for(;t<y.length;){for(U=$(y[t]),q=$(y[t+1]),V=$(y[t+2]),X=$(y[t+3]),_=U^n[0],L=X^n[1],G=V^n[2],F=q^n[3],w=4,x=1;x<r;x++)S=A[_>>>24]^l[L>>16&255]^c[G>>8&255]^h[F&255]^n[w],C=A[L>>>24]^l[G>>16&255]^c[F>>8&255]^h[_&255]^n[w+1],Q=A[G>>>24]^l[F>>16&255]^c[_>>8&255]^h[L&255]^n[w+2],B=A[F>>>24]^l[_>>16&255]^c[L>>8&255]^h[G&255]^n[w+3],_=S,L=C,G=Q,F=B,w=w+4;S=o[_>>>24]<<24^o[L>>16&255]<<16^o[G>>8&255]<<8^o[F&255]^n[w],C=o[L>>>24]<<24^o[G>>16&255]<<16^o[F>>8&255]<<8^o[_&255]^n[w+1],Q=o[G>>>24]<<24^o[F>>16&255]<<16^o[_>>8&255]<<8^o[L&255]^n[w+2],B=o[F>>>24]<<24^o[_>>16&255]<<16^o[L>>8&255]<<8^o[G&255]^n[w+3],v[t]=$(S^d),v[t+1]=$(B^g),v[t+2]=$(Q^f),v[t+3]=$(C^p),d=U,g=q,f=V,p=X,t=t+4}return v.buffer}}const op=16;class jo{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.useSoftware=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?rp(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=Dt(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new np),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=Ki(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i));this.key=t,this.fastAesKey=new sp(this.subtle,t)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new ip(this.subtle,new Uint8Array(i)).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(N.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%op;return i!==e.length&&(t=Ki(e,0,i),this.remainderData=Ki(e,i)),t}logOnce(e){this.logEnabled&&(N.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const ap={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},j={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 Xo extends W0{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=j.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.loadedmetadata=!1,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.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=N.log.bind(N,`${r}:`),this.warn=N.warn.bind(N,`${r}:`),this.hls=e,this.fragmentLoader=new tp(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new jo(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){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=j.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return He.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===j.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=He.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${oe(o)?o.toFixed(3):o}, state: ${n}`),this.state===j.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=j.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._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=j.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===at.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),A=this.backtrackFragment;((A?e.sn-A.sn:0)===1||this.reduceMaxBufferLength(a))&&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)===at.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)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===j.STOPPED||this.state===j.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=j.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()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===ge.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?ap.toString(He.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==ge.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(h=>!!c[h])){this.state=j.IDLE;return}}const l=(A=this.levels)==null?void 0:A[e.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=j.IDLE,a&&(!this.loadedmetadata&&e.type==ge.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new qo(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=j.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===j.KEY_LOADING&&(this.state=j.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=j.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,u,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),oe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(E.FRAG_LOADED,u);const g=Ec(i,e.sn,h.index+1)||Ic(l,e.sn,h.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===H.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?Ec(a,n,o):null,l=A?A.fragment:x0(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==j.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=Dt(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!He.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=He.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return oe(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=He.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return He.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}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){const t=this.config,i=e||t.maxBufferLength,r=t.maxMaxBufferLength/2;return r>=i?(t.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=ge.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,ge.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===at.OK||i===at.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=D0(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=k0(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,{maxFragLookUpTolerance:l}=r,c=i.partList,h=!!(r.lowLatencyMode&&c!=null&&c.length&&A);h&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let u;if(e<t){const d=e>t-l?0:l;u=ln(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,g=this.fragmentTracker.getState(u);if((g===at.OK||g===at.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const p=o[d+1];u.sn<a&&this.fragmentTracker.getState(p)!==at.OK?u=p:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,o=!t,a=e.alignedSliding&&oe(n);if(o||!a&&!n){const{fragPrevious:A}=this;Z0(A,i,e);const l=e.fragments[0].start;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${A?A.sn:"na"} fragments: ${r}`),l}return n}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;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&oe(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===H.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===dt.RetryRequest&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Vo(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=j.FRAG_LOADING_WAITING_RETRY}else if(l&&o)if(this.resetFragmentErrors(e),A<l.maxNumRetry)!n&&a!==dt.RemoveAlternatePermanently&&(o.resolved=!0);else{N.warn(`${t.details} reached or exceeded max retry (${A})`);return}else(o==null?void 0:o.action)===dt.SendAlternateToPenaltyBox?this.state=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===ge.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=He.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=j.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:fc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=j.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Dc{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=Ap(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Ap(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}function lp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function cp(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function hp(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Zt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class zo{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,r){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=Dt(this.cachedData,e),this.cachedData=null);let i=Zs(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?Lo(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(A))&&(this.basePTS=up(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ot.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else kf(e,r)?(i=Zs(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ot.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=Ki(e,n);this.cachedData?this.cachedData=Dt(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:Zt(),id3Track:a,textTrack:Zt()}}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:Zt(),id3Track:this._id3Track,textTrack:Zt()}}destroy(){}}const up=(s,e,t)=>{if(oe(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function dp(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){const u=new Error(`invalid ADTS sampling index:${h}`);s.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!0,error:u,reason:u.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,N.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${h}`),/firefox/i.test(A)?h>=6?(r=5,a=new Array(4),n=h-3):(r=2,a=new Array(2),n=h):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=h):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&h>=6?n=h-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(h>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=h)),a[0]=r<<3,a[0]|=(h&14)>>1,a[1]|=(h&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[h],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function Lc(s,e){return s[e]===255&&(s[e+1]&246)===240}function _c(s,e){return s[e+1]&1?7:9}function Zo(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function gp(s,e){return e+5<s.length}function gn(s,e){return e+1<s.length&&Lc(s,e)}function fp(s,e){return gp(s,e)&&Lc(s,e)&&Zo(s,e)<=s.length-e}function pp(s,e){if(gn(s,e)){const t=_c(s,e);if(e+t>=s.length)return!1;const i=Zo(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||gn(s,r)}return!1}function kc(s,e,t,i,r){if(!s.samplerate){const n=dp(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,N.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function Fc(s){return 9216e4/s}function Ep(s,e){const t=_c(s,e);if(e+t<=s.length){const i=Zo(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Nc(s,e,t,i,r){const n=Fc(s.samplerate),o=i+r*n,a=Ep(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}let fn=null;const Ip=[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],mp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Cp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],yp=[0,1,1,4];function Mc(s,e,t,i,r){if(t+24>e.length)return;const n=Pc(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function Pc(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=Ip[A*14+r-1]*1e3,h=mp[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=Cp[t][i],g=yp[i],f=d*8*g,p=Math.floor(d*l/h+o)*g;if(fn===null){const S=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fn=S?parseInt(S[1]):0}return!!fn&&fn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:p,samplesPerFrame:f}}}function ea(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Oc(s,e){return e+1<s.length&&ea(s,e)}function vp(s,e){return ea(s,e)&&4<=s.length-e}function Uc(s,e){if(e+1<s.length&&ea(s,e)){const i=Pc(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Oc(s,n)}return!1}class Bp extends zo{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Zs(e,0);let i=(t==null?void 0:t.length)||0;if(Uc(e,i))return!1;for(let r=e.length;i<r;i++)if(pp(e,i))return N.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return fp(e,t)}appendFrame(e,t,i){kc(e,this.observer,t,i,e.manifestCodec);const r=Nc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Qp=/\/emsg[-/]ID3/i;class Sp{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,r){const n=this.videoTrack=Zt("video",1),o=this.audioTrack=Zt("audio",1),a=this.txtTrack=Zt("text",1);if(this.id3Track=Zt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=Hl(e);if(A.video){const{id:l,timescale:c,codec:h}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=h}if(A.audio){const{id:l,timescale:c,codec:h}=A.audio;o.id=l,o.timescale=c,o.codec=h}a.id=Pl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return $f(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Dt(this.remainderData,e));const a=Xf(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=Yl(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=Yl(e,t),{videoTrack:t,audioTrack:Zt(),id3Track:r,textTrack:Zt()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ve(e.samples,["emsg"]);r&&r.forEach(n=>{const o=e0(n);if(Qp.test(o.schemeIdUri)){const a=oe(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Ot.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Gc=(s,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=s[e];const a=Math.min(i,8),A=8-a;n[0]=4278190080>>>24+A<<A,r[0]=(o[0]&n[0])>>A,t=t?t<<a|r[0]:r[0],e+=1,i-=a}return t};class bp extends zo{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=Hc(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=Zs(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Lo(t)!==void 0&&Gc(e,i)<16}}function Hc(s,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],A=e[t+4]&63,c=[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][A*3+n]*2;if(t+c>e.length)return-1;const h=e[t+6]>>5;let u=0;h===2?u+=2:(h&1&&h!==1&&(u+=2),h&4&&(u+=2));const d=(e[t+6]<<8|e[t+7])>>12-u&1,f=[2,1,2,3,3,4,4,5][h]+d,p=e[t+5]>>3,y=e[t+5]&7,v=new Uint8Array([n<<6|p<<1|y>>2,(y&3)<<6|h<<3|d<<2|A>>4,A<<4&224]),S=1536/a*9e4,C=i+r*S,Q=e.subarray(t,t+c);return s.config=v,s.channelCount=f,s.samplerate=a,s.samples.push({unit:Q,pts:C}),c}class wp{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&N.log(e.pts+"/"+e.dts+":"+e.debug)}}class $c{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,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(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&&N.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)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const p=A();if(l(5),u(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const B=c();if(B===3&&u(1),g(),g(),u(1),h())for(o=B!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const y=c();if(y===0)c();else if(y===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const v=c(),S=c(),C=l(1);C===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let Q=[1,1];if(h()&&h())switch(A()){case 1:Q=[1,1];break;case 2:Q=[12,11];break;case 3:Q=[10,11];break;case 4:Q=[16,11];break;case 5:Q=[40,33];break;case 6:Q=[24,11];break;case 7:Q=[20,11];break;case 8:Q=[32,11];break;case 9:Q=[80,33];break;case 10:Q=[18,11];break;case 11:Q=[15,11];break;case 12:Q=[64,33];break;case 13:Q=[160,99];break;case 14:Q=[4,3];break;case 15:Q=[3,2];break;case 16:Q=[2,1];break;case 255:{Q=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((v+1)*16-e*2-t*2),height:(2-C)*(S+1)*16-(C?2:4)*(i+r),pixelRatio:Q}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Rp extends wp{parseAVCPES(e,t,i,r,n){const o=this.parseAVCNALu(e,i.data);let a=this.VideoSample,A,l=!1;i.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(c=>{var h;switch(c.type){case 1:{let f=!1;A=!0;const p=c.data;if(l&&p.length>4){const y=new $c(p).readSliceType();(y===2||y===4||y===7||y===9)&&(f=!0)}if(f){var u;(u=a)!=null&&u.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=f;break}case 5:A=!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:{A=!0,Kl(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,y=new $c(f).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||((d=e.pixelRatio)==null?void 0:d[0])!==y.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[f],e.duration=n;const v=f.subarray(1,4);let S="avc1.";for(let C=0;C<3;C++){let Q=v[C].toString(16);Q.length<2&&(Q="0"+Q),S+=Q}e.codec=S}break}case 8:A=!0,e.pps=[c.data];break;case 9:A=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:A=!0;break;default:A=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&A&&a.units.push(c)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(l=a-r-1,h>=0){const d={data:t.subarray(h,l),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l>0&&(d.data=Dt(d.data,t.subarray(0,l)),d.state=0))}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=Dt(d.data,t))}return e.naluState=r,o}}class xp{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new jo(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,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 r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=Vl(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const At=188;class xi{constructor(e,t,i){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._duration=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.videoParser=new Rp}static probe(e){const t=xi.syncOffset(e);return t>0&&N.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(At*5,t-At)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=At)if(e[A]===71&&(t-A===At||e[A+At]===71)){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+At*99,e.length-At)+1)),n||(n=ta(e,A)===0),n&&a>1&&(o===0&&a>2||A+At>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Pl[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=xi.createTrack("video"),this._audioTrack=xi.createTrack("audio",r),this._id3Track=xi.createTrack("id3"),this._txtTrack=xi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}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,r=!1){i||(this.sampleAes=null);let n;const o=this._videoTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,y=this.pmtParsed,v=this._pmtId,S=e.length;if(this.remainderData&&(e=Dt(this.remainderData,e),S=e.length,this.remainderData=null),S<At&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,xi.syncOffset(e));S-=(S-C)%At,S<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));let Q=0;for(let _=C;_<S;_+=At)if(e[_]===71){const L=!!(e[_+1]&64),G=ta(e,_),F=(e[_+3]&48)>>4;let U;if(F>1){if(U=_+5+e[_+4],U===_+At)continue}else U=_+4;switch(G){case c:L&&(h&&(n=ps(h))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(U,_+At)),h.size+=_+At-U);break;case u:if(L){if(g&&(n=ps(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(U,_+At)),g.size+=_+At-U);break;case d:L&&(f&&(n=ps(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(U,_+At)),f.size+=_+At-U);break;case 0:L&&(U+=e[U]+1),v=this._pmtId=Tp(e,U);break;case v:{L&&(U+=e[U]+1);const q=Dp(e,U,this.typeSupported,i,this.observer);c=q.videoPid,c>0&&(o.pid=c,o.segmentCodec=q.segmentVideoCodec),u=q.audioPid,u>0&&(a.pid=u,a.segmentCodec=q.segmentAudioCodec),d=q.id3Pid,d>0&&(A.pid=d),p!==null&&!y&&(N.warn(`MPEG-TS PMT found at ${_} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,_=C-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=G;break}}else Q++;Q>0&&pn(this.observer,new Error(`Found ${Q} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=g,A.pesData=f;const B={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(B),B}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:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=ps(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=ps(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&N.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=ps(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new xp(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1)n=Dt(r.sample.unit,n);else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!gn(n,o);o++);if(o!==i){let h;const u=o<a-1;if(u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES",pn(this.observer,new Error(h),u),!u)return}kc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=Fc(e.samplerate);A=r.sample.pts+h}else{N.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=Nc(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!gn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){N.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(Oc(i,o)){const A=Mc(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){N.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let o=0,a=0,A;for(;a<n&&(A=Hc(e,i,a,r,o++))>0;)a+=A}}parseID3PES(e,t){if(t.pts===void 0){N.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ze({},t,{type:this._videoTrack?Ot.emsg:Ot.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ta(s,e){return((s[e+1]&31)<<8)+s[e+2]}function Tp(s,e){return(s[e+10]&31)<<8|s[e+11]}function Dp(s,e,t,i,r){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(s[e+1]&15)<<8|s[e+2],a=e+3+o-4,A=(s[e+10]&15)<<8|s[e+11];for(e+=12+A;e<a;){const l=ta(s,e),c=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){ia("ADTS AAC");break}case 15:n.audioPid===-1&&(n.audioPid=l);break;case 21:n.id3Pid===-1&&(n.id3Pid=l);break;case 219:if(!i){ia("H.264");break}case 27:n.videoPid===-1&&(n.videoPid=l,n.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?N.log("MPEG audio found, not supported in this browser"):n.audioPid===-1&&(n.audioPid=l,n.segmentAudioCodec="mp3");break;case 193:if(!i){ia("AC-3");break}case 129:t.ac3?n.audioPid===-1&&(n.audioPid=l,n.segmentAudioCodec="ac3"):N.log("AC-3 audio found, not supported in this browser");break;case 6:if(n.audioPid===-1&&c>0){let h=e+5,u=c;for(;u>2;){switch(s[h]){case 106:t.ac3!==!0?N.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=l,n.segmentAudioCodec="ac3");break}const g=s[h+1]+2;h+=g,u-=g}}break;case 194:case 135:return pn(r,new Error("Unsupported EC-3 in M2TS found")),n;case 36:return pn(r,new Error("Unsupported HEVC in M2TS found")),n}e+=c+5}return n}function pn(s,e,t){N.warn(`parsing error: ${e.message}`),s.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ia(s){N.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function ps(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=Dt(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(N.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const h=new Uint8Array(s.size);for(let u=0,d=a.length;u<d;u++){t=a[u];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;h.set(t,e),e+=g}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}class Lp extends zo{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Zs(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Lo(t)!==void 0&&Gc(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Uc(e,i))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return vp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Mc(e,t,i,this.basePTS,this.frameIndex)}}class Yc{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 Ti=Math.pow(2,32)-1;class P{static init(){P.types={avc1:[],avcC:[],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 P.types)P.types.hasOwnProperty(e)&&(P.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]);P.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=n,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,o,A,o,a),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return P.box(P.types.hdlr,P.HDLR_TYPES[e])}static mdat(e){return P.box(P.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Ti+1)),r=Math.floor(t%(Ti+1));return P.box(P.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,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return P.box(P.types.mdia,P.mdhd(e.timescale,e.duration),P.hdlr(e.type),P.minf(e))}static mfhd(e){return P.box(P.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"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(e)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(e))}static moof(e,t,i){return P.box(P.types.moof,P.mfhd(e),P.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=P.trak(e[t]);return P.box.apply(null,[P.types.moov,P.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(P.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=P.trex(e[t]);return P.box.apply(null,[P.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Ti+1)),r=Math.floor(t%(Ti+1)),n=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,r>>24,r>>16&255,r>>8&255,r&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 P.box(P.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return P.box(P.types.sdtp,i)}static stbl(e){return P.box(P.types.stbl,P.stsd(e),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=P.box(P.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return P.box(P.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,A>>8&255,A&255,l>>8&255,l&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]),a,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return P.box(P.types.mp4a,P.audioStsd(e),P.box(P.types.esds,P.esds(e)))}static mp3(e){return P.box(P.types[".mp3"],P.audioStsd(e))}static ac3(e){return P.box(P.types["ac-3"],P.audioStsd(e),P.box(P.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(e)):e.segmentCodec==="ac3"?P.box(P.types.stsd,P.STSD,P.ac3(e)):P.box(P.types.stsd,P.STSD,P.mp4a(e)):P.box(P.types.stsd,P.STSD,P.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Ti+1)),a=Math.floor(i%(Ti+1));return P.box(P.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,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&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,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=P.sdtp(e),r=e.id,n=Math.floor(t/(Ti+1)),o=Math.floor(t%(Ti+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),P.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,P.box(P.types.trak,P.tkhd(e),P.mdia(e))}static trex(e){const t=e.id;return P.box(P.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||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,h,u;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,h=A.flags,u=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*a);return P.box(P.types.trun,o)}static initSegment(e){P.types||P.init();const t=P.moov(e);return Dt(P.FTYP,t)}}P.types=void 0,P.HDLR_TYPES=void 0,P.STTS=void 0,P.STSC=void 0,P.STCO=void 0,P.STSZ=void 0,P.VMHD=void 0,P.SMHD=void 0,P.STSD=void 0,P.FTYP=void 0,P.DINF=void 0;const Kc=9e4;function sa(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function _p(s,e,t=1,i=!1){return sa(s,e,1/t,i)}function ir(s,e=!1){return sa(s,1e3,1/Kc,e)}function kp(s,e=1){return sa(s,Kc,1/e)}const Fp=10*1e3,Vc=1024,Np=1152,Mp=1536;let Es=null,ra=null;class En{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=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,Es===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Es=o?parseInt(o[1]):0}if(ra===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);ra=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){N.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){N.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){N.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Lt(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&N.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,h,u,d,g,f=n,p=n;const y=e.pid>-1,v=t.pid>-1,S=t.samples.length,C=e.samples.length>0,Q=a&&S>0||S>1;if((!y||C)&&(!v||Q)||this.ISGenerated||a){if(this.ISGenerated){var _,L,G,F;const X=this.videoTrackConfig;X&&(t.width!==X.width||t.height!==X.height||((_=t.pixelRatio)==null?void 0:_[0])!==((L=X.pixelRatio)==null?void 0:L[0])||((G=t.pixelRatio)==null?void 0:G[1])!==((F=X.pixelRatio)==null?void 0:F[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,n,o);const U=this.isVideoContiguous;let q=-1,V;if(Q&&(q=Pp(t.samples),!U&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,q>0){N.warn(`[mp4-remuxer]: Dropped ${q} out of ${S} video samples due to a missing keyframe`);const X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(q),t.dropped+=q,p+=(t.samples[0].pts-X)/t.inputTimeScale,V=p}else q===-1&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${S} video samples`),g=!1);if(this.ISGenerated){if(C&&Q){const X=this.getVideoStartPts(t.samples),x=(Lt(e.samples[0].pts,X)-X)/t.inputTimeScale;f+=Math.max(0,x),p+=Math.max(0,-x)}if(C){if(e.samplerate||(N.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,v||Q||A===ge.AUDIO?p:void 0),Q){const X=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(N.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,U,X)}}else Q&&(l=this.remuxVideo(t,p,U,0));l&&(l.firstKeyFrame=q,l.independent=q!==-1,l.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=Jc(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=Wc(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:g,text:u,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,h="audio/mp4",u,d,g;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):P.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?u=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:P.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),p=Math.round(g*i);d=Math.min(d,Lt(o[0].dts,f)-p),u=Math.min(u,f-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:g},this._initDTS={baseTime:d,timescale:g}):u=g=void 0,{tracks:A,initPTS:u,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,h=8,u=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!i||c===null){const b=t*n,T=o[0].pts-Lt(o[0].dts,o[0].pts);Es&&c!==null&&Math.abs(b-T-c)<15e3?i=!0:c=b-T}const v=l.baseTime*n/l.timescale;for(let b=0;b<A;b++){const T=o[b];T.pts=Lt(T.pts-v,c),T.dts=Lt(T.dts-v,c),T.dts<o[b>0?b-1:b].dts&&(y=!0)}y&&o.sort(function(b,T){const K=b.dts-T.dts,M=b.pts-T.pts;return K||M}),d=o[0].dts,g=o[o.length-1].dts;const S=g-d,C=S?Math.round(S/(A-1)):u||e.inputTimeScale/30;if(i){const b=d-c,T=b>C,K=b<-1;if((T||K)&&(T?N.warn(`AVC: ${ir(b,!0)} ms (${b}dts) hole between fragments detected at ${t.toFixed(3)}`):N.warn(`AVC: ${ir(-b,!0)} ms (${b}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!K||c>=o[0].pts||Es)){d=c;const M=o[0].pts-b;if(T)o[0].dts=d,o[0].pts=M;else for(let W=0;W<o.length&&!(o[W].dts>M);W++)o[W].dts-=b,o[W].pts-=b;N.log(`Video: Initial PTS/DTS adjusted: ${ir(M,!0)}/${ir(d,!0)}, delta: ${ir(b,!0)} ms`)}}d=Math.max(0,d);let Q=0,B=0,_=d;for(let b=0;b<A;b++){const T=o[b],K=T.units,M=K.length;let W=0;for(let ie=0;ie<M;ie++)W+=K[ie].data.length;B+=W,Q+=M,T.length=W,T.dts<_?(T.dts=_,_+=C/4|0||1):_=T.dts,f=Math.min(T.pts,f),p=Math.max(T.pts,p)}g=o[A-1].dts;const L=B+4*Q+8;let G;try{G=new Uint8Array(L)}catch(b){this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:b,bytes:L,reason:`fail allocating video mdat ${L}`});return}const F=new DataView(G.buffer);F.setUint32(0,L),G.set(P.types.mdat,4);let U=!1,q=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,w=Number.NEGATIVE_INFINITY;for(let b=0;b<A;b++){const T=o[b],K=T.units;let M=0;for(let ce=0,ae=K.length;ce<ae;ce++){const me=K[ce],Be=me.data,xe=me.data.byteLength;F.setUint32(h,xe),h+=4,G.set(Be,h),h+=xe,M+=4+xe}let W;if(b<A-1)u=o[b+1].dts-T.dts,W=o[b+1].pts-T.pts;else{const ce=this.config,ae=b>0?T.dts-o[b-1].dts:C;if(W=b>0?T.pts-o[b-1].pts:C,ce.stretchShortVideoTrack&&this.nextAudioPts!==null){const me=Math.floor(ce.maxBufferHole*n),Be=(r?f+r*n:this.nextAudioPts)-T.pts;Be>me?(u=Be-ae,u<0?u=ae:U=!0,N.log(`[mp4-remuxer]: It is approximately ${Be/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=ae}else u=ae}const ie=Math.round(T.pts-T.dts);q=Math.min(q,u),X=Math.max(X,u),V=Math.min(V,W),w=Math.max(w,W),a.push(new qc(T.key,u,M,ie))}if(a.length){if(Es){if(Es<70){const b=a[0].flags;b.dependsOn=2,b.isNonSync=0}}else if(ra&&w-V<X-q&&C/X<.025&&a[0].cts===0){N.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let b=d;for(let T=0,K=a.length;T<K;T++){const M=b+a[T].duration,W=b+a[T].cts;if(T<K-1){const ie=M+a[T+1].cts;a[T].duration=ie-W}else a[T].duration=T?a[T-1].duration:C;a[T].cts=0,b=M}}}u=U||!u?C:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const R={data1:P.moof(e.sequenceNumber++,d,Ze({},e,{samples:a})),data2:G,startPTS:f/n,endPTS:(p+u)/n,startDTS:d/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,R}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Np;case"ac3":return Mp;default:return Vc}}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=this.getSamplesPerFrame(e),c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,p=u?0:8,y=this.nextAudioPts||-1;const v=t*o,S=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&y>0&&(r&&Math.abs(v-y)<9e3||Math.abs(Lt(f[0].pts-S,v)-y)<20*c),f.forEach(function(x){x.pts=Lt(x.pts-S,v)}),!i||y<0){if(f=f.filter(x=>x.pts>=0),!f.length)return;n===0?y=0:r&&!g?y=Math.max(0,v):y=f[0].pts}if(e.segmentCodec==="aac"){const x=this.config.maxAudioFramesDrift;for(let $=0,R=y;$<f.length;$++){const b=f[$],T=b.pts,K=T-R,M=Math.abs(1e3*K/o);if(K<=-x*c&&g)$===0&&(N.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*K/o)} ms.`),this.nextAudioPts=y=R=T);else if(K>=x*c&&M<Fp&&g){let W=Math.round(K/c);R=T-W*c,R<0&&(W--,R+=c),$===0&&(this.nextAudioPts=y=R),N.warn(`[mp4-remuxer]: Injecting ${W} audio frame @ ${(R/o).toFixed(3)}s due to ${Math.round(1e3*K/o)} ms gap.`);for(let ie=0;ie<W;ie++){const ce=Math.max(R,0);let ae=Yc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ae||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ae=b.unit.subarray()),f.splice($,0,{unit:ae,pts:ce}),R+=c,$++}}b.pts=R,R+=c}}let C=null,Q=null,B,_=0,L=f.length;for(;L--;)_+=f[L].unit.byteLength;for(let x=0,$=f.length;x<$;x++){const R=f[x],b=R.unit;let T=R.pts;if(Q!==null){const M=d[x-1];M.duration=Math.round((T-Q)/A)}else if(i&&e.segmentCodec==="aac"&&(T=y),C=T,_>0){_+=p;try{B=new Uint8Array(_)}catch(M){this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:M,bytes:_,reason:`fail allocating audio mdat ${_}`});return}u||(new DataView(B.buffer).setUint32(0,_),B.set(P.types.mdat,4))}else return;B.set(b,p);const K=b.byteLength;p+=K,d.push(new qc(!0,l,K,0)),Q=T}const G=d.length;if(!G)return;const F=d[d.length-1];this.nextAudioPts=y=Q+A*F.duration;const U=u?new Uint8Array(0):P.moof(e.sequenceNumber++,C/A,Ze({},e,{samples:d}));e.samples=[];const q=C/o,V=y/o,w={data1:U,data2:B,startPTS:q,endPTS:V,startDTS:q,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:G};return this.isAudioContiguous=!0,w}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*Vc,g=Math.ceil((u-h)/d),f=Yc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(N.warn("[mp4-remuxer]: remux empty Audio"),!f){N.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let y=0;y<g;y++){const v=h+y*d;p.push({unit:f,pts:v,dts:v})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Lt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function Pp(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Jc(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Lt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Lt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Wc(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=Lt(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class qc{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Op{constructor(){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}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(Vf(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Hl(e);r.audio&&(t=jc(r.audio,Fe.AUDIO)),r.video&&(i=jc(r.video,Fe.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:N.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(u),g=this.initData),!((A=g)!=null&&A.length))return N.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=Wf(u,g),p=Jf(g,u),y=p===null?n:p;(Up(l,y,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=y-n,l&&l.timescale===1&&N.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const v=e?y-l.baseTime/l.timescale:c,S=v+f;jf(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=S:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,Q=!!g.video;let B="";C&&(B+="audio"),Q&&(B+="video");const _={data1:u,startPTS:v,startDTS:v,endPTS:S,endDTS:S,type:B,hasAudio:C,hasVideo:Q,nb:1,dropped:0};return h.audio=_.type==="audio"?_:void 0,h.video=_.type!=="audio"?_:void 0,h.initSegment=d,h.id3=Jc(i,n,l,l),r.samples.length&&(h.text=Wc(r,n,l)),h}}function Up(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function jc(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Fe.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return tn(t,!1);const i="mp4a.40.5";return N.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return N.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Ei;try{Ei=self.performance.now.bind(self.performance)}catch{N.debug("Unable to use Performance API on this environment"),Ei=ls==null?void 0:ls.Date.now}const In=[{demux:Sp,remux:Op},{demux:xi,remux:En},{demux:Bp,remux:En},{demux:Lp,remux:En}];In.splice(2,0,{demux:bp,remux:En});class Xc{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=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.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Ei();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:y,duration:v,initSegmentData:S}=A,C=Gp(o,t);if(C&&C.method==="AES-128"){const L=this.getDecrypter();if(L.isSync()){let G=L.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&(G=L.flush()),!G)return n.executeEnd=Ei(),na(i);o=new Uint8Array(G)}else return this.decryptionPromise=L.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(G=>{const F=this.push(G,null,i);return this.decryptionPromise=null,F}),this.decryptionPromise}const Q=this.needsProbing(c,h);if(Q){const L=this.configureTransmuxer(o);if(L)return N.warn(`[transmuxer] ${L.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:L,reason:L.message}),n.executeEnd=Ei(),na(i)}(c||h||g||Q)&&this.resetInitSegment(S,f,p,v,t),(c||g||Q)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const B=this.transmux(o,C,d,u,i),_=this.currentTransmuxState;return _.contiguous=!0,_.discontinuity=!1,_.trackSwitch=!1,n.executeEnd=Ei(),B}flush(e){const t=e.transmuxing;t.executeStart=Ei();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=Ei(),[na(e)];const c=A.flush(a);return mn(c)?c.then(h=>(this.flushRemux(o,h,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;N.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=Ei()}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,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let u=0,d=In.length;u<d;u++){var a;if((a=In[u].demux)!=null&&a.probe(e)){o=In[u];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const A=this.demuxer,l=this.remuxer,c=o.remux,h=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!A||!(A instanceof h))&&(this.demuxer=new h(i,t,r),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 jo(this.config)),e}}function Gp(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const na=s=>({remuxResult:{},chunkMeta:s});function mn(s){return"then"in s&&s.then instanceof Function}class Hp{constructor(e,t,i,r,n){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=r,this.defaultInitPts=n||null}}class $p{constructor(e,t,i,r,n,o){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=r,this.timeOffset=n,this.initSegmentChange=o}}var zc={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,h,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,h||A,u),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)e.call(c,h)&&l.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,d=h.length,g=new Array(d);u<d;u++)g[u]=h[u].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,u,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var p=this._events[f],y=arguments.length,v,S;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,h),!0;case 4:return p.fn.call(p.context,c,h,u),!0;case 5:return p.fn.call(p.context,c,h,u,d),!0;case 6:return p.fn.call(p.context,c,h,u,d,g),!0}for(S=1,v=new Array(y-1);S<y;S++)v[S-1]=arguments[S];p.fn.apply(p.context,v)}else{var C=p.length,Q;for(S=0;S<C;S++)switch(p[S].once&&this.removeListener(l,p[S].fn,void 0,!0),y){case 1:p[S].fn.call(p[S].context);break;case 2:p[S].fn.call(p[S].context,c);break;case 3:p[S].fn.call(p[S].context,c,h);break;case 4:p[S].fn.call(p[S].context,c,h,u);break;default:if(!v)for(Q=1,v=new Array(y-1);Q<y;Q++)v[Q-1]=arguments[Q];p[S].fn.apply(p[S].context,v)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,u){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!u||g.once)&&(!h||g.context===h)&&o(this,d);else{for(var f=0,p=[],y=g.length;f<y;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&p.push(g[f]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(zc);var Yp=zc.exports,oa=df(Yp);class Zc{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(l,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,l===E.ERROR&&(this.error=c.error),this.hls.trigger(l,c)};this.observer=new oa,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a=Vi(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},A={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||lp())){try{n.workerPath?(N.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=hp(n.workerPath)):(N.log(`injecting Web Worker for "${t}"`),this.workerContext=cp()),this.onwmsg=h=>this.onWorkerMessage(h);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=h=>{const u=new Error(`${h.message} (${h.filename}:${h.lineno})`);n.enableWorker=!1,N.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})},c.postMessage({cmd:"init",typeSupported:A,vendor:"",id:t,config:JSON.stringify(n)})}catch(c){N.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new Xc(this.observer,A,n,"",t)}return}this.transmuxer=new Xc(this.observer,A,n,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,p=this.frag,y=!(p&&n.cc===p.cc),v=!(p&&l.level===p.level),S=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,Q=S===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),B=!v&&(S===1||S===0&&(C===1||Q&&C<=0)),_=self.performance.now();(v||S||n.stats.parsing.start===0)&&(n.stats.parsing.start=_),o&&(C||!B)&&(o.stats.parsing.start=_);const L=!(p&&((h=n.initSegment)==null?void 0:h.url)===((u=p.initSegment)==null?void 0:u.url)),G=new $p(y,B,A,v,g,L);if(!B||y||L){N.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
165
165
  discontinuity: ${y}
166
166
  trackSwitch: ${v}
167
167
  contiguous: ${B}
168
168
  accurateTimeOffset: ${A}
169
169
  timeOffset: ${g}
170
- initSegmentChange: ${L}`);const F=new Hp(i,r,t,a,c);this.configureTransmuxer(F)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:G},e instanceof ArrayBuffer?[e]:[]);else if(d){const F=d.push(e,f,l,G);mn(F)?(d.async=!0,F.then(U=>{this.handleTransmuxComplete(U)}).catch(U=>{this.transmuxerError(U,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(F))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);mn(i)||t.async?(mn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":N[t.data.logType]&&N[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function zc(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Is(s[t].attrs,e[t].attrs))return!1;return!0}function Is(s,e,t){const i=s["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>s[r]!==e[r])}function oa(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const Zc=100;class Kp extends jo{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",fe.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-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.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===j.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Zc),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=j.IDLE):(this.loadedmetadata=!1,this.state=j.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=j.WAITING_INIT_PTS}break}case j.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;if(!r||i>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[o])||null),this.state=j.IDLE}break}case j.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=j.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=He.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);Vo(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=j.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!i&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=j.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Fe.AUDIO,fe.AUDIO));const l=this.getFwdBufferInfo(A,fe.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=j.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,fe.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len),f=a.fragments,p=f[0].start;let y=this.flushing?this.getLoadPosition():l.end;if(h&&i){const Q=this.getLoadPosition();c&&!Is(h.attrs,c.attrs)&&(y=Q),a.PTSKnown&&Q<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(d>=g&&!h&&y<f[f.length-1].start)return;let v=this.getNextFragment(y,a),S=!1;if(v&&this.isLoopLoading(v,y)&&(S=!!v.gap,v=this.getNextFragmentLoopLoading(v,a,l,fe.MAIN,g)),!v){this.bufferFlushed=!0;return}const C=u&&v.start>u.end+a.targetduration;if(C||!(u!=null&&u.len)&&l.len){const Q=this.getAppendedFrag(v.start,fe.MAIN);if(Q===null||(S||(S=!!Q.gap||!!C&&u.len===0),C&&!S||S&&l.nextStart&&l.nextStart<Q.end))return}this.loadFragment(v,o,y)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new hs(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(Zc):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=j.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=j.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;if(!a.details&&n.hasProgramDateTime&&c.hasProgramDateTime)gn(n,c),A=n.fragments[0].start;else{var l;A=this.alignPlaylists(n,a.details,(l=this.levelLastLoaded)==null?void 0:l.details)}}a.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,A),this.state===j.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=j.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){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 l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new Xc(this.hls,fe.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const p=r?r.index:-1,y=p!==-1,v=new Wo(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,y);u.push(n,g,h,"",i,r,c.totalduration,!1,v,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new xc,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=j.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==fe.AUDIO){if(!this.loadedmetadata&&i.type===fe.MAIN){const n=this.videoBuffer||this.media;n&&He.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,ot({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.AUDIO,t);break;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Te.AUDIO_TRACK&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Fe.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Fe.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,fe.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const p=A.initSegment||A;this._bufferInitSegment(c,f.tracks,p,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:f.tracks})}if(u){const{startPTS:p,endPTS:y,startDTS:v,endDTS:S}=u;l&&(l.elementaryStreams[Fe.AUDIO]={startPTS:p,endPTS:y,startDTS:v,endDTS:S}),A.setElementaryStreamInfo(Fe.AUDIO,p,y,v,S),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=Ze({id:i,frag:A,details:h},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=Ze({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${o}/${n.codec}]`),o&&o.split(",").length===1&&(n.levelCodec=o),this.hls.trigger(E.BUFFER_CODECS,t);const a=n.initSegment;if(a!=null&&a.byteLength){const A={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(E.BUFFER_APPENDING,A)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===at.NOT_LOADED||r===at.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.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=j.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&gn(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,r=i==null?void 0:i.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,ot({},e))}}class Vp extends Jo{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.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:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!i||i.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,d)=>{u.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const A=this.hls.config.audioPreference;if(!n&&A){const u=zt(A,a,gs);if(u>-1)n=a[u];else{const d=zt(A,this.tracks);n=this.tracks[d]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,c);const h=this.trackId;if(l!==-1&&h===-1)this.setAudioTrack(l);else if(a.length&&h===-1){var o;const u=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(u.message),this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:u})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Te.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-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 r=this.currentTrack;if(r&&ds(e,r,gs))return r;const n=zt(e,this.tracksInGroup,gs);if(n>-1){const o=this.tracksInGroup[n];return this.setAudioTrack(n),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=V0(e,t.levels,i,o,gs);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=zt(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,ot({},r)),n))return;const o=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||ds(e,r,gs)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A}=e;for(let l=0;l<t.length;l++){const c=t[l];if(ds({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,gs))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}const eh=500;class Jp extends jo{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",fe.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=j.IDLE,this.setInterval(eh),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=j.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,fe.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===fe.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===fe.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&zc(this.levels,t)){this.levels=t.map(i=>new hs(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new hs(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,fe.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 r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(eh)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:o,id:a}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const A=n[r];if(a>=n.length||a!==r||!A)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(i=A.details)!=null&&i.live){const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;const u=h.fragments[0];if(!A.details)o.hasProgramDateTime&&h.hasProgramDateTime?(gn(o,h),l=o.fragments[0].start):u&&(l=u.start,Yo(o,l));else{var c;l=this.alignPlaylists(o,A.details,(c=this.levelLastLoaded)==null?void 0:c.details),l===0&&u&&(l=u.start,Yo(o,l))}}A.details=o,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===j.IDLE&&(cn(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=He.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,fe.MAIN),c=i.details,h=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const p=this.fragPrevious;if(a<g){const y=r.maxFragLookUpTolerance,v=a>g-y?0:y;f=cn(p,u,Math.max(u[0].start,a),v),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const y=f.sn-c.startSN,v=u[y-1];v&&v.cc===f.cc&&this.fragmentTracker.getState(v)===at.NOT_LOADED&&(f=v)}this.fragmentTracker.getState(f)===at.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new Wp(this.tracksBuffered[this.currentTrackId]||[])}}class Wp{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class qp extends Jo{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.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=nn(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.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(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),nn(this.media.textTracks).forEach(t=>{cs(t)}),this.subtitleTrack=-1,this.media=null}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:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!i||i.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,h)=>{c.id=h});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!n&&a){this.selectDefaultTrack=!1;const c=zt(a,o);if(c>-1)n=o[c];else{const h=zt(a,this.tracks);n=this.tracks[h]}}let A=this.findTrackId(n);A===-1&&n&&(A=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,l),A!==-1&&this.trackId===-1&&this.setSubtitleTrack(A)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||ds(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(oa(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Te.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){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&ds(e,i))return i;const r=zt(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=zt(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=nn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>oa(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!oe(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:a="",name:A,type:l,url:c}=r;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(h)}}class jp{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){N.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const th=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class Xp{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:r}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:i,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&N.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource&&typeof self<"u"&&self.ManagedMediaSource,this.log=N.log.bind(N,t),this.warn=N.warn.bind(N,t),this.error=N.error.bind(N,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new jp(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,r=ls(this.appendSource);if(i&&r){var n;const o=this.mediaSource=new r;this.log(`created media source: ${(n=o.constructor)==null?void 0:n.name}`),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming));const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const A=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||A&&o instanceof A,ih(i),zp(i,a),i.load()}catch{i.src=a}else i.src=a;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&ih(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(o=>{if(i){const A=this.tracks[o];if(A&&typeof A.buffer.changeType=="function"){var a;const{id:l,codec:c,levelCodec:h,container:u,metadata:d}=t[o],g=Xl(A.codec,A.levelCodec),f=g==null?void 0:g.replace(th,"$1");let p=Xl(c,h);const y=(a=p)==null?void 0:a.replace(th,"$1");if(p&&f!==y){o.slice(0,5)==="audio"&&(p=rn(p,this.appendSource));const v=`${u};codecs=${p}`;this.appendChangeType(o,v),this.log(`switching codec ${g} to ${p}`),this.tracks[o]={buffer:A.buffer,codec:c,container:u,levelCodec:h,metadata:d,id:l}}}}else this.pendingTracks[o]=t[o]}),i)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=u),g&&g.start===0&&(g.start=u);const f=n.audio;let p=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=A.start,v={execute:()=>{if(h.executeStart=self.performance.now(),p){const S=this.sourceBuffer[a];if(S){const C=y-S.timestampOffset;Math.abs(C)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${y} (delta: ${C}) sn: ${A.sn})`),S.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();h.executeEnd=h.end=S,d.first===0&&(d.first=S),g&&g.first===0&&(g.first=S);const{sourceBuffer:C}=this,Q={};for(const B in C)Q[B]=He.getBuffered(C[B]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:Q})},onError:S=>{const C={type:pe.MEDIA_ERROR,parent:A.type,details:H.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:S,err:S,fatal:!1};if(S.code===DOMException.QUOTA_EXCEEDED_ERR)C.details=H.BUFFER_FULL_ERROR;else{const Q=++this.appendErrors[a];C.details=H.BUFFER_APPEND_ERROR,this.warn(`Failed ${Q}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),Q>=i.config.appendErrorMaxRetry&&(C.fatal=!0)}i.trigger(E.ERROR,C)}};r.append(v,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{this.warn(`Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[Fe.AUDIOVIDEO]?n.push("audiovideo"):(o[Fe.AUDIO]&&n.push("audio"),o[Fe.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,o=i.currentTime,a=t.levelTargetDuration,A=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(oe(A)&&A>0){const l=Math.max(A,a),c=Math.floor(o/a)*a-l;this.flushBackBuffer(o,a,c)}if(oe(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const l=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(l,a),h=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,h)}}flushBackBuffer(e,t,i){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(a=>{const A=n[a];if(A){const l=He.getBuffered(A);if(l.length>0&&i>l.start(0)){if(this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:i}),r!=null&&r.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(A.ended&&l.end(l.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const a=r[o];if(a){const A=He.getBuffered(a),l=A.length;if(l<2)return;const c=A.start(l-1),h=A.end(l-1);if(i>c||e>=c&&e<=h)return;if(a.ended&&e-h<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:o})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!oe(o))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${o}.`),t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||r===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);let o=n.levelCodec||n.codec;o&&r.slice(0,5)==="audio"&&(o=rn(o,this.appendSource));const a=`${n.container};codecs=${o}`;this.log(`creating sourceBuffer(${a})`);try{const A=t[r]=i.addSourceBuffer(a),l=r;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(l,"bufferedchange",(c,h)=>{const u=h.removedRanges;u!=null&&u.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:r})}),this.tracks[r]={buffer:A,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:r,mimeType:a})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=oe(r.duration)?r.duration:1/0,c=oe(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&(!A.ending||A.ended)?(A.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function ih(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function zp(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const sh={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},rh=function(e){let t=e;return sh.hasOwnProperty(e)&&(t=sh[e]),String.fromCharCode(t)},Gt=15,Ii=100,Zp={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},eE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},tE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},iE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},sE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class rE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;N.log(`${this.time} [${e}] ${i}`)}}}const Vi=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class nh{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 r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}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 nE{constructor(){this.uchar=" ",this.penState=new nh}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 oE{constructor(e){this.chars=[],this.pos=0,this.currPenState=new nh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ii;t++)this.chars.push(new nE);this.logger=e}equals(e){for(let t=0;t<Ii;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ii;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ii;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>Ii&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ii)}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=rh(e);if(this.pos>=Ii){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<Ii;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<Ii;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class aa{constructor(e){this.rows=[],this.currRow=Gt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Gt;t++)this.rows.push(new oE(e));this.logger=e}reset(){for(let e=0;e<Gt;e++)this.rows[e].clear();this.currRow=Gt-1}equals(e){let t=!0;for(let i=0;i<Gt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Gt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Gt;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<Gt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a!==null&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){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="",r=-1;for(let n=0;n<Gt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
171
- `)),i}getTextAndFormat(){return this.rows}}class oh{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 aa(i),this.nonDisplayedMemory=new aa(i),this.lastOutputScreen=new aa(i),this.currRollUpRow=this.displayedMemory.rows[Gt-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[Gt-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,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(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 ah{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lh(),this.logger=void 0;const r=this.logger=new rE;this.channels=[null,new oh(e,t,r),new oh(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(r=t[a]&127,n=t[a+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+Vi([t[a],t[a+1]])+"] -> ("+Vi([r,n])+")"),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n)),!i&&(o=this.parseChars(r,n),o)){const A=this.currentChannel;A&&A>0?this.channels[A].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!o&&this.logger.log(2,"Couldn't parse cleaned data "+Vi([r,n])+" orig: "+Vi([t[a],t[a+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(Ah(e,t,i))return ms(null,null,i),this.logger.log(3,"Repeated command ("+Vi([e,t])+") is dropped"),!0;const o=e===20||e===21||e===23?1:2,a=this.channels[o];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),ms(e,t,i),this.currentChannel=o,!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 r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Vi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(n||o))return!1;if(Ah(e,t,r))return ms(null,null,r),!0;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?Zp[e]:tE[e]:i=a===1?eE[e]:iE[e];const A=this.channels[a];return A?(A.setPAC(this.interpretPAC(i,t)),ms(e,t,r),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,"Special char '"+rh(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const o=Vi(r);this.logger.log(3,"Char codes = "+o.join(",")),ms(e,t,this.cmdHistory)}return r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=sE[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),ms(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=lh()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function ms(s,e,t){t.a=s,t.b=e}function Ah(s,e,t){return t.a===s&&t.b===e}function lh(){return{a:null,b:null}}class Cn{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}}var Aa=function(){if(As!=null&&As.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const h in c)a[h]=c[h]}return a}function o(a,A,l){const c=this,h={enumerable:!0};c.hasBeenReset=!1;let u="",d=!1,g=a,f=A,p=l,y=null,v="",S=!0,C="auto",Q="start",B=50,_="middle",L=50,G="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(F){u=""+F}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(F){d=!!F}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return g},set:function(F){if(typeof F!="number")throw new TypeError("Start time must be set to a number.");g=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return f},set:function(F){if(typeof F!="number")throw new TypeError("End time must be set to a number.");f=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return p},set:function(F){p=""+F,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return y},set:function(F){y=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return v},set:function(F){const U=i(F);if(U===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return S},set:function(F){S=!!F,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return C},set:function(F){if(typeof F!="number"&&F!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return Q},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");Q=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return B},set:function(F){if(F<0||F>100)throw new Error("Position must be between 0 and 100.");B=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return _},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");_=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return L},set:function(F){if(F<0||F>100)throw new Error("Size must be between 0 and 100.");L=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return G},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");G=U,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class aE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ch(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.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 AE{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 r=0;r<i.length;++r)if(t===i[r]){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 hh(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const la=new Aa(0,0,""),yn=la.align==="middle"?"middle":"center";function lE(s,e,t){const i=s;function r(){const a=ch(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new AE;hh(a,function(u,d){let g;switch(u){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(u,t[f].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",yn,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",yn,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",yn,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&la.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",yn);let h=l.get("position","auto");h==="auto"&&la.position===50&&(h=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=h}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function uh(s){return s.replace(/<br(?: \/)?>/gi,`
172
- `)}class cE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new aE,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 n=t.buffer,o=0;for(n=uh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
170
+ initSegmentChange: ${L}`);const F=new Hp(i,r,t,a,c);this.configureTransmuxer(F)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:G},e instanceof ArrayBuffer?[e]:[]);else if(d){const F=d.push(e,f,l,G);mn(F)?(d.async=!0,F.then(U=>{this.handleTransmuxComplete(U)}).catch(U=>{this.transmuxerError(U,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(F))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);mn(i)||t.async?(mn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){N.warn(`worker message received with no ${t?"event name":"data"}`);return}const i=this.hls;if(this.hls)switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":N[t.data.logType]&&N[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function eh(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Is(s[t].attrs,e[t].attrs))return!1;return!0}function Is(s,e,t){const i=s["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>s[r]!==e[r])}function aa(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const th=100;class Kp extends Xo{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",ge.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-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.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===j.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(th),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=j.IDLE):(this.loadedmetadata=!1,this.state=j.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=j.WAITING_INIT_PTS}break}case j.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;if(!r||i>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[o])||null),this.state=j.IDLE}break}case j.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=j.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=He.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);Jo(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=j.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!i&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=j.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Fe.AUDIO,ge.AUDIO));const l=this.getFwdBufferInfo(A,ge.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=j.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ge.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len),f=a.fragments,p=f[0].start;let y=this.flushing?this.getLoadPosition():l.end;if(h&&i){const Q=this.getLoadPosition();c&&!Is(h.attrs,c.attrs)&&(y=Q),a.PTSKnown&&Q<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(d>=g&&!h&&y<f[f.length-1].start)return;let v=this.getNextFragment(y,a),S=!1;if(v&&this.isLoopLoading(v,y)&&(S=!!v.gap,v=this.getNextFragmentLoopLoading(v,a,l,ge.MAIN,g)),!v){this.bufferFlushed=!0;return}const C=u&&v.start>u.end+a.targetduration;if(C||!(u!=null&&u.len)&&l.len){const Q=this.getAppendedFrag(v.start,ge.MAIN);if(Q===null||(S||(S=!!Q.gap||!!C&&u.len===0),C&&!S||S&&l.nextStart&&l.nextStart<Q.end))return}this.loadFragment(v,o,y)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new hs(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(th):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=j.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=j.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;if(!a.details&&n.hasProgramDateTime&&c.hasProgramDateTime)dn(n,c),A=n.fragments[0].start;else{var l;A=this.alignPlaylists(n,a.details,(l=this.levelLastLoaded)==null?void 0:l.details)}}a.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,A),this.state===j.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=j.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){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 l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new Zc(this.hls,ge.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const p=r?r.index:-1,y=p!==-1,v=new qo(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,y);u.push(n,g,h,"",i,r,c.totalduration,!1,v,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Dc,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=j.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==ge.AUDIO){if(!this.loadedmetadata&&i.type===ge.MAIN){const n=this.videoBuffer||this.media;n&&He.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,ot({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.AUDIO,t);break;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Te.AUDIO_TRACK&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Fe.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Fe.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,ge.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const p=A.initSegment||A;this._bufferInitSegment(c,f.tracks,p,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:f.tracks})}if(u){const{startPTS:p,endPTS:y,startDTS:v,endDTS:S}=u;l&&(l.elementaryStreams[Fe.AUDIO]={startPTS:p,endPTS:y,startDTS:v,endDTS:S}),A.setElementaryStreamInfo(Fe.AUDIO,p,y,v,S),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=Ze({id:i,frag:A,details:h},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=Ze({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${o}/${n.codec}]`),o&&o.split(",").length===1&&(n.levelCodec=o),this.hls.trigger(E.BUFFER_CODECS,t);const a=n.initSegment;if(a!=null&&a.byteLength){const A={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(E.BUFFER_APPENDING,A)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===at.NOT_LOADED||r===at.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.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=j.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&dn(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,r=i==null?void 0:i.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,ot({},e))}}class Vp extends Wo{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.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:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!i||i.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,d)=>{u.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const A=this.hls.config.audioPreference;if(!n&&A){const u=zt(A,a,gs);if(u>-1)n=a[u];else{const d=zt(A,this.tracks);n=this.tracks[d]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,c);const h=this.trackId;if(l!==-1&&h===-1)this.setAudioTrack(l);else if(a.length&&h===-1){var o;const u=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(u.message),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:u})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Te.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-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 r=this.currentTrack;if(r&&ds(e,r,gs))return r;const n=zt(e,this.tracksInGroup,gs);if(n>-1){const o=this.tracksInGroup[n];return this.setAudioTrack(n),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=V0(e,t.levels,i,o,gs);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=zt(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,ot({},r)),n))return;const o=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||ds(e,r,gs)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A}=e;for(let l=0;l<t.length;l++){const c=t[l];if(ds({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,gs))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}const ih=500;class Jp extends Xo{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",ge.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=j.IDLE,this.setInterval(ih),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=j.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,ge.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ge.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ge.SUBTITLE&&(t.details===H.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&eh(this.levels,t)){this.levels=t.map(i=>new hs(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new hs(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ge.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 r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(ih)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:o,id:a}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const A=n[a];if(a>=n.length||!A)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(i=A.details)!=null&&i.live){const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;const u=h.fragments[0];if(!A.details)o.hasProgramDateTime&&h.hasProgramDateTime?(dn(o,h),l=o.fragments[0].start):u&&(l=u.start,Ko(o,l));else{var c;l=this.alignPlaylists(o,A.details,(c=this.levelLastLoaded)==null?void 0:c.details),l===0&&u&&(l=u.start,Ko(o,l))}}A.details=o,this.levelLastLoaded=A,a===r&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===j.IDLE&&(ln(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=He.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,ge.MAIN),c=i.details,h=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const p=this.fragPrevious;if(a<g){const y=r.maxFragLookUpTolerance,v=a>g-y?0:y;f=ln(p,u,Math.max(u[0].start,a),v),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const y=f.sn-c.startSN,v=u[y-1];v&&v.cc===f.cc&&this.fragmentTracker.getState(v)===at.NOT_LOADED&&(f=v)}this.fragmentTracker.getState(f)===at.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new Wp(this.tracksBuffered[this.currentTrackId]||[])}}class Wp{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class qp extends Wo{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.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=sn(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.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(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),sn(this.media.textTracks).forEach(t=>{cs(t)}),this.subtitleTrack=-1,this.media=null}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:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}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,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!i||i.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,h)=>{c.id=h});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!n&&a){this.selectDefaultTrack=!1;const c=zt(a,o);if(c>-1)n=o[c];else{const h=zt(a,this.tracks);n=this.tracks[h]}}let A=this.findTrackId(n);A===-1&&n&&(A=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,l),A!==-1&&this.trackId===-1&&this.setSubtitleTrack(A)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||ds(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(aa(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Te.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){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&ds(e,i))return i;const r=zt(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=zt(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=sn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>aa(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!oe(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:a="",name:A,type:l,url:c}=r;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(h)}}class jp{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){N.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const sh=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class Xp{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:r}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:i,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&N.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=o0(Vi(e.config.preferManagedMediaSource)),this.log=N.log.bind(N,t),this.warn=N.warn.bind(N,t),this.error=N.error.bind(N,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new jp(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,r=Vi(this.appendSource);if(i&&r){var n;const o=this.mediaSource=new r;this.log(`created media source: ${(n=o.constructor)==null?void 0:n.name}`),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming));const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const A=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||A&&o instanceof A,rh(i),zp(i,a),i.load()}catch{i.src=a}else i.src=a;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&rh(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(o=>{if(i){const A=this.tracks[o];if(A&&typeof A.buffer.changeType=="function"){var a;const{id:l,codec:c,levelCodec:h,container:u,metadata:d}=t[o],g=zl(A.codec,A.levelCodec),f=g==null?void 0:g.replace(sh,"$1");let p=zl(c,h);const y=(a=p)==null?void 0:a.replace(sh,"$1");if(p&&f!==y){o.slice(0,5)==="audio"&&(p=tn(p,this.appendSource));const v=`${u};codecs=${p}`;this.appendChangeType(o,v),this.log(`switching codec ${g} to ${p}`),this.tracks[o]={buffer:A.buffer,codec:c,container:u,levelCodec:h,metadata:d,id:l}}}}else this.pendingTracks[o]=t[o]}),i)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=u),g&&g.start===0&&(g.start=u);const f=n.audio;let p=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=A.start,v={execute:()=>{if(h.executeStart=self.performance.now(),p){const S=this.sourceBuffer[a];if(S){const C=y-S.timestampOffset;Math.abs(C)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${y} (delta: ${C}) sn: ${A.sn})`),S.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();h.executeEnd=h.end=S,d.first===0&&(d.first=S),g&&g.first===0&&(g.first=S);const{sourceBuffer:C}=this,Q={};for(const B in C)Q[B]=He.getBuffered(C[B]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:Q})},onError:S=>{const C={type:Ee.MEDIA_ERROR,parent:A.type,details:H.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:S,err:S,fatal:!1};if(S.code===DOMException.QUOTA_EXCEEDED_ERR)C.details=H.BUFFER_FULL_ERROR;else{const Q=++this.appendErrors[a];C.details=H.BUFFER_APPEND_ERROR,this.warn(`Failed ${Q}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),Q>=i.config.appendErrorMaxRetry&&(C.fatal=!0)}i.trigger(E.ERROR,C)}};r.append(v,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{this.warn(`Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[Fe.AUDIOVIDEO]?n.push("audiovideo"):(o[Fe.AUDIO]&&n.push("audio"),o[Fe.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,o=i.currentTime,a=t.levelTargetDuration,A=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(oe(A)&&A>0){const l=Math.max(A,a),c=Math.floor(o/a)*a-l;this.flushBackBuffer(o,a,c)}if(oe(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const l=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(l,a),h=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,h)}}flushBackBuffer(e,t,i){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(a=>{const A=n[a];if(A){const l=He.getBuffered(A);if(l.length>0&&i>l.start(0)){if(this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:i}),r!=null&&r.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(A.ended&&l.end(l.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const a=r[o];if(a){const A=He.getBuffered(a),l=A.length;if(l<2)return;const c=A.start(l-1),h=A.end(l-1);if(i>c||e>=c&&e<=h)return;if(a.ended&&e-h<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:o})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!oe(o))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${o}.`),t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||r===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var r;const o=e[n];if(!o)throw Error(`source buffer exists for track ${n}, however track does not`);let a=((r=o.levelCodec)==null?void 0:r.indexOf(","))===-1?o.levelCodec:o.codec;a&&n.slice(0,5)==="audio"&&(a=tn(a,this.appendSource));const A=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${A})`);try{const l=t[n]=i.addSourceBuffer(A),c=n;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(c,"bufferedchange",(h,u)=>{const d=u.removedRanges;d!=null&&d.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:l,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(l){this.error(`error while trying to add sourceBuffer: ${l.message}`),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,sourceBufferName:n,mimeType:A})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=oe(r.duration)?r.duration:1/0,c=oe(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&(!A.ending||A.ended)?(A.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function rh(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function zp(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const Zp={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},nh=s=>String.fromCharCode(Zp[s]||s),Gt=15,Ii=100,eE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},tE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},iE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},sE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class nE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;N.log(`${this.time} [${e}] ${i}`)}}}const Ji=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class oh{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 r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}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 oE{constructor(){this.uchar=" ",this.penState=new oh}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 aE{constructor(e){this.chars=[],this.pos=0,this.currPenState=new oh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ii;t++)this.chars.push(new oE);this.logger=e}equals(e){for(let t=0;t<Ii;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ii;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ii;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>Ii&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ii)}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=nh(e);if(this.pos>=Ii){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<Ii;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<Ii;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Aa{constructor(e){this.rows=[],this.currRow=Gt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Gt;t++)this.rows.push(new aE(e));this.logger=e}reset(){for(let e=0;e<Gt;e++)this.rows[e].clear();this.currRow=Gt-1}equals(e){let t=!0;for(let i=0;i<Gt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Gt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Gt;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<Gt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a!==null&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){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="",r=-1;for(let n=0;n<Gt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
171
+ `)),i}getTextAndFormat(){return this.rows}}class ah{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 Aa(i),this.nonDisplayedMemory=new Aa(i),this.lastOutputScreen=new Aa(i),this.currRollUpRow=this.displayedMemory.rows[Gt-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[Gt-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,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(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 Ah{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=lE(),this.logger=void 0;const r=this.logger=new nE;this.channels=[null,new ah(e,t,r),new ah(e+1,i,r)]}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 r=t[i]&127,n=t[i+1]&127;let o=!1,a=null;if(r===0&&n===0)continue;this.logger.log(3,()=>"["+Ji([t[i],t[i+1]])+"] -> ("+Ji([r,n])+")");const A=this.cmdHistory;if(r>=16&&r<=31){if(AE(r,n,A)){Cn(null,null,A),this.logger.log(3,()=>"Repeated command ("+Ji([r,n])+") is dropped");continue}Cn(r,n,this.cmdHistory),o=this.parseCmd(r,n),o||(o=this.parseMidrow(r,n)),o||(o=this.parsePAC(r,n)),o||(o=this.parseBackgroundAttributes(r,n))}else Cn(null,null,A);if(!o&&(a=this.parseChars(r,n),a)){const c=this.currentChannel;c&&c>0?this.channels[c].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!a&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Ji([r,n])+" orig: "+Ji([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(i||r))return!1;const n=e===20||e===21||e===23?1:2,o=this.channels[n];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),this.currentChannel=n,!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 r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Ji([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const o=e<=23?1:2;t>=64&&t<=95?i=o===1?eE[e]:iE[e]:i=o===1?tE[e]:sE[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(i,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+nh(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+Ji(r).join(",")),r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=rE[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Cn(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 Cn(s,e,t){t.a=s,t.b=e}function AE(s,e,t){return t.a===s&&t.b===e}function lE(){return{a:null,b:null}}class yn{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}}var la=function(){if(ls!=null&&ls.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const h in c)a[h]=c[h]}return a}function o(a,A,l){const c=this,h={enumerable:!0};c.hasBeenReset=!1;let u="",d=!1,g=a,f=A,p=l,y=null,v="",S=!0,C="auto",Q="start",B=50,_="middle",L=50,G="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(F){u=""+F}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(F){d=!!F}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return g},set:function(F){if(typeof F!="number")throw new TypeError("Start time must be set to a number.");g=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return f},set:function(F){if(typeof F!="number")throw new TypeError("End time must be set to a number.");f=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return p},set:function(F){p=""+F,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return y},set:function(F){y=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return v},set:function(F){const U=i(F);if(U===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return S},set:function(F){S=!!F,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return C},set:function(F){if(typeof F!="number"&&F!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return Q},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");Q=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return B},set:function(F){if(F<0||F>100)throw new Error("Position must be between 0 and 100.");B=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return _},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");_=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return L},set:function(F){if(F<0||F>100)throw new Error("Size must be between 0 and 100.");L=F,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return G},set:function(F){const U=r(F);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");G=U,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class cE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function lh(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.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 hE{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 r=0;r<i.length;++r)if(t===i[r]){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 ch(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const ca=new la(0,0,""),vn=ca.align==="middle"?"middle":"center";function uE(s,e,t){const i=s;function r(){const a=lh(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new hE;ch(a,function(u,d){let g;switch(u){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(u,t[f].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",vn,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",vn,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",vn,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&ca.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",vn);let h=l.get("position","auto");h==="auto"&&ca.position===50&&(h=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=h}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function hh(s){return s.replace(/<br(?: \/)?>/gi,`
172
+ `)}class dE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new cE,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 n=t.buffer,o=0;for(n=hh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
173
173
  `;)++o;const a=n.slice(0,o);return n[o]==="\r"&&++o,n[o]===`
174
- `&&++o,t.buffer=n.slice(o),a}function r(n){hh(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Aa(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{lE(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!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+=`
174
+ `&&++o,t.buffer=n.slice(o),a}function r(n){ch(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new la(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{uE(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!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+=`
175
175
  `),t.cue.text+=n}continue;case"BADCUE":n||(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+=`
176
176
 
177
- `,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 hE=/\r\n|\n\r|\n|\r/g,ca=function(e,t,i=0){return e.slice(i,i+t.length)===t},uE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!oe(t)||!oe(i)||!oe(r)||!oe(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},ha=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function ua(s,e,t){return ha(s.toString())+ha(e.toString())+ha(t)}const dE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function gE(s,e,t,i,r,n,o){const a=new cE,A=Wt(new Uint8Array(s)).trim().replace(hE,`
177
+ `,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 gE=/\r\n|\n\r|\n|\r/g,ha=function(e,t,i=0){return e.slice(i,i+t.length)===t},fE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!oe(t)||!oe(i)||!oe(r)||!oe(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},ua=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function da(s,e,t){return ua(s.toString())+ua(e.toString())+ua(t)}const pE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function EE(s,e,t,i,r,n,o){const a=new dE,A=Wt(new Uint8Array(s)).trim().replace(gE,`
178
178
  `).split(`
179
- `),l=[],c=e?kp(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(p){const y=t[i];let v=t.ccOffset;const S=(u-c)/9e4;if(y!=null&&y.new&&(d!==void 0?v=t.ccOffset=y.start:dE(t,i,S)),S){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}v=S-t.presentationOffset}const C=p.endTime-p.startTime,Q=Lt((p.startTime+v-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(Q,0),p.endTime=Math.max(Q+C,0);const B=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(B)),p.id||(p.id=ua(p.startTime,p.endTime,B)),p.endTime>0&&l.push(p)},a.onparsingerror=function(p){g=p},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(p=>{if(f)if(ca(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(y=>{ca(y,"LOCAL:")?h=y.slice(6):ca(y,"MPEGTS:")&&(u=parseInt(y.slice(7)))});try{d=uE(h)/1e3}catch(y){g=y}return}else p===""&&(f=!1);a.parse(p+`
180
- `)}),a.flush()}const da="stpp.ttml.im1t",dh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,gh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,fE={left:"start",center:"center",right:"end",start:"start",end:"end"};function fh(s,e,t,i){const r=ve(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Wt(a)),o=_p(e.baseTime,1,e.timescale);try{n.forEach(a=>t(pE(a,o)))}catch(a){i(a)}}function pE(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((h,u)=>(h[u]=r.getAttribute(`ttp:${u}`)||n[u],h),{}),a=r.getAttribute("xml:space")!=="preserve",A=ph(ga(r,"styling","style")),l=ph(ga(r,"layout","region")),c=ga(r,"body","[begin]");return[].map.call(c,h=>{const u=Eh(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=pa(h.getAttribute("begin"),o),g=pa(h.getAttribute("dur"),o);let f=pa(h.getAttribute("end"),o);if(d===null)throw Ih(h);if(f===null){if(g===null)throw Ih(h);f=d+g}const p=new Aa(d-e,f-e,u);p.id=ua(p.startTime,p.endTime,p.text);const y=l[h.getAttribute("region")],v=A[h.getAttribute("style")],S=EE(y,v,A),{textAlign:C}=S;if(C){const Q=fE[C];Q&&(p.lineAlign=Q),p.align=C}return Ze(p,S),p}).filter(h=>h!==null)}function ga(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function ph(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Eh(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
181
- `:(n=i.childNodes)!=null&&n.length?Eh(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function EE(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=fa(e,i,A)||fa(s,i,A)||fa(r,i,A);return l&&(a[A]=l),a},{})}function fa(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Ih(s){return new Error(`Could not parse ttml timestamp ${s}`)}function pa(s,e){if(!s)return null;let t=ch(s);return t===null&&(dh.test(s)?t=IE(s,e):gh.test(s)&&(t=mE(s,e))),t}function IE(s,e){const t=dh.exec(s),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 mE(s,e){const t=gh.exec(s),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 CE{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=yh(),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(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Cn(this,"textTrack1"),t=new Cn(this,"textTrack2"),i=new Cn(this,"textTrack3"),r=new Cn(this,"textTrack4");this.cea608Parser1=new ah(1,e,t),this.cea608Parser2=new ah(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=yE(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(Ch(n,{name:e,lang:t,attrs:{}}))return n}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:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(n,o);if(a)i[e]=a,cs(i[e]),Ac(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{cs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=yh(),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++)cs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===da);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(zc(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?nn(o.textTracks):null;if(this.tracks.forEach((A,l)=>{let c;if(a){let h=null;for(let u=0;u<a.length;u++)if(a[u]&&Ch(a[u],A)){h=a[u],a[u]=null;break}h&&(c=h)}if(c)cs(c);else{const h=mh(A);c=this.createTextTrack(h,A.name,A.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const A=a.filter(l=>l!==null).map(l=>l.label);A.length&&N.warn(`Media element contains unused subtitle tracks: ${A.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r,lastCc:n,lastSn:o,lastPartIndex:a}=this;if(!(!this.enabled||!i||!r)&&t.frag.type===fe.MAIN){var A,l;const{cc:c,sn:h}=t.frag,u=(A=t==null||(l=t.part)==null?void 0:l.index)!=null?A:-1;h===o+1||h===o&&u===a+1||c===n||(i.reset(),r.reset()),this.lastCc=c,this.lastSn=h,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===fe.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===da?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;fh(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{N.log(`Failed to parse IMSC1: ${r}`),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?Dt(i.initSegment.data,new Uint8Array(r)):r;gE(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),N.log(`Failed to parse VTT cue: ${c}`),!(h&&a>i.cc)&&A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||fh(t,this.initPTS[e.cc],()=>{i.textCodec=da,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>lc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===fe.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;const{frag:n,samples:o}=t;if(!(n.type===fe.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>Oo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>Oo(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function mh(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Ch(s,e){return!!s&&s.kind===mh(e)&&oa(e,s)}function yE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function yh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ea{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(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.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&&oe(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}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&&N.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,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((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Ea.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.width||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 e}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 r=(a,A)=>A?a.width!==A.width||a.height!==A.height:!0;let n=e.length-1;const o=Math.max(t,i);for(let a=0;a<e.length;a+=1){const A=e[a];if((A.width>=o||A.height>=o)&&r(A,e[a+1])){n=a;break}}return n}}class vE{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(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,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 r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;N.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,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)}}const vn="[eme]";class Cs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Cs.CDMCleanupPromise?[Cs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=N.debug.bind(N,vn),this.log=N.log.bind(N,vn),this.warn=N.warn.bind(N,vn),this.error=N.error.bind(N,vn),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Ke.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(h=>o({keySystem:c,mediaKeys:h})).catch(h=>{l.length?A(l):h instanceof _t?a(h):a(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return _l===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=_f(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(h=>h?this.setMediaKeysServerCertificate(c,e,h):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${qt.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return qt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${qt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
182
- } (data length: ${t&&t.byteLength})`),r.update(t)}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){return new Promise((t,i)=>{const r=xo(this.config),n=e.map(Tl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=Ll(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(A,"cenc",t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof _t?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Tl(e.keyFormat),n=r?[r]:xo(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=xo(this.config)),e.length===0)throw new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Ke.FAIRPLAY]){const c=nt(new Uint8Array(i));try{const h=wo(JSON.parse(c).sinf),u=Hl(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ke.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=r0(i);if(c===null)return;c.version===0&&c.systemId===Dl.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=Lf(c.systemId)}if(!n||!r)return;const o=qt.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const h=A[c],u=h.decryptdata;if(u.pssh||!u.keyId)continue;const d=qt.hexDump(u.keyId);if(o===d||u.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],u.pssh=new Uint8Array(i),u.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(h,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:h})=>{var u;this.throwIfDestroyed();const d=new tr("ISO-23001-7",o,(u=Ll(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const g=a.call(this.hls,t,i,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");t=g.initDataType,i=e.decryptdata.pssh=g.initData?new Uint8Array(g.initData):null}catch(g){var A;if(this.warn(g.message),(A=this.hls)!=null&&A.config.debug)throw g}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new na,h=e._onmessage=g=>{const f=e.mediaKeysSession;if(!f){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=g;this.log(`"${p}" message event for session "${f.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(v=>{this.handleError(v),c.emit("error",v)}):p==="license-release"?e.keySystem===Ke.FAIRPLAY&&(this.updateKeySession(e,Ro("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},u=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const p=e.keyStatus;c.emit("keyStatus",p),p==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);const d=new Promise((g,f)=>{c.on("error",f),c.on("keyStatus",p=>{p.startsWith("usable")?g():p==="output-restricted"?f(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?f(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var g;this.log(`Request generated for key-session "${(g=e.mediaKeysSession)==null?void 0:g.sessionId}" keyId: ${l}`)}).catch(g=>{throw new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_SESSION,error:g,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>d).catch(g=>{throw c.removeAllListeners(),this.removeSession(e),g}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${qt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${qt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{o(u.data)},onError:(u,d,g,f)=>{a(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:ot({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,g)=>{a(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,g)=>{a(new Error("aborted"))}};r.load(A,c,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.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 r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let c;for(let h=0,u=n.length;h<u;h++){var o,a;c=n[h];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,g=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&g&&e.setRequestHeader(d,g)}}const A=r.querySelector("Challenge"),l=A==null?void 0:A.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return Ro(atob(l))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new _t({type:pe.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{e.keySystem==Ke.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(A,l)),A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},tr.clearKeyUriToKeyIdMap();const i=t.length;Cs.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),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);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Cs.CDMCleanupPromise=void 0;class _t 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}}var Et;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(Et||(Et={}));var Ia;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Ia||(Ia={}));var Ji;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Ji||(Ji={}));const BE={[Ji.OBJECT]:["br","d","ot","tb"],[Ji.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Ji.SESSION]:["cid","pr","sf","sid","st","v"],[Ji.STATUS]:["bs","rtp"]};class ys{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof ys?i:new ys(i))),this.value=e,this.params=t}}class vh{constructor(e){this.description=void 0,this.description=e}}const QE="Dict";function SE(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function bE(s,e,t,i){return new Error(`failed to ${s} "${SE(e)}" as ${t}`,{cause:i})}const Bh="Bare Item",wE="Boolean",RE="Byte Sequence",xE="Decimal",TE="Integer";function DE(s){return s<-999999999999999||999999999999999<s}const LE=/[\x00-\x1f\x7f]+/,_E="Token",kE="Key";function ei(s,e,t){return bE("serialize",s,e,t)}function FE(s){if(typeof s!="boolean")throw ei(s,wE);return s?"?1":"?0"}function NE(s){return btoa(String.fromCharCode(...s))}function ME(s){if(ArrayBuffer.isView(s)===!1)throw ei(s,RE);return`:${NE(s)}:`}function Qh(s){if(DE(s))throw ei(s,TE);return s.toString()}function PE(s){return`@${Qh(s.getTime()/1e3)}`}function Sh(s,e){if(s<0)return-Sh(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const r=Math.floor(s*t);return(r%2===0?r:r+1)/t}else return Math.round(s*t)/t}function OE(s){const e=Sh(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ei(s,xE);const t=e.toString();return t.includes(".")?t:`${t}.0`}const UE="String";function GE(s){if(LE.test(s))throw ei(s,UE);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function HE(s){return s.description||s.toString().slice(7,-1)}function bh(s){const e=HE(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ei(e,_E);return e}function ma(s){switch(typeof s){case"number":if(!oe(s))throw ei(s,Bh);return Number.isInteger(s)?Qh(s):OE(s);case"string":return GE(s);case"symbol":return bh(s);case"boolean":return FE(s);case"object":if(s instanceof Date)return PE(s);if(s instanceof Uint8Array)return ME(s);if(s instanceof vh)return bh(s);default:throw ei(s,Bh)}}function Ca(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw ei(s,kE);return s}function ya(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Ca(e)}`:`;${Ca(e)}=${ma(t)}`).join("")}function wh(s){return s instanceof ys?`${ma(s.value)}${ya(s.params)}`:ma(s)}function $E(s){return`(${s.value.map(wh).join(" ")})${ya(s.params)}`}function YE(s,e={whitespace:!0}){if(typeof s!="object")throw ei(s,QE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof ys||(n=new ys(n));let o=Ca(r);return n.value===!0?o+=ya(n.params):(o+="=",Array.isArray(n.value)?o+=$E(n):o+=wh(n)),o}).join(`,${i}`)}function KE(s,e){return YE(s,e)}const VE=s=>s==="ot"||s==="sf"||s==="st",JE=s=>typeof s=="number"?oe(s):s!=null&&s!==""&&s!==!1;function WE(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function qE(){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,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const Bn=s=>Math.round(s),jE=(s,e)=>(e!=null&&e.baseUrl&&(s=WE(s,e.baseUrl)),encodeURIComponent(s)),Qn=s=>Bn(s/100)*100,XE={br:Bn,d:Bn,bl:Qn,dl:Qn,mtp:Qn,nor:jE,rtp:Qn,tb:Bn};function zE(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=Ze({},XE,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return i.forEach(o=>{if(n!=null&&n(o))return;let a=s[o];const A=r[o];A&&(a=A(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||JE(a)&&(VE(o)&&typeof a=="string"&&(a=new vh(a)),t[o]=a))}),t}function Rh(s,e={}){return s?KE(zE(s,e),Ze({whitespace:!1},e)):""}function ZE(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(BE).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,o)=>{var a,A;const[l,c]=o,h=((a=i.find(u=>u[1].includes(l)))==null?void 0:a[0])||Ji.REQUEST;return(A=n[h])!=null||(n[h]={}),n[h][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=Rh(a,e),n),{})}function eI(s,e,t){return Ze(s,ZE(e,t))}const tI="CMCD";function iI(s,e={}){if(!s)return"";const t=Rh(s,e);return`${tI}=${encodeURIComponent(t)}`}const xh=/CMCD=[^&#]+/;function sI(s,e,t){const i=iI(e,t);if(!i)return s;if(xh.test(s))return s.replace(xh,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class rI{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=r=>{try{this.apply(r,{ot:Et.MANIFEST,su:!this.initialized})}catch(n){N.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===Et.VIDEO||a===Et.AUDIO||a==Et.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){N.warn("Could not generate segment CMCD data.",n)}},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||qE(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Ia.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ze(t,this.createData());const i=t.ot===Et.INIT||t.ot===Et.VIDEO||t.ot===Et.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,o)=>(r.includes(o)&&(n[o]=t[o]),n),{})),this.useHeaders?(e.headers||(e.headers={}),eI(e.headers,t)):e.url=sI(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Et.TIMED_TEXT;if(e.sn==="initSegment")return Et.INIT;if(t==="audio")return Et.AUDIO;if(t==="main")return this.hls.audioTracks.length?Et.VIDEO:Et.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Et.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Et.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:He.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(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}}const nI=3e5;class oI{constructor(e){this.hls=void 0,this.log=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.log=N.log.bind(N,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}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)===dt.SendAlternateToPenaltyBox&&i.flags===Ut.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:A,type:l}=t.context;a&&r?o=this.getPathwayForGroupId(a,l,o):A&&(o=A)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!n&&r&&(n=r.reduce((a,A)=>(a.indexOf(A.pathwayId)===-1&&a.push(A.pathwayId),a),[])),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==o),i.resolved||N.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(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):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>nI&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(o in i)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,Ec(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===Te.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===Te.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=new We(c.attrs);h["PATHWAY-ID"]=o;const u=h.AUDIO&&`${h.AUDIO}_clone_${o}`,d=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;u&&(i[h.AUDIO]=u,h.AUDIO=u),d&&(r[h.SUBTITLES]=d,h.SUBTITLES=d);const g=Dh(c.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new hs({attrs:h,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:g,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)f.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)f.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return f});t.push(...l),Th(this.audioTracks,i,A,o),Th(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||u.url),p&&this.clonePathways(p);const v={steeringManifest:g,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,v),y&&this.updatePathwayPriority(y)},onError:(c,h,u,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${h.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,g)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Th(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=Ze({},o);return a.details=void 0,a.attrs=new We(a.attrs),a.url=a.attrs.URI=Dh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Dh(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const aI=/^age:\s*[\d.]+\s*$/im;class Lh{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 jr,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=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,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(i,t.url)}).catch(o=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);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=n&&oe(n)?n:o,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 r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry,c={url:e.url,data:void 0,code:o};ln(A,l,!1,c)?this.retry(A):(N.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,i=this.stats.retry;if(ln(t,i,!0))this.retry(t);else{var r;N.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Ko(e,i.retry),i.retry++,N.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&&aI.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}}function AI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const lI=/(\d+)-(\d+)\/(\d+)/;class _h{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||dI,this.controller=new self.AbortController,this.stats=new jr}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 r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=cI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&oe(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:g}=h;throw new gI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=uI(h.headers)||r.total,o&&oe(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const u=this.response;if(!u)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const g={url:u.url,data:h,code:u.status};o&&!oe(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(g,r,e,u)}).catch(h=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const u=h&&h.code||0,d=h?h.message:null;i.onError({code:u,text:d},e,h?h.details:null,r)})}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,r=0,n){const o=new xc,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,h=c.length;return t.loaded+=h,h<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function cI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ze({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function hI(s){const e=lI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uI(s){const e=s.get("Content-Range");if(e){const i=hI(e);if(oe(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function dI(s,e){return new self.Request(s.url,e)}class gI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const fI=/\s/,pI={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(n=i.rows[u],a=!0,A=0,l="",!n.isEmpty()){var h;for(let f=0;f<n.chars.length;f++)fI.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=uh(l.trim()),g=ua(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=u+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((u,d)=>u.line==="auto"||d.line==="auto"?0:u.line>8&&d.line>8?d.line-u.line:u.line-d.line),r.forEach(u=>lc(s,u))),r}},EI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},kh=ot(ot({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:Lh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:J0,bufferController:Xp,capLevelController:Ea,errorController:F0,fpsController:vE,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:_l,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:EI},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},II()),{},{subtitleStreamController:Jp,subtitleTrackController:qp,timelineController:CE,audioStreamController:Kp,audioTrackController:Vp,emeController:Cs,cmcdController:rI,contentSteeringController:oI});function II(){return{cueHandler:pI,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 mI(s,e){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 t=va(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,h=e[c];if(h!==void 0&&a){A.push(c);const u=t[o].default;switch(e[o]={default:u},l){case"TimeOut":u.maxLoadTimeMs=h,u.maxTimeToFirstByteMs=h;break;case"MaxRetry":u.errorRetry.maxNumRetry=h,u.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":u.errorRetry.retryDelayMs=h,u.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=h,u.timeoutRetry.maxRetryDelayMs=h;break}}}),A.length&&N.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ot(ot({},t),e)}function va(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(va):Object.keys(s).reduce((e,t)=>(e[t]=va(s[t]),e),{}):s}function CI(s){const e=s.loader;e!==_h&&e!==Lh?(N.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):AI()&&(s.loader=_h,s.progressive=!0,s.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Ba;class yI extends Jo{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.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,r=[],n={},o={};let a=!1,A=!1,l=!1;t.levels.forEach(c=>{var h,u;const d=c.attrs;let{audioCodec:g,videoCodec:f}=c;((h=g)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(Ba||(Ba=/chrome|firefox/i.test(navigator.userAgent)),Ba&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=rn(g,i)),((u=f)==null?void 0:u.indexOf("avc1"))===0&&(f=c.videoCodec=c0(f));const{width:p,height:y,unknownCodecs:v}=c;if(a||(a=!!(p&&y)),A||(A=!!f),l||(l=!!g),v!=null&&v.length||g&&!No(g,"audio",i)||f&&!No(f,"video",i))return;const{CODECS:S,"FRAME-RATE":C,"HDCP-LEVEL":Q,"PATHWAY-ID":B,RESOLUTION:_,"VIDEO-RANGE":L}=d,F=`${`${B||"."}-`}${c.bitrate}-${_}-${C}-${S}-${L}-${Q}`;if(n[F])if(n[F].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const U=o[F]+=1;c.attrs["PATHWAY-ID"]=new Array(U+1).join(".");const q=new hs(c);n[F]=q,r.push(q)}else n[F].addGroupId("audio",d.AUDIO),n[F].addGroupId("text",d.SUBTITLES);else{const U=new hs(c);n[F]=U,o[F]=1,r.push(U)}}),this.filterAndSortMediaOptions(r,t,a,A,l)}filterAndSortMediaOptions(e,t,i,r,n){let o=[],a=[],A=e;if((i||r)&&n&&(A=A.filter(({videoCodec:g,videoRange:f,width:p,height:y})=>(!!g||!!(p&&y))&&B0(f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const g=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:g,reason:g.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:g}=this.hls.config;o=t.audioTracks.filter(f=>!f.audioCodec||No(f.audioCodec,"audio",g)),Fh(o)}t.subtitles&&(a=t.subtitles,Fh(a));const l=A.slice(0);A.sort((g,f)=>{if(g.attrs["HDCP-LEVEL"]!==f.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(f.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&g.height!==f.height)return g.height-f.height;if(g.frameRate!==f.frameRate)return g.frameRate-f.frameRate;if(g.videoRange!==f.videoRange)return an.indexOf(g.videoRange)-an.indexOf(f.videoRange);if(g.videoCodec!==f.videoCodec){const p=jl(g.videoCodec),y=jl(f.videoCodec);if(p!==y)return y-p}if(g.uri===f.uri&&g.codecSet!==f.codecSet){const p=sn(g.codecSet),y=sn(f.codecSet);if(p!==y)return y-p}return g.averageBitrate!==f.averageBitrate?g.averageBitrate-f.averageBitrate:0});let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let g=0;g<l.length;g++)if(l[g].pathwayId===A[0].pathwayId){c=l[g];break}}this._levels=A;for(let g=0;g<A.length;g++)if(A[g]===c){var h;this._firstLevel=g;const f=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${f}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const y=Math.min(f,this.hls.config.abrEwmaDefaultEstimateMax);y>p&&p===kh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const u=n&&!r,d={levels:A,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!u&&o.some(g=>!!g.url)};this.hls.trigger(E.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(E.ERROR,{type:pe.OTHER_ERROR,details:H.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details);this.loadPlaylist(c)}}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}onError(e,t){t.fatal||!t.context||t.context.type===Te.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===fe.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const n=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||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;const i=this._levels.filter((r,n)=>n!==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));Ec(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(E.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(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Fh(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class vI{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=H.KEY_LOAD_ERROR,i,r,n){return new pi({type:pe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{const{frag:p,keyInfo:y,url:v}=g;if(!p.decryptdata||y!==this.keyUriToKeyInfo[v])return a(this.createKeyLoadError(p,H.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));y.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,ot({url:A.url,data:void 0},u)))},onTimeout:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function Nh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Mh(){if(!ls())return!1;const e=Nh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function BI(){if(!Mh())return!1;const s=ls();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(ir(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(ir(e,"audio"))))}function QI(){var s;const e=Nh();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const SI=250,Sn=2,bI=.1,wI=.05;class RI{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),n!==null){if(this.stallReported){const p=self.performance.now()-n;N.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!He.getBuffered(r).length){this.nudgeRetry=0;return}const c=He.bufferInfo(r,o,0),h=c.nextStart||0;if(a){const p=c.len>Sn,y=!h||t&&t.start<=o||h-o>Sn&&!this.fragmentTracker.getPartialFragment(o);if(p||y)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u;if(!(c.len>0)&&!h)return;const y=Math.max(h,c.start||0)-o,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(v==null||(u=v.details)==null?void 0:u.live)?v.details.targetduration*2:Sn,Q=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=C||Q)){r.paused||this._trySkipBufferHole(Q);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=SI&&(this._reportStall(c),!this.media))return;const f=He.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(f,g)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(N.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);N.warn(n.message),t.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=He.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:u}=this;let d=!1;if(n===0){const g=u.getAppendedFrag(0,fe.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,fe.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const y=u.getPartialFragment(p);if(y)p+=y.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+wI,n+bI);if(N.warn(`skipping hole, adjusting currentTime from ${n} to ${h}`),this.moved=!0,this.stalled=null,r.currentTime=h,e&&!e.gap){const u=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${h}`);i.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:e})}return h}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);N.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);N.error(o.message),t.trigger(E.ERROR,{type:pe.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const xI=100;class TI extends jo{constructor(e,t,i){super(e,t,i,"[stream-controller]",fe.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(xI),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=j.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=j.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case j.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t==null?void 0:t[i],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=j.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=j.IDLE;break}break}case j.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,o=r==null?void 0:r[n];this.resetStartWhenNotLoaded(o||null),this.state=j.IDLE}}break}this.state===j.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(i!=null&&i[n]))return;const o=i[n],a=this.getMainFwdBufferInfo();if(a===null)return;const A=this.getLevelDetails();if(A&&this._streamEnded(a,A)){const f={};this.altAudio&&(f.type="video"),this.hls.trigger(E.BUFFER_EOS,f),this.state=j.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=o.details;if(!l||this.state===j.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=j.WAITING_LEVEL;return}const c=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(c>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==at.OK){var g;const p=((g=this.backtrackFragment)!=null?g:d).sn-l.startSN,y=l.fragments[p-1];y&&d.cc===y.cc&&(d=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,u)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?Fe.AUDIO:Fe.VIDEO,y=(p===Fe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,p,fe.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,fe.MAIN,h)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,u))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===at.NOT_LOADED||r===at.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,fe.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 r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,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 j.KEY_LOADING:case j.FRAG_LOADING:case j.FRAG_LOADING_WAITING_RETRY:case j.PARSING:case j.PARSED:this.state=j.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new RI(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;oe(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(n=>{const o=n.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!QI(),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!==j.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=j.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===j.FRAG_LOADING||this.state===j.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(A.details=o,this.levelLastLoaded=A,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===j.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=j.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Xc(this.hls,fe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new Wo(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),y=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==fe.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===j.PARSED&&(this.state=j.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.MAIN,t);break;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Te.LEVEL&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!He.getBuffered(e).length){const i=this.state!==j.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=j.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Fe.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Fe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,fe.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),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 r=He.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),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:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=j.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:g}=n,{details:f}=c,p=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,g){if(g!=null&&g.tracks){const S=A.initSegment||A;this._bufferInitSegment(c,g.tracks,S,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:i,tracks:g.tracks})}const y=g.initPTS,v=g.timescale;oe(y)&&(this.initPTS[A.cc]={baseTime:y,timescale:v},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:y,timescale:v}))}if(h&&f&&A.sn!=="initSegment"){const y=f.fragments[A.sn-1-f.startSN],v=A.sn===f.startSN,S=!y||A.cc>y.cc;if(n.independent!==!1){const{startPTS:C,endPTS:Q,startDTS:B,endDTS:_}=h;if(l)l.elementaryStreams[h.type]={startPTS:C,endPTS:Q,startDTS:B,endDTS:_};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!S&&(this.couldBacktrack=!0),h.dropped&&h.independent){const L=this.getMainFwdBufferInfo(),G=(L?L.end:this.getLoadPosition())+this.config.maxBufferHole,F=h.firstKeyFramePTS?h.firstKeyFramePTS:C;if(!v&&G<F-this.config.maxBufferHole&&!S){this.backtrack(A);return}else S&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,Q,A.start,_,!0)}else v&&C>Sn&&(A.gap=!0);A.setElementaryStreamInfo(h.type,C,Q,B,_),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,v||S)}else if(v||S)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:y,endPTS:v,startDTS:S,endDTS:C}=p;l&&(l.elementaryStreams[Fe.AUDIO]={startPTS:y,endPTS:v,startDTS:S,endDTS:C}),A.setElementaryStreamInfo(Fe.AUDIO,y,v,S,C),this.bufferFragmentData(p,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:i,frag:A,details:f,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,y)}if(f&&u){const y={id:i,frag:A,details:f,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),n.metadata.channelCount!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")),A&&A.indexOf("mp4a.40.5")!==-1&&l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,fe.MAIN)}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=j.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(He.isBuffered(e,i)?t=this.getAppendedFrag(i):He.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&oe(t)&&oe(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}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 mi{static get version(){return"1.5.7"}static isMSESupported(){return Mh()}static isSupported(){return BI()}static getMediaSource(){return ls()}static get Events(){return E}static get ErrorTypes(){return pe}static get ErrorDetails(){return H}static get DefaultConfig(){return mi.defaultConfig?mi.defaultConfig:kh}static set DefaultConfig(e){mi.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new na,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,vf(e.debug||!1,"Hls instance");const t=this.config=mI(mi.DefaultConfig,e);this.userConfig=e,t.progressive&&CI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),h=this.capLevelController=new n(this),u=new a(this),d=new f0(this),g=new C0(this),f=t.contentSteeringController,p=f?new f(this):null,y=this.levelController=new yI(this,p),v=new q0(this),S=new vI(this.config),C=this.streamController=new TI(this,v,S);h.setStreamController(C),u.setStreamController(C);const Q=[d,y,C];p&&Q.splice(1,0,p),this.networkControllers=Q;const B=[l,c,h,u,g,v];this.audioTrackController=this.createController(t.audioTrackController,Q);const _=t.audioStreamController;_&&Q.push(new _(this,v,S)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Q);const L=t.subtitleStreamController;L&&Q.push(new L(this,v,S)),this.createController(t.timelineController,B),S.emeController=this.emeController=this.createController(t.emeController,B),this.cmcdController=this.createController(t.cmcdController,B),this.latencyController=this.createController(y0,B),this.coreComponents=B,Q.push(A);const G=A.onErrorOut;typeof G=="function"&&this.on(E.ERROR,G,A)}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,r){this._emitter.off(e,t,i,r)}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(N.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:pe.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){N.log("destroy"),this.trigger(E.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){N.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){N.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=Qo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,N.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){N.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){N.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){N.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){N.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){N.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){N.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){N.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){N.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){N.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 ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(N.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){v0(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 r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}mi.defaultConfig=void 0;function DI(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function LI(s){return s}function _I(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||LI,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const h=a[c],u=e.safe&&Array.isArray(h),d=Object.prototype.toString.call(h),g=DI(h),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,p,l+1);n[p]=h})}return o(s),n}var Ph=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function kI(s,e){return!!(s===e||Ph(s)&&Ph(e))}function FI(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!kI(s[t],e[t]))return!1;return!0}function NI(s,e){e===void 0&&(e=FI);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}/**
179
+ `),l=[],c=e?kp(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(p){const y=t[i];let v=t.ccOffset;const S=(u-c)/9e4;if(y!=null&&y.new&&(d!==void 0?v=t.ccOffset=y.start:pE(t,i,S)),S){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}v=S-t.presentationOffset}const C=p.endTime-p.startTime,Q=Lt((p.startTime+v-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(Q,0),p.endTime=Math.max(Q+C,0);const B=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(B)),p.id||(p.id=da(p.startTime,p.endTime,B)),p.endTime>0&&l.push(p)},a.onparsingerror=function(p){g=p},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(p=>{if(f)if(ha(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(y=>{ha(y,"LOCAL:")?h=y.slice(6):ha(y,"MPEGTS:")&&(u=parseInt(y.slice(7)))});try{d=fE(h)/1e3}catch(y){g=y}return}else p===""&&(f=!1);a.parse(p+`
180
+ `)}),a.flush()}const ga="stpp.ttml.im1t",uh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,dh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,IE={left:"start",center:"center",right:"end",start:"start",end:"end"};function gh(s,e,t,i){const r=ve(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Wt(a)),o=_p(e.baseTime,1,e.timescale);try{n.forEach(a=>t(mE(a,o)))}catch(a){i(a)}}function mE(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((h,u)=>(h[u]=r.getAttribute(`ttp:${u}`)||n[u],h),{}),a=r.getAttribute("xml:space")!=="preserve",A=fh(fa(r,"styling","style")),l=fh(fa(r,"layout","region")),c=fa(r,"body","[begin]");return[].map.call(c,h=>{const u=ph(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=Ea(h.getAttribute("begin"),o),g=Ea(h.getAttribute("dur"),o);let f=Ea(h.getAttribute("end"),o);if(d===null)throw Eh(h);if(f===null){if(g===null)throw Eh(h);f=d+g}const p=new la(d-e,f-e,u);p.id=da(p.startTime,p.endTime,p.text);const y=l[h.getAttribute("region")],v=A[h.getAttribute("style")],S=CE(y,v,A),{textAlign:C}=S;if(C){const Q=IE[C];Q&&(p.lineAlign=Q),p.align=C}return Ze(p,S),p}).filter(h=>h!==null)}function fa(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function fh(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function ph(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
181
+ `:(n=i.childNodes)!=null&&n.length?ph(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function CE(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=pa(e,i,A)||pa(s,i,A)||pa(r,i,A);return l&&(a[A]=l),a},{})}function pa(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Eh(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Ea(s,e){if(!s)return null;let t=lh(s);return t===null&&(uh.test(s)?t=yE(s,e):dh.test(s)&&(t=vE(s,e))),t}function yE(s,e){const t=uh.exec(s),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 vE(s,e){const t=dh.exec(s),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 BE{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=Ch(),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(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new yn(this,"textTrack1"),t=new yn(this,"textTrack2"),i=new yn(this,"textTrack3"),r=new yn(this,"textTrack4");this.cea608Parser1=new Ah(1,e,t),this.cea608Parser2=new Ah(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=QE(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(mh(n,{name:e,lang:t,attrs:{}}))return n}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:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(n,o);if(a)i[e]=a,cs(i[e]),lc(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{cs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Ch(),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++)cs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===ga);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(eh(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?sn(o.textTracks):null;if(this.tracks.forEach((A,l)=>{let c;if(a){let h=null;for(let u=0;u<a.length;u++)if(a[u]&&mh(a[u],A)){h=a[u],a[u]=null;break}h&&(c=h)}if(c)cs(c);else{const h=Ih(A);c=this.createTextTrack(h,A.name,A.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const A=a.filter(l=>l!==null).map(l=>l.label);A.length&&N.warn(`Media element contains unused subtitle tracks: ${A.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.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===ge.MAIN){var i,r;const{cea608Parser1:n,cea608Parser2:o,lastSn:a}=this,{cc:A,sn:l}=t.frag,c=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;n&&o&&(l!==a+1||l===a&&c!==this.lastPartIndex+1||A!==this.lastCc)&&(n.reset(),o.reset()),this.lastCc=A,this.lastSn=l,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===ge.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===ga?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;gh(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{N.log(`Failed to parse IMSC1: ${r}`),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?Dt(i.initSegment.data,new Uint8Array(r)):r;EE(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),N.log(`Failed to parse VTT cue: ${c}`),!(h&&a>i.cc)&&A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||gh(t,this.initPTS[e.cc],()=>{i.textCodec=ga,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>cc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===ge.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;const{frag:n,samples:o}=t;if(!(n.type===ge.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>Uo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>Uo(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function Ih(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function mh(s,e){return!!s&&s.kind===Ih(e)&&aa(e,s)}function QE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function Ch(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ia{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(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.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&&oe(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}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&&N.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,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((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Ia.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.width||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 e}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 r=(a,A)=>A?a.width!==A.width||a.height!==A.height:!0;let n=e.length-1;const o=Math.max(t,i);for(let a=0;a<e.length;a+=1){const A=e[a];if((A.width>=o||A.height>=o)&&r(A,e[a+1])){n=a;break}}return n}}class SE{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(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,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 r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;N.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,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)}}const Bn="[eme]";class ms{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=ms.CDMCleanupPromise?[ms.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=N.debug.bind(N,Bn),this.log=N.log.bind(N,Bn),this.warn=N.warn.bind(N,Bn),this.error=N.error.bind(N,Bn),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Ke.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(h=>o({keySystem:c,mediaKeys:h})).catch(h=>{l.length?A(l):h instanceof _t?a(h):a(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return kl===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=Lf(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(h=>h?this.setMediaKeysServerCertificate(c,e,h):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${qt.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return qt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${qt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
182
+ } (data length: ${t&&t.byteLength})`),r.update(t)}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){return new Promise((t,i)=>{const r=To(this.config),n=e.map(Dl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=_l(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(A,"cenc",t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof _t?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Dl(e.keyFormat),n=r?[r]:To(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=To(this.config)),e.length===0)throw new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Ke.FAIRPLAY]){const c=nt(new Uint8Array(i));try{const h=Ro(JSON.parse(c).sinf),u=$l(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ke.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=s0(i);if(c===null)return;c.version===0&&c.systemId===Ll.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=Df(c.systemId)}if(!n||!r)return;const o=qt.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const h=A[c],u=h.decryptdata;if(u.pssh||!u.keyId)continue;const d=qt.hexDump(u.keyId);if(o===d||u.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],u.pssh=new Uint8Array(i),u.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(h,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:h})=>{var u;this.throwIfDestroyed();const d=new er("ISO-23001-7",o,(u=_l(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const g=a.call(this.hls,t,i,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");t=g.initDataType,i=e.decryptdata.pssh=g.initData?new Uint8Array(g.initData):null}catch(g){var A;if(this.warn(g.message),(A=this.hls)!=null&&A.config.debug)throw g}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new oa,h=e._onmessage=g=>{const f=e.mediaKeysSession;if(!f){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=g;this.log(`"${p}" message event for session "${f.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(v=>{this.handleError(v),c.emit("error",v)}):p==="license-release"?e.keySystem===Ke.FAIRPLAY&&(this.updateKeySession(e,xo("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},u=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const p=e.keyStatus;c.emit("keyStatus",p),p==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);const d=new Promise((g,f)=>{c.on("error",f),c.on("keyStatus",p=>{p.startsWith("usable")?g():p==="output-restricted"?f(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?f(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var g;this.log(`Request generated for key-session "${(g=e.mediaKeysSession)==null?void 0:g.sessionId}" keyId: ${l}`)}).catch(g=>{throw new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_SESSION,error:g,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>d).catch(g=>{throw c.removeAllListeners(),this.removeSession(e),g}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${qt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${qt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{o(u.data)},onError:(u,d,g,f)=>{a(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:ot({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,g)=>{a(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,g)=>{a(new Error("aborted"))}};r.load(A,c,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.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 r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let c;for(let h=0,u=n.length;h<u;h++){var o,a;c=n[h];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,g=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&g&&e.setRequestHeader(d,g)}}const A=r.querySelector("Challenge"),l=A==null?void 0:A.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return xo(atob(l))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new _t({type:Ee.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{e.keySystem==Ke.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(A,l)),A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},er.clearKeyUriToKeyIdMap();const i=t.length;ms.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),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);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}ms.CDMCleanupPromise=void 0;class _t 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}}var Et;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(Et||(Et={}));var ma;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(ma||(ma={}));var Wi;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Wi||(Wi={}));const bE={[Wi.OBJECT]:["br","d","ot","tb"],[Wi.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Wi.SESSION]:["cid","pr","sf","sid","st","v"],[Wi.STATUS]:["bs","rtp"]};class Cs{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof Cs?i:new Cs(i))),this.value=e,this.params=t}}class yh{constructor(e){this.description=void 0,this.description=e}}const wE="Dict";function RE(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function xE(s,e,t,i){return new Error(`failed to ${s} "${RE(e)}" as ${t}`,{cause:i})}const vh="Bare Item",TE="Boolean",DE="Byte Sequence",LE="Decimal",_E="Integer";function kE(s){return s<-999999999999999||999999999999999<s}const FE=/[\x00-\x1f\x7f]+/,NE="Token",ME="Key";function ei(s,e,t){return xE("serialize",s,e,t)}function PE(s){if(typeof s!="boolean")throw ei(s,TE);return s?"?1":"?0"}function OE(s){return btoa(String.fromCharCode(...s))}function UE(s){if(ArrayBuffer.isView(s)===!1)throw ei(s,DE);return`:${OE(s)}:`}function Bh(s){if(kE(s))throw ei(s,_E);return s.toString()}function GE(s){return`@${Bh(s.getTime()/1e3)}`}function Qh(s,e){if(s<0)return-Qh(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const r=Math.floor(s*t);return(r%2===0?r:r+1)/t}else return Math.round(s*t)/t}function HE(s){const e=Qh(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ei(s,LE);const t=e.toString();return t.includes(".")?t:`${t}.0`}const $E="String";function YE(s){if(FE.test(s))throw ei(s,$E);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function KE(s){return s.description||s.toString().slice(7,-1)}function Sh(s){const e=KE(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ei(e,NE);return e}function Ca(s){switch(typeof s){case"number":if(!oe(s))throw ei(s,vh);return Number.isInteger(s)?Bh(s):HE(s);case"string":return YE(s);case"symbol":return Sh(s);case"boolean":return PE(s);case"object":if(s instanceof Date)return GE(s);if(s instanceof Uint8Array)return UE(s);if(s instanceof yh)return Sh(s);default:throw ei(s,vh)}}function ya(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw ei(s,ME);return s}function va(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${ya(e)}`:`;${ya(e)}=${Ca(t)}`).join("")}function bh(s){return s instanceof Cs?`${Ca(s.value)}${va(s.params)}`:Ca(s)}function VE(s){return`(${s.value.map(bh).join(" ")})${va(s.params)}`}function JE(s,e={whitespace:!0}){if(typeof s!="object")throw ei(s,wE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Cs||(n=new Cs(n));let o=ya(r);return n.value===!0?o+=va(n.params):(o+="=",Array.isArray(n.value)?o+=VE(n):o+=bh(n)),o}).join(`,${i}`)}function WE(s,e){return JE(s,e)}const qE=s=>s==="ot"||s==="sf"||s==="st",jE=s=>typeof s=="number"?oe(s):s!=null&&s!==""&&s!==!1;function XE(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function zE(){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,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const Qn=s=>Math.round(s),ZE=(s,e)=>(e!=null&&e.baseUrl&&(s=XE(s,e.baseUrl)),encodeURIComponent(s)),Sn=s=>Qn(s/100)*100,eI={br:Qn,d:Qn,bl:Sn,dl:Sn,mtp:Sn,nor:ZE,rtp:Sn,tb:Qn};function tI(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=Ze({},eI,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return i.forEach(o=>{if(n!=null&&n(o))return;let a=s[o];const A=r[o];A&&(a=A(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||jE(a)&&(qE(o)&&typeof a=="string"&&(a=new yh(a)),t[o]=a))}),t}function wh(s,e={}){return s?WE(tI(s,e),Ze({whitespace:!1},e)):""}function iI(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(bE).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,o)=>{var a,A;const[l,c]=o,h=((a=i.find(u=>u[1].includes(l)))==null?void 0:a[0])||Wi.REQUEST;return(A=n[h])!=null||(n[h]={}),n[h][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=wh(a,e),n),{})}function sI(s,e,t){return Ze(s,iI(e,t))}const rI="CMCD";function nI(s,e={}){if(!s)return"";const t=wh(s,e);return`${rI}=${encodeURIComponent(t)}`}const Rh=/CMCD=[^&#]+/;function oI(s,e,t){const i=nI(e,t);if(!i)return s;if(Rh.test(s))return s.replace(Rh,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class aI{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=r=>{try{this.apply(r,{ot:Et.MANIFEST,su:!this.initialized})}catch(n){N.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===Et.VIDEO||a===Et.AUDIO||a==Et.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){N.warn("Could not generate segment CMCD data.",n)}},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||zE(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:ma.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ze(t,this.createData());const i=t.ot===Et.INIT||t.ot===Et.VIDEO||t.ot===Et.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,o)=>(r.includes(o)&&(n[o]=t[o]),n),{})),this.useHeaders?(e.headers||(e.headers={}),sI(e.headers,t)):e.url=oI(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Et.TIMED_TEXT;if(e.sn==="initSegment")return Et.INIT;if(t==="audio")return Et.AUDIO;if(t==="main")return this.hls.audioTracks.length?Et.VIDEO:Et.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Et.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Et.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:He.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(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}}const AI=3e5;class lI{constructor(e){this.hls=void 0,this.log=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.log=N.log.bind(N,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}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)===dt.SendAlternateToPenaltyBox&&i.flags===Ut.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:A,type:l}=t.context;a&&r?o=this.getPathwayForGroupId(a,l,o):A&&(o=A)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!n&&r&&(n=r.reduce((a,A)=>(a.indexOf(A.pathwayId)===-1&&a.push(A.pathwayId),a),[])),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==o),i.resolved||N.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(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):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>AI&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(o in i)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,mc(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===Te.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===Te.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=new We(c.attrs);h["PATHWAY-ID"]=o;const u=h.AUDIO&&`${h.AUDIO}_clone_${o}`,d=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;u&&(i[h.AUDIO]=u,h.AUDIO=u),d&&(r[h.SUBTITLES]=d,h.SUBTITLES=d);const g=Th(c.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new hs({attrs:h,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:g,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)f.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)f.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return f});t.push(...l),xh(this.audioTracks,i,A,o),xh(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||u.url),p&&this.clonePathways(p);const v={steeringManifest:g,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,v),y&&this.updatePathwayPriority(y)},onError:(c,h,u,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${h.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,g)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function xh(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=Ze({},o);return a.details=void 0,a.attrs=new We(a.attrs),a.url=a.attrs.URI=Th(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Th(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const cI=/^age:\s*[\d.]+\s*$/im;class Dh{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 Wr,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,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return n(i,t.url)}).catch(o=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);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=n&&oe(n)?n:o,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 r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry,c={url:e.url,data:void 0,code:o};An(A,l,!1,c)?this.retry(A):(N.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(An(e,t,!0))this.retry(e);else{var i;N.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Vo(e,i.retry),i.retry++,N.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&&cI.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}}function hI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const uI=/(\d+)-(\d+)\/(\d+)/;class Lh{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||pI,this.controller=new self.AbortController,this.stats=new Wr}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 r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=dI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&oe(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:g}=h;throw new EI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=fI(h.headers)||r.total,o&&oe(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const u=this.response;if(!u)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const g={url:u.url,data:h,code:u.status};o&&!oe(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(g,r,e,u)}).catch(h=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const u=h&&h.code||0,d=h?h.message:null;i.onError({code:u,text:d},e,h?h.details:null,r)})}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,r=0,n){const o=new Dc,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,h=c.length;return t.loaded+=h,h<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function dI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ze({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function gI(s){const e=uI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function fI(s){const e=s.get("Content-Range");if(e){const i=gI(e);if(oe(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function pI(s,e){return new self.Request(s.url,e)}class EI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const II=/\s/,mI={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(n=i.rows[u],a=!0,A=0,l="",!n.isEmpty()){var h;for(let f=0;f<n.chars.length;f++)II.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=hh(l.trim()),g=da(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=u+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((u,d)=>u.line==="auto"||d.line==="auto"?0:u.line>8&&d.line>8?d.line-u.line:u.line-d.line),r.forEach(u=>cc(s,u))),r}},CI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},_h=ot(ot({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:Dh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:J0,bufferController:Xp,capLevelController:Ia,errorController:F0,fpsController:SE,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:kl,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:CI},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},yI()),{},{subtitleStreamController:Jp,subtitleTrackController:qp,timelineController:BE,audioStreamController:Kp,audioTrackController:Vp,emeController:ms,cmcdController:aI,contentSteeringController:lI});function yI(){return{cueHandler:mI,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 vI(s,e){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 t=Ba(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,h=e[c];if(h!==void 0&&a){A.push(c);const u=t[o].default;switch(e[o]={default:u},l){case"TimeOut":u.maxLoadTimeMs=h,u.maxTimeToFirstByteMs=h;break;case"MaxRetry":u.errorRetry.maxNumRetry=h,u.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":u.errorRetry.retryDelayMs=h,u.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=h,u.timeoutRetry.maxRetryDelayMs=h;break}}}),A.length&&N.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ot(ot({},t),e)}function Ba(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Ba):Object.keys(s).reduce((e,t)=>(e[t]=Ba(s[t]),e),{}):s}function BI(s){const e=s.loader;e!==Lh&&e!==Dh?(N.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):hI()&&(s.loader=Lh,s.progressive=!0,s.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Qa;class QI extends Wo{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(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.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,r=[],n={},o={};let a=!1,A=!1,l=!1;t.levels.forEach(c=>{var h,u;const d=c.attrs;let{audioCodec:g,videoCodec:f}=c;((h=g)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(Qa||(Qa=/chrome|firefox/i.test(navigator.userAgent)),Qa&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=tn(g,i)),((u=f)==null?void 0:u.indexOf("avc1"))===0&&(f=c.videoCodec=c0(f));const{width:p,height:y,unknownCodecs:v}=c;if(a||(a=!!(p&&y)),A||(A=!!f),l||(l=!!g),v!=null&&v.length||g&&!Mo(g,"audio",i)||f&&!Mo(f,"video",i))return;const{CODECS:S,"FRAME-RATE":C,"HDCP-LEVEL":Q,"PATHWAY-ID":B,RESOLUTION:_,"VIDEO-RANGE":L}=d,F=`${`${B||"."}-`}${c.bitrate}-${_}-${C}-${S}-${L}-${Q}`;if(n[F])if(n[F].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const U=o[F]+=1;c.attrs["PATHWAY-ID"]=new Array(U+1).join(".");const q=new hs(c);n[F]=q,r.push(q)}else n[F].addGroupId("audio",d.AUDIO),n[F].addGroupId("text",d.SUBTITLES);else{const U=new hs(c);n[F]=U,o[F]=1,r.push(U)}}),this.filterAndSortMediaOptions(r,t,a,A,l)}filterAndSortMediaOptions(e,t,i,r,n){let o=[],a=[],A=e;if((i||r)&&n&&(A=A.filter(({videoCodec:g,videoRange:f,width:p,height:y})=>(!!g||!!(p&&y))&&B0(f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const g=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:g,reason:g.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:g}=this.hls.config;o=t.audioTracks.filter(f=>!f.audioCodec||Mo(f.audioCodec,"audio",g)),kh(o)}t.subtitles&&(a=t.subtitles,kh(a));const l=A.slice(0);A.sort((g,f)=>{if(g.attrs["HDCP-LEVEL"]!==f.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(f.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&g.height!==f.height)return g.height-f.height;if(g.frameRate!==f.frameRate)return g.frameRate-f.frameRate;if(g.videoRange!==f.videoRange)return nn.indexOf(g.videoRange)-nn.indexOf(f.videoRange);if(g.videoCodec!==f.videoCodec){const p=Xl(g.videoCodec),y=Xl(f.videoCodec);if(p!==y)return y-p}if(g.uri===f.uri&&g.codecSet!==f.codecSet){const p=en(g.codecSet),y=en(f.codecSet);if(p!==y)return y-p}return g.averageBitrate!==f.averageBitrate?g.averageBitrate-f.averageBitrate:0});let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let g=0;g<l.length;g++)if(l[g].pathwayId===A[0].pathwayId){c=l[g];break}}this._levels=A;for(let g=0;g<A.length;g++)if(A[g]===c){var h;this._firstLevel=g;const f=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${f}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const y=Math.min(f,this.hls.config.abrEwmaDefaultEstimateMax);y>p&&p===_h.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const u=n&&!r,d={levels:A,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!u&&o.some(g=>!!g.url)};this.hls.trigger(E.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:H.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details,l);this.loadPlaylist(c)}}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}onError(e,t){t.fatal||!t.context||t.context.type===Te.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ge.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const n=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||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;const i=this._levels.filter((r,n)=>n!==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));mc(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(E.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(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function kh(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class SI{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=H.KEY_LOAD_ERROR,i,r,n){return new pi({type:Ee.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,H.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{const{frag:p,keyInfo:y,url:v}=g;if(!p.decryptdata||y!==this.keyUriToKeyInfo[v])return a(this.createKeyLoadError(p,H.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));y.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,ot({url:A.url,data:void 0},u)))},onTimeout:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function Fh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Nh(){if(!Vi())return!1;const e=Fh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function bI(){if(!Nh())return!1;const s=Vi();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(tr(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(tr(e,"audio"))))}function wI(){var s;const e=Fh();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const RI=250,bn=2,xI=.1,TI=.05;class DI{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),n!==null){if(this.stallReported){const p=self.performance.now()-n;N.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!He.getBuffered(r).length){this.nudgeRetry=0;return}const c=He.bufferInfo(r,o,0),h=c.nextStart||0;if(a){const p=c.len>bn,y=!h||t&&t.start<=o||h-o>bn&&!this.fragmentTracker.getPartialFragment(o);if(p||y)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u;if(!(c.len>0)&&!h)return;const y=Math.max(h,c.start||0)-o,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(v==null||(u=v.details)==null?void 0:u.live)?v.details.targetduration*2:bn,Q=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=C||Q)){r.paused||this._trySkipBufferHole(Q);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=RI&&(this._reportStall(c),!this.media))return;const f=He.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(f,g)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(N.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);N.warn(n.message),t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=He.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:u}=this;let d=!1;if(n===0){const g=u.getAppendedFrag(0,ge.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,ge.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const y=u.getPartialFragment(p);if(y)p+=y.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+TI,n+xI);if(N.warn(`skipping hole, adjusting currentTime from ${n} to ${h}`),this.moved=!0,this.stalled=null,r.currentTime=h,e&&!e.gap){const u=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${h}`);i.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:e})}return h}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);N.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);N.error(o.message),t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const LI=100;class _I extends Xo{constructor(e,t,i){super(e,t,i,"[stream-controller]",ge.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(LI),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=j.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=j.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case j.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t==null?void 0:t[i],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=j.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=j.IDLE;break}break}case j.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,o=r==null?void 0:r[n];this.resetStartWhenNotLoaded(o||null),this.state=j.IDLE}}break}this.state===j.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(i!=null&&i[n]))return;const o=i[n],a=this.getMainFwdBufferInfo();if(a===null)return;const A=this.getLevelDetails();if(A&&this._streamEnded(a,A)){const f={};this.altAudio&&(f.type="video"),this.hls.trigger(E.BUFFER_EOS,f),this.state=j.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=o.details;if(!l||this.state===j.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=j.WAITING_LEVEL;return}const c=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(c>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==at.OK){var g;const p=((g=this.backtrackFragment)!=null?g:d).sn-l.startSN,y=l.fragments[p-1];y&&d.cc===y.cc&&(d=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,u)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?Fe.AUDIO:Fe.VIDEO,y=(p===Fe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,p,ge.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,ge.MAIN,h)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,u))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===at.NOT_LOADED||r===at.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ge.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 r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,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 j.KEY_LOADING:case j.FRAG_LOADING:case j.FRAG_LOADING_WAITING_RETRY:case j.PARSING:case j.PARSED:this.state=j.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new DI(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;oe(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(n=>{const o=n.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!wI(),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!==j.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=j.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===j.FRAG_LOADING||this.state===j.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(A.details=o,this.levelLastLoaded=A,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===j.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=j.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Zc(this.hls,ge.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new qo(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),y=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==ge.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===j.PARSED&&(this.state=j.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.MAIN,t);break;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Te.LEVEL&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!He.getBuffered(e).length){const i=this.state!==j.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=j.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Fe.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Fe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,ge.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),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 r=He.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),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:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=j.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:g}=n,{details:f}=c,p=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,g){if(g!=null&&g.tracks){const S=A.initSegment||A;this._bufferInitSegment(c,g.tracks,S,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:S,id:i,tracks:g.tracks})}const y=g.initPTS,v=g.timescale;oe(y)&&(this.initPTS[A.cc]={baseTime:y,timescale:v},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:y,timescale:v}))}if(h&&f&&A.sn!=="initSegment"){const y=f.fragments[A.sn-1-f.startSN],v=A.sn===f.startSN,S=!y||A.cc>y.cc;if(n.independent!==!1){const{startPTS:C,endPTS:Q,startDTS:B,endDTS:_}=h;if(l)l.elementaryStreams[h.type]={startPTS:C,endPTS:Q,startDTS:B,endDTS:_};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!S&&(this.couldBacktrack=!0),h.dropped&&h.independent){const L=this.getMainFwdBufferInfo(),G=(L?L.end:this.getLoadPosition())+this.config.maxBufferHole,F=h.firstKeyFramePTS?h.firstKeyFramePTS:C;if(!v&&G<F-this.config.maxBufferHole&&!S){this.backtrack(A);return}else S&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,Q,A.start,_,!0)}else v&&C>bn&&(A.gap=!0);A.setElementaryStreamInfo(h.type,C,Q,B,_),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,v||S)}else if(v||S)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:y,endPTS:v,startDTS:S,endDTS:C}=p;l&&(l.elementaryStreams[Fe.AUDIO]={startPTS:y,endPTS:v,startDTS:S,endDTS:C}),A.setElementaryStreamInfo(Fe.AUDIO,y,v,S,C),this.bufferFragmentData(p,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:i,frag:A,details:f,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,y)}if(f&&u){const y={id:i,frag:A,details:f,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5");const c=n.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")}A&&A.indexOf("mp4a.40.5")!==-1&&l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ge.MAIN)}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=j.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(He.isBuffered(e,i)?t=this.getAppendedFrag(i):He.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&oe(t)&&oe(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}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 mi{static get version(){return"1.5.11"}static isMSESupported(){return Nh()}static isSupported(){return bI()}static getMediaSource(){return Vi()}static get Events(){return E}static get ErrorTypes(){return Ee}static get ErrorDetails(){return H}static get DefaultConfig(){return mi.defaultConfig?mi.defaultConfig:_h}static set DefaultConfig(e){mi.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new oa,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,yf(e.debug||!1,"Hls instance");const t=this.config=vI(mi.DefaultConfig,e);this.userConfig=e,t.progressive&&BI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),h=this.capLevelController=new n(this),u=new a(this),d=new f0(this),g=new C0(this),f=t.contentSteeringController,p=f?new f(this):null,y=this.levelController=new QI(this,p),v=new q0(this),S=new SI(this.config),C=this.streamController=new _I(this,v,S);h.setStreamController(C),u.setStreamController(C);const Q=[d,y,C];p&&Q.splice(1,0,p),this.networkControllers=Q;const B=[l,c,h,u,g,v];this.audioTrackController=this.createController(t.audioTrackController,Q);const _=t.audioStreamController;_&&Q.push(new _(this,v,S)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Q);const L=t.subtitleStreamController;L&&Q.push(new L(this,v,S)),this.createController(t.timelineController,B),S.emeController=this.emeController=this.createController(t.emeController,B),this.cmcdController=this.createController(t.cmcdController,B),this.latencyController=this.createController(y0,B),this.coreComponents=B,Q.push(A);const G=A.onErrorOut;typeof G=="function"&&this.on(E.ERROR,G,A)}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,r){this._emitter.off(e,t,i,r)}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(N.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){N.log("destroy"),this.trigger(E.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){N.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){N.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=So.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,N.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){N.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){N.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){N.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){N.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){N.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){N.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){N.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){N.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){N.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 ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(N.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){v0(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 r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}mi.defaultConfig=void 0;function kI(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function FI(s){return s}function NI(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||FI,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const h=a[c],u=e.safe&&Array.isArray(h),d=Object.prototype.toString.call(h),g=kI(h),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,p,l+1);n[p]=h})}return o(s),n}var Mh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function MI(s,e){return!!(s===e||Mh(s)&&Mh(e))}function PI(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!MI(s[t],e[t]))return!1;return!0}function OI(s,e){e===void 0&&(e=PI);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}/**
183
183
  * @license
184
184
  * Copyright 2017 Google LLC
185
185
  * SPDX-License-Identifier: BSD-3-Clause
186
- */const Oh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Uh=ns(class extends $s{constructor(s){if(super(s),s.type!==rs.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=dd(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Oi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Oi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Oi(r[h],n[g]),Hs(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Oi(r[u],n[d]),Hs(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Oh(o,d,g),c=Oh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Hs(s,r[h]);Oi(y,n[d]),A[d]=y}else A[d]=Oi(p,n[d]),Hs(s,r[h],p),r[f]=null;d++}else jn(r[u]),u--;else jn(r[h]),h++;for(;d<=g;){const f=Hs(s,A[g+1]);Oi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&jn(f)}return this.ut=o,ud(s,A),Pt}});var wt="top",kt="bottom",Ft="right",Rt="left",Qa="auto",nr=[wt,kt,Ft,Rt],vs="start",or="end",MI="clippingParents",Gh="viewport",ar="popper",PI="reference",Hh=nr.reduce(function(s,e){return s.concat([e+"-"+vs,e+"-"+or])},[]),$h=[].concat(nr,[Qa]).reduce(function(s,e){return s.concat([e,e+"-"+vs,e+"-"+or])},[]),OI="beforeRead",UI="read",GI="afterRead",HI="beforeMain",$I="main",YI="afterMain",KI="beforeWrite",VI="write",JI="afterWrite",WI=[OI,UI,GI,HI,$I,YI,KI,VI,JI];function ti(s){return s?(s.nodeName||"").toLowerCase():null}function xt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function Wi(s){var e=xt(s).Element;return s instanceof e||s instanceof Element}function Nt(s){var e=xt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Sa(s){if(typeof ShadowRoot>"u")return!1;var e=xt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function qI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Nt(n)||!ti(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function jI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Nt(r)||!ti(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const Yh={name:"applyStyles",enabled:!0,phase:"write",fn:qI,effect:jI,requires:["computeStyles"]};function ii(s){return s.split("-")[0]}var qi=Math.max,bn=Math.min,Bs=Math.round;function ba(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Kh(){return!/^((?!chrome|android).)*safari/i.test(ba())}function Qs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Nt(s)&&(r=s.offsetWidth>0&&Bs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Bs(i.height)/s.offsetHeight||1);var o=Wi(s)?xt(s):window,a=o.visualViewport,A=!Kh()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function wa(s){var e=Qs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function Vh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Sa(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Ci(s){return xt(s).getComputedStyle(s)}function XI(s){return["table","td","th"].indexOf(ti(s))>=0}function Di(s){return((Wi(s)?s.ownerDocument:s.document)||window.document).documentElement}function wn(s){return ti(s)==="html"?s:s.assignedSlot||s.parentNode||(Sa(s)?s.host:null)||Di(s)}function Jh(s){return!Nt(s)||Ci(s).position==="fixed"?null:s.offsetParent}function zI(s){var e=/firefox/i.test(ba()),t=/Trident/i.test(ba());if(t&&Nt(s)){var i=Ci(s);if(i.position==="fixed")return null}var r=wn(s);for(Sa(r)&&(r=r.host);Nt(r)&&["html","body"].indexOf(ti(r))<0;){var n=Ci(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function Ar(s){for(var e=xt(s),t=Jh(s);t&&XI(t)&&Ci(t).position==="static";)t=Jh(t);return t&&(ti(t)==="html"||ti(t)==="body"&&Ci(t).position==="static")?e:t||zI(s)||e}function Ra(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function lr(s,e,t){return qi(s,bn(e,t))}function ZI(s,e,t){var i=lr(s,e,t);return i>t?t:i}function Wh(){return{top:0,right:0,bottom:0,left:0}}function qh(s){return Object.assign({},Wh(),s)}function jh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var em=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,qh(typeof e!="number"?e:jh(e,nr))};function tm(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ii(t.placement),A=Ra(a),l=[Rt,Ft].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=em(r.padding,t),u=wa(n),d=A==="y"?wt:Rt,g=A==="y"?kt:Ft,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=Ar(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,S=f/2-p/2,C=h[d],Q=v-u[c]-h[g],B=v/2-u[c]/2+S,_=lr(C,B,Q),L=A;t.modifiersData[i]=(e={},e[L]=_,e.centerOffset=_-B,e)}}function im(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Vh(e.elements.popper,r)&&(e.elements.arrow=r))}const sm={name:"arrow",enabled:!0,phase:"main",fn:tm,effect:im,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ss(s){return s.split("-")[1]}var rm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function nm(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Bs(t*r)/r||0,y:Bs(i*r)/r||0}}function Xh(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),S=Rt,C=wt,Q=window;if(l){var B=Ar(t),_="clientHeight",L="clientWidth";if(B===xt(t)&&(B=Di(t),Ci(B).position!=="static"&&a==="absolute"&&(_="scrollHeight",L="scrollWidth")),B=B,r===wt||(r===Rt||r===Ft)&&n===or){C=kt;var G=h&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[_];f-=G-i.height,f*=A?1:-1}if(r===Rt||(r===wt||r===kt)&&n===or){S=Ft;var F=h&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[L];d-=F-i.width,d*=A?1:-1}}var U=Object.assign({position:a},l&&rm),q=c===!0?nm({x:d,y:f},xt(t)):{x:d,y:f};if(d=q.x,f=q.y,A){var V;return Object.assign({},U,(V={},V[C]=v?"0":"",V[S]=y?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},U,(e={},e[C]=v?f+"px":"",e[S]=y?d+"px":"",e.transform="",e))}function om(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ii(e.placement),variation:Ss(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Xh(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Xh(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const am={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:om,data:{}};var Rn={passive:!0};function Am(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=xt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,Rn)}),a&&A.addEventListener("resize",t.update,Rn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,Rn)}),a&&A.removeEventListener("resize",t.update,Rn)}}const lm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Am,data:{}};var cm={left:"right",right:"left",bottom:"top",top:"bottom"};function xn(s){return s.replace(/left|right|bottom|top/g,function(e){return cm[e]})}var hm={start:"end",end:"start"};function zh(s){return s.replace(/start|end/g,function(e){return hm[e]})}function xa(s){var e=xt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ta(s){return Qs(Di(s)).left+xa(s).scrollLeft}function um(s,e){var t=xt(s),i=Di(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=Kh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ta(s),y:A}}function dm(s){var e,t=Di(s),i=xa(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=qi(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=qi(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Ta(s),A=-i.scrollTop;return Ci(r||t).direction==="rtl"&&(a+=qi(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function Da(s){var e=Ci(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Zh(s){return["html","body","#document"].indexOf(ti(s))>=0?s.ownerDocument.body:Nt(s)&&Da(s)?s:Zh(wn(s))}function cr(s,e){var t;e===void 0&&(e=[]);var i=Zh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=xt(i),o=r?[n].concat(n.visualViewport||[],Da(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(cr(wn(o)))}function La(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function gm(s,e){var t=Qs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function eu(s,e,t){return e===Gh?La(um(s,t)):Wi(e)?gm(e,t):La(dm(Di(s)))}function fm(s){var e=cr(wn(s)),t=["absolute","fixed"].indexOf(Ci(s).position)>=0,i=t&&Nt(s)?Ar(s):s;return Wi(i)?e.filter(function(r){return Wi(r)&&Vh(r,i)&&ti(r)!=="body"}):[]}function pm(s,e,t,i){var r=e==="clippingParents"?fm(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=eu(s,l,i);return A.top=qi(c.top,A.top),A.right=bn(c.right,A.right),A.bottom=bn(c.bottom,A.bottom),A.left=qi(c.left,A.left),A},eu(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function tu(s){var e=s.reference,t=s.element,i=s.placement,r=i?ii(i):null,n=i?Ss(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case wt:A={x:o,y:e.y-t.height};break;case kt:A={x:o,y:e.y+e.height};break;case Ft:A={x:e.x+e.width,y:a};break;case Rt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ra(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case vs:A[l]=A[l]-(e[c]/2-t[c]/2);break;case or:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function hr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?MI:a,l=t.rootBoundary,c=l===void 0?Gh:l,h=t.elementContext,u=h===void 0?ar:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=qh(typeof p!="number"?p:jh(p,nr)),v=u===ar?PI:ar,S=s.rects.popper,C=s.elements[g?v:u],Q=pm(Wi(C)?C:C.contextElement||Di(s.elements.popper),A,c,o),B=Qs(s.elements.reference),_=tu({reference:B,element:S,strategy:"absolute",placement:r}),L=La(Object.assign({},S,_)),G=u===ar?L:B,F={top:Q.top-G.top+y.top,bottom:G.bottom-Q.bottom+y.bottom,left:Q.left-G.left+y.left,right:G.right-Q.right+y.right},U=s.modifiersData.offset;if(u===ar&&U){var q=U[r];Object.keys(F).forEach(function(V){var X=[Ft,kt].indexOf(V)>=0?1:-1,w=[wt,kt].indexOf(V)>=0?"y":"x";F[V]+=q[w]*X})}return F}function Em(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?$h:A,c=Ss(i),h=c?a?Hh:Hh.filter(function(g){return Ss(g)===c}):nr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=hr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ii(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function Im(s){if(ii(s)===Qa)return[];var e=xn(s);return[zh(s),e,zh(e)]}function mm(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ii(p),v=y===p,S=A||(v||!g?[xn(p)]:Im(p)),C=[p].concat(S).reduce(function(ie,ce){return ie.concat(ii(ce)===Qa?Em(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),Q=e.rects.reference,B=e.rects.popper,_=new Map,L=!0,G=C[0],F=0;F<C.length;F++){var U=C[F],q=ii(U),V=Ss(U)===vs,X=[wt,kt].indexOf(q)>=0,w=X?"width":"height",x=hr(e,{placement:U,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),$=X?V?Ft:Rt:V?kt:wt;Q[w]>B[w]&&($=xn($));var R=xn($),b=[];if(n&&b.push(x[q]<=0),a&&b.push(x[$]<=0,x[R]<=0),b.every(function(ie){return ie})){G=U,L=!1;break}_.set(U,b)}if(L)for(var T=g?3:1,K=function(ce){var ae=C.find(function(me){var Be=_.get(me);if(Be)return Be.slice(0,ce).every(function(xe){return xe})});if(ae)return G=ae,"break"},M=T;M>0;M--){var W=K(M);if(W==="break")break}e.placement!==G&&(e.modifiersData[i]._skip=!0,e.placement=G,e.reset=!0)}}const Cm={name:"flip",enabled:!0,phase:"main",fn:mm,requiresIfExists:["offset"],data:{_skip:!1}};function iu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function su(s){return[wt,Ft,kt,Rt].some(function(e){return s[e]>=0})}function ym(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=hr(e,{elementContext:"reference"}),a=hr(e,{altBoundary:!0}),A=iu(o,i),l=iu(a,r,n),c=su(A),h=su(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const vm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ym};function Bm(s,e,t){var i=ii(s),r=[Rt,wt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Rt,Ft].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Qm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=$h.reduce(function(c,h){return c[h]=Bm(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Sm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Qm};function bm(s){var e=s.state,t=s.name;e.modifiersData[t]=tu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const wm={name:"popperOffsets",enabled:!0,phase:"read",fn:bm,data:{}};function Rm(s){return s==="x"?"y":"x"}function xm(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=hr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ii(e.placement),v=Ss(e.placement),S=!v,C=Ra(y),Q=Rm(C),B=e.modifiersData.popperOffsets,_=e.rects.reference,L=e.rects.popper,G=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,F=typeof G=="number"?{mainAxis:G,altAxis:G}:Object.assign({mainAxis:0,altAxis:0},G),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(B){if(n){var V,X=C==="y"?wt:Rt,w=C==="y"?kt:Ft,x=C==="y"?"height":"width",$=B[C],R=$+p[X],b=$-p[w],T=d?-L[x]/2:0,K=v===vs?_[x]:L[x],M=v===vs?-L[x]:-_[x],W=e.elements.arrow,ie=d&&W?wa(W):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Wh(),ae=ce[X],me=ce[w],Be=lr(0,_[x],ie[x]),xe=S?_[x]/2-T-Be-ae-F.mainAxis:K-Be-ae-F.mainAxis,re=S?-_[x]/2+T+Be+me+F.mainAxis:M+Be+me+F.mainAxis,Ce=e.elements.arrow&&Ar(e.elements.arrow),ye=Ce?C==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,ue=(V=U==null?void 0:U[C])!=null?V:0,he=$+xe-ue-ye,Ae=$+re-ue,we=lr(d?bn(R,he):R,$,d?qi(b,Ae):b);B[C]=we,q[C]=we-$}if(a){var Oe,De=C==="x"?wt:Rt,ke=C==="x"?kt:Ft,Ue=B[Q],Le=Q==="y"?"height":"width",Se=Ue+p[De],Ve=Ue-p[ke],je=[wt,Rt].indexOf(y)!==-1,ct=(Oe=U==null?void 0:U[Q])!=null?Oe:0,st=je?Se:Ue-_[Le]-L[Le]-ct+F.altAxis,mt=je?Ue+_[Le]+L[Le]-ct-F.altAxis:Ve,yi=d&&je?ZI(st,Ue,mt):lr(d?st:Se,Ue,d?mt:Ve);B[Q]=yi,q[Q]=yi-Ue}e.modifiersData[i]=q}}const Tm={name:"preventOverflow",enabled:!0,phase:"main",fn:xm,requiresIfExists:["offset"]};function Dm(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function Lm(s){return s===xt(s)||!Nt(s)?xa(s):Dm(s)}function _m(s){var e=s.getBoundingClientRect(),t=Bs(e.width)/s.offsetWidth||1,i=Bs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function km(s,e,t){t===void 0&&(t=!1);var i=Nt(e),r=Nt(e)&&_m(e),n=Di(e),o=Qs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ti(e)!=="body"||Da(n))&&(a=Lm(e)),Nt(e)?(A=Qs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ta(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function Fm(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function Nm(s){var e=Fm(s);return WI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Mm(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Pm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var ru={placement:"bottom",modifiers:[],strategy:"absolute"};function nu(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Om(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?ru:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ru,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:Wi(a)?cr(a):a.contextElement?cr(a.contextElement):[],popper:cr(A)};var S=Nm(Pm([].concat(i,c.options.modifiers)));return c.orderedModifiers=S.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,S=y.popper;if(nu(v,S)){c.rects={reference:km(v,Ar(S),c.options.strategy==="fixed"),popper:wa(S)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(F){return c.modifiersData[F.name]=Object.assign({},F.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,_=Q.options,L=_===void 0?{}:_,G=Q.name;typeof B=="function"&&(c=B({state:c,options:L,name:G,instance:d})||c)}}}},update:Mm(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!nu(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,S=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:y,instance:d,options:S}),B=function(){};h.push(Q||B)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var Um=[lm,wm,am,Yh,Sm,Cm,Tm,sm,vm],Gm=Om({defaultModifiers:Um}),Hm="tippy-box",ou="tippy-content",$m="tippy-backdrop",au="tippy-arrow",Au="tippy-svg-arrow",ji={passive:!0,capture:!0},lu=function(){return document.body};function _a(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function ka(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function cu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function hu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Ym(s){return s.split(/\s+/).filter(Boolean)}function bs(s){return[].concat(s)}function uu(s,e){s.indexOf(e)===-1&&s.push(e)}function Km(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function Vm(s){return s.split("-")[0]}function Tn(s){return[].slice.call(s)}function du(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function ur(){return document.createElement("div")}function Dn(s){return["Element","Fragment"].some(function(e){return ka(s,e)})}function Jm(s){return ka(s,"NodeList")}function Wm(s){return ka(s,"MouseEvent")}function qm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function jm(s){return Dn(s)?[s]:Jm(s)?Tn(s):Array.isArray(s)?s:Tn(document.querySelectorAll(s))}function Fa(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function gu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Xm(s){var e,t=bs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function zm(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=Vm(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function Na(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function fu(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var si={isTouch:!1},pu=0;function Zm(){si.isTouch||(si.isTouch=!0,window.performance&&document.addEventListener("mousemove",Eu))}function Eu(){var s=performance.now();s-pu<20&&(si.isTouch=!1,document.removeEventListener("mousemove",Eu)),pu=s}function eC(){var s=document.activeElement;if(qm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function tC(){document.addEventListener("touchstart",Zm,ji),window.addEventListener("blur",eC)}var iC=typeof window<"u"&&typeof document<"u",sC=iC?!!window.msCrypto:!1,rC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},nC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ht=Object.assign({appendTo:lu,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},rC,nC),oC=Object.keys(Ht),aC=function(e){var t=Object.keys(e);t.forEach(function(i){Ht[i]=e[i]})};function Iu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Ht[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function AC(s,e){var t=e?Object.keys(Iu(Object.assign({},Ht,{plugins:e}))):oC,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function mu(s,e){var t=Object.assign({},e,{content:cu(e.content,[s])},e.ignoreAttributes?{}:AC(s,e.plugins));return t.aria=Object.assign({},Ht.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var lC=function(){return"innerHTML"};function Ma(s,e){s[lC()]=e}function Cu(s){var e=ur();return s===!0?e.className=au:(e.className=Au,Dn(s)?e.appendChild(s):Ma(e,s)),e}function yu(s,e){Dn(e.content)?(Ma(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ma(s,e.content):s.textContent=e.content)}function Pa(s){var e=s.firstElementChild,t=Tn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(ou)}),arrow:t.find(function(i){return i.classList.contains(au)||i.classList.contains(Au)}),backdrop:t.find(function(i){return i.classList.contains($m)})}}function vu(s){var e=ur(),t=ur();t.className=Hm,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=ur();i.className=ou,i.setAttribute("data-state","hidden"),yu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Pa(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&yu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Cu(o.arrow))):A.appendChild(Cu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}vu.$$tippy=!0;var cC=1,Ln=[],Oa=[];function hC(s,e){var t=mu(s,Object.assign({},Ht,Iu(du(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=hu(he,t.interactiveDebounce),f,p=cC++,y=null,v=Km(t.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:ur(),popperInstance:y,props:t,state:S,plugins:v,clearDelayTimeouts:st,setProps:mt,setContent:yi,show:Ct,hide:ai,hideWithInteractivity:Ai,enable:je,disable:ct,unmount:li,destroy:gt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,_=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var L=v.map(function(Y){return Y.fn(C)}),G=s.hasAttribute("aria-expanded");return Ce(),T(),$(),R("onCreate",[C]),t.showOnCreate&&Se(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&X().addEventListener("mousemove",g)}),C;function F(){var Y=C.props.touch;return Array.isArray(Y)?Y:[Y,0]}function U(){return F()[0]==="hold"}function q(){var Y;return!!((Y=C.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function X(){var Y=V().parentNode;return Y?Xm(Y):document}function w(){return Pa(B)}function x(Y){return C.state.isMounted&&!C.state.isVisible||si.isTouch||c&&c.type==="focus"?0:_a(C.props.delay,Y?0:1,Ht.delay)}function $(Y){Y===void 0&&(Y=!1),B.style.pointerEvents=C.props.interactive&&!Y?"":"none",B.style.zIndex=""+C.props.zIndex}function R(Y,le,ge){if(ge===void 0&&(ge=!0),L.forEach(function(be){be[Y]&&be[Y].apply(be,le)}),ge){var Re;(Re=C.props)[Y].apply(Re,le)}}function b(){var Y=C.props.aria;if(Y.content){var le="aria-"+Y.content,ge=B.id,Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){var Je=be.getAttribute(le);if(C.state.isVisible)be.setAttribute(le,Je?Je+" "+ge:ge);else{var yt=Je&&Je.replace(ge,"").trim();yt?be.setAttribute(le,yt):be.removeAttribute(le)}})}}function T(){if(!(G||!C.props.aria.expanded)){var Y=bs(C.props.triggerTarget||s);Y.forEach(function(le){C.props.interactive?le.setAttribute("aria-expanded",C.state.isVisible&&le===V()?"true":"false"):le.removeAttribute("aria-expanded")})}}function K(){X().removeEventListener("mousemove",g),Ln=Ln.filter(function(Y){return Y!==g})}function M(Y){if(!(si.isTouch&&(A||Y.type==="mousedown"))){var le=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(C.props.interactive&&fu(B,le))){if(bs(C.props.triggerTarget||s).some(function(ge){return fu(ge,le)})){if(si.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[C,Y]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||ae())}}}function W(){A=!0}function ie(){A=!1}function ce(){var Y=X();Y.addEventListener("mousedown",M,!0),Y.addEventListener("touchend",M,ji),Y.addEventListener("touchstart",ie,ji),Y.addEventListener("touchmove",W,ji)}function ae(){var Y=X();Y.removeEventListener("mousedown",M,!0),Y.removeEventListener("touchend",M,ji),Y.removeEventListener("touchstart",ie,ji),Y.removeEventListener("touchmove",W,ji)}function me(Y,le){xe(Y,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&le()})}function Be(Y,le){xe(Y,le)}function xe(Y,le){var ge=w().box;function Re(be){be.target===ge&&(Na(ge,"remove",Re),le())}if(Y===0)return le();Na(ge,"remove",h),Na(ge,"add",Re),h=Re}function re(Y,le,ge){ge===void 0&&(ge=!1);var Re=bs(C.props.triggerTarget||s);Re.forEach(function(be){be.addEventListener(Y,le,ge),d.push({node:be,eventType:Y,handler:le,options:ge})})}function Ce(){U()&&(re("touchstart",ue,{passive:!0}),re("touchend",Ae,{passive:!0})),Ym(C.props.trigger).forEach(function(Y){if(Y!=="manual")switch(re(Y,ue),Y){case"mouseenter":re("mouseleave",Ae);break;case"focus":re(sC?"focusout":"blur",we);break;case"focusin":re("focusout",we);break}})}function ye(){d.forEach(function(Y){var le=Y.node,ge=Y.eventType,Re=Y.handler,be=Y.options;le.removeEventListener(ge,Re,be)}),d=[]}function ue(Y){var le,ge=!1;if(!(!C.state.isEnabled||Oe(Y)||a)){var Re=((le=c)==null?void 0:le.type)==="focus";c=Y,f=Y.currentTarget,T(),!C.state.isVisible&&Wm(Y)&&Ln.forEach(function(be){return be(Y)}),Y.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?ge=!0:Se(Y),Y.type==="click"&&(o=!ge),ge&&!Re&&Ve(Y)}}function he(Y){var le=Y.target,ge=V().contains(le)||B.contains(le);if(!(Y.type==="mousemove"&&ge)){var Re=Le().concat(B).map(function(be){var Je,yt=be._tippy,vt=(Je=yt.popperInstance)==null?void 0:Je.state;return vt?{popperRect:be.getBoundingClientRect(),popperState:vt,props:t}:null}).filter(Boolean);zm(Re,Y)&&(K(),Ve(Y))}}function Ae(Y){var le=Oe(Y)||C.props.trigger.indexOf("click")>=0&&o;if(!le){if(C.props.interactive){C.hideWithInteractivity(Y);return}Ve(Y)}}function we(Y){C.props.trigger.indexOf("focusin")<0&&Y.target!==V()||C.props.interactive&&Y.relatedTarget&&B.contains(Y.relatedTarget)||Ve(Y)}function Oe(Y){return si.isTouch?U()!==Y.type.indexOf("touch")>=0:!1}function De(){ke();var Y=C.props,le=Y.popperOptions,ge=Y.placement,Re=Y.offset,be=Y.getReferenceClientRect,Je=Y.moveTransition,yt=q()?Pa(B).arrow:null,vt=be?{getBoundingClientRect:be,contextElement:be.contextElement||V()}:s,Ds={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ls){var ki=Ls.state;if(q()){var Ir=w(),mr=Ir.box;["placement","reference-hidden","escaped"].forEach(function(_s){_s==="placement"?mr.setAttribute("data-placement",ki.placement):ki.attributes.popper["data-popper-"+_s]?mr.setAttribute("data-"+_s,""):mr.removeAttribute("data-"+_s)}),ki.attributes.popper={}}}},Bt=[{name:"offset",options:{offset:Re}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Je}},Ds];q()&&yt&&Bt.push({name:"arrow",options:{element:yt,padding:3}}),Bt.push.apply(Bt,(le==null?void 0:le.modifiers)||[]),C.popperInstance=Gm(vt,B,Object.assign({},le,{placement:ge,onFirstUpdate:u,modifiers:Bt}))}function ke(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ue(){var Y=C.props.appendTo,le,ge=V();C.props.interactive&&Y===lu||Y==="parent"?le=ge.parentNode:le=cu(Y,[ge]),le.contains(B)||le.appendChild(B),C.state.isMounted=!0,De()}function Le(){return Tn(B.querySelectorAll("[data-tippy-root]"))}function Se(Y){C.clearDelayTimeouts(),Y&&R("onTrigger",[C,Y]),ce();var le=x(!0),ge=F(),Re=ge[0],be=ge[1];si.isTouch&&Re==="hold"&&be&&(le=be),le?i=setTimeout(function(){C.show()},le):C.show()}function Ve(Y){if(C.clearDelayTimeouts(),R("onUntrigger",[C,Y]),!C.state.isVisible){ae();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var le=x(!1);le?r=setTimeout(function(){C.state.isVisible&&C.hide()},le):n=requestAnimationFrame(function(){C.hide()})}}function je(){C.state.isEnabled=!0}function ct(){C.hide(),C.state.isEnabled=!1}function st(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function mt(Y){if(!C.state.isDestroyed){R("onBeforeUpdate",[C,Y]),ye();var le=C.props,ge=mu(s,Object.assign({},le,du(Y),{ignoreAttributes:!0}));C.props=ge,Ce(),le.interactiveDebounce!==ge.interactiveDebounce&&(K(),g=hu(he,ge.interactiveDebounce)),le.triggerTarget&&!ge.triggerTarget?bs(le.triggerTarget).forEach(function(Re){Re.removeAttribute("aria-expanded")}):ge.triggerTarget&&s.removeAttribute("aria-expanded"),T(),$(),_&&_(le,ge),C.popperInstance&&(De(),Le().forEach(function(Re){requestAnimationFrame(Re._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[C,Y])}}function yi(Y){C.setProps({content:Y})}function Ct(){var Y=C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=si.isTouch&&!C.props.touch,be=_a(C.props.duration,0,Ht.duration);if(!(Y||le||ge||Re)&&!V().hasAttribute("disabled")&&(R("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,q()&&(B.style.visibility="visible"),$(),ce(),C.state.isMounted||(B.style.transition="none"),q()){var Je=w(),yt=Je.box,vt=Je.content;Fa([yt,vt],0)}u=function(){var Bt;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,q()&&C.props.animation){var es=w(),Ls=es.box,ki=es.content;Fa([Ls,ki],be),gu([Ls,ki],"visible")}b(),T(),uu(Oa,C),(Bt=C.popperInstance)==null||Bt.forceUpdate(),R("onMount",[C]),C.props.animation&&q()&&Be(be,function(){C.state.isShown=!0,R("onShown",[C])})}},Ue()}}function ai(){var Y=!C.state.isVisible,le=C.state.isDestroyed,ge=!C.state.isEnabled,Re=_a(C.props.duration,1,Ht.duration);if(!(Y||le||ge)&&(R("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,q()&&(B.style.visibility="hidden"),K(),ae(),$(!0),q()){var be=w(),Je=be.box,yt=be.content;C.props.animation&&(Fa([Je,yt],Re),gu([Je,yt],"hidden"))}b(),T(),C.props.animation?q()&&me(Re,C.unmount):C.unmount()}}function Ai(Y){X().addEventListener("mousemove",g),uu(Ln,g),g(Y)}function li(){C.state.isVisible&&C.hide(),C.state.isMounted&&(ke(),Le().forEach(function(Y){Y._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Oa=Oa.filter(function(Y){return Y!==C}),C.state.isMounted=!1,R("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),ye(),delete s._tippy,C.state.isDestroyed=!0,R("onDestroy",[C]))}}function Xi(s,e){e===void 0&&(e={});var t=Ht.plugins.concat(e.plugins||[]);tC();var i=Object.assign({},e,{plugins:t}),r=jm(s),n=r.reduce(function(o,a){var A=a&&hC(a,i);return A&&o.push(A),o},[]);return Dn(s)?n[0]:n}Xi.defaultProps=Ht,Xi.setDefaultProps=aC,Xi.currentInput=si,Object.assign({},Yh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),Xi.setDefaultProps({render:vu});class ri extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const uC=5;class dC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-uC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=ml((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=Vr(c)&&d<=Vr(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return pt(this._canvas)}controls(){return pt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,u.currentTime):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new ri("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function gC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function fC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Ua(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!gC()&&mi.isSupported()){let l=!1;a=new mi({autoStartLoad:!0,progressive:!0,fetchSetup:(c,h)=>{let u=c.url;const d=r.split("?")[1];if(d&&!u.toString().includes("?")&&(u+="?"+d),!l&&u.includes(".ts")){const g=new AbortController,f=g.signal;return g.abort(),new Request(u,{...h,signal:f})}return new Request(u,h)}}),a.on(mi.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);l=!0,a.startLevel=a.firstLevel,setTimeout(()=>{a==null||a.startLoad(c)}),a.currentLevel=u!==-1?u:a.firstLevel}}}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function Bu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const pC=.5,EC=ui(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let IC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._delayProcessing=(t=100)=>{const i=new AbortController,r=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(r)}),i},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const{id:i,key:r}=t,n=await Ua(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Bu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{const n=this.videoMeta[i];if(n&&this.scenes){const o=this.scenes.scenes.find(A=>{var l,c;return i===((c=(l=A.video)==null?void 0:l.config)==null?void 0:c.key)}),a=Math.max(this.scenes.transitionDuration,pC);o&&r.currentTime>n.start+a&&r.currentTime<n.start+n.duration-a&&(this.host._drawController.currentTime=o.start+r.currentTime-n.start)}this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new ri(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Sr(this.host,async([e,t,i,r,n,o,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:h})=>n===h))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let d=null;if(r)try{d=await(await fetch(r,{method:"GET"})).text()}catch(p){const y=new ri("Track failed to fetch",p);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:y,message:y.message}))}const f={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:d}}}]}};try{this.scenes=await as({data:f,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){try{this.scenes=await as({data:f,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){throw new ri("Fatal source template error",y,!0)}c=new ri("Source template error",p)}}else try{this.scenes=await as({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await as({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new ri("Fatal data template error",g,!0)}c=new ri("Data template error",d)}Object.keys(this.videos).forEach(d=>{this.scenes.scenes.find(({video:g})=>d===(g==null?void 0:g.key))||this._videos[d].node.pause()});const h=this.scenes.scenes.reduce((d,{video:g})=>(g&&(d[g.key]=g),d),{});this.videos=h,this.videoState={...this.videoState,...this.scenes.scenes.reduce((d,{video:g,start:f,duration:p})=>{var y;const v=(g==null?void 0:g.key)??`${f}-${p}`,S=this._getBufferSegments({key:v,node:g==null?void 0:g.node,duration:this.scenes.duration});return d[v]={initialised:!g,waiting:!!g,...this.videoState[v],buffered:g?S:(y=this.videoState[v])==null?void 0:y.buffered},d},{})},this.videoMeta=this.scenes.scenes.reduce((d,{video:g,videoMeta:f})=>(g&&f&&(d[g.key]=f),d),{}),(await Promise.all(this.scenes.fonts.map(d=>EC(d)))).forEach(d=>{document.fonts.add(d)}),this.duration=this.scenes.duration,Object.keys(this.videos).sort().join("|")!==Object.keys(h).sort().join("|")?this.host.reset(0,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function mC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function CC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Ga=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],yC={id:"captions",event:"captions:click",label:"Closed Captions"},vC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Qu={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},BC={id:"playbackRate",label:"Playback playbackRate",subItems:Qu};class QC extends RA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==rs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Pt}}const Ha=ns(QC),SC=NI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=fl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ni={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},bC={colors:ni,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${ni["dark-100"]}`,medium:`0 .125rem .625rem ${ni["dark-100"]}`,large:`0 .25rem 1rem ${ni["dark-50"]}`,xl:`.25rem .25rem 1rem ${ni["dark-250"]}`,xxl:`0 .25rem 2rem ${ni["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ni["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ni["dark-50"]}`,text:`0 0 .25rem ${ni["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ni["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Su=_I(bC,{delimiter:"-"}),wC=Object.keys(Su).map(s=>ks(`:host { --${s}: ${Su[s]}; }`)),Ne=(s=>{const e=class extends s{firstUpdated(){SC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],wC,ht`
186
+ */const Ph=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Oh=os(class extends Hs{constructor(s){if(super(s),s.type!==ns.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=ud(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Oi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Oi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Oi(r[h],n[g]),Gs(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Oi(r[u],n[d]),Gs(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Ph(o,d,g),c=Ph(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Gs(s,r[h]);Oi(y,n[d]),A[d]=y}else A[d]=Oi(p,n[d]),Gs(s,r[h],p),r[f]=null;d++}else Xn(r[u]),u--;else Xn(r[h]),h++;for(;d<=g;){const f=Gs(s,A[g+1]);Oi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&Xn(f)}return this.ut=o,hd(s,A),Pt}});var wt="top",kt="bottom",Ft="right",Rt="left",Sa="auto",sr=[wt,kt,Ft,Rt],ys="start",rr="end",UI="clippingParents",Uh="viewport",nr="popper",GI="reference",Gh=sr.reduce(function(s,e){return s.concat([e+"-"+ys,e+"-"+rr])},[]),Hh=[].concat(sr,[Sa]).reduce(function(s,e){return s.concat([e,e+"-"+ys,e+"-"+rr])},[]),HI="beforeRead",$I="read",YI="afterRead",KI="beforeMain",VI="main",JI="afterMain",WI="beforeWrite",qI="write",jI="afterWrite",XI=[HI,$I,YI,KI,VI,JI,WI,qI,jI];function ti(s){return s?(s.nodeName||"").toLowerCase():null}function xt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function qi(s){var e=xt(s).Element;return s instanceof e||s instanceof Element}function Nt(s){var e=xt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function ba(s){if(typeof ShadowRoot>"u")return!1;var e=xt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function zI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Nt(n)||!ti(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function ZI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Nt(r)||!ti(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const $h={name:"applyStyles",enabled:!0,phase:"write",fn:zI,effect:ZI,requires:["computeStyles"]};function ii(s){return s.split("-")[0]}var ji=Math.max,wn=Math.min,vs=Math.round;function wa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Yh(){return!/^((?!chrome|android).)*safari/i.test(wa())}function Bs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Nt(s)&&(r=s.offsetWidth>0&&vs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&vs(i.height)/s.offsetHeight||1);var o=qi(s)?xt(s):window,a=o.visualViewport,A=!Yh()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Ra(s){var e=Bs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function Kh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&ba(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Ci(s){return xt(s).getComputedStyle(s)}function em(s){return["table","td","th"].indexOf(ti(s))>=0}function Di(s){return((qi(s)?s.ownerDocument:s.document)||window.document).documentElement}function Rn(s){return ti(s)==="html"?s:s.assignedSlot||s.parentNode||(ba(s)?s.host:null)||Di(s)}function Vh(s){return!Nt(s)||Ci(s).position==="fixed"?null:s.offsetParent}function tm(s){var e=/firefox/i.test(wa()),t=/Trident/i.test(wa());if(t&&Nt(s)){var i=Ci(s);if(i.position==="fixed")return null}var r=Rn(s);for(ba(r)&&(r=r.host);Nt(r)&&["html","body"].indexOf(ti(r))<0;){var n=Ci(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function or(s){for(var e=xt(s),t=Vh(s);t&&em(t)&&Ci(t).position==="static";)t=Vh(t);return t&&(ti(t)==="html"||ti(t)==="body"&&Ci(t).position==="static")?e:t||tm(s)||e}function xa(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function ar(s,e,t){return ji(s,wn(e,t))}function im(s,e,t){var i=ar(s,e,t);return i>t?t:i}function Jh(){return{top:0,right:0,bottom:0,left:0}}function Wh(s){return Object.assign({},Jh(),s)}function qh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var sm=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Wh(typeof e!="number"?e:qh(e,sr))};function rm(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ii(t.placement),A=xa(a),l=[Rt,Ft].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=sm(r.padding,t),u=Ra(n),d=A==="y"?wt:Rt,g=A==="y"?kt:Ft,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=or(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,S=f/2-p/2,C=h[d],Q=v-u[c]-h[g],B=v/2-u[c]/2+S,_=ar(C,B,Q),L=A;t.modifiersData[i]=(e={},e[L]=_,e.centerOffset=_-B,e)}}function nm(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Kh(e.elements.popper,r)&&(e.elements.arrow=r))}const om={name:"arrow",enabled:!0,phase:"main",fn:rm,effect:nm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Qs(s){return s.split("-")[1]}var am={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Am(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:vs(t*r)/r||0,y:vs(i*r)/r||0}}function jh(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),S=Rt,C=wt,Q=window;if(l){var B=or(t),_="clientHeight",L="clientWidth";if(B===xt(t)&&(B=Di(t),Ci(B).position!=="static"&&a==="absolute"&&(_="scrollHeight",L="scrollWidth")),B=B,r===wt||(r===Rt||r===Ft)&&n===rr){C=kt;var G=h&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[_];f-=G-i.height,f*=A?1:-1}if(r===Rt||(r===wt||r===kt)&&n===rr){S=Ft;var F=h&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[L];d-=F-i.width,d*=A?1:-1}}var U=Object.assign({position:a},l&&am),q=c===!0?Am({x:d,y:f},xt(t)):{x:d,y:f};if(d=q.x,f=q.y,A){var V;return Object.assign({},U,(V={},V[C]=v?"0":"",V[S]=y?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},U,(e={},e[C]=v?f+"px":"",e[S]=y?d+"px":"",e.transform="",e))}function lm(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ii(e.placement),variation:Qs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,jh(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,jh(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const cm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:lm,data:{}};var xn={passive:!0};function hm(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=xt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,xn)}),a&&A.addEventListener("resize",t.update,xn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,xn)}),a&&A.removeEventListener("resize",t.update,xn)}}const um={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:hm,data:{}};var dm={left:"right",right:"left",bottom:"top",top:"bottom"};function Tn(s){return s.replace(/left|right|bottom|top/g,function(e){return dm[e]})}var gm={start:"end",end:"start"};function Xh(s){return s.replace(/start|end/g,function(e){return gm[e]})}function Ta(s){var e=xt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Da(s){return Bs(Di(s)).left+Ta(s).scrollLeft}function fm(s,e){var t=xt(s),i=Di(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=Yh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Da(s),y:A}}function pm(s){var e,t=Di(s),i=Ta(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=ji(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=ji(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Da(s),A=-i.scrollTop;return Ci(r||t).direction==="rtl"&&(a+=ji(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function La(s){var e=Ci(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function zh(s){return["html","body","#document"].indexOf(ti(s))>=0?s.ownerDocument.body:Nt(s)&&La(s)?s:zh(Rn(s))}function Ar(s,e){var t;e===void 0&&(e=[]);var i=zh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=xt(i),o=r?[n].concat(n.visualViewport||[],La(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(Ar(Rn(o)))}function _a(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function Em(s,e){var t=Bs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function Zh(s,e,t){return e===Uh?_a(fm(s,t)):qi(e)?Em(e,t):_a(pm(Di(s)))}function Im(s){var e=Ar(Rn(s)),t=["absolute","fixed"].indexOf(Ci(s).position)>=0,i=t&&Nt(s)?or(s):s;return qi(i)?e.filter(function(r){return qi(r)&&Kh(r,i)&&ti(r)!=="body"}):[]}function mm(s,e,t,i){var r=e==="clippingParents"?Im(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=Zh(s,l,i);return A.top=ji(c.top,A.top),A.right=wn(c.right,A.right),A.bottom=wn(c.bottom,A.bottom),A.left=ji(c.left,A.left),A},Zh(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function eu(s){var e=s.reference,t=s.element,i=s.placement,r=i?ii(i):null,n=i?Qs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case wt:A={x:o,y:e.y-t.height};break;case kt:A={x:o,y:e.y+e.height};break;case Ft:A={x:e.x+e.width,y:a};break;case Rt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?xa(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case ys:A[l]=A[l]-(e[c]/2-t[c]/2);break;case rr:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function lr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?UI:a,l=t.rootBoundary,c=l===void 0?Uh:l,h=t.elementContext,u=h===void 0?nr:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=Wh(typeof p!="number"?p:qh(p,sr)),v=u===nr?GI:nr,S=s.rects.popper,C=s.elements[g?v:u],Q=mm(qi(C)?C:C.contextElement||Di(s.elements.popper),A,c,o),B=Bs(s.elements.reference),_=eu({reference:B,element:S,strategy:"absolute",placement:r}),L=_a(Object.assign({},S,_)),G=u===nr?L:B,F={top:Q.top-G.top+y.top,bottom:G.bottom-Q.bottom+y.bottom,left:Q.left-G.left+y.left,right:G.right-Q.right+y.right},U=s.modifiersData.offset;if(u===nr&&U){var q=U[r];Object.keys(F).forEach(function(V){var X=[Ft,kt].indexOf(V)>=0?1:-1,w=[wt,kt].indexOf(V)>=0?"y":"x";F[V]+=q[w]*X})}return F}function Cm(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?Hh:A,c=Qs(i),h=c?a?Gh:Gh.filter(function(g){return Qs(g)===c}):sr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=lr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ii(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function ym(s){if(ii(s)===Sa)return[];var e=Tn(s);return[Xh(s),e,Xh(e)]}function vm(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ii(p),v=y===p,S=A||(v||!g?[Tn(p)]:ym(p)),C=[p].concat(S).reduce(function(ie,ce){return ie.concat(ii(ce)===Sa?Cm(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),Q=e.rects.reference,B=e.rects.popper,_=new Map,L=!0,G=C[0],F=0;F<C.length;F++){var U=C[F],q=ii(U),V=Qs(U)===ys,X=[wt,kt].indexOf(q)>=0,w=X?"width":"height",x=lr(e,{placement:U,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),$=X?V?Ft:Rt:V?kt:wt;Q[w]>B[w]&&($=Tn($));var R=Tn($),b=[];if(n&&b.push(x[q]<=0),a&&b.push(x[$]<=0,x[R]<=0),b.every(function(ie){return ie})){G=U,L=!1;break}_.set(U,b)}if(L)for(var T=g?3:1,K=function(ce){var ae=C.find(function(me){var Be=_.get(me);if(Be)return Be.slice(0,ce).every(function(xe){return xe})});if(ae)return G=ae,"break"},M=T;M>0;M--){var W=K(M);if(W==="break")break}e.placement!==G&&(e.modifiersData[i]._skip=!0,e.placement=G,e.reset=!0)}}const Bm={name:"flip",enabled:!0,phase:"main",fn:vm,requiresIfExists:["offset"],data:{_skip:!1}};function tu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function iu(s){return[wt,Ft,kt,Rt].some(function(e){return s[e]>=0})}function Qm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=lr(e,{elementContext:"reference"}),a=lr(e,{altBoundary:!0}),A=tu(o,i),l=tu(a,r,n),c=iu(A),h=iu(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const Sm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Qm};function bm(s,e,t){var i=ii(s),r=[Rt,wt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Rt,Ft].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function wm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=Hh.reduce(function(c,h){return c[h]=bm(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Rm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:wm};function xm(s){var e=s.state,t=s.name;e.modifiersData[t]=eu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Tm={name:"popperOffsets",enabled:!0,phase:"read",fn:xm,data:{}};function Dm(s){return s==="x"?"y":"x"}function Lm(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=lr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ii(e.placement),v=Qs(e.placement),S=!v,C=xa(y),Q=Dm(C),B=e.modifiersData.popperOffsets,_=e.rects.reference,L=e.rects.popper,G=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,F=typeof G=="number"?{mainAxis:G,altAxis:G}:Object.assign({mainAxis:0,altAxis:0},G),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(B){if(n){var V,X=C==="y"?wt:Rt,w=C==="y"?kt:Ft,x=C==="y"?"height":"width",$=B[C],R=$+p[X],b=$-p[w],T=d?-L[x]/2:0,K=v===ys?_[x]:L[x],M=v===ys?-L[x]:-_[x],W=e.elements.arrow,ie=d&&W?Ra(W):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Jh(),ae=ce[X],me=ce[w],Be=ar(0,_[x],ie[x]),xe=S?_[x]/2-T-Be-ae-F.mainAxis:K-Be-ae-F.mainAxis,re=S?-_[x]/2+T+Be+me+F.mainAxis:M+Be+me+F.mainAxis,Ce=e.elements.arrow&&or(e.elements.arrow),ye=Ce?C==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,ue=(V=U==null?void 0:U[C])!=null?V:0,he=$+xe-ue-ye,Ae=$+re-ue,we=ar(d?wn(R,he):R,$,d?ji(b,Ae):b);B[C]=we,q[C]=we-$}if(a){var Oe,De=C==="x"?wt:Rt,ke=C==="x"?kt:Ft,Ue=B[Q],Le=Q==="y"?"height":"width",Se=Ue+p[De],Ve=Ue-p[ke],je=[wt,Rt].indexOf(y)!==-1,ct=(Oe=U==null?void 0:U[Q])!=null?Oe:0,st=je?Se:Ue-_[Le]-L[Le]-ct+F.altAxis,mt=je?Ue+_[Le]+L[Le]-ct-F.altAxis:Ve,yi=d&&je?im(st,Ue,mt):ar(d?st:Se,Ue,d?mt:Ve);B[Q]=yi,q[Q]=yi-Ue}e.modifiersData[i]=q}}const _m={name:"preventOverflow",enabled:!0,phase:"main",fn:Lm,requiresIfExists:["offset"]};function km(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function Fm(s){return s===xt(s)||!Nt(s)?Ta(s):km(s)}function Nm(s){var e=s.getBoundingClientRect(),t=vs(e.width)/s.offsetWidth||1,i=vs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function Mm(s,e,t){t===void 0&&(t=!1);var i=Nt(e),r=Nt(e)&&Nm(e),n=Di(e),o=Bs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ti(e)!=="body"||La(n))&&(a=Fm(e)),Nt(e)?(A=Bs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Da(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function Pm(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function Om(s){var e=Pm(s);return XI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Um(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Gm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var su={placement:"bottom",modifiers:[],strategy:"absolute"};function ru(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Hm(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?su:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},su,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:qi(a)?Ar(a):a.contextElement?Ar(a.contextElement):[],popper:Ar(A)};var S=Om(Gm([].concat(i,c.options.modifiers)));return c.orderedModifiers=S.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,S=y.popper;if(ru(v,S)){c.rects={reference:Mm(v,or(S),c.options.strategy==="fixed"),popper:Ra(S)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(F){return c.modifiersData[F.name]=Object.assign({},F.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,_=Q.options,L=_===void 0?{}:_,G=Q.name;typeof B=="function"&&(c=B({state:c,options:L,name:G,instance:d})||c)}}}},update:Um(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!ru(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,S=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:y,instance:d,options:S}),B=function(){};h.push(Q||B)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var $m=[um,Tm,cm,$h,Rm,Bm,_m,om,Sm],Ym=Hm({defaultModifiers:$m}),Km="tippy-box",nu="tippy-content",Vm="tippy-backdrop",ou="tippy-arrow",au="tippy-svg-arrow",Xi={passive:!0,capture:!0},Au=function(){return document.body};function ka(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Fa(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function lu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function cu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Jm(s){return s.split(/\s+/).filter(Boolean)}function Ss(s){return[].concat(s)}function hu(s,e){s.indexOf(e)===-1&&s.push(e)}function Wm(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function qm(s){return s.split("-")[0]}function Dn(s){return[].slice.call(s)}function uu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function cr(){return document.createElement("div")}function Ln(s){return["Element","Fragment"].some(function(e){return Fa(s,e)})}function jm(s){return Fa(s,"NodeList")}function Xm(s){return Fa(s,"MouseEvent")}function zm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function Zm(s){return Ln(s)?[s]:jm(s)?Dn(s):Array.isArray(s)?s:Dn(document.querySelectorAll(s))}function Na(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function du(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function eC(s){var e,t=Ss(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function tC(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=qm(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function Ma(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function gu(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var si={isTouch:!1},fu=0;function iC(){si.isTouch||(si.isTouch=!0,window.performance&&document.addEventListener("mousemove",pu))}function pu(){var s=performance.now();s-fu<20&&(si.isTouch=!1,document.removeEventListener("mousemove",pu)),fu=s}function sC(){var s=document.activeElement;if(zm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function rC(){document.addEventListener("touchstart",iC,Xi),window.addEventListener("blur",sC)}var nC=typeof window<"u"&&typeof document<"u",oC=nC?!!window.msCrypto:!1,aC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},AC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ht=Object.assign({appendTo:Au,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},aC,AC),lC=Object.keys(Ht),cC=function(e){var t=Object.keys(e);t.forEach(function(i){Ht[i]=e[i]})};function Eu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Ht[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function hC(s,e){var t=e?Object.keys(Eu(Object.assign({},Ht,{plugins:e}))):lC,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function Iu(s,e){var t=Object.assign({},e,{content:lu(e.content,[s])},e.ignoreAttributes?{}:hC(s,e.plugins));return t.aria=Object.assign({},Ht.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var uC=function(){return"innerHTML"};function Pa(s,e){s[uC()]=e}function mu(s){var e=cr();return s===!0?e.className=ou:(e.className=au,Ln(s)?e.appendChild(s):Pa(e,s)),e}function Cu(s,e){Ln(e.content)?(Pa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Pa(s,e.content):s.textContent=e.content)}function Oa(s){var e=s.firstElementChild,t=Dn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(nu)}),arrow:t.find(function(i){return i.classList.contains(ou)||i.classList.contains(au)}),backdrop:t.find(function(i){return i.classList.contains(Vm)})}}function yu(s){var e=cr(),t=cr();t.className=Km,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=cr();i.className=nu,i.setAttribute("data-state","hidden"),Cu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Oa(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&Cu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(mu(o.arrow))):A.appendChild(mu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}yu.$$tippy=!0;var dC=1,_n=[],Ua=[];function gC(s,e){var t=Iu(s,Object.assign({},Ht,Eu(uu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=cu(he,t.interactiveDebounce),f,p=dC++,y=null,v=Wm(t.plugins),S={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:cr(),popperInstance:y,props:t,state:S,plugins:v,clearDelayTimeouts:st,setProps:mt,setContent:yi,show:Ct,hide:ai,hideWithInteractivity:Ai,enable:je,disable:ct,unmount:li,destroy:gt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,_=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var L=v.map(function(Y){return Y.fn(C)}),G=s.hasAttribute("aria-expanded");return Ce(),T(),$(),R("onCreate",[C]),t.showOnCreate&&Se(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&X().addEventListener("mousemove",g)}),C;function F(){var Y=C.props.touch;return Array.isArray(Y)?Y:[Y,0]}function U(){return F()[0]==="hold"}function q(){var Y;return!!((Y=C.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function X(){var Y=V().parentNode;return Y?eC(Y):document}function w(){return Oa(B)}function x(Y){return C.state.isMounted&&!C.state.isVisible||si.isTouch||c&&c.type==="focus"?0:ka(C.props.delay,Y?0:1,Ht.delay)}function $(Y){Y===void 0&&(Y=!1),B.style.pointerEvents=C.props.interactive&&!Y?"":"none",B.style.zIndex=""+C.props.zIndex}function R(Y,le,fe){if(fe===void 0&&(fe=!0),L.forEach(function(be){be[Y]&&be[Y].apply(be,le)}),fe){var Re;(Re=C.props)[Y].apply(Re,le)}}function b(){var Y=C.props.aria;if(Y.content){var le="aria-"+Y.content,fe=B.id,Re=Ss(C.props.triggerTarget||s);Re.forEach(function(be){var Je=be.getAttribute(le);if(C.state.isVisible)be.setAttribute(le,Je?Je+" "+fe:fe);else{var yt=Je&&Je.replace(fe,"").trim();yt?be.setAttribute(le,yt):be.removeAttribute(le)}})}}function T(){if(!(G||!C.props.aria.expanded)){var Y=Ss(C.props.triggerTarget||s);Y.forEach(function(le){C.props.interactive?le.setAttribute("aria-expanded",C.state.isVisible&&le===V()?"true":"false"):le.removeAttribute("aria-expanded")})}}function K(){X().removeEventListener("mousemove",g),_n=_n.filter(function(Y){return Y!==g})}function M(Y){if(!(si.isTouch&&(A||Y.type==="mousedown"))){var le=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(C.props.interactive&&gu(B,le))){if(Ss(C.props.triggerTarget||s).some(function(fe){return gu(fe,le)})){if(si.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[C,Y]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||ae())}}}function W(){A=!0}function ie(){A=!1}function ce(){var Y=X();Y.addEventListener("mousedown",M,!0),Y.addEventListener("touchend",M,Xi),Y.addEventListener("touchstart",ie,Xi),Y.addEventListener("touchmove",W,Xi)}function ae(){var Y=X();Y.removeEventListener("mousedown",M,!0),Y.removeEventListener("touchend",M,Xi),Y.removeEventListener("touchstart",ie,Xi),Y.removeEventListener("touchmove",W,Xi)}function me(Y,le){xe(Y,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&le()})}function Be(Y,le){xe(Y,le)}function xe(Y,le){var fe=w().box;function Re(be){be.target===fe&&(Ma(fe,"remove",Re),le())}if(Y===0)return le();Ma(fe,"remove",h),Ma(fe,"add",Re),h=Re}function re(Y,le,fe){fe===void 0&&(fe=!1);var Re=Ss(C.props.triggerTarget||s);Re.forEach(function(be){be.addEventListener(Y,le,fe),d.push({node:be,eventType:Y,handler:le,options:fe})})}function Ce(){U()&&(re("touchstart",ue,{passive:!0}),re("touchend",Ae,{passive:!0})),Jm(C.props.trigger).forEach(function(Y){if(Y!=="manual")switch(re(Y,ue),Y){case"mouseenter":re("mouseleave",Ae);break;case"focus":re(oC?"focusout":"blur",we);break;case"focusin":re("focusout",we);break}})}function ye(){d.forEach(function(Y){var le=Y.node,fe=Y.eventType,Re=Y.handler,be=Y.options;le.removeEventListener(fe,Re,be)}),d=[]}function ue(Y){var le,fe=!1;if(!(!C.state.isEnabled||Oe(Y)||a)){var Re=((le=c)==null?void 0:le.type)==="focus";c=Y,f=Y.currentTarget,T(),!C.state.isVisible&&Xm(Y)&&_n.forEach(function(be){return be(Y)}),Y.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?fe=!0:Se(Y),Y.type==="click"&&(o=!fe),fe&&!Re&&Ve(Y)}}function he(Y){var le=Y.target,fe=V().contains(le)||B.contains(le);if(!(Y.type==="mousemove"&&fe)){var Re=Le().concat(B).map(function(be){var Je,yt=be._tippy,vt=(Je=yt.popperInstance)==null?void 0:Je.state;return vt?{popperRect:be.getBoundingClientRect(),popperState:vt,props:t}:null}).filter(Boolean);tC(Re,Y)&&(K(),Ve(Y))}}function Ae(Y){var le=Oe(Y)||C.props.trigger.indexOf("click")>=0&&o;if(!le){if(C.props.interactive){C.hideWithInteractivity(Y);return}Ve(Y)}}function we(Y){C.props.trigger.indexOf("focusin")<0&&Y.target!==V()||C.props.interactive&&Y.relatedTarget&&B.contains(Y.relatedTarget)||Ve(Y)}function Oe(Y){return si.isTouch?U()!==Y.type.indexOf("touch")>=0:!1}function De(){ke();var Y=C.props,le=Y.popperOptions,fe=Y.placement,Re=Y.offset,be=Y.getReferenceClientRect,Je=Y.moveTransition,yt=q()?Oa(B).arrow:null,vt=be?{getBoundingClientRect:be,contextElement:be.contextElement||V()}:s,Ts={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ds){var ki=Ds.state;if(q()){var pr=w(),Er=pr.box;["placement","reference-hidden","escaped"].forEach(function(Ls){Ls==="placement"?Er.setAttribute("data-placement",ki.placement):ki.attributes.popper["data-popper-"+Ls]?Er.setAttribute("data-"+Ls,""):Er.removeAttribute("data-"+Ls)}),ki.attributes.popper={}}}},Bt=[{name:"offset",options:{offset:Re}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Je}},Ts];q()&&yt&&Bt.push({name:"arrow",options:{element:yt,padding:3}}),Bt.push.apply(Bt,(le==null?void 0:le.modifiers)||[]),C.popperInstance=Ym(vt,B,Object.assign({},le,{placement:fe,onFirstUpdate:u,modifiers:Bt}))}function ke(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ue(){var Y=C.props.appendTo,le,fe=V();C.props.interactive&&Y===Au||Y==="parent"?le=fe.parentNode:le=lu(Y,[fe]),le.contains(B)||le.appendChild(B),C.state.isMounted=!0,De()}function Le(){return Dn(B.querySelectorAll("[data-tippy-root]"))}function Se(Y){C.clearDelayTimeouts(),Y&&R("onTrigger",[C,Y]),ce();var le=x(!0),fe=F(),Re=fe[0],be=fe[1];si.isTouch&&Re==="hold"&&be&&(le=be),le?i=setTimeout(function(){C.show()},le):C.show()}function Ve(Y){if(C.clearDelayTimeouts(),R("onUntrigger",[C,Y]),!C.state.isVisible){ae();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var le=x(!1);le?r=setTimeout(function(){C.state.isVisible&&C.hide()},le):n=requestAnimationFrame(function(){C.hide()})}}function je(){C.state.isEnabled=!0}function ct(){C.hide(),C.state.isEnabled=!1}function st(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function mt(Y){if(!C.state.isDestroyed){R("onBeforeUpdate",[C,Y]),ye();var le=C.props,fe=Iu(s,Object.assign({},le,uu(Y),{ignoreAttributes:!0}));C.props=fe,Ce(),le.interactiveDebounce!==fe.interactiveDebounce&&(K(),g=cu(he,fe.interactiveDebounce)),le.triggerTarget&&!fe.triggerTarget?Ss(le.triggerTarget).forEach(function(Re){Re.removeAttribute("aria-expanded")}):fe.triggerTarget&&s.removeAttribute("aria-expanded"),T(),$(),_&&_(le,fe),C.popperInstance&&(De(),Le().forEach(function(Re){requestAnimationFrame(Re._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[C,Y])}}function yi(Y){C.setProps({content:Y})}function Ct(){var Y=C.state.isVisible,le=C.state.isDestroyed,fe=!C.state.isEnabled,Re=si.isTouch&&!C.props.touch,be=ka(C.props.duration,0,Ht.duration);if(!(Y||le||fe||Re)&&!V().hasAttribute("disabled")&&(R("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,q()&&(B.style.visibility="visible"),$(),ce(),C.state.isMounted||(B.style.transition="none"),q()){var Je=w(),yt=Je.box,vt=Je.content;Na([yt,vt],0)}u=function(){var Bt;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,q()&&C.props.animation){var ts=w(),Ds=ts.box,ki=ts.content;Na([Ds,ki],be),du([Ds,ki],"visible")}b(),T(),hu(Ua,C),(Bt=C.popperInstance)==null||Bt.forceUpdate(),R("onMount",[C]),C.props.animation&&q()&&Be(be,function(){C.state.isShown=!0,R("onShown",[C])})}},Ue()}}function ai(){var Y=!C.state.isVisible,le=C.state.isDestroyed,fe=!C.state.isEnabled,Re=ka(C.props.duration,1,Ht.duration);if(!(Y||le||fe)&&(R("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,q()&&(B.style.visibility="hidden"),K(),ae(),$(!0),q()){var be=w(),Je=be.box,yt=be.content;C.props.animation&&(Na([Je,yt],Re),du([Je,yt],"hidden"))}b(),T(),C.props.animation?q()&&me(Re,C.unmount):C.unmount()}}function Ai(Y){X().addEventListener("mousemove",g),hu(_n,g),g(Y)}function li(){C.state.isVisible&&C.hide(),C.state.isMounted&&(ke(),Le().forEach(function(Y){Y._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Ua=Ua.filter(function(Y){return Y!==C}),C.state.isMounted=!1,R("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),ye(),delete s._tippy,C.state.isDestroyed=!0,R("onDestroy",[C]))}}function zi(s,e){e===void 0&&(e={});var t=Ht.plugins.concat(e.plugins||[]);rC();var i=Object.assign({},e,{plugins:t}),r=Zm(s),n=r.reduce(function(o,a){var A=a&&gC(a,i);return A&&o.push(A),o},[]);return Ln(s)?n[0]:n}zi.defaultProps=Ht,zi.setDefaultProps=cC,zi.currentInput=si,Object.assign({},$h,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),zi.setDefaultProps({render:yu});class ri extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const fC=5;class pC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-fC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=Cl((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=Yr(c)&&d<=Yr(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return pt(this._canvas)}controls(){return pt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,d):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new ri("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function EC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function IC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Ga(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!EC()&&mi.isSupported()){let l=!1;a=new mi({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,g,f){g.toString().includes("?")||(g+="?"+u),!(!l&&g.toString().includes(".ts"))&&h.apply(this,[d,g,f])}}}),a.on(mi.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);l=!0,a.startLevel=a.firstLevel,a.startLoad(c),a.currentLevel=u!==-1?u:a.firstLevel}}}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function vu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const mC=.5,CC=ui(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let yC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._delayProcessing=(t=100)=>{const i=new AbortController,r=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(r)}),i},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const{id:i,key:r}=t,n=await Ga(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await vu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{const n=this.videoMeta[i];if(n&&this.scenes){const o=this.scenes.scenes.find(A=>{var l,c;return i===((c=(l=A.video)==null?void 0:l.config)==null?void 0:c.key)}),a=Math.max(this.scenes.transitionDuration,mC);o&&r.currentTime>n.start+a&&r.currentTime<n.start+n.duration-a&&(this.host._drawController.currentTime=o.start+r.currentTime-n.start)}this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new ri(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Br(this.host,async([e,t,i,r,n,o,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:h})=>n===h))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let d=null;if(r)try{d=await(await fetch(r,{method:"GET"})).text()}catch(p){const y=new ri("Track failed to fetch",p);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:y,message:y.message}))}const f={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:d}}}]}};try{this.scenes=await As({data:f,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){try{this.scenes=await As({data:f,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){throw new ri("Fatal source template error",y,!0)}c=new ri("Source template error",p)}}else try{this.scenes=await As({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await As({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new ri("Fatal data template error",g,!0)}c=new ri("Data template error",d)}Object.keys(this.videos).forEach(d=>{this.scenes.scenes.find(({video:g})=>d===(g==null?void 0:g.key))||this._videos[d].node.pause()});const h=this.scenes.scenes.reduce((d,{video:g})=>(g&&(d[g.key]=g),d),{});this.videos=h,this.videoState={...this.videoState,...this.scenes.scenes.reduce((d,{video:g,start:f,duration:p})=>{var y;const v=(g==null?void 0:g.key)??`${f}-${p}`,S=this._getBufferSegments({key:v,node:g==null?void 0:g.node,duration:this.scenes.duration});return d[v]={initialised:!g,waiting:!!g,...this.videoState[v],buffered:g?S:(y=this.videoState[v])==null?void 0:y.buffered},d},{})},this.videoMeta=this.scenes.scenes.reduce((d,{video:g,videoMeta:f})=>(g&&f&&(d[g.key]=f),d),{}),(await Promise.all(this.scenes.fonts.map(d=>CC(d)))).forEach(d=>{document.fonts.add(d)}),this.duration=this.scenes.duration,Object.keys(this.videos).sort().join("|")!==Object.keys(h).sort().join("|")?this.host.reset(0,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function vC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function BC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Ha=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],QC={id:"captions",event:"captions:click",label:"Closed Captions"},SC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Bu={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},bC={id:"playbackRate",label:"Playback playbackRate",subItems:Bu};class wC extends xA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==ns.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Pt}}const $a=os(wC),RC=OI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=pl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ni={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},xC={colors:ni,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${ni["dark-100"]}`,medium:`0 .125rem .625rem ${ni["dark-100"]}`,large:`0 .25rem 1rem ${ni["dark-50"]}`,xl:`.25rem .25rem 1rem ${ni["dark-250"]}`,xxl:`0 .25rem 2rem ${ni["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ni["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ni["dark-50"]}`,text:`0 0 .25rem ${ni["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ni["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Qu=NI(xC,{delimiter:"-"}),TC=Object.keys(Qu).map(s=>_s(`:host { --${s}: ${Qu[s]}; }`)),Ne=(s=>{const e=class extends s{firstUpdated(){RC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],TC,ht`
187
187
  :host {
188
188
  font-family: var(--fontFamilies-sans);
189
189
  font-size: var(--fontSizes-medium);
@@ -264,7 +264,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
264
264
  scroll-behavior: auto !important;
265
265
  }
266
266
  }
267
- `],e})(ss),RC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),xC=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},Qt=s=>e=>typeof e=="function"?RC(s,e):xC(s,e);class TC{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const i=await Ua(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=ui(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await Ua(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Bu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Sr(this.host,async([e,t,i,r,n])=>{var o,a;try{if(e){const A=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await as({data:{questions:{items:[{answer:{id:"source",media:{[A]:e}}}]}},template:i,burnCaptions:n},this._createDataResolver(r),this._resolveVideo,this._resolveVideoMeta)}catch(l){throw new ri("Video preview source template error",l)}this._video=((a=(o=this.scenes.scenes[0])==null?void 0:o.video)==null?void 0:a.node)??null}else if(t)try{this.scenes=await as({data:t,template:i,burnCaptions:n},this._createDataResolver(r),this._resolveAnswer,this._resolveVideoMeta)}catch(A){throw new ri("Video preview data template error",A)}}catch(A){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:A,message:A.message}))}},()=>{const e=JSON.stringify({src:this.host.src,data:this.host.data,template:this.host.template,language:this.host.language,burnCaptions:this.host.burnCaptions});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template,this.host.language,this.host.burnCaptions];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function bu(s,e,t){return Math.min(Math.max(e,s),t)}function dr(s,e){return e?e instanceof ShadowRoot?dr(s,e.host):e instanceof HTMLElement&&e.matches(s)?e:dr(s,e.parentNode):null}function $a(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var DC=Object.defineProperty,LC=Object.getOwnPropertyDescriptor,ws=(s,e,t,i)=>{for(var r=i>1?void 0:i?LC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&DC(e,t,r),r};let Li=class extends Ne{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ie`<button
267
+ `],e})(rs),DC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),LC=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},Qt=s=>e=>typeof e=="function"?DC(s,e):LC(s,e);class _C{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=ui(async t=>{const i=await Ga(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=ui(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await Ga(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await vu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Br(this.host,async([e,t,i,r,n])=>{var o,a;try{if(e){const A=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await As({data:{questions:{items:[{answer:{id:"source",media:{[A]:e}}}]}},template:i,burnCaptions:n},this._createDataResolver(r),this._resolveVideo,this._resolveVideoMeta)}catch(l){throw new ri("Video preview source template error",l)}this._video=((a=(o=this.scenes.scenes[0])==null?void 0:o.video)==null?void 0:a.node)??null}else if(t)try{this.scenes=await As({data:t,template:i,burnCaptions:n},this._createDataResolver(r),this._resolveAnswer,this._resolveVideoMeta)}catch(A){throw new ri("Video preview data template error",A)}}catch(A){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:A,message:A.message}))}},()=>{const e=JSON.stringify({src:this.host.src,data:this.host.data,template:this.host.template,language:this.host.language,burnCaptions:this.host.burnCaptions});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template,this.host.language,this.host.burnCaptions];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function Su(s,e,t){return Math.min(Math.max(e,s),t)}function hr(s,e){return e?e instanceof ShadowRoot?hr(s,e.host):e instanceof HTMLElement&&e.matches(s)?e:hr(s,e.parentNode):null}function Ya(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var kC=Object.defineProperty,FC=Object.getOwnPropertyDescriptor,bs=(s,e,t,i)=>{for(var r=i>1?void 0:i?FC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&kC(e,t,r),r};let Li=class extends Ne{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ie`<button
268
268
  class=${Ye({active:this.active,"size-tiny":this.size==="tiny","size-small":this.size==="small","size-large":this.size==="large","radius-medium":this.rounded==="medium","radius-full":this.rounded==="full","weight-light":this.weight==="light","weight-heavy":this.weight==="heavy"})}
269
269
  >
270
270
  <slot></slot>
@@ -345,7 +345,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
345
345
  .weight-light:focus {
346
346
  --button-background: var(--vu-button-background-hover, #9d9d9d);
347
347
  }
348
- `],ws([z({type:Boolean})],Li.prototype,"active",2),ws([z({type:String})],Li.prototype,"size",2),ws([z({type:String})],Li.prototype,"rounded",2),ws([z({type:String})],Li.prototype,"weight",2),ws([z({type:String})],Li.prototype,"icon",2),Li=ws([Qt("vmp-button")],Li);const wu={"arrow-left":()=>Ie`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
348
+ `],bs([z({type:Boolean})],Li.prototype,"active",2),bs([z({type:String})],Li.prototype,"size",2),bs([z({type:String})],Li.prototype,"rounded",2),bs([z({type:String})],Li.prototype,"weight",2),bs([z({type:String})],Li.prototype,"icon",2),Li=bs([Qt("vmp-button")],Li);const bu={"arrow-left":()=>Ie`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
349
349
  <path
350
350
  d="M16.6666 9.21875H6.52492L11.1833 4.85156L9.99992 3.75L3.33325 10L9.99992 16.25L11.1749 15.1484L6.52492 10.7812H16.6666V9.21875Z"
351
351
  fill="currentColor"
@@ -506,14 +506,14 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
506
506
  <path
507
507
  d="M9.853 23.246L4.86 7.688H0L7 27.42h5.52l7.265-19.733h-4.65L9.854 23.246zM95.12 7.08a8.905 8.905 0 00-4.648 1.294V0H86.14v27.419h4.332V16.087a4.656 4.656 0 014.649-4.65 4.656 4.656 0 014.649 4.65v11.332h4.332V16.087c.026-4.966-4.015-9.008-8.981-9.008zM57.188 19.02a4.656 4.656 0 01-4.649 4.649 4.656 4.656 0 01-4.649-4.65V7.689h-4.332V19.02c0 4.966 4.041 8.98 8.981 8.98 4.94 0 8.981-4.04 8.981-8.98V7.688h-4.332V19.02zM30.483 7.133c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408c5.732 0 10.408-4.676 10.408-10.408 0-5.732-4.676-10.407-10.408-10.407zm0 16.483a6.076 6.076 0 116.075-6.076c0 3.355-2.747 6.076-6.075 6.076zM74.517 23.616a6.076 6.076 0 010-12.151 6.132 6.132 0 015.045 2.668l3.592-2.43a10.473 10.473 0 00-8.637-4.57c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408a10.35 10.35 0 008.611-4.596l-3.593-2.43a5.975 5.975 0 01-5.018 2.694z"
508
508
  />
509
- </svg>`};var _C=Object.defineProperty,kC=Object.getOwnPropertyDescriptor,Ru=(s,e,t,i)=>{for(var r=i>1?void 0:i?kC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&_C(e,t,r),r};let _n=class extends Ne{render(){return!this.icon||!Object.keys(wu).includes(this.icon)?null:wu[this.icon]()}};_n.styles=[Ne.styles??[],ht`
509
+ </svg>`};var NC=Object.defineProperty,MC=Object.getOwnPropertyDescriptor,wu=(s,e,t,i)=>{for(var r=i>1?void 0:i?MC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&NC(e,t,r),r};let kn=class extends Ne{render(){return!this.icon||!Object.keys(bu).includes(this.icon)?null:bu[this.icon]()}};kn.styles=[Ne.styles??[],ht`
510
510
  :host {
511
511
  display: flex;
512
512
  align-items: center;
513
513
  justify-content: center;
514
514
  flex-shrink: 0;
515
515
  }
516
- `],Ru([z({type:String})],_n.prototype,"icon",2),_n=Ru([Qt("vmp-icon")],_n);var FC=Object.defineProperty,NC=Object.getOwnPropertyDescriptor,Rs=(s,e,t,i)=>{for(var r=i>1?void 0:i?NC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&FC(e,t,r),r};let _i=class extends Ne{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ie`
516
+ `],wu([z({type:String})],kn.prototype,"icon",2),kn=wu([Qt("vmp-icon")],kn);var PC=Object.defineProperty,OC=Object.getOwnPropertyDescriptor,ws=(s,e,t,i)=>{for(var r=i>1?void 0:i?OC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&PC(e,t,r),r};let _i=class extends Ne{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ie`
517
517
  <vmp-button
518
518
  ?active=${this.active}
519
519
  size=${bi(this.size)}
@@ -540,11 +540,11 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
540
540
  height: 32px;
541
541
  width: 32px;
542
542
  }
543
- `],Rs([z({type:Boolean})],_i.prototype,"active",2),Rs([z({type:String})],_i.prototype,"size",2),Rs([z({type:String})],_i.prototype,"rounded",2),Rs([z({type:String})],_i.prototype,"weight",2),Rs([z({type:String})],_i.prototype,"icon",2),_i=Rs([Qt("vmp-icon-button")],_i);var MC=Object.defineProperty,PC=Object.getOwnPropertyDescriptor,et=(s,e,t,i)=>{for(var r=i>1?void 0:i?PC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&MC(e,t,r),r};let Mt=class extends Ne{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=fo,this.dataResolver=vo,this._currentTime=0,this._sceneController=new TC(this),this._canvasRef=ft(),this._previewRef=ft(),this._previewTimeRef=ft(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${bu(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const u=(A=(a=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:d,duration:g,video:f})=>f&&s>=d&&s<=d+g))==null?void 0:a.video)==null?void 0:A.node;if(u&&(u.currentTime=s),this._draw(),(l=this._previewRef)!=null&&l.value){const d=this._previewRef.value.getBoundingClientRect(),g=(c=this._previewRef.value.getRootNode().host)==null?void 0:c.getBoundingClientRect();if(d&&g){const f=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,p]=Array.from(f.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${bu(t-g.left,e-g.left-d.width/2,i-g.left-d.width)}px, ${p[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",$a(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback();const s=dr("vmp-media-player",this);s==null||s.addEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const s=dr("vmp-media-player",this);s==null||s.removeEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var s;const{height:e,width:t}=po({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?Ie`
543
+ `],ws([z({type:Boolean})],_i.prototype,"active",2),ws([z({type:String})],_i.prototype,"size",2),ws([z({type:String})],_i.prototype,"rounded",2),ws([z({type:String})],_i.prototype,"weight",2),ws([z({type:String})],_i.prototype,"icon",2),_i=ws([Qt("vmp-icon-button")],_i);var UC=Object.defineProperty,GC=Object.getOwnPropertyDescriptor,et=(s,e,t,i)=>{for(var r=i>1?void 0:i?GC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&UC(e,t,r),r};let Mt=class extends Ne{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=po,this.dataResolver=Bo,this._currentTime=0,this._sceneController=new _C(this),this._canvasRef=ft(),this._previewRef=ft(),this._previewTimeRef=ft(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Su(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const u=(A=(a=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:d,duration:g,video:f})=>f&&s>=d&&s<=d+g))==null?void 0:a.video)==null?void 0:A.node;if(u&&(u.currentTime=s),this._draw(),(l=this._previewRef)!=null&&l.value){const d=this._previewRef.value.getBoundingClientRect(),g=(c=this._previewRef.value.getRootNode().host)==null?void 0:c.getBoundingClientRect();if(d&&g){const f=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,p]=Array.from(f.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Su(t-g.left,e-g.left-d.width/2,i-g.left-d.width)}px, ${p[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",Ya(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback();const s=hr("vmp-media-player",this);s==null||s.addEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const s=hr("vmp-media-player",this);s==null||s.removeEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var s;const{height:e,width:t}=Eo({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?Ie`
544
544
  <div
545
545
  ${pt(this._previewRef)}
546
546
  class="preview"
547
- style=${Bo({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
547
+ style=${Qo({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
548
548
  >
549
549
  <canvas ${pt(this._canvasRef)} class="preview-canvas" width=${t} height=${e}></canvas>
550
550
  <vmp-text ${pt(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
@@ -580,7 +580,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
580
580
  color: var(--colors-light-1000);
581
581
  font-variant-numeric: tabular-nums;
582
582
  }
583
- `],et([z({type:String})],Mt.prototype,"src",2),et([z({type:Object})],Mt.prototype,"data",2),et([z({type:Object})],Mt.prototype,"template",2),et([z({type:String})],Mt.prototype,"language",2),et([z({type:Boolean})],Mt.prototype,"disabled",2),et([z({type:Number})],Mt.prototype,"aspectRatio",2),et([z({type:Boolean})],Mt.prototype,"burnCaptions",2),et([z({attribute:!1})],Mt.prototype,"compilation",2),et([z({attribute:!1})],Mt.prototype,"dataResolver",2),Mt=et([Qt("vmp-video-preview-content")],Mt);let $t=class extends Ne{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=fo,this.dataResolver=vo}render(){return Ie`
583
+ `],et([z({type:String})],Mt.prototype,"src",2),et([z({type:Object})],Mt.prototype,"data",2),et([z({type:Object})],Mt.prototype,"template",2),et([z({type:String})],Mt.prototype,"language",2),et([z({type:Boolean})],Mt.prototype,"disabled",2),et([z({type:Number})],Mt.prototype,"aspectRatio",2),et([z({type:Boolean})],Mt.prototype,"burnCaptions",2),et([z({attribute:!1})],Mt.prototype,"compilation",2),et([z({attribute:!1})],Mt.prototype,"dataResolver",2),Mt=et([Qt("vmp-video-preview-content")],Mt);let $t=class extends Ne{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=po,this.dataResolver=Bo}render(){return Ie`
584
584
  <vmp-video-preview-content
585
585
  ?disabled=${this.disabled}
586
586
  .src=${this.src}
@@ -592,15 +592,15 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
592
592
  .compilation=${this.compilation}
593
593
  .dataResolver=${this.dataResolver}
594
594
  ></vmp-video-preview-content>
595
- `}};et([z({type:String})],$t.prototype,"src",2),et([z({type:Object})],$t.prototype,"data",2),et([z({type:Object})],$t.prototype,"template",2),et([z({type:String})],$t.prototype,"language",2),et([z({type:Boolean})],$t.prototype,"disabled",2),et([z({type:Number})],$t.prototype,"aspectRatio",2),et([z({type:Boolean})],$t.prototype,"burnCaptions",2),et([z({attribute:!1})],$t.prototype,"compilation",2),et([z({attribute:!1})],$t.prototype,"dataResolver",2),$t=et([Qt("vmp-video-preview")],$t);class OC extends $s{constructor(e){if(super(e),e.type!==rs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Pt}}const xu=ns(OC);class UC{constructor(e){this.hiddenControls=[],this._measureRef=ft(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var i,r,n;const o=this._measureRef.value,a=(n=(r=(i=t==null?void 0:t[0])==null?void 0:i.borderBoxSize)==null?void 0:r[0])==null?void 0:n.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;o.scrollWidth>o.offsetWidth;){const l=Object.keys(this._hideables).find(h=>this._hideables[h].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(h=>{this._showables[h].showOn.some(u=>A.includes(u))&&(this._showables[h].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return pt(this._measureRef)}contain(){return Ha(this._onResize)}hide(e,t){return xu(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return xu(i=>{this._showables[e]={element:i,showOn:t}})}}const Ya=".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";var GC=Object.defineProperty,HC=Object.getOwnPropertyDescriptor,gr=(s,e,t,i)=>{for(var r=i>1?void 0:i?HC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&GC(e,t,r),r};let zi=class extends Ne{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return Ie`
595
+ `}};et([z({type:String})],$t.prototype,"src",2),et([z({type:Object})],$t.prototype,"data",2),et([z({type:Object})],$t.prototype,"template",2),et([z({type:String})],$t.prototype,"language",2),et([z({type:Boolean})],$t.prototype,"disabled",2),et([z({type:Number})],$t.prototype,"aspectRatio",2),et([z({type:Boolean})],$t.prototype,"burnCaptions",2),et([z({attribute:!1})],$t.prototype,"compilation",2),et([z({attribute:!1})],$t.prototype,"dataResolver",2),$t=et([Qt("vmp-video-preview")],$t);class HC extends Hs{constructor(e){if(super(e),e.type!==ns.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Pt}}const Ru=os(HC);class $C{constructor(e){this.hiddenControls=[],this._measureRef=ft(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var i,r,n;const o=this._measureRef.value,a=(n=(r=(i=t==null?void 0:t[0])==null?void 0:i.borderBoxSize)==null?void 0:r[0])==null?void 0:n.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;o.scrollWidth>o.offsetWidth;){const l=Object.keys(this._hideables).find(h=>this._hideables[h].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(h=>{this._showables[h].showOn.some(u=>A.includes(u))&&(this._showables[h].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return pt(this._measureRef)}contain(){return $a(this._onResize)}hide(e,t){return Ru(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Ru(i=>{this._showables[e]={element:i,showOn:t}})}}const Ka=".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";var YC=Object.defineProperty,KC=Object.getOwnPropertyDescriptor,ur=(s,e,t,i)=>{for(var r=i>1?void 0:i?KC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&YC(e,t,r),r};let Zi=class extends Ne{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return Ie`
596
596
  <div
597
597
  part="content"
598
598
  class=${Ye({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
599
- style=${Bo({fontFamily:$r({text:this.content,font:"var(--fontFamilies-sans)"})})}
599
+ style=${Qo({fontFamily:Gr({text:this.content,font:"var(--fontFamilies-sans)"})})}
600
600
  >
601
601
  ${this.content}
602
602
  </div>
603
- `}};zi.styles=[Ne.styles??[],ht`
603
+ `}};Zi.styles=[Ne.styles??[],ht`
604
604
  :host {
605
605
  --text-size: var(--fontSizes-medium);
606
606
  --text-line-height: var(--lineHeights-medium);
@@ -637,7 +637,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
637
637
  text-overflow: ellipsis;
638
638
  overflow: hidden;
639
639
  }
640
- `],gr([z({type:Boolean})],zi.prototype,"semibold",2),gr([z({type:Boolean})],zi.prototype,"truncate",2),gr([z({type:String})],zi.prototype,"size",2),gr([z({type:String})],zi.prototype,"content",2),zi=gr([Qt("vmp-text")],zi);var $C=Object.defineProperty,YC=Object.getOwnPropertyDescriptor,fr=(s,e,t,i)=>{for(var r=i>1?void 0:i?YC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&$C(e,t,r),r};let Zi=class extends Ne{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=ft()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var s,e;const t=(e=(s=this.items)==null?void 0:s.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=Xi(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return Ie`
640
+ `],ur([z({type:Boolean})],Zi.prototype,"semibold",2),ur([z({type:Boolean})],Zi.prototype,"truncate",2),ur([z({type:String})],Zi.prototype,"size",2),ur([z({type:String})],Zi.prototype,"content",2),Zi=ur([Qt("vmp-text")],Zi);var VC=Object.defineProperty,JC=Object.getOwnPropertyDescriptor,dr=(s,e,t,i)=>{for(var r=i>1?void 0:i?JC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&VC(e,t,r),r};let es=class extends Ne{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=ft()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var s,e;const t=(e=(s=this.items)==null?void 0:s.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=zi(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return Ie`
641
641
  <slot></slot>
642
642
  <div ${pt(this._contentRef)} class="content">
643
643
  <div class="title">
@@ -653,7 +653,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
653
653
  .content=${((s=this.visibleItems)==null?void 0:s.title)??"Sub Menu"}
654
654
  ></vmp-text>
655
655
  </div>
656
- ${Uh(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>Ie`
656
+ ${Oh(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>Ie`
657
657
  <button
658
658
  class="item"
659
659
  @click=${()=>{t.subItems&&(this.subItemsActive=t.id,this.visibleItems=t.subItems),t.event&&this.dispatchEvent(new CustomEvent(t.event,{detail:t,bubbles:!0,composed:!0}))}}
@@ -663,7 +663,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
663
663
  </button>
664
664
  `)}
665
665
  </div>
666
- `}};Zi.styles=[Ne.styles??[],ks(Ya),ht`
666
+ `}};es.styles=[Ne.styles??[],_s(Ka),ht`
667
667
  :host {
668
668
  display: flex;
669
669
  }
@@ -725,12 +725,12 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
725
725
  height: 20px;
726
726
  width: 20px;
727
727
  }
728
- `],fr([z({type:Object})],Zi.prototype,"items",2),fr([z({type:Array})],Zi.prototype,"activeItems",2),fr([ze()],Zi.prototype,"visibleItems",2),fr([ze()],Zi.prototype,"subItemsActive",2),Zi=fr([Qt("vmp-menu")],Zi);var KC=Object.defineProperty,VC=Object.getOwnPropertyDescriptor,Ka=(s,e,t,i)=>{for(var r=i>1?void 0:i?VC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&KC(e,t,r),r};let pr=class extends Ne{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=ft()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=Xi(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return Ie`
728
+ `],dr([z({type:Object})],es.prototype,"items",2),dr([z({type:Array})],es.prototype,"activeItems",2),dr([ze()],es.prototype,"visibleItems",2),dr([ze()],es.prototype,"subItemsActive",2),es=dr([Qt("vmp-menu")],es);var WC=Object.defineProperty,qC=Object.getOwnPropertyDescriptor,Va=(s,e,t,i)=>{for(var r=i>1?void 0:i?qC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&WC(e,t,r),r};let gr=class extends Ne{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=ft()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=zi(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return Ie`
729
729
  <slot></slot>
730
730
  <div ${pt(this._contentRef)} class="content">
731
731
  <vmp-text content=${this.content}></vmp-text>
732
732
  </div>
733
- `}};pr.styles=[Ne.styles??[],ks(Ya),ht`
733
+ `}};gr.styles=[Ne.styles??[],_s(Ka),ht`
734
734
  :host {
735
735
  display: flex;
736
736
  }
@@ -744,7 +744,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
744
744
  background: var(--colors-dark-800);
745
745
  border-radius: var(--radii-medium);
746
746
  }
747
- `],Ka([z({type:String})],pr.prototype,"content",2),Ka([z({type:Boolean})],pr.prototype,"disabled",2),pr=Ka([Qt("vmp-tooltip")],pr);var JC=Object.defineProperty,WC=Object.getOwnPropertyDescriptor,Va=(s,e,t,i)=>{for(var r=i>1?void 0:i?WC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&JC(e,t,r),r};let Er=class extends Ne{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=ft(),this._anchorRef=ft(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=Xi(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return Ie`
747
+ `],Va([z({type:String})],gr.prototype,"content",2),Va([z({type:Boolean})],gr.prototype,"disabled",2),gr=Va([Qt("vmp-tooltip")],gr);var jC=Object.defineProperty,XC=Object.getOwnPropertyDescriptor,Ja=(s,e,t,i)=>{for(var r=i>1?void 0:i?XC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&jC(e,t,r),r};let fr=class extends Ne{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=ft(),this._anchorRef=ft(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=zi(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return Ie`
748
748
  <vmp-icon-button
749
749
  ${pt(this._anchorRef)}
750
750
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -764,7 +764,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
764
764
  @blur=${()=>{var s;return(s=this.tippy)==null?void 0:s.hide()}}
765
765
  />
766
766
  </div>
767
- `}};Er.styles=[Ne.styles??[],ks(Ya),ht`
767
+ `}};fr.styles=[Ne.styles??[],_s(Ka),ht`
768
768
  .content {
769
769
  --volume-slider-height: 4px;
770
770
  --volume-slider-width: 78px;
@@ -906,11 +906,11 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
906
906
  --volume-slider-height: 8px;
907
907
  color: var(--colors-light-800);
908
908
  }
909
- `],Va([z({type:Number})],Er.prototype,"volume",2),Va([z({type:Boolean})],Er.prototype,"muted",2),Er=Va([Qt("vmp-volume-button")],Er);var qC=Object.defineProperty,jC=Object.getOwnPropertyDescriptor,kn=(s,e,t,i)=>{for(var r=i>1?void 0:i?jC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&qC(e,t,r),r};let xs=class extends Ne{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=ft(),this._handleContainerResize=()=>{var s;const e=(s=this._containerRef.value)==null?void 0:s.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),r=(s.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:r*this.duration,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var s;const e=((s=this.buffer)==null?void 0:s.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return Ie`
909
+ `],Ja([z({type:Number})],fr.prototype,"volume",2),Ja([z({type:Boolean})],fr.prototype,"muted",2),fr=Ja([Qt("vmp-volume-button")],fr);var zC=Object.defineProperty,ZC=Object.getOwnPropertyDescriptor,Fn=(s,e,t,i)=>{for(var r=i>1?void 0:i?ZC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&zC(e,t,r),r};let Rs=class extends Ne{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=ft(),this._handleContainerResize=()=>{var s;const e=(s=this._containerRef.value)==null?void 0:s.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),r=(s.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:r*this.duration,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var s;const e=((s=this.buffer)==null?void 0:s.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return Ie`
910
910
  <div
911
911
  class="container"
912
912
  ${pt(this._containerRef)}
913
- ${Ha(this._handleContainerResize)}
913
+ ${$a(this._handleContainerResize)}
914
914
  @mouseenter=${this._handleMouseEnter}
915
915
  @mousemove=${this._handleMouseMove}
916
916
  @mouseleave=${this._handleMouseLeave}
@@ -925,11 +925,11 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
925
925
  .value=${this.currentTime.toString()}
926
926
  data-testid="scrubber"
927
927
  />
928
- ${Uh(e,({id:t})=>t,t=>Ie`
928
+ ${Oh(e,({id:t})=>t,t=>Ie`
929
929
  <div class="buffer" style=${`left: ${t.start}%; width: ${t.end-t.start}%`}></div>
930
930
  `)}
931
931
  </div>
932
- `}};xs.styles=[Ne.styles??[],ht`
932
+ `}};Rs.styles=[Ne.styles??[],ht`
933
933
  :host {
934
934
  --player-scrubber-height: 8px;
935
935
  --player-scrubber-shadow-width: 4000px;
@@ -1079,7 +1079,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1079
1079
  --player-scrubber-height: 16px;
1080
1080
  color: var(--colors-light-800);
1081
1081
  }
1082
- `],kn([z({type:Number})],xs.prototype,"duration",2),kn([z({type:Number})],xs.prototype,"currentTime",2),kn([z({type:Array})],xs.prototype,"buffer",2),xs=kn([Qt("vmp-progress-scrubber")],xs);var XC=Object.defineProperty,zC=Object.getOwnPropertyDescriptor,tt=(s,e,t,i)=>{for(var r=i>1?void 0:i?zC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&XC(e,t,r),r};let qe=class extends Ne{constructor(){super(...arguments),this.resizeHider=new UC(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Ga,this.volumeMenuOpen=!1,this.languageMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLanguageMenuOpen({detail:s}){this.languageMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var s,e,t,i,r,n,o,a,A,l,c,h,u,d,g;const f=((s=this.languages)==null?void 0:s.map(M=>({id:`language-${M.value}`,event:"language:click",label:M.label,value:M.value})))??[],p={title:"Languages",items:f},y={id:"languages",label:"Languages",subItems:p},v=p.items.find(({value:M})=>M===this.language),S=((e=this.levels)==null?void 0:e.map((M,W)=>{const ie=Math.min(M.width,M.height);return{id:`level-${W.toString()}`,event:"level:click",label:`${ie}p`,value:{resolution:ie,level:W}}}))??[],C={title:"Quality",items:[...S.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},Q={id:"levels",label:"Quality",subItems:C},B=(t=C.items)==null?void 0:t.find(({value:M})=>M.level===this.level),_=[(f==null?void 0:f.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(M=>{var W;return(W=this.controls)==null?void 0:W.includes(M)}),L={title:"Settings",items:[(f==null?void 0:f.length)&&y,yC,vC,Q,BC].filter(Boolean).filter(({id:M})=>_.includes(M)&&this.resizeHider.hiddenControls.includes(M))},G=(i=this.controls)==null?void 0:i.includes("progress"),F=(r=this.controls)==null?void 0:r.includes("navigation"),U=(n=this.controls)==null?void 0:n.includes("play"),q=(o=this.controls)==null?void 0:o.includes("volume"),V=(a=this.controls)==null?void 0:a.includes("current-time"),X=(A=this.controls)==null?void 0:A.includes("duration"),w=(l=this.controls)==null?void 0:l.includes("languages"),x=(c=this.controls)==null?void 0:c.includes("levels"),$=(h=this.controls)==null?void 0:h.includes("speed"),R=(u=this.controls)==null?void 0:u.includes("captions"),b=(d=this.controls)==null?void 0:d.includes("fullscreen"),T=U||q||V||X||w||x||$||R||b,K=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(g=this.level)==null?void 0:g.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return Ie`
1082
+ `],Fn([z({type:Number})],Rs.prototype,"duration",2),Fn([z({type:Number})],Rs.prototype,"currentTime",2),Fn([z({type:Array})],Rs.prototype,"buffer",2),Rs=Fn([Qt("vmp-progress-scrubber")],Rs);var ey=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,tt=(s,e,t,i)=>{for(var r=i>1?void 0:i?ty(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ey(e,t,r),r};let qe=class extends Ne{constructor(){super(...arguments),this.resizeHider=new $C(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Ha,this.volumeMenuOpen=!1,this.languageMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLanguageMenuOpen({detail:s}){this.languageMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var s,e,t,i,r,n,o,a,A,l,c,h,u,d,g;const f=((s=this.languages)==null?void 0:s.map(M=>({id:`language-${M.value}`,event:"language:click",label:M.label,value:M.value})))??[],p={title:"Languages",items:f},y={id:"languages",label:"Languages",subItems:p},v=p.items.find(({value:M})=>M===this.language),S=((e=this.levels)==null?void 0:e.map((M,W)=>{const ie=Math.min(M.width,M.height);return{id:`level-${W.toString()}`,event:"level:click",label:`${ie}p`,value:{resolution:ie,level:W}}}))??[],C={title:"Quality",items:[...S.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},Q={id:"levels",label:"Quality",subItems:C},B=(t=C.items)==null?void 0:t.find(({value:M})=>M.level===this.level),_=[(f==null?void 0:f.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(M=>{var W;return(W=this.controls)==null?void 0:W.includes(M)}),L={title:"Settings",items:[(f==null?void 0:f.length)&&y,QC,SC,Q,bC].filter(Boolean).filter(({id:M})=>_.includes(M)&&this.resizeHider.hiddenControls.includes(M))},G=(i=this.controls)==null?void 0:i.includes("progress"),F=(r=this.controls)==null?void 0:r.includes("navigation"),U=(n=this.controls)==null?void 0:n.includes("play"),q=(o=this.controls)==null?void 0:o.includes("volume"),V=(a=this.controls)==null?void 0:a.includes("current-time"),X=(A=this.controls)==null?void 0:A.includes("duration"),w=(l=this.controls)==null?void 0:l.includes("languages"),x=(c=this.controls)==null?void 0:c.includes("levels"),$=(h=this.controls)==null?void 0:h.includes("speed"),R=(u=this.controls)==null?void 0:u.includes("captions"),b=(d=this.controls)==null?void 0:d.includes("fullscreen"),T=U||q||V||X||w||x||$||R||b,K=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(g=this.level)==null?void 0:g.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return Ie`
1083
1083
  <div
1084
1084
  ${this.resizeHider.measure()}
1085
1085
  ${this.resizeHider.contain()}
@@ -1136,13 +1136,13 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1136
1136
  ${this.resizeHider.hide("current-time",2)}
1137
1137
  class=${Ye({hidden:!V})}
1138
1138
  ?semibold=${!0}
1139
- content="${$a(this.currentTime)}${X?"/":null}"
1139
+ content="${Ya(this.currentTime)}${X?"/":null}"
1140
1140
  ></vmp-text>
1141
1141
  <vmp-text
1142
1142
  ${this.resizeHider.hide("duration",6)}
1143
1143
  class=${Ye({hidden:!X})}
1144
1144
  ?semibold=${!0}
1145
- content=${$a(this.duration)}
1145
+ content=${Ya(this.duration)}
1146
1146
  ></vmp-text>
1147
1147
  </div>
1148
1148
  </div>
@@ -1172,7 +1172,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1172
1172
  <vmp-menu
1173
1173
  ${this.resizeHider.hide("playback-rate",5)}
1174
1174
  class=${Ye({hidden:!$})}
1175
- .items=${Qu}
1175
+ .items=${Bu}
1176
1176
  .activeItems=${K}
1177
1177
  @menu:toggle=${this._handlePlaybackMenuToggle}
1178
1178
  >
@@ -1291,17 +1291,17 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1291
1291
  .hidden {
1292
1292
  display: none;
1293
1293
  }
1294
- `],tt([z({type:Boolean})],qe.prototype,"playing",2),tt([z({type:Number})],qe.prototype,"volume",2),tt([z({type:Boolean})],qe.prototype,"muted",2),tt([z({type:Number})],qe.prototype,"currentTime",2),tt([z({type:Number})],qe.prototype,"duration",2),tt([z({type:Array})],qe.prototype,"languages",2),tt([z({type:String})],qe.prototype,"language",2),tt([z({type:Array,attribute:!1})],qe.prototype,"levels",2),tt([z({type:Number})],qe.prototype,"level",2),tt([z({type:Number})],qe.prototype,"playbackRate",2),tt([z({type:Array})],qe.prototype,"buffer",2),tt([z({type:Boolean})],qe.prototype,"captions",2),tt([z({type:Boolean})],qe.prototype,"fullscreen",2),tt([z({type:Array})],qe.prototype,"controls",2),tt([ze()],qe.prototype,"volumeMenuOpen",2),tt([ze()],qe.prototype,"languageMenuOpen",2),tt([ze()],qe.prototype,"levelsMenuOpen",2),tt([ze()],qe.prototype,"playbackRateMenuOpen",2),tt([ze()],qe.prototype,"settingsMenuOpen",2),qe=tt([Qt("vmp-player-controls")],qe);var ZC=Object.defineProperty,ey=Object.getOwnPropertyDescriptor,ty=(s,e,t,i)=>{for(var r=i>1?void 0:i?ey(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ZC(e,t,r),r};let Ja=class extends Ne{render(){return Ie`<vmp-icon icon="loading"></vmp-icon>`}};Ja.styles=[Ne.styles??[],ht`
1294
+ `],tt([z({type:Boolean})],qe.prototype,"playing",2),tt([z({type:Number})],qe.prototype,"volume",2),tt([z({type:Boolean})],qe.prototype,"muted",2),tt([z({type:Number})],qe.prototype,"currentTime",2),tt([z({type:Number})],qe.prototype,"duration",2),tt([z({type:Array})],qe.prototype,"languages",2),tt([z({type:String})],qe.prototype,"language",2),tt([z({type:Array,attribute:!1})],qe.prototype,"levels",2),tt([z({type:Number})],qe.prototype,"level",2),tt([z({type:Number})],qe.prototype,"playbackRate",2),tt([z({type:Array})],qe.prototype,"buffer",2),tt([z({type:Boolean})],qe.prototype,"captions",2),tt([z({type:Boolean})],qe.prototype,"fullscreen",2),tt([z({type:Array})],qe.prototype,"controls",2),tt([ze()],qe.prototype,"volumeMenuOpen",2),tt([ze()],qe.prototype,"languageMenuOpen",2),tt([ze()],qe.prototype,"levelsMenuOpen",2),tt([ze()],qe.prototype,"playbackRateMenuOpen",2),tt([ze()],qe.prototype,"settingsMenuOpen",2),qe=tt([Qt("vmp-player-controls")],qe);var iy=Object.defineProperty,sy=Object.getOwnPropertyDescriptor,ry=(s,e,t,i)=>{for(var r=i>1?void 0:i?sy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&iy(e,t,r),r};let Wa=class extends Ne{render(){return Ie`<vmp-icon icon="loading"></vmp-icon>`}};Wa.styles=[Ne.styles??[],ht`
1295
1295
  :host {
1296
1296
  display: flex;
1297
1297
  align-items: center;
1298
1298
  justify-content: center;
1299
1299
  }
1300
- `],Ja=ty([Qt("vmp-loading-spinner")],Ja);var iy=Object.defineProperty,sy=Object.getOwnPropertyDescriptor,Tu=(s,e,t,i)=>{for(var r=i>1?void 0:i?sy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&iy(e,t,r),r};let Fn=class extends Ne{constructor(){super(...arguments),this.caption=""}render(){return Ie`
1300
+ `],Wa=ry([Qt("vmp-loading-spinner")],Wa);var ny=Object.defineProperty,oy=Object.getOwnPropertyDescriptor,xu=(s,e,t,i)=>{for(var r=i>1?void 0:i?oy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ny(e,t,r),r};let Nn=class extends Ne{constructor(){super(...arguments),this.caption=""}render(){return Ie`
1301
1301
  <div class="container">
1302
1302
  <vmp-text content=${this.caption} size="large"></vmp-text>
1303
1303
  </div>
1304
- `}};Fn.styles=[Ne.styles??[],ht`
1304
+ `}};Nn.styles=[Ne.styles??[],ht`
1305
1305
  .container {
1306
1306
  display: block;
1307
1307
  margin: 0 var(--space-small);
@@ -1320,7 +1320,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1320
1320
  /* Line height controls the spacing between the cloned boxes so has to override the default */
1321
1321
  line-height: 2.2;
1322
1322
  }
1323
- `],Tu([z({type:String})],Fn.prototype,"caption",2),Fn=Tu([Qt("vmp-captions")],Fn);var ry=Object.defineProperty,ny=Object.getOwnPropertyDescriptor,lt=(s,e,t,i)=>{for(var r=i>1?void 0:i?ny(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ry(e,t,r),r};const oy=3e3;let it=class extends Ne{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Ga,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=ft()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},oy)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var s;const e=(s=this.controls)==null?void 0:s.includes("play-large"),t=this.playing&&!this.showControls,i=!!(e&&!this.playing);return Ie`
1323
+ `],xu([z({type:String})],Nn.prototype,"caption",2),Nn=xu([Qt("vmp-captions")],Nn);var ay=Object.defineProperty,Ay=Object.getOwnPropertyDescriptor,lt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ay(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ay(e,t,r),r};const ly=3e3;let it=class extends Ne{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Ha,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=ft()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},ly)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var s;const e=(s=this.controls)==null?void 0:s.includes("play-large"),t=this.playing&&!this.showControls,i=!!(e&&!this.playing);return Ie`
1324
1324
  <div
1325
1325
  class=${Ye({container:!0,hide:t})}
1326
1326
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
@@ -1440,7 +1440,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1440
1440
  vmp-captions.hiddenControls {
1441
1441
  transform: translateY(calc(var(--space-small) * -1));
1442
1442
  }
1443
- `],lt([z({type:Boolean})],it.prototype,"loading",2),lt([z({type:Boolean})],it.prototype,"playing",2),lt([z({type:Number})],it.prototype,"volume",2),lt([z({type:Boolean})],it.prototype,"muted",2),lt([z({type:Number})],it.prototype,"currentTime",2),lt([z({type:Number})],it.prototype,"duration",2),lt([z({type:Array})],it.prototype,"languages",2),lt([z({type:String})],it.prototype,"language",2),lt([z({type:Array,attribute:!1})],it.prototype,"levels",2),lt([z({type:Number})],it.prototype,"level",2),lt([z({type:Number})],it.prototype,"playbackRate",2),lt([z({type:String})],it.prototype,"caption",2),lt([z({type:Array})],it.prototype,"buffer",2),lt([z({type:Boolean})],it.prototype,"captions",2),lt([z({type:Boolean})],it.prototype,"fullscreen",2),lt([z({type:Array})],it.prototype,"controls",2),lt([ze()],it.prototype,"showControls",2),it=lt([Qt("vmp-player-overlay")],it);var ay=Object.defineProperty,Ay=Object.getOwnPropertyDescriptor,$e=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ay(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ay(e,t,r),r};const ly=1e3/60;let Pe=class extends Ne{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=fo,this.dataResolver=vo,this.languageResolver=uf,this._sceneController=new IC(this),this._drawController=new dC(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._playerRef=ft(),this._canvasRef=ft(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language=this.propLanguage,this._languages=[],this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,ly):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{this.sceneConfig&&this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate,this._lastTimestamp=s),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{this===document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get languages(){return this._languages}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new ri(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?CC():this._playerRef.value&&mC(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(s){s.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),s.has("propLanguage")&&(this._language=this.propLanguage)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this.processing&&!this._sceneController.hasPlayed&&s.has("_processing")&&this.play()}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Ie`
1443
+ `],lt([z({type:Boolean})],it.prototype,"loading",2),lt([z({type:Boolean})],it.prototype,"playing",2),lt([z({type:Number})],it.prototype,"volume",2),lt([z({type:Boolean})],it.prototype,"muted",2),lt([z({type:Number})],it.prototype,"currentTime",2),lt([z({type:Number})],it.prototype,"duration",2),lt([z({type:Array})],it.prototype,"languages",2),lt([z({type:String})],it.prototype,"language",2),lt([z({type:Array,attribute:!1})],it.prototype,"levels",2),lt([z({type:Number})],it.prototype,"level",2),lt([z({type:Number})],it.prototype,"playbackRate",2),lt([z({type:String})],it.prototype,"caption",2),lt([z({type:Array})],it.prototype,"buffer",2),lt([z({type:Boolean})],it.prototype,"captions",2),lt([z({type:Boolean})],it.prototype,"fullscreen",2),lt([z({type:Array})],it.prototype,"controls",2),lt([ze()],it.prototype,"showControls",2),it=lt([Qt("vmp-player-overlay")],it);var cy=Object.defineProperty,hy=Object.getOwnPropertyDescriptor,$e=(s,e,t,i)=>{for(var r=i>1?void 0:i?hy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&cy(e,t,r),r};const uy=1e3/60;let Pe=class extends Ne{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=po,this.dataResolver=Bo,this.languageResolver=hf,this._sceneController=new yC(this),this._drawController=new pC(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._playerRef=ft(),this._canvasRef=ft(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language=this.propLanguage,this._languages=[],this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,uy):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{this.sceneConfig&&this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate,this._lastTimestamp=s),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{this===document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get languages(){return this._languages}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new ri(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?BC():this._playerRef.value&&vC(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(s){s.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),s.has("propLanguage")&&(this._language=this.propLanguage)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this.processing&&!this._sceneController.hasPlayed&&s.has("_processing")&&this.play()}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Ie`
1444
1444
  <style>
1445
1445
  :host {
1446
1446
  aspect-ratio: ${this.propAspectRatio};
@@ -1461,17 +1461,17 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1461
1461
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
1462
1462
  <vmp-text semibold content="Please try again later."></vmp-text>
1463
1463
  </div>
1464
- </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=po({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??720,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((v,S)=>v.concat(this.sceneVideoState[S].buffered??[]),[]),c=o?[]:(e=this.controls??Ga)==null?void 0:e.filter(v=>!(v==="fullscreen"&&fC()||v==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=!(c!=null&&c.includes("preview")),u=(((t=this.scenes)==null?void 0:t.length)??0)-1,d=((i=this.scenes)==null?void 0:i.findIndex(v=>v===this._drawController.activeScenes[0]))??0,g=(n=(r=this._drawController.activeScenes[0])==null?void 0:r.video)==null?void 0:n.hls,f=this.loading||this.waiting||this.processing,p=!this.src&&!this.data,y=!!this.errors.find(v=>v.fatal);return Ie`
1464
+ </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=Eo({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??720,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((v,S)=>v.concat(this.sceneVideoState[S].buffered??[]),[]),c=o?[]:(e=this.controls??Ha)==null?void 0:e.filter(v=>!(v==="fullscreen"&&IC()||v==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=!(c!=null&&c.includes("preview")),u=(((t=this.scenes)==null?void 0:t.length)??0)-1,d=((i=this.scenes)==null?void 0:i.findIndex(v=>v===this._drawController.activeScenes[0]))??0,g=(n=(r=this._drawController.activeScenes[0])==null?void 0:r.video)==null?void 0:n.hls,f=this.loading||this.waiting||this.processing,p=!this.src&&!this.data,y=!!this.errors.find(v=>v.fatal);return Ie`
1465
1465
  ${this._renderStyles()}
1466
1466
  <div
1467
1467
  ${pt(this._playerRef)}
1468
1468
  class=${Ye({player:!0,responsive:!this.propAspectRatio})}
1469
- style=${Bo({aspectRatio:this.aspectRatio})}
1469
+ style=${Qo({aspectRatio:this.aspectRatio})}
1470
1470
  >
1471
1471
  ${!f&&(p||y)?this._renderError():Ie`<canvas
1472
1472
  ${pt(this._canvasRef)}
1473
1473
  ${this._drawController.canvas()}
1474
- ${Ha(this._handleCanvasResize)}
1474
+ ${$a(this._handleCanvasResize)}
1475
1475
  height=${a}
1476
1476
  width=${A}
1477
1477
  ></canvas>
@@ -1582,7 +1582,7 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1582
1582
  top: 0;
1583
1583
  left: 0;
1584
1584
  }
1585
- `],$e([z({type:Object})],Pe.prototype,"data",2),$e([z({type:Object})],Pe.prototype,"template",2),$e([z({type:Boolean})],Pe.prototype,"burnCaptions",2),$e([z({type:Boolean})],Pe.prototype,"debug",2),$e([z({type:String})],Pe.prototype,"src",2),$e([z({type:String})],Pe.prototype,"track",2),$e([z({type:String,attribute:"language"})],Pe.prototype,"propLanguage",2),$e([z({type:Number,attribute:"aspectratio"})],Pe.prototype,"propAspectRatio",2),$e([z({type:String})],Pe.prototype,"preload",2),$e([z({type:Boolean})],Pe.prototype,"autoplay",2),$e([z({type:Boolean})],Pe.prototype,"loading",2),$e([z({type:Array})],Pe.prototype,"controls",2),$e([z({attribute:!1})],Pe.prototype,"compilation",2),$e([z({attribute:!1})],Pe.prototype,"dataResolver",2),$e([z({attribute:!1})],Pe.prototype,"languageResolver",2),$e([ze()],Pe.prototype,"_pageHidden",2),$e([ze()],Pe.prototype,"_aspectRatio",2),$e([ze()],Pe.prototype,"_processing",2),$e([ze()],Pe.prototype,"_waiting",2),$e([ze()],Pe.prototype,"_errors",2),$e([ze()],Pe.prototype,"_seeking",2),$e([ze()],Pe.prototype,"_language",2),$e([ze()],Pe.prototype,"_languages",2),$e([ze()],Pe.prototype,"_captions",2),$e([ze()],Pe.prototype,"_fullscreen",2),Pe=$e([Qt("vmp-media-player")],Pe);var cy=Object.defineProperty,hy=Object.getOwnPropertyDescriptor,It=(s,e,t,i)=>{for(var r=i>1?void 0:i?hy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&cy(e,t,r),r};Ge.PlayerEmbed=class extends ss{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="auto",this.autoplay=!1,this.aspectRatio=0,this.eventController=new md(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","seeking","seeked","timeupdate","volumechange","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new _d(this),this._trackingController=new rf(this),this._mediaPlayerRef=ft()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get scene(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scene)??null}get scenes(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scenes)??[]}get sceneConfig(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.sceneConfig)??null}get videoState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var i;(i=this._mediaPlayerRef.value)==null||i.reset(e,t)}setScene(e){var t;(t=this._mediaPlayerRef.value)==null||t.setScene(e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?Ie`
1585
+ `],$e([z({type:Object})],Pe.prototype,"data",2),$e([z({type:Object})],Pe.prototype,"template",2),$e([z({type:Boolean})],Pe.prototype,"burnCaptions",2),$e([z({type:Boolean})],Pe.prototype,"debug",2),$e([z({type:String})],Pe.prototype,"src",2),$e([z({type:String})],Pe.prototype,"track",2),$e([z({type:String,attribute:"language"})],Pe.prototype,"propLanguage",2),$e([z({type:Number,attribute:"aspectratio"})],Pe.prototype,"propAspectRatio",2),$e([z({type:String})],Pe.prototype,"preload",2),$e([z({type:Boolean})],Pe.prototype,"autoplay",2),$e([z({type:Boolean})],Pe.prototype,"loading",2),$e([z({type:Array})],Pe.prototype,"controls",2),$e([z({attribute:!1})],Pe.prototype,"compilation",2),$e([z({attribute:!1})],Pe.prototype,"dataResolver",2),$e([z({attribute:!1})],Pe.prototype,"languageResolver",2),$e([ze()],Pe.prototype,"_pageHidden",2),$e([ze()],Pe.prototype,"_aspectRatio",2),$e([ze()],Pe.prototype,"_processing",2),$e([ze()],Pe.prototype,"_waiting",2),$e([ze()],Pe.prototype,"_errors",2),$e([ze()],Pe.prototype,"_seeking",2),$e([ze()],Pe.prototype,"_language",2),$e([ze()],Pe.prototype,"_languages",2),$e([ze()],Pe.prototype,"_captions",2),$e([ze()],Pe.prototype,"_fullscreen",2),Pe=$e([Qt("vmp-media-player")],Pe);var dy=Object.defineProperty,gy=Object.getOwnPropertyDescriptor,It=(s,e,t,i)=>{for(var r=i>1?void 0:i?gy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&dy(e,t,r),r};Ge.PlayerEmbed=class extends rs{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="auto",this.autoplay=!1,this.aspectRatio=0,this.eventController=new Id(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","seeking","seeked","timeupdate","volumechange","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new Ld(this),this._trackingController=new sf(this),this._mediaPlayerRef=ft()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get scene(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scene)??null}get scenes(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scenes)??[]}get sceneConfig(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.sceneConfig)??null}get videoState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var i;(i=this._mediaPlayerRef.value)==null||i.reset(e,t)}setScene(e){var t;(t=this._mediaPlayerRef.value)==null||t.setScene(e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?Ie`
1586
1586
  <style>
1587
1587
  :host {
1588
1588
  aspect-ratio: ${this.aspectRatio};
@@ -1613,5 +1613,5 @@ ${e}`,Rg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xg=Objec
1613
1613
  :host {
1614
1614
  display: flex;
1615
1615
  }
1616
- `],It([z({type:Object})],Ge.PlayerEmbed.prototype,"data",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"vouchId",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"templateId",2),It([z({type:Array})],Ge.PlayerEmbed.prototype,"questions",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"env",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"apiKey",2),It([z({type:Boolean})],Ge.PlayerEmbed.prototype,"disableTracking",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"trackingSource",2),It([z({type:Array})],Ge.PlayerEmbed.prototype,"controls",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"preload",2),It([z({type:Boolean})],Ge.PlayerEmbed.prototype,"autoplay",2),It([z({type:Number})],Ge.PlayerEmbed.prototype,"aspectRatio",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"language",2),It([ze()],Ge.PlayerEmbed.prototype,"vouch",2),It([ze()],Ge.PlayerEmbed.prototype,"template",2),Ge.PlayerEmbed=It([od("vouch-embed-player")],Ge.PlayerEmbed);function oi(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Du(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function uy(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var Ts={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),oi(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=Du(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(oi(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Du(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return oi(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];oi(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Ts.normalize(e)},relative:function(e,t){if(oi(e),oi(t),e===t||(e=Ts.resolve(e),t=Ts.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,h=0;h<=l;++h){if(h===l){if(A>l){if(t.charCodeAt(o+h)===47)return t.slice(o+h+1);if(h===0)return t.slice(o+h)}else n>l&&(e.charCodeAt(i+h)===47?c=h:h===0&&(c=0));break}var u=e.charCodeAt(i+h),d=t.charCodeAt(o+h);if(u!==d)break;u===47&&(c=h)}var g="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(oi(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');oi(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){oi(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return uy("/",e)},parse:function(e){oi(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Ts.posix=Ts;var dy=Ts;const{basename:Lu,extname:gy}=dy;class fy{constructor(){let e=typeof _r>"u",t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function py(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new fy,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||gy(e),f=c(h(g)||g),p=h(f),y=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${u})`);if(!y)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let v,S,C=e.replace(/{(\d*)}/g,(B,_)=>(S=!0,_=parseInt(_,10),v=isFinite(_)?_:isFinite(v)?v:-1,"{}")),Q=r>0?r-1:r<0?y+r:void 0;if(isFinite(Q)&&Q<0||Q>=y)throw new RangeError(y==1?`Canvas only has a ‘page 1’ (${Q} is out of bounds)`:`Canvas has pages 1–${y} (${Q} is out of bounds)`);if(s=isFinite(Q)?[s[Q]]:S||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let B=(t||Lu(e,g)).match(/@(\d+)x$/i);a=B?parseInt(B[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:C,format:f,mime:p,pages:s,padding:v,quality:n,matte:o,density:a,outline:A,archive:d}}class Nn{static for(e){return new Nn().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Nn.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function Wa(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const Mn=class Mn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=Mn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=Wa(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Nn.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let h=Wa(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,h.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:h}),this.offset=l}toBuffer(){let e=this.files.reduce((h,{name:u})=>46+u.length+h,0),t=Wa(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};Ju(Mn,"encoder",new TextEncoder);let qa=Mn;const ja=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},Ey=(...s)=>ja(...s).then(e=>e.arrayBuffer()),Iy=async(s,e,t,i,r)=>{_u(r,await ja(s,e,t,i))},my=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Lu(r,".zip")||"archive",l=new qa(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await ja(c,e,t,i))})),_u(`${A}.zip`,l.blob)},_u=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var Cy={asBuffer:Ey,asDownload:Iy,asZipDownload:my,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:py};const{asBuffer:Xa,asDownload:yy,asZipDownload:vy,atScale:za,options:Za}=Cy,ku=Symbol.for("toDataURL"),By=s=>{let e=Object.assign(new Fu,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class Qy{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>Xa(i,"image/png"),jpg:()=>Xa(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=Za(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:p}=l,y=za(l.pages,f);return h==null?yy(y[0],u,d,g,a):vy(y,u,d,g,p,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Za(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=za(d,g,u)[0];return Xa(f,c,h,u)},[ku]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Za(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=za(d,g,u)[0],p=f[f===i?ku:"toDataURL"](c,h);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:Sy,CanvasGradient:by,CanvasPattern:wy,Image:Fu,ImageData:Ry,Path2D:xy,DOMMatrix:Ty,DOMRect:Dy,DOMPoint:Ly}=window;var Nu={Canvas:Qy,loadImage:By,CanvasRenderingContext2D:Sy,CanvasGradient:by,CanvasPattern:wy,Image:Fu,ImageData:Ry,Path2D:xy,DOMMatrix:Ty,DOMRect:Dy,DOMPoint:Ly};const Mu=ci({__proto__:null,default:il(Nu)},[Nu]);return Object.defineProperty(Ge,Symbol.toStringTag,{value:"Module"}),Ge}({});
1616
+ `],It([z({type:Object})],Ge.PlayerEmbed.prototype,"data",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"vouchId",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"templateId",2),It([z({type:Array})],Ge.PlayerEmbed.prototype,"questions",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"env",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"apiKey",2),It([z({type:Boolean})],Ge.PlayerEmbed.prototype,"disableTracking",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"trackingSource",2),It([z({type:Array})],Ge.PlayerEmbed.prototype,"controls",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"preload",2),It([z({type:Boolean})],Ge.PlayerEmbed.prototype,"autoplay",2),It([z({type:Number})],Ge.PlayerEmbed.prototype,"aspectRatio",2),It([z({type:String})],Ge.PlayerEmbed.prototype,"language",2),It([ze()],Ge.PlayerEmbed.prototype,"vouch",2),It([ze()],Ge.PlayerEmbed.prototype,"template",2),Ge.PlayerEmbed=It([nd("vouch-embed-player")],Ge.PlayerEmbed);function oi(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Tu(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function fy(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var xs={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),oi(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=Tu(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(oi(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Tu(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return oi(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];oi(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xs.normalize(e)},relative:function(e,t){if(oi(e),oi(t),e===t||(e=xs.resolve(e),t=xs.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,h=0;h<=l;++h){if(h===l){if(A>l){if(t.charCodeAt(o+h)===47)return t.slice(o+h+1);if(h===0)return t.slice(o+h)}else n>l&&(e.charCodeAt(i+h)===47?c=h:h===0&&(c=0));break}var u=e.charCodeAt(i+h),d=t.charCodeAt(o+h);if(u!==d)break;u===47&&(c=h)}var g="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(oi(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');oi(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){oi(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return fy("/",e)},parse:function(e){oi(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};xs.posix=xs;var py=xs;const{basename:Du,extname:Ey}=py;class Iy{constructor(){let e=typeof Dr>"u",t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function my(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new Iy,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||Ey(e),f=c(h(g)||g),p=h(f),y=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${u})`);if(!y)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let v,S,C=e.replace(/{(\d*)}/g,(B,_)=>(S=!0,_=parseInt(_,10),v=isFinite(_)?_:isFinite(v)?v:-1,"{}")),Q=r>0?r-1:r<0?y+r:void 0;if(isFinite(Q)&&Q<0||Q>=y)throw new RangeError(y==1?`Canvas only has a ‘page 1’ (${Q} is out of bounds)`:`Canvas has pages 1–${y} (${Q} is out of bounds)`);if(s=isFinite(Q)?[s[Q]]:S||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let B=(t||Du(e,g)).match(/@(\d+)x$/i);a=B?parseInt(B[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:C,format:f,mime:p,pages:s,padding:v,quality:n,matte:o,density:a,outline:A,archive:d}}class Mn{static for(e){return new Mn().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Mn.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function qa(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const Pn=class Pn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=Pn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=qa(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Mn.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let h=qa(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,h.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:h}),this.offset=l}toBuffer(){let e=this.files.reduce((h,{name:u})=>46+u.length+h,0),t=qa(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};Vu(Pn,"encoder",new TextEncoder);let ja=Pn;const Xa=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},Cy=(...s)=>Xa(...s).then(e=>e.arrayBuffer()),yy=async(s,e,t,i,r)=>{Lu(r,await Xa(s,e,t,i))},vy=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Du(r,".zip")||"archive",l=new ja(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await Xa(c,e,t,i))})),Lu(`${A}.zip`,l.blob)},Lu=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var By={asBuffer:Cy,asDownload:yy,asZipDownload:vy,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:my};const{asBuffer:za,asDownload:Qy,asZipDownload:Sy,atScale:Za,options:eA}=By,_u=Symbol.for("toDataURL"),by=s=>{let e=Object.assign(new ku,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class wy{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>za(i,"image/png"),jpg:()=>za(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=eA(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:p}=l,y=Za(l.pages,f);return h==null?Qy(y[0],u,d,g,a):Sy(y,u,d,g,p,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=eA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=Za(d,g,u)[0];return za(f,c,h,u)},[_u]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=eA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=Za(d,g,u)[0],p=f[f===i?_u:"toDataURL"](c,h);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:Ry,CanvasGradient:xy,CanvasPattern:Ty,Image:ku,ImageData:Dy,Path2D:Ly,DOMMatrix:_y,DOMRect:ky,DOMPoint:Fy}=window;var Fu={Canvas:wy,loadImage:by,CanvasRenderingContext2D:Ry,CanvasGradient:xy,CanvasPattern:Ty,Image:ku,ImageData:Dy,Path2D:Ly,DOMMatrix:_y,DOMRect:ky,DOMPoint:Fy};const Nu=ci({__proto__:null,default:sl(Fu)},[Fu]);return Object.defineProperty(Ge,Symbol.toStringTag,{value:"Module"}),Ge}({});
1617
1617
  //# sourceMappingURL=embed.iife.js.map