@vouchfor/embeds 0.0.0-experiment.f77dbf9 → 0.0.0-experiment.f90d920

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,122 +2,122 @@ var dialogEmbed=function(mt){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var df;const Ni=globalThis,go=Ni.ShadowRoot&&(Ni.ShadyCSS===void 0||Ni.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,po=Symbol(),Vl=new WeakMap;let Kl=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==po)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(go&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Vl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Vl.set(t,e))}return e}toString(){return this.cssText}};const Yn=r=>new Kl(typeof r=="string"?r:r+"",void 0,po),lt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(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.")})(i)+r[s+1],r[0]);return new Kl(t,r,po)},yf=(r,e)=>{if(go)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Ni.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Jl=go?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Yn(t)})(r):r;/**
5
+ */var Rd;const Fi=globalThis,so=Fi.ShadowRoot&&(Fi.ShadyCSS===void 0||Fi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oo=Symbol(),Sl=new WeakMap;let Rl=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==oo)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(so&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Sl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Sl.set(t,e))}return e}toString(){return this.cssText}};const Vn=r=>new Rl(typeof r=="string"?r:r+"",void 0,oo),lt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(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.")})(i)+r[s+1],r[0]);return new Rl(t,r,oo)},Od=(r,e)=>{if(so)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Fi.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Dl=so?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Vn(t)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Bf,defineProperty:Tf,getOwnPropertyDescriptor:Qf,getOwnPropertyNames:bf,getOwnPropertySymbols:xf,getPrototypeOf:wf}=Object,Lr=globalThis,Wl=Lr.trustedTypes,Sf=Wl?Wl.emptyScript:"",mo=Lr.reactiveElementPolyfillSupport,Vn=(r,e)=>r,Mi={toAttribute(r,e){switch(e){case Boolean:r=r?Sf:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Pi=(r,e)=>!Bf(r,e),ql={attribute:!0,type:String,converter:Mi,reflect:!1,hasChanged:Pi};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Lr.litPropertyMetadata??(Lr.litPropertyMetadata=new WeakMap);class dn 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=ql){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Tf(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Qf(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const a=i==null?void 0:i.call(this);s.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ql}static _$Ei(){if(this.hasOwnProperty(Vn("elementProperties")))return;const e=wf(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Vn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Vn("properties"))){const t=this.properties,n=[...bf(t),...xf(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Jl(i))}else e!==void 0&&t.push(Jl(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return yf(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 n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){var s;const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const o=(((s=n.converter)==null?void 0:s.toAttribute)!==void 0?n.converter:Mi).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){var s;const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=n.getPropertyOptions(i),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:Mi;this._$Em=i,this[i]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){if(n??(n=this.constructor.getPropertyOptions(e)),!(n.hasChanged??Pi)(this[e],t))return;this.P(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),n.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 n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,o]of i)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(t)):this._$EU()}catch(i){throw e=!1,this._$EU(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),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){}}dn.elementStyles=[],dn.shadowRootOptions={mode:"open"},dn[Vn("elementProperties")]=new Map,dn[Vn("finalized")]=new Map,mo==null||mo({ReactiveElement:dn}),(Lr.reactiveElementVersions??(Lr.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:Ud,defineProperty:Gd,getOwnPropertyDescriptor:Hd,getOwnPropertyNames:$d,getOwnPropertySymbols:Yd,getPrototypeOf:Vd}=Object,Fr=globalThis,_l=Fr.trustedTypes,Kd=_l?_l.emptyScript:"",ao=Fr.reactiveElementPolyfillSupport,Kn=(r,e)=>r,ki={toAttribute(r,e){switch(e){case Boolean:r=r?Kd:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ni=(r,e)=>!Ud(r,e),Ll={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Ni};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Fr.litPropertyMetadata??(Fr.litPropertyMetadata=new WeakMap);class dn 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=Ll){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Gd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Hd(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const a=i==null?void 0:i.call(this);s.call(this,o),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ll}static _$Ei(){if(this.hasOwnProperty(Kn("elementProperties")))return;const e=Vd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Kn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Kn("properties"))){const t=this.properties,n=[...$d(t),...Yd(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Dl(i))}else e!==void 0&&t.push(Dl(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Od(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 n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){var s;const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const o=(((s=n.converter)==null?void 0:s.toAttribute)!==void 0?n.converter:ki).toAttribute(t,n.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){var s;const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=n.getPropertyOptions(i),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:ki;this._$Em=i,this[i]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){if(n??(n=this.constructor.getPropertyOptions(e)),!(n.hasChanged??Ni)(this[e],t))return;this.P(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),n.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 n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,o]of i)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.P(s,this[s],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(t)):this._$EU()}catch(i){throw e=!1,this._$EU(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),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){}}dn.elementStyles=[],dn.shadowRootOptions={mode:"open"},dn[Kn("elementProperties")]=new Map,dn[Kn("finalized")]=new Map,ao==null||ao({ReactiveElement:dn}),(Fr.reactiveElementVersions??(Fr.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Kn=globalThis,Oi=Kn.trustedTypes,jl=Oi?Oi.createPolicy("lit-html",{createHTML:r=>r}):void 0,Eo="$lit$",Cr=`lit$${(Math.random()+"").slice(9)}$`,Io="?"+Cr,Rf=`<${Io}>`,Yr=document,Jn=()=>Yr.createComment(""),Wn=r=>r===null||typeof r!="object"&&typeof r!="function",Xl=Array.isArray,zl=r=>Xl(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Co=`[
14
- \f\r]`,qn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zl=/-->/g,eA=/>/g,Vr=RegExp(`>|${Co}(?:([^\\s"'>=/]+)(${Co}*=${Co}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),tA=/'/g,rA=/"/g,nA=/^(?:script|style|textarea|title)$/i,Df=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ve=Df(1),jt=Symbol.for("lit-noChange"),et=Symbol.for("lit-nothing"),iA=new WeakMap,Kr=Yr.createTreeWalker(Yr,129);function sA(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return jl!==void 0?jl.createHTML(e):e}const oA=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=qn;for(let a=0;a<t;a++){const l=r[a];let A,c,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,c=o.exec(l),c!==null);)h=o.lastIndex,o===qn?c[1]==="!--"?o=Zl:c[1]!==void 0?o=eA:c[2]!==void 0?(nA.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Vr):c[3]!==void 0&&(o=Vr):o===Vr?c[0]===">"?(o=i??qn,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,A=c[1],o=c[3]===void 0?Vr:c[3]==='"'?rA:tA):o===rA||o===tA?o=Vr:o===Zl||o===eA?o=qn:(o=Vr,i=void 0);const d=o===Vr&&r[a+1].startsWith("/>")?" ":"";s+=o===qn?l+Rf:u>=0?(n.push(A),l.slice(0,u)+Eo+l.slice(u)+Cr+d):l+Cr+(u===-2?a:d)}return[sA(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class jn{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[A,c]=oA(e,t);if(this.el=jn.createElement(A,n),Kr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(Eo)){const h=c[o++],d=i.getAttribute(u).split(Cr),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?lA:f[1]==="?"?AA:f[1]==="@"?cA:Xn}),i.removeAttribute(u)}else u.startsWith(Cr)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(nA.test(i.tagName)){const u=i.textContent.split(Cr),h=u.length-1;if(h>0){i.textContent=Oi?Oi.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Jn()),Kr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Jn())}}}else if(i.nodeType===8)if(i.data===Io)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Cr,u+1))!==-1;)l.push({type:7,index:s}),u+=Cr.length-1}s++}}static createElement(e,t){const n=Yr.createElement("template");return n.innerHTML=e,n}}function Jr(r,e,t=r,n){var o,a;if(e===jt)return e;let i=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const s=Wn(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Jr(r,i._$AS(r,e.values),i,n)),e}class aA{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:n}=this._$AD,i=((e==null?void 0:e.creationScope)??Yr).importNode(t,!0);Kr.currentNode=i;let s=Kr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new fn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new uA(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Kr.nextNode(),o++)}return Kr.currentNode=Yr,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class fn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=et,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.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=Jr(this,e,t),Wn(e)?e===et||e==null||e===""?(this._$AH!==et&&this._$AR(),this._$AH=et):e!==this._$AH&&e!==jt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):zl(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!==et&&Wn(this._$AH)?this._$AA.nextSibling.data=e:this.T(Yr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=jn.createElement(sA(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new aA(i,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 jn(e)),t}k(e){Xl(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new fn(this.S(Jn()),this.S(Jn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Xn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=et,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=et}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Jr(this,e,t,0),o=!Wn(e)||e!==this._$AH&&e!==jt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Jr(this,a[n+l],t,l),A===jt&&(A=this._$AH[l]),o||(o=!Wn(A)||A!==this._$AH[l]),A===et?e=et:e!==et&&(e+=(A??"")+s[l+1]),this._$AH[l]=A}o&&!i&&this.j(e)}j(e){e===et?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class lA extends Xn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===et?void 0:e}}class AA extends Xn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==et)}}class cA extends Xn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Jr(this,e,t,0)??et)===jt)return;const n=this._$AH,i=e===et&&n!==et||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==et&&(n===et||i);i&&this.element.removeEventListener(this.name,this,n),s&&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 uA{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Jr(this,e)}}const _f={P:Eo,A:Cr,C:Io,M:1,L:oA,R:aA,D:zl,V:Jr,I:fn,H:Xn,N:AA,U:cA,B:lA,F:uA},vo=Kn.litHtmlPolyfillSupport;vo==null||vo(jn,fn),(Kn.litHtmlVersions??(Kn.litHtmlVersions=[])).push("3.1.2");const Lf=(r,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new fn(e.insertBefore(Jn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
13
+ */const Jn=globalThis,Mi=Jn.trustedTypes,Fl=Mi?Mi.createPolicy("lit-html",{createHTML:r=>r}):void 0,lo="$lit$",Cr=`lit$${(Math.random()+"").slice(9)}$`,Ao="?"+Cr,Jd=`<${Ao}>`,Yr=document,Wn=()=>Yr.createComment(""),qn=r=>r===null||typeof r!="object"&&typeof r!="function",kl=Array.isArray,Nl=r=>kl(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",co=`[
14
+ \f\r]`,Xn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ml=/-->/g,Pl=/>/g,Vr=RegExp(`>|${co}(?:([^\\s"'>=/]+)(${co}*=${co}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ol=/'/g,Ul=/"/g,Gl=/^(?:script|style|textarea|title)$/i,Wd=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ve=Wd(1),Xt=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),Hl=new WeakMap,Kr=Yr.createTreeWalker(Yr,129);function $l(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fl!==void 0?Fl.createHTML(e):e}const Yl=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=Xn;for(let a=0;a<t;a++){const l=r[a];let A,c,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,c=o.exec(l),c!==null);)h=o.lastIndex,o===Xn?c[1]==="!--"?o=Ml:c[1]!==void 0?o=Pl:c[2]!==void 0?(Gl.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Vr):c[3]!==void 0&&(o=Vr):o===Vr?c[0]===">"?(o=i??Xn,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,A=c[1],o=c[3]===void 0?Vr:c[3]==='"'?Ul:Ol):o===Ul||o===Ol?o=Vr:o===Ml||o===Pl?o=Xn:(o=Vr,i=void 0);const d=o===Vr&&r[a+1].startsWith("/>")?" ":"";s+=o===Xn?l+Jd:u>=0?(n.push(A),l.slice(0,u)+lo+l.slice(u)+Cr+d):l+Cr+(u===-2?a:d)}return[$l(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class jn{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[A,c]=Yl(e,t);if(this.el=jn.createElement(A,n),Kr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Kr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(lo)){const h=c[o++],d=i.getAttribute(u).split(Cr),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?Kl:f[1]==="?"?Jl:f[1]==="@"?Wl:zn}),i.removeAttribute(u)}else u.startsWith(Cr)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Gl.test(i.tagName)){const u=i.textContent.split(Cr),h=u.length-1;if(h>0){i.textContent=Mi?Mi.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Wn()),Kr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Wn())}}}else if(i.nodeType===8)if(i.data===Ao)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Cr,u+1))!==-1;)l.push({type:7,index:s}),u+=Cr.length-1}s++}}static createElement(e,t){const n=Yr.createElement("template");return n.innerHTML=e,n}}function Jr(r,e,t=r,n){var o,a;if(e===Xt)return e;let i=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const s=qn(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Jr(r,i._$AS(r,e.values),i,n)),e}class Vl{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:n}=this._$AD,i=((e==null?void 0:e.creationScope)??Yr).importNode(t,!0);Kr.currentNode=i;let s=Kr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new fn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new ql(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Kr.nextNode(),o++)}return Kr.currentNode=Yr,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class fn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.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=Jr(this,e,t),qn(e)?e===tt||e==null||e===""?(this._$AH!==tt&&this._$AR(),this._$AH=tt):e!==this._$AH&&e!==Xt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nl(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!==tt&&qn(this._$AH)?this._$AA.nextSibling.data=e:this.T(Yr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=jn.createElement($l(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new Vl(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Hl.get(e.strings);return t===void 0&&Hl.set(e.strings,t=new jn(e)),t}k(e){kl(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new fn(this.S(Wn()),this.S(Wn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class zn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=tt}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Jr(this,e,t,0),o=!qn(e)||e!==this._$AH&&e!==Xt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Jr(this,a[n+l],t,l),A===Xt&&(A=this._$AH[l]),o||(o=!qn(A)||A!==this._$AH[l]),A===tt?e=tt:e!==tt&&(e+=(A??"")+s[l+1]),this._$AH[l]=A}o&&!i&&this.j(e)}j(e){e===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Kl extends zn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===tt?void 0:e}}class Jl extends zn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==tt)}}class Wl extends zn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Jr(this,e,t,0)??tt)===Xt)return;const n=this._$AH,i=e===tt&&n!==tt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==tt&&(n===tt||i);i&&this.element.removeEventListener(this.name,this,n),s&&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 ql{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Jr(this,e)}}const qd={P:lo,A:Cr,C:Ao,M:1,L:Yl,R:Vl,D:Nl,V:Jr,I:fn,H:zn,N:Jl,U:Wl,B:Kl,F:ql},uo=Jn.litHtmlPolyfillSupport;uo==null||uo(jn,fn),(Jn.litHtmlVersions??(Jn.litHtmlVersions=[])).push("3.1.2");const Xd=(r,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new fn(e.insertBefore(Wn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let vr=class extends dn{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=Lf(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 jt}};vr._$litElement$=!0,vr.finalized=!0,(df=globalThis.litElementHydrateSupport)==null||df.call(globalThis,{LitElement:vr});const yo=globalThis.litElementPolyfillSupport;yo==null||yo({LitElement:vr}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
19
+ */let vr=class extends dn{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=Xd(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 Xt}};vr._$litElement$=!0,vr.finalized=!0,(Rd=globalThis.litElementHydrateSupport)==null||Rd.call(globalThis,{LitElement:vr});const ho=globalThis.litElementPolyfillSupport;ho==null||ho({LitElement:vr}),(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 Ui=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
23
+ */const Pi=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Ff={attribute:!0,type:String,converter:Mi,reflect:!1,hasChanged:Pi},kf=(r=Ff,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(t.name,r),n==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(n==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+n)};function ee(r){return(e,t)=>typeof t=="object"?kf(r,e,t):((n,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,o?{...n,wrapped:!0}:n),o?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}/**
27
+ */const jd={attribute:!0,type:String,converter:ki,reflect:!1,hasChanged:Ni},zd=(r=jd,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(t.name,r),n==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(n==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+n)};function ee(r){return(e,t)=>typeof t=="object"?zd(r,e,t):((n,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,o?{...n,wrapped:!0}:n),o?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function tt(r){return ee({...r,state:!0,attribute:!1})}/**
31
+ */function rt(r){return ee({...r,state:!0,attribute:!1})}/**
32
32
  * @license
33
33
  * Copyright 2018 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */const At=r=>r??et;let Gi;const Nf=new Uint8Array(16);function Mf(){if(!Gi&&(Gi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Gi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gi(Nf)}const Et=[];for(let r=0;r<256;++r)Et.push((r+256).toString(16).slice(1));function Pf(r,e=0){return Et[r[e+0]]+Et[r[e+1]]+Et[r[e+2]]+Et[r[e+3]]+"-"+Et[r[e+4]]+Et[r[e+5]]+"-"+Et[r[e+6]]+Et[r[e+7]]+"-"+Et[r[e+8]]+Et[r[e+9]]+"-"+Et[r[e+10]]+Et[r[e+11]]+Et[r[e+12]]+Et[r[e+13]]+Et[r[e+14]]+Et[r[e+15]]}const hA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fr(r,e,t){if(hA.randomUUID&&!e&&!r)return hA.randomUUID();r=r||{};const n=r.random||(r.rng||Mf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return Pf(n)}/**
35
+ */const At=r=>r??tt;let Oi;const Zd=new Uint8Array(16);function ef(){if(!Oi&&(Oi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Oi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Oi(Zd)}const Et=[];for(let r=0;r<256;++r)Et.push((r+256).toString(16).slice(1));function tf(r,e=0){return Et[r[e+0]]+Et[r[e+1]]+Et[r[e+2]]+Et[r[e+3]]+"-"+Et[r[e+4]]+Et[r[e+5]]+"-"+Et[r[e+6]]+Et[r[e+7]]+"-"+Et[r[e+8]]+Et[r[e+9]]+"-"+Et[r[e+10]]+Et[r[e+11]]+Et[r[e+12]]+Et[r[e+13]]+Et[r[e+14]]+Et[r[e+15]]}const Xl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function kr(r,e,t){if(Xl.randomUUID&&!e&&!r)return Xl.randomUUID();r=r||{};const n=r.random||(r.rng||ef)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return tf(n)}/**
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
39
- */const{I:Of}=_f,Uf=r=>r.strings===void 0,dA=()=>document.createComment(""),zn=(r,e,t)=>{var s;const n=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){const o=n.insertBefore(dA(),i),a=n.insertBefore(dA(),i);t=new Of(o,a,r,r.options)}else{const o=t._$AB.nextSibling,a=t._$AM,l=a!==r;if(l){let A;(s=t._$AQ)==null||s.call(t,r),t._$AM=r,t._$AP!==void 0&&(A=r._$AU)!==a._$AU&&t._$AP(A)}if(o!==i||l){let A=t._$AA;for(;A!==o;){const c=A.nextSibling;n.insertBefore(A,i),A=c}}}return t},Wr=(r,e,t=r)=>(r._$AI(e,t),r),Gf={},Hf=(r,e=Gf)=>r._$AH=e,$f=r=>r._$AH,Bo=r=>{var n;(n=r._$AP)==null||n.call(r,!1,!0);let e=r._$AA;const t=r._$AB.nextSibling;for(;e!==t;){const i=e.nextSibling;e.remove(),e=i}};/**
39
+ */const{I:rf}=qd,nf=r=>r.strings===void 0,jl=()=>document.createComment(""),Zn=(r,e,t)=>{var s;const n=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){const o=n.insertBefore(jl(),i),a=n.insertBefore(jl(),i);t=new rf(o,a,r,r.options)}else{const o=t._$AB.nextSibling,a=t._$AM,l=a!==r;if(l){let A;(s=t._$AQ)==null||s.call(t,r),t._$AM=r,t._$AP!==void 0&&(A=r._$AU)!==a._$AU&&t._$AP(A)}if(o!==i||l){let A=t._$AA;for(;A!==o;){const c=A.nextSibling;n.insertBefore(A,i),A=c}}}return t},Wr=(r,e,t=r)=>(r._$AI(e,t),r),sf={},of=(r,e=sf)=>r._$AH=e,af=r=>r._$AH,fo=r=>{var n;(n=r._$AP)==null||n.call(r,!1,!0);let e=r._$AA;const t=r._$AB.nextSibling;for(;e!==t;){const i=e.nextSibling;e.remove(),e=i}};/**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */const gn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},pn=r=>(...e)=>({_$litDirective$:r,values:e});let Zn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
43
+ */const gn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},pn=r=>(...e)=>({_$litDirective$:r,values:e});let ei=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$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 ei=(r,e)=>{var n;const t=r._$AN;if(t===void 0)return!1;for(const i of t)(n=i._$AO)==null||n.call(i,e,!1),ei(i,e);return!0},Hi=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while((t==null?void 0:t.size)===0)},fA=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),Kf(e)}};function Yf(r){this._$AN!==void 0?(Hi(this),this._$AM=r,fA(this)):this._$AM=r}function Vf(r,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let s=t;s<n.length;s++)ei(n[s],!1),Hi(n[s]);else n!=null&&(ei(n,!1),Hi(n));else ei(this,r)}const Kf=r=>{r.type==gn.CHILD&&(r._$AP??(r._$AP=Vf),r._$AQ??(r._$AQ=Yf))};class gA extends Zn{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),fA(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)==null||n.call(this):(i=this.disconnected)==null||i.call(this)),t&&(ei(this,e),Hi(this))}setValue(e){if(Uf(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 ti=(r,e)=>{var n;const t=r._$AN;if(t===void 0)return!1;for(const i of t)(n=i._$AO)==null||n.call(i,e,!1),ti(i,e);return!0},Ui=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while((t==null?void 0:t.size)===0)},zl=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),cf(e)}};function lf(r){this._$AN!==void 0?(Ui(this),this._$AM=r,zl(this)):this._$AM=r}function Af(r,e=!1,t=0){const n=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(n))for(let s=t;s<n.length;s++)ti(n[s],!1),Ui(n[s]);else n!=null&&(ti(n,!1),Ui(n));else ti(this,r)}const cf=r=>{r.type==gn.CHILD&&(r._$AP??(r._$AP=Af),r._$AQ??(r._$AQ=lf))};class Zl extends ei{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),zl(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,i;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)==null||n.call(this):(i=this.disconnected)==null||i.call(this)),t&&(ti(this,e),Ui(this))}setValue(e){if(nf(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 It=()=>new Jf;let Jf=class{};const To=new WeakMap,Ct=pn(class extends gA{render(r){return et}update(r,[e]){var n;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=(n=r.options)==null?void 0:n.host,this.rt(this.ct=r.element)),et}rt(r){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=To.get(e);t===void 0&&(t=new WeakMap,To.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=To.get(this.ht??globalThis))==null?void 0:r.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 Wf(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class qf{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=It(),this.host=e,this._events=t,e.addController(this)}register(){return Ct(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Wf(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const It=()=>new uf;let uf=class{};const go=new WeakMap,Ct=pn(class extends Zl{render(r){return tt}update(r,[e]){var n;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=(n=r.options)==null?void 0:n.host,this.rt(this.ct=r.element)),tt}rt(r){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=go.get(e);t===void 0&&(t=new WeakMap,go.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=go.get(this.ht??globalThis))==null?void 0:r.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 hf(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class df{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=It(),this.host=e,this._events=t,e.addController(this)}register(){return Ct(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(hf(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 jf=Symbol();class $i{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,n){var s;this.u=0,this.status=0,(this.p=e).addController(this);const i=typeof t=="object"?t:{task:t,args:n};this._=i.task,this.v=i.args,this.j=i.argsEqual??Xf,this.m=i.onComplete,this.g=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.l=i.initialValue,this.status=2,this.k=(s=this.A)==null?void 0:s.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,l,A,c;let t,n;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 i=++this.u;this.T=new AbortController;let s=!1;try{t=await this._(e,{signal:this.T.signal})}catch(u){s=!0,n=u}if(this.u===i){if(t===jf)this.status=0;else{if(s===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(l=this.i)==null||l.call(this,t)}else{try{(A=this.g)==null||A.call(this,n)}catch{}this.status=3,(c=this.o)==null||c.call(this,n)}this.l=t,this.h=n}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,n,i,s;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(n=e.pending)==null?void 0:n.call(e);case 2:return(i=e.complete)==null?void 0:i.call(e,this.value);case 3:return(s=e.error)==null?void 0:s.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const Xf=(r,e)=>r===e||r.length===e.length&&r.every((t,n)=>!Pi(t,e[n])),pA="https://d2rxhdlm2q91uk.cloudfront.net",zf="https://d1ix11aj5kfygl.cloudfront.net",Zf="https://d157jlwnudd93d.cloudfront.net",mA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",eg="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",tg="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",rg="http://localhost:6060/v2",ng="https://embed-dev.vouchfor.com/v2",ig="https://embed-staging.vouchfor.com/v2",sg="https://embed.vouchfor.com/v2";function Yi(r){if(!["local","dev","staging","prod"].includes(r))throw new Error(`Unknown environment: ${r}`);if(r==="local")return{videoUrl:pA,publicApiUrl:mA,embedApiUrl:rg};if(r==="dev")return{videoUrl:pA,publicApiUrl:mA,embedApiUrl:ng};if(r==="staging")return{videoUrl:zf,publicApiUrl:eg,embedApiUrl:ig};if(r==="prod")return{videoUrl:Zf,publicApiUrl:tg,embedApiUrl:sg}}class og{constructor(e){this._fetching=!1,this.getVouch=async(t,n,i)=>{var c;const{embedApiUrl:s}=Yi(t),o=Fr(),a=await fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:l==null?void 0:l.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.getTemplate=async(t,n,i)=>{var c;const{embedApiUrl:s}=Yi(t),o=Fr(),a=await fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.host=e,new $i(this.host,async([t,n,i,s,o])=>{var a,l,A,c;try{if(e.vouch=void 0,e.template=void 0,i){let u;o&&(this.fetching=!0,u=await this.getTemplate(t,n,o)),this._vouch=i,e.template=u??((l=(a=i==null?void 0:i.settings)==null?void 0:a.template)==null?void 0:l.instance)}else if(s){this.fetching=!0;const[u,h]=await Promise.all([this.getVouch(t,n,s),o?this.getTemplate(t,n,o):null]);this._vouch=u,e.template=h??((c=(A=u==null?void 0:u.settings)==null?void 0:A.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new $i(this.host,([t,n])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((i,s)=>!(n!=null&&n.length)||(n==null?void 0:n.includes(s+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 ag=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!lg(i,s)&&n||Object.defineProperty(r,t,s)},lg=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Ag=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},cg=(r,e)=>`/* Wrapped ${r}*/
56
- ${e}`,ug=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),hg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),dg=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=cg.bind(null,n,e.toString());Object.defineProperty(i,"name",hg);const{writable:s,enumerable:o,configurable:a}=ug;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function fg(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))ag(r,e,i,t);return Ag(r,e),dg(r,e,n),r}const gg=new WeakMap,EA=new WeakMap;function Vi(r,{cacheKey:e,cache:t=new Map,maxAge:n}={}){if(n===0)return r;if(typeof n=="number"){if(n>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(n<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const i=function(...s){var A;const o=e?e(s):s[0],a=t.get(o);if(a)return a.data;const l=r.apply(this,s);if(t.set(o,{data:l,maxAge:n?Date.now()+n:Number.POSITIVE_INFINITY}),typeof n=="number"&&n!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},n);(A=c.unref)==null||A.call(c);const u=EA.get(r)??new Set;u.add(c),EA.set(r,u)}return l};return fg(i,r,{ignoreNonConfigurable:!0}),gg.set(i,t),i}var IA=function(){};const pg=(r,e,t)=>Math.min(Math.max(t,r),e),CA=(r,e,t)=>{const n=e-r;return n===0?1:(t-r)/n},Qo=(r,e,t)=>-t*r+t*e+r,vA=(r,e)=>t=>Math.max(Math.min(t,e),r),ti=r=>r%1?Number(r.toFixed(5)):r,Ki=/(-)?([\d]*\.?[\d])+/g,bo=/(#[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,mg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function ri(r){return typeof r=="string"}const Ji={test:r=>typeof r=="number",parse:parseFloat,transform:r=>r},yA=Object.assign(Object.assign({},Ji),{transform:vA(0,1)});Object.assign(Object.assign({},Ji),{default:1});const ni=(r=>({test:e=>ri(e)&&e.endsWith(r)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${r}`}))("%");Object.assign(Object.assign({},ni),{parse:r=>ni.parse(r)/100,transform:r=>ni.transform(r*100)});const xo=(r,e)=>t=>!!(ri(t)&&mg.test(t)&&t.startsWith(r)||e&&Object.prototype.hasOwnProperty.call(t,e)),BA=(r,e,t)=>n=>{if(!ri(n))return n;const[i,s,o,a]=n.match(Ki);return{[r]:parseFloat(i),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},qr={test:xo("hsl","hue"),parse:BA("hue","saturation","lightness"),transform:({hue:r,saturation:e,lightness:t,alpha:n=1})=>"hsla("+Math.round(r)+", "+ni.transform(ti(e))+", "+ni.transform(ti(t))+", "+ti(yA.transform(n))+")"},Eg=vA(0,255),wo=Object.assign(Object.assign({},Ji),{transform:r=>Math.round(Eg(r))}),kr={test:xo("rgb","red"),parse:BA("red","green","blue"),transform:({red:r,green:e,blue:t,alpha:n=1})=>"rgba("+wo.transform(r)+", "+wo.transform(e)+", "+wo.transform(t)+", "+ti(yA.transform(n))+")"};function Ig(r){let e="",t="",n="",i="";return r.length>5?(e=r.substr(1,2),t=r.substr(3,2),n=r.substr(5,2),i=r.substr(7,2)):(e=r.substr(1,1),t=r.substr(2,1),n=r.substr(3,1),i=r.substr(4,1),e+=e,t+=t,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const So={test:xo("#"),parse:Ig,transform:kr.transform},Wi={test:r=>kr.test(r)||So.test(r)||qr.test(r),parse:r=>kr.test(r)?kr.parse(r):qr.test(r)?qr.parse(r):So.parse(r),transform:r=>ri(r)?r:r.hasOwnProperty("red")?kr.transform(r):qr.transform(r)},TA="${c}",QA="${n}";function Cg(r){var e,t,n,i;return isNaN(r)&&ri(r)&&((t=(e=r.match(Ki))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((i=(n=r.match(bo))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>0}function bA(r){typeof r=="number"&&(r=`${r}`);const e=[];let t=0;const n=r.match(bo);n&&(t=n.length,r=r.replace(bo,TA),e.push(...n.map(Wi.parse)));const i=r.match(Ki);return i&&(r=r.replace(Ki,QA),e.push(...i.map(Ji.parse))),{values:e,numColors:t,tokenised:r}}function xA(r){return bA(r).values}function wA(r){const{values:e,numColors:t,tokenised:n}=bA(r),i=e.length;return s=>{let o=n;for(let a=0;a<i;a++)o=o.replace(a<t?TA:QA,a<t?Wi.transform(s[a]):ti(s[a]));return o}}const vg=r=>typeof r=="number"?0:r;function yg(r){const e=xA(r);return wA(r)(e.map(vg))}const SA={test:Cg,parse:xA,createTransformer:wA,getAnimatableNone:yg};function Ro(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?r+(e-r)*6*t:t<.5?e:t<.6666666666666666?r+(e-r)*(.6666666666666666-t)*6:r}function RA({hue:r,saturation:e,lightness:t,alpha:n}){r/=360,e/=100,t/=100;let i=0,s=0,o=0;if(!e)i=s=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=Ro(l,a,r+.3333333333333333),s=Ro(l,a,r),o=Ro(l,a,r-.3333333333333333)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}const Bg=(r,e,t)=>{const n=r*r,i=e*e;return Math.sqrt(Math.max(0,t*(i-n)+n))},Tg=[So,kr,qr],DA=r=>Tg.find(e=>e.test(r)),_A=(r,e)=>{let t=DA(r),n=DA(e),i=t.parse(r),s=n.parse(e);t===qr&&(i=RA(i),t=kr),n===qr&&(s=RA(s),n=kr);const o=Object.assign({},i);return a=>{for(const l in o)l!=="alpha"&&(o[l]=Bg(i[l],s[l],a));return o.alpha=Qo(i.alpha,s.alpha,a),t.transform(o)}},Qg=r=>typeof r=="number",bg=(r,e)=>t=>e(r(t)),LA=(...r)=>r.reduce(bg);function FA(r,e){return Qg(r)?t=>Qo(r,e,t):Wi.test(r)?_A(r,e):MA(r,e)}const kA=(r,e)=>{const t=[...r],n=t.length,i=r.map((s,o)=>FA(s,e[o]));return s=>{for(let o=0;o<n;o++)t[o]=i[o](s);return t}},xg=(r,e)=>{const t=Object.assign(Object.assign({},r),e),n={};for(const i in t)r[i]!==void 0&&e[i]!==void 0&&(n[i]=FA(r[i],e[i]));return i=>{for(const s in n)t[s]=n[s](i);return t}};function NA(r){const e=SA.parse(r),t=e.length;let n=0,i=0,s=0;for(let o=0;o<t;o++)n||typeof e[o]=="number"?n++:e[o].hue!==void 0?s++:i++;return{parsed:e,numNumbers:n,numRGB:i,numHSL:s}}const MA=(r,e)=>{const t=SA.createTransformer(e),n=NA(r),i=NA(e);return n.numHSL===i.numHSL&&n.numRGB===i.numRGB&&n.numNumbers>=i.numNumbers?LA(kA(n.parsed,i.parsed),t):o=>`${o>0?e:r}`},wg=(r,e)=>t=>Qo(r,e,t);function Sg(r){if(typeof r=="number")return wg;if(typeof r=="string")return Wi.test(r)?_A:MA;if(Array.isArray(r))return kA;if(typeof r=="object")return xg}function Rg(r,e,t){const n=[],i=t||Sg(r[0]),s=r.length-1;for(let o=0;o<s;o++){let a=i(r[o],r[o+1]);if(e){const l=Array.isArray(e)?e[o]:e;a=LA(l,a)}n.push(a)}return n}function Dg([r,e],[t]){return n=>t(CA(r,e,n))}function _g(r,e){const t=r.length,n=t-1;return i=>{let s=0,o=!1;if(i<=r[0]?o=!0:i>=r[n]&&(s=n-1,o=!0),!o){let l=1;for(;l<t&&!(r[l]>i||l===n);l++);s=l-1}const a=CA(r[s],r[s+1],i);return e[s](a)}}function Lg(r,e,{clamp:t=!0,ease:n,mixer:i}={}){const s=r.length;IA(s===e.length),IA(!n||!Array.isArray(n)||n.length===s-1),r[0]>r[s-1]&&(r=[].concat(r),e=[].concat(e),r.reverse(),e.reverse());const o=Rg(e,n,i),a=s===2?Dg(r,o):_g(r,o);return t?l=>a(pg(r[0],r[s-1],l)):a}const qi=r=>e=>1-r(1-e),Do=r=>e=>e<=.5?r(2*e)/2:(2-r(2*(1-e)))/2,Fg=r=>e=>Math.pow(e,r),PA=r=>e=>e*e*((r+1)*e-r),kg=r=>{const e=PA(r);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},OA=1.525,Ng=4/11,Mg=8/11,Pg=9/10,Og=r=>r,_o=Fg(2),Ug=qi(_o),Gg=Do(_o),UA=r=>1-Math.sin(Math.acos(r)),GA=qi(UA),Hg=Do(GA),Lo=PA(OA),$g=qi(Lo),Yg=Do(Lo),Vg=kg(OA),Kg=4356/361,Jg=35442/1805,Wg=16061/1805,ji=r=>{if(r===1||r===0)return r;const e=r*r;return r<Ng?7.5625*e:r<Mg?9.075*e-9.9*r+3.4:r<Pg?Kg*e-Jg*r+Wg:10.8*r*r-20.52*r+10.72},qg=qi(ji),jg=r=>r<.5?.5*(1-ji(1-r*2)):.5*ji(r*2-1)+.5;var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ko={exports:{}};(function(r,e){(function(t,n){n(e)})(mn,function(t){function n(_){var S,F,J=new Error(_);return S=J,F=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(S,F):S.__proto__=F,J}function i(_,S,F){var J=S.slice(0,F).split(/\n/),Y=J.length,ne=J[Y-1].length+1;throw n(_+=" at line "+Y+" col "+ne+`:
55
+ */const ff=Symbol();class Gi{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,n){var s;this.u=0,this.status=0,(this.p=e).addController(this);const i=typeof t=="object"?t:{task:t,args:n};this._=i.task,this.v=i.args,this.j=i.argsEqual??gf,this.m=i.onComplete,this.g=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.l=i.initialValue,this.status=2,this.k=(s=this.A)==null?void 0:s.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,l,A,c;let t,n;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 i=++this.u;this.T=new AbortController;let s=!1;try{t=await this._(e,{signal:this.T.signal})}catch(u){s=!0,n=u}if(this.u===i){if(t===ff)this.status=0;else{if(s===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(l=this.i)==null||l.call(this,t)}else{try{(A=this.g)==null||A.call(this,n)}catch{}this.status=3,(c=this.o)==null||c.call(this,n)}this.l=t,this.h=n}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,n,i,s;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(n=e.pending)==null?void 0:n.call(e);case 2:return(i=e.complete)==null?void 0:i.call(e,this.value);case 3:return(s=e.error)==null?void 0:s.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const gf=(r,e)=>r===e||r.length===e.length&&r.every((t,n)=>!Ni(t,e[n])),eA="https://d2rxhdlm2q91uk.cloudfront.net",pf="https://d1ix11aj5kfygl.cloudfront.net",mf="https://d157jlwnudd93d.cloudfront.net",tA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Ef="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",If="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",Cf="http://localhost:6060/v2",vf="https://embed-dev.vouchfor.com/v2",yf="https://embed-staging.vouchfor.com/v2",Bf="https://embed.vouchfor.com/v2";function Hi(r){if(!["local","dev","staging","prod"].includes(r))throw new Error(`Unknown environment: ${r}`);if(r==="local")return{videoUrl:eA,publicApiUrl:tA,embedApiUrl:Cf};if(r==="dev")return{videoUrl:eA,publicApiUrl:tA,embedApiUrl:vf};if(r==="staging")return{videoUrl:pf,publicApiUrl:Ef,embedApiUrl:yf};if(r==="prod")return{videoUrl:mf,publicApiUrl:If,embedApiUrl:Bf}}class Tf{constructor(e){this._fetching=!1,this.getVouch=async(t,n,i)=>{var c;const{embedApiUrl:s}=Hi(t),o=kr(),a=await fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:l==null?void 0:l.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.getTemplate=async(t,n,i)=>{var c;const{embedApiUrl:s}=Hi(t),o=kr(),a=await fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.host=e,new Gi(this.host,async([t,n,i,s,o])=>{var a,l,A,c;try{if(e.vouch=void 0,e.template=void 0,i){let u;o&&(this.fetching=!0,u=await this.getTemplate(t,n,o)),this._vouch=i,e.template=u??((l=(a=i==null?void 0:i.settings)==null?void 0:a.template)==null?void 0:l.instance)}else if(s){this.fetching=!0;const[u,h]=await Promise.all([this.getVouch(t,n,s),o?this.getTemplate(t,n,o):null]);this._vouch=u,e.template=h??((c=(A=u==null?void 0:u.settings)==null?void 0:A.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Gi(this.host,([t,n])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((i,s)=>!(n!=null&&n.length)||(n==null?void 0:n.includes(s+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 Qf=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!bf(i,s)&&n||Object.defineProperty(r,t,s)},bf=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},xf=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},wf=(r,e)=>`/* Wrapped ${r}*/
56
+ ${e}`,Sf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Rf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Df=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=wf.bind(null,n,e.toString());Object.defineProperty(i,"name",Rf);const{writable:s,enumerable:o,configurable:a}=Sf;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function _f(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))Qf(r,e,i,t);return xf(r,e),Df(r,e,n),r}const Lf=new WeakMap,rA=new WeakMap;function po(r,{cacheKey:e,cache:t=new Map,maxAge:n}={}){if(n===0)return r;if(typeof n=="number"){if(n>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(n<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const i=function(...s){var A;const o=e?e(s):s[0],a=t.get(o);if(a)return a.data;const l=r.apply(this,s);if(t.set(o,{data:l,maxAge:n?Date.now()+n:Number.POSITIVE_INFINITY}),typeof n=="number"&&n!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},n);(A=c.unref)==null||A.call(c);const u=rA.get(r)??new Set;u.add(c),rA.set(r,u)}return l};return _f(i,r,{ignoreNonConfigurable:!0}),Lf.set(i,t),i}var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Eo={exports:{}};(function(r,e){(function(t,n){n(e)})(mn,function(t){function n(_){var S,F,J=new Error(_);return S=J,F=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(S,F):S.__proto__=F,J}function i(_,S,F){var J=S.slice(0,F).split(/\n/),Y=J.length,ne=J[Y-1].length+1;throw n(_+=" at line "+Y+" col "+ne+`:
57
57
 
58
58
  `+S.split(/\n/)[Y-1]+`
59
59
  `+Array(ne).join(" ")+"^")}n.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(_){if(!(_ instanceof SyntaxError))throw _}function a(_,S){return Object.prototype.hasOwnProperty.call(_,S)}function l(_,S,F){for(var J in S)a(S,J)&&(S[J]==null||typeof S[J]!="object"||J!=="storage"&&J!=="prefixes"||F?_[J]=S[J]:_[J]=l({},S[J]));return _}var A=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,h=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function f(_){return d.test(_)?_.replace(d,"\\$&"):_}function g(_,S){S.rmWhitespace&&(_=_.replace(/[\r\n]+/g,`
60
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var F=S.prefixes,J=[F.h,F.b,F.i,F.r,F.c,F.e].reduce(function(fe,Qe){return fe&&Qe?fe+"|"+f(Qe):Qe?f(Qe):fe},""),Y=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(S.tags[1])+")","g"),ne=new RegExp("([^]*?)"+f(S.tags[0])+"(-|_)?\\s*("+J+")?\\s*","g"),ce=0,pe=!1;function ge(fe,Qe){var Me,we={f:[]},We=0,Te="c";function T(be){var De=_.slice(ce,be),ke=De.trim();if(Te==="f")ke==="safe"?we.raw=!0:S.async&&A.test(ke)?(ke=ke.replace(A,""),we.f.push([ke,"",!0])):we.f.push([ke,""]);else if(Te==="fp")we.f[we.f.length-1][1]+=ke;else if(Te==="err"){if(ke){var _e=De.search(/\S/);i("invalid syntax",_,ce+_e)}}else we[Te]=ke;ce=be+1}for(Qe==="h"||Qe==="b"||Qe==="c"?Te="n":Qe==="r"&&(we.raw=!0,Qe="i"),Y.lastIndex=ce;(Me=Y.exec(_))!==null;){var m=Me[1],E=Me[2],x=Me[3],M=Me[4],z=Me[5],X=Me.index;if(m)m==="("?(We===0&&(Te==="n"?(T(X),Te="p"):Te==="f"&&(T(X),Te="fp")),We++):m===")"?--We===0&&Te!=="c"&&(T(X),Te="err"):We===0&&m==="|"?(T(X),Te="f"):m==="=>"&&(T(X),ce+=1,Te="res");else if(E)if(E==="/*"){var Ie=_.indexOf("*/",Y.lastIndex);Ie===-1&&i("unclosed comment",_,Me.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Me.index,u.exec(_)?Y.lastIndex=u.lastIndex:i("unclosed string",_,Me.index)):E==='"'?(h.lastIndex=Me.index,h.exec(_)?Y.lastIndex=h.lastIndex:i("unclosed string",_,Me.index)):E==="`"&&(c.lastIndex=Me.index,c.exec(_)?Y.lastIndex=c.lastIndex:i("unclosed string",_,Me.index));else if(x)return T(X),ce=X+Me[0].length,ne.lastIndex=ce,pe=z,M&&Qe==="h"&&(Qe="s"),we.t=Qe,we}return i("unclosed tag",_,fe),we}var Se=function fe(Qe,Me){Qe.b=[],Qe.d=[];var we,We=!1,Te=[];function T(_e,Mt){_e&&(_e=function(ut,Ut,Er,Ir){var Tt,q;return typeof Ut.autoTrim=="string"?Tt=q=Ut.autoTrim:Array.isArray(Ut.autoTrim)&&(Tt=Ut.autoTrim[1],q=Ut.autoTrim[0]),(Er||Er===!1)&&(Tt=Er),(Ir||Ir===!1)&&(q=Ir),Tt==="slurp"&&q==="slurp"?ut.trim():(Tt==="_"||Tt==="slurp"?ut=String.prototype.trimLeft?ut.trimLeft():ut.replace(/^[\s\uFEFF\xA0]+/,""):Tt!=="-"&&Tt!=="nl"||(ut=ut.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ut=String.prototype.trimRight?ut.trimRight():ut.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ut=ut.replace(/(?:\n|\r|\r\n)$/,"")),ut)}(_e,S,pe,Mt))&&(_e=_e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Te.push(_e))}for(;(we=ne.exec(_))!==null;){var m,E=we[1],x=we[2],M=we[3]||"";for(var z in F)if(F[z]===M){m=z;break}T(E,x),ce=we.index+we[0].length,m||i("unrecognized tag type: "+M,_,ce);var X=ge(we.index,m),Ie=X.t;if(Ie==="h"){var be=X.n||"";S.async&&A.test(be)&&(X.a=!0,X.n=be.replace(A,"")),X=fe(X),Te.push(X)}else if(Ie==="c"){if(Qe.n===X.n)return We?(We.d=Te,Qe.b.push(We)):Qe.d=Te,Qe;i("Helper start and end don't match",_,we.index+we[0].length)}else if(Ie==="b"){We?(We.d=Te,Qe.b.push(We)):Qe.d=Te;var De=X.n||"";S.async&&A.test(De)&&(X.a=!0,X.n=De.replace(A,"")),We=X,Te=[]}else if(Ie==="s"){var ke=X.n||"";S.async&&A.test(ke)&&(X.a=!0,X.n=ke.replace(A,"")),Te.push(X)}else Te.push(X)}if(!Me)throw n('unclosed helper "'+Qe.n+'"');return T(_.slice(ce,_.length),!1),Qe.d=Te,Qe}({f:[]},!0);if(S.plugins)for(var Le=0;Le<S.plugins.length;Le++){var Ge=S.plugins[Le];Ge.processAST&&(Se.d=Ge.processAST(Se.d,S))}return Se.d}function p(_,S){var F=g(_,S),J="var tR='';"+(S.useWith?"with("+S.varName+"||{}){":"")+w(F,S)+"if(cb){cb(null,tR)} return tR"+(S.useWith?"}":"");if(S.plugins)for(var Y=0;Y<S.plugins.length;Y++){var ne=S.plugins[Y];ne.processFnString&&(J=ne.processFnString(J,S))}return J}function y(_,S){for(var F=0;F<S.length;F++){var J=S[F][0],Y=S[F][1];_=(S[F][2]?"await ":"")+"c.l('F','"+J+"')("+_,Y&&(_+=","+Y),_+=")"}return _}function Q(_,S,F,J,Y,ne){var ce="{exec:"+(Y?"async ":"")+v(F,S,_)+",params:["+J+"]";return ne&&(ce+=",name:'"+ne+"'"),Y&&(ce+=",async:true"),ce+="}"}function b(_,S){for(var F="[",J=0;J<_.length;J++){var Y=_[J];F+=Q(S,Y.res||"",Y.d,Y.p||"",Y.a,Y.n),J<_.length&&(F+=",")}return F+="]"}function v(_,S,F){return"function("+S+"){var tR='';"+w(_,F)+"return tR}"}function w(_,S){for(var F=0,J=_.length,Y="";F<J;F++){var ne=_[F];if(typeof ne=="string")Y+="tR+='"+ne+"';";else{var ce=ne.t,pe=ne.c||"",ge=ne.f,Se=ne.n||"",Le=ne.p||"",Ge=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Me=y(pe,ge);!ne.raw&&S.autoEscape&&(Me="c.l('F','e')("+Me+")"),Y+="tR+="+Me+";"}else if(ce==="h")if(S.storage.nativeHelpers.get(Se))Y+=S.storage.nativeHelpers.get(Se)(ne,S);else{var we=(Qe?"await ":"")+"c.l('H','"+Se+"')("+Q(S,Ge,ne.d,Le,Qe);we+=fe?","+b(fe,S):",[]",Y+="tR+="+y(we+=",c)",ge)+";"}else ce==="s"?Y+="tR+="+y((Qe?"await ":"")+"c.l('H','"+Se+"')({params:["+Le+"]},[],c)",ge)+";":ce==="e"&&(Y+=pe+`
61
- `)}}return Y}var R=function(){function _(S){this.cache=S}return _.prototype.define=function(S,F){this.cache[S]=F},_.prototype.get=function(S){return this.cache[S]},_.prototype.remove=function(S){delete this.cache[S]},_.prototype.reset=function(){this.cache={}},_.prototype.load=function(S){l(this.cache,S,!0)},_}();function k(_,S,F,J){if(S&&S.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept blocks");if(F&&F.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept filters")}var H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function V(_){return H[_]}var O=new R({}),W=new R({each:function(_,S){var F="",J=_.params[0];if(k("each",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?Ge(Le):ce(pe,ge+1,Se,Le,Ge)})})(J,0,_.exec,F,ne)});for(var Y=0;Y<J.length;Y++)F+=_.exec(J[Y],Y);return F},foreach:function(_,S){var F=_.params[0];if(k("foreach",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){Ge+=Qe,Se===ge.length-1?fe(Ge):ce(pe,ge,Se+1,Le,Ge,fe)})})(F,Object.keys(F),0,_.exec,"",ne)});var J="";for(var Y in F)a(F,Y)&&(J+=_.exec(Y,F[Y]));return J},include:function(_,S,F){k("include",S,!1);var J=F.storage.templates.get(_.params[0]);if(!J)throw n('Could not fetch template "'+_.params[0]+'"');return J(_.params[1],F)},extends:function(_,S,F){var J=_.params[1]||{};J.content=_.exec();for(var Y=0;Y<S.length;Y++){var ne=S[Y];J[ne.name]=ne.exec()}var ce=F.storage.templates.get(_.params[0]);if(!ce)throw n('Could not fetch template "'+_.params[0]+'"');return ce(J,F)},useScope:function(_,S){return k("useScope",S,!1),_.exec(_.params[0])}}),ie=new R({if:function(_,S){k("if",!1,_.f,!0);var F="if("+_.p+"){"+w(_.d,S)+"}";if(_.b)for(var J=0;J<_.b.length;J++){var Y=_.b[J];Y.n==="else"?F+="else{"+w(Y.d,S)+"}":Y.n==="elif"&&(F+="else if("+Y.p+"){"+w(Y.d,S)+"}")}return F},try:function(_,S){if(k("try",!1,_.f,!0),!_.b||_.b.length!==1||_.b[0].n!=="catch")throw n("native helper 'try' only accepts 1 block, 'catch'");var F="try{"+w(_.d,S)+"}",J=_.b[0];return F+="catch"+(J.res?"("+J.res+")":"")+"{"+w(J.d,S)+"}"},block:function(_,S){return k("block",_.b,_.f,!0),"if(!"+S.varName+"["+_.p+"]){tR+=("+v(_.d,"",S)+")()}else{tR+="+S.varName+"["+_.p+"]}"}}),te=new R({e:function(_){var S=String(_);return/[&<>"']/.test(S)?S.replace(/[&<>"']/g,V):S}}),le={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(_,S){if(_==="H"){var F=this.storage.helpers.get(S);if(F)return F;throw n("Can't find helper '"+S+"'")}if(_==="F"){var J=this.storage.filters.get(S);if(J)return J;throw n("Can't find filter '"+S+"'")}},async:!1,storage:{helpers:W,nativeHelpers:ie,filters:te,templates:O},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function D(_,S){var F={};return l(F,le),S&&l(F,S),_&&l(F,_),F.l.bind(F),F}function P(_,S){var F=D(S||{}),J=Function;if(F.async){if(!o)throw n("This environment doesn't support async/await");J=o}try{return new J(F.varName,"c","cb",p(_,F))}catch(Y){throw Y instanceof SyntaxError?n(`Bad template syntax
60
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var F=S.prefixes,J=[F.h,F.b,F.i,F.r,F.c,F.e].reduce(function(fe,Qe){return fe&&Qe?fe+"|"+f(Qe):Qe?f(Qe):fe},""),Y=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(S.tags[1])+")","g"),ne=new RegExp("([^]*?)"+f(S.tags[0])+"(-|_)?\\s*("+J+")?\\s*","g"),ce=0,pe=!1;function ge(fe,Qe){var Me,we={f:[]},qe=0,Te="c";function T(be){var De=_.slice(ce,be),ke=De.trim();if(Te==="f")ke==="safe"?we.raw=!0:S.async&&A.test(ke)?(ke=ke.replace(A,""),we.f.push([ke,"",!0])):we.f.push([ke,""]);else if(Te==="fp")we.f[we.f.length-1][1]+=ke;else if(Te==="err"){if(ke){var _e=De.search(/\S/);i("invalid syntax",_,ce+_e)}}else we[Te]=ke;ce=be+1}for(Qe==="h"||Qe==="b"||Qe==="c"?Te="n":Qe==="r"&&(we.raw=!0,Qe="i"),Y.lastIndex=ce;(Me=Y.exec(_))!==null;){var m=Me[1],E=Me[2],w=Me[3],M=Me[4],z=Me[5],j=Me.index;if(m)m==="("?(qe===0&&(Te==="n"?(T(j),Te="p"):Te==="f"&&(T(j),Te="fp")),qe++):m===")"?--qe===0&&Te!=="c"&&(T(j),Te="err"):qe===0&&m==="|"?(T(j),Te="f"):m==="=>"&&(T(j),ce+=1,Te="res");else if(E)if(E==="/*"){var Ie=_.indexOf("*/",Y.lastIndex);Ie===-1&&i("unclosed comment",_,Me.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Me.index,u.exec(_)?Y.lastIndex=u.lastIndex:i("unclosed string",_,Me.index)):E==='"'?(h.lastIndex=Me.index,h.exec(_)?Y.lastIndex=h.lastIndex:i("unclosed string",_,Me.index)):E==="`"&&(c.lastIndex=Me.index,c.exec(_)?Y.lastIndex=c.lastIndex:i("unclosed string",_,Me.index));else if(w)return T(j),ce=j+Me[0].length,ne.lastIndex=ce,pe=z,M&&Qe==="h"&&(Qe="s"),we.t=Qe,we}return i("unclosed tag",_,fe),we}var Se=function fe(Qe,Me){Qe.b=[],Qe.d=[];var we,qe=!1,Te=[];function T(_e,Mt){_e&&(_e=function(ut,Ut,Er,Ir){var Tt,q;return typeof Ut.autoTrim=="string"?Tt=q=Ut.autoTrim:Array.isArray(Ut.autoTrim)&&(Tt=Ut.autoTrim[1],q=Ut.autoTrim[0]),(Er||Er===!1)&&(Tt=Er),(Ir||Ir===!1)&&(q=Ir),Tt==="slurp"&&q==="slurp"?ut.trim():(Tt==="_"||Tt==="slurp"?ut=String.prototype.trimLeft?ut.trimLeft():ut.replace(/^[\s\uFEFF\xA0]+/,""):Tt!=="-"&&Tt!=="nl"||(ut=ut.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ut=String.prototype.trimRight?ut.trimRight():ut.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ut=ut.replace(/(?:\n|\r|\r\n)$/,"")),ut)}(_e,S,pe,Mt))&&(_e=_e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Te.push(_e))}for(;(we=ne.exec(_))!==null;){var m,E=we[1],w=we[2],M=we[3]||"";for(var z in F)if(F[z]===M){m=z;break}T(E,w),ce=we.index+we[0].length,m||i("unrecognized tag type: "+M,_,ce);var j=ge(we.index,m),Ie=j.t;if(Ie==="h"){var be=j.n||"";S.async&&A.test(be)&&(j.a=!0,j.n=be.replace(A,"")),j=fe(j),Te.push(j)}else if(Ie==="c"){if(Qe.n===j.n)return qe?(qe.d=Te,Qe.b.push(qe)):Qe.d=Te,Qe;i("Helper start and end don't match",_,we.index+we[0].length)}else if(Ie==="b"){qe?(qe.d=Te,Qe.b.push(qe)):Qe.d=Te;var De=j.n||"";S.async&&A.test(De)&&(j.a=!0,j.n=De.replace(A,"")),qe=j,Te=[]}else if(Ie==="s"){var ke=j.n||"";S.async&&A.test(ke)&&(j.a=!0,j.n=ke.replace(A,"")),Te.push(j)}else Te.push(j)}if(!Me)throw n('unclosed helper "'+Qe.n+'"');return T(_.slice(ce,_.length),!1),Qe.d=Te,Qe}({f:[]},!0);if(S.plugins)for(var Le=0;Le<S.plugins.length;Le++){var Ge=S.plugins[Le];Ge.processAST&&(Se.d=Ge.processAST(Se.d,S))}return Se.d}function p(_,S){var F=g(_,S),J="var tR='';"+(S.useWith?"with("+S.varName+"||{}){":"")+x(F,S)+"if(cb){cb(null,tR)} return tR"+(S.useWith?"}":"");if(S.plugins)for(var Y=0;Y<S.plugins.length;Y++){var ne=S.plugins[Y];ne.processFnString&&(J=ne.processFnString(J,S))}return J}function C(_,S){for(var F=0;F<S.length;F++){var J=S[F][0],Y=S[F][1];_=(S[F][2]?"await ":"")+"c.l('F','"+J+"')("+_,Y&&(_+=","+Y),_+=")"}return _}function Q(_,S,F,J,Y,ne){var ce="{exec:"+(Y?"async ":"")+v(F,S,_)+",params:["+J+"]";return ne&&(ce+=",name:'"+ne+"'"),Y&&(ce+=",async:true"),ce+="}"}function b(_,S){for(var F="[",J=0;J<_.length;J++){var Y=_[J];F+=Q(S,Y.res||"",Y.d,Y.p||"",Y.a,Y.n),J<_.length&&(F+=",")}return F+="]"}function v(_,S,F){return"function("+S+"){var tR='';"+x(_,F)+"return tR}"}function x(_,S){for(var F=0,J=_.length,Y="";F<J;F++){var ne=_[F];if(typeof ne=="string")Y+="tR+='"+ne+"';";else{var ce=ne.t,pe=ne.c||"",ge=ne.f,Se=ne.n||"",Le=ne.p||"",Ge=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Me=C(pe,ge);!ne.raw&&S.autoEscape&&(Me="c.l('F','e')("+Me+")"),Y+="tR+="+Me+";"}else if(ce==="h")if(S.storage.nativeHelpers.get(Se))Y+=S.storage.nativeHelpers.get(Se)(ne,S);else{var we=(Qe?"await ":"")+"c.l('H','"+Se+"')("+Q(S,Ge,ne.d,Le,Qe);we+=fe?","+b(fe,S):",[]",Y+="tR+="+C(we+=",c)",ge)+";"}else ce==="s"?Y+="tR+="+C((Qe?"await ":"")+"c.l('H','"+Se+"')({params:["+Le+"]},[],c)",ge)+";":ce==="e"&&(Y+=pe+`
61
+ `)}}return Y}var R=function(){function _(S){this.cache=S}return _.prototype.define=function(S,F){this.cache[S]=F},_.prototype.get=function(S){return this.cache[S]},_.prototype.remove=function(S){delete this.cache[S]},_.prototype.reset=function(){this.cache={}},_.prototype.load=function(S){l(this.cache,S,!0)},_}();function k(_,S,F,J){if(S&&S.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept blocks");if(F&&F.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept filters")}var $={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function K(_){return $[_]}var O=new R({}),W=new R({each:function(_,S){var F="",J=_.params[0];if(k("each",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?Ge(Le):ce(pe,ge+1,Se,Le,Ge)})})(J,0,_.exec,F,ne)});for(var Y=0;Y<J.length;Y++)F+=_.exec(J[Y],Y);return F},foreach:function(_,S){var F=_.params[0];if(k("foreach",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){Ge+=Qe,Se===ge.length-1?fe(Ge):ce(pe,ge,Se+1,Le,Ge,fe)})})(F,Object.keys(F),0,_.exec,"",ne)});var J="";for(var Y in F)a(F,Y)&&(J+=_.exec(Y,F[Y]));return J},include:function(_,S,F){k("include",S,!1);var J=F.storage.templates.get(_.params[0]);if(!J)throw n('Could not fetch template "'+_.params[0]+'"');return J(_.params[1],F)},extends:function(_,S,F){var J=_.params[1]||{};J.content=_.exec();for(var Y=0;Y<S.length;Y++){var ne=S[Y];J[ne.name]=ne.exec()}var ce=F.storage.templates.get(_.params[0]);if(!ce)throw n('Could not fetch template "'+_.params[0]+'"');return ce(J,F)},useScope:function(_,S){return k("useScope",S,!1),_.exec(_.params[0])}}),ie=new R({if:function(_,S){k("if",!1,_.f,!0);var F="if("+_.p+"){"+x(_.d,S)+"}";if(_.b)for(var J=0;J<_.b.length;J++){var Y=_.b[J];Y.n==="else"?F+="else{"+x(Y.d,S)+"}":Y.n==="elif"&&(F+="else if("+Y.p+"){"+x(Y.d,S)+"}")}return F},try:function(_,S){if(k("try",!1,_.f,!0),!_.b||_.b.length!==1||_.b[0].n!=="catch")throw n("native helper 'try' only accepts 1 block, 'catch'");var F="try{"+x(_.d,S)+"}",J=_.b[0];return F+="catch"+(J.res?"("+J.res+")":"")+"{"+x(J.d,S)+"}"},block:function(_,S){return k("block",_.b,_.f,!0),"if(!"+S.varName+"["+_.p+"]){tR+=("+v(_.d,"",S)+")()}else{tR+="+S.varName+"["+_.p+"]}"}}),te=new R({e:function(_){var S=String(_);return/[&<>"']/.test(S)?S.replace(/[&<>"']/g,K):S}}),le={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(_,S){if(_==="H"){var F=this.storage.helpers.get(S);if(F)return F;throw n("Can't find helper '"+S+"'")}if(_==="F"){var J=this.storage.filters.get(S);if(J)return J;throw n("Can't find filter '"+S+"'")}},async:!1,storage:{helpers:W,nativeHelpers:ie,filters:te,templates:O},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function D(_,S){var F={};return l(F,le),S&&l(F,S),_&&l(F,_),F.l.bind(F),F}function P(_,S){var F=D(S||{}),J=Function;if(F.async){if(!o)throw n("This environment doesn't support async/await");J=o}try{return new J(F.varName,"c","cb",p(_,F))}catch(Y){throw Y instanceof SyntaxError?n(`Bad template syntax
62
62
 
63
63
  `+Y.message+`
64
64
  `+Array(Y.message.length+1).join("=")+`
65
- `+p(_,F)):Y}}function j(_,S){var F;return S.cache&&S.name&&S.storage.templates.get(S.name)?S.storage.templates.get(S.name):(F=typeof _=="function"?_:P(_,S),S.cache&&S.name&&S.storage.templates.define(S.name,F),F)}le.l.bind(le),t.compile=P,t.compileScope=w,t.compileScopeIntoFunction=v,t.compileToString=p,t.defaultConfig=le,t.filters=te,t.getConfig=D,t.helpers=W,t.nativeHelpers=ie,t.parse=g,t.render=function(_,S,F,J){var Y=D(F||{});if(!Y.async)return j(_,Y)(S,Y);if(!J){if(typeof s=="function")return new s(function(ne,ce){try{ne(j(_,Y)(S,Y))}catch(pe){ce(pe)}});throw n("Please provide a callback function, this env doesn't support Promises")}try{j(_,Y)(S,Y,J)}catch(ne){return J(ne)}},t.templates=O,Object.defineProperty(t,"__esModule",{value:!0})})})(ko,ko.exports);var Xg=ko.exports;const zg=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Zg(i,s)&&n||Object.defineProperty(r,t,s)},Zg=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},e0=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},t0=(r,e)=>`/* Wrapped ${r}*/
66
- ${e}`,r0=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),n0=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),i0=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=t0.bind(null,n,e.toString());Object.defineProperty(i,"name",n0),Object.defineProperty(r,"toString",{...r0,value:i})};function s0(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))zg(r,e,i,t);return e0(r,e),i0(r,e,n),r}const o0=new WeakMap;function ii(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,i=function(...s){const o=e(s);if(n.has(o))return n.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const A=await r.apply(this,s);try{return A}finally{t&&await t.set(o,A)}}finally{n.delete(o)}})();return n.set(o,a),a};return s0(i,r,{ignoreNonConfigurable:!0}),o0.set(i,t),i}var HA={},No={},Re={};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=Re.Wrap=Re.Unit=Re.PrintOptions=Re.PositionType=Re.Overflow=Re.NodeType=Re.MeasureMode=Re.LogLevel=Re.Justify=Re.Gutter=Re.FlexDirection=Re.ExperimentalFeature=Re.Errata=Re.Edge=Re.Display=Re.Direction=Re.Dimension=Re.Align=void 0;let yr=function(r){return r[r.Auto=0]="Auto",r[r.FlexStart=1]="FlexStart",r[r.Center=2]="Center",r[r.FlexEnd=3]="FlexEnd",r[r.Stretch=4]="Stretch",r[r.Baseline=5]="Baseline",r[r.SpaceBetween=6]="SpaceBetween",r[r.SpaceAround=7]="SpaceAround",r}({});Re.Align=yr;let Mo=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=Mo;let Xi=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=Xi;let Po=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=Po;let ir=function(r){return r[r.Left=0]="Left",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=3]="Bottom",r[r.Start=4]="Start",r[r.End=5]="End",r[r.Horizontal=6]="Horizontal",r[r.Vertical=7]="Vertical",r[r.All=8]="All",r}({});Re.Edge=ir;let si=function(r){return r[r.None=0]="None",r[r.StretchFlexBasis=1]="StretchFlexBasis",r[r.All=2147483647]="All",r[r.Classic=2147483646]="Classic",r}({});Re.Errata=si;let zi=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=zi;let oi=function(r){return r[r.Column=0]="Column",r[r.ColumnReverse=1]="ColumnReverse",r[r.Row=2]="Row",r[r.RowReverse=3]="RowReverse",r}({});Re.FlexDirection=oi;let Zi=function(r){return r[r.Column=0]="Column",r[r.Row=1]="Row",r[r.All=2]="All",r}({});Re.Gutter=Zi;let jr=function(r){return r[r.FlexStart=0]="FlexStart",r[r.Center=1]="Center",r[r.FlexEnd=2]="FlexEnd",r[r.SpaceBetween=3]="SpaceBetween",r[r.SpaceAround=4]="SpaceAround",r[r.SpaceEvenly=5]="SpaceEvenly",r}({});Re.Justify=jr;let Xr=function(r){return r[r.Error=0]="Error",r[r.Warn=1]="Warn",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r[r.Verbose=4]="Verbose",r[r.Fatal=5]="Fatal",r}({});Re.LogLevel=Xr;let es=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=es;let Oo=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=Oo;let ts=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=ts;let rs=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=rs;let ns=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=ns;let ai=function(r){return r[r.Undefined=0]="Undefined",r[r.Point=1]="Point",r[r.Percent=2]="Percent",r[r.Auto=3]="Auto",r}({});Re.Unit=ai;let is=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=is;var a0={ALIGN_AUTO:yr.Auto,ALIGN_FLEX_START:yr.FlexStart,ALIGN_CENTER:yr.Center,ALIGN_FLEX_END:yr.FlexEnd,ALIGN_STRETCH:yr.Stretch,ALIGN_BASELINE:yr.Baseline,ALIGN_SPACE_BETWEEN:yr.SpaceBetween,ALIGN_SPACE_AROUND:yr.SpaceAround,DIMENSION_WIDTH:Mo.Width,DIMENSION_HEIGHT:Mo.Height,DIRECTION_INHERIT:Xi.Inherit,DIRECTION_LTR:Xi.LTR,DIRECTION_RTL:Xi.RTL,DISPLAY_FLEX:Po.Flex,DISPLAY_NONE:Po.None,EDGE_LEFT:ir.Left,EDGE_TOP:ir.Top,EDGE_RIGHT:ir.Right,EDGE_BOTTOM:ir.Bottom,EDGE_START:ir.Start,EDGE_END:ir.End,EDGE_HORIZONTAL:ir.Horizontal,EDGE_VERTICAL:ir.Vertical,EDGE_ALL:ir.All,ERRATA_NONE:si.None,ERRATA_STRETCH_FLEX_BASIS:si.StretchFlexBasis,ERRATA_ALL:si.All,ERRATA_CLASSIC:si.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:zi.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:zi.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:zi.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:oi.Column,FLEX_DIRECTION_COLUMN_REVERSE:oi.ColumnReverse,FLEX_DIRECTION_ROW:oi.Row,FLEX_DIRECTION_ROW_REVERSE:oi.RowReverse,GUTTER_COLUMN:Zi.Column,GUTTER_ROW:Zi.Row,GUTTER_ALL:Zi.All,JUSTIFY_FLEX_START:jr.FlexStart,JUSTIFY_CENTER:jr.Center,JUSTIFY_FLEX_END:jr.FlexEnd,JUSTIFY_SPACE_BETWEEN:jr.SpaceBetween,JUSTIFY_SPACE_AROUND:jr.SpaceAround,JUSTIFY_SPACE_EVENLY:jr.SpaceEvenly,LOG_LEVEL_ERROR:Xr.Error,LOG_LEVEL_WARN:Xr.Warn,LOG_LEVEL_INFO:Xr.Info,LOG_LEVEL_DEBUG:Xr.Debug,LOG_LEVEL_VERBOSE:Xr.Verbose,LOG_LEVEL_FATAL:Xr.Fatal,MEASURE_MODE_UNDEFINED:es.Undefined,MEASURE_MODE_EXACTLY:es.Exactly,MEASURE_MODE_AT_MOST:es.AtMost,NODE_TYPE_DEFAULT:Oo.Default,NODE_TYPE_TEXT:Oo.Text,OVERFLOW_VISIBLE:ts.Visible,OVERFLOW_HIDDEN:ts.Hidden,OVERFLOW_SCROLL:ts.Scroll,POSITION_TYPE_STATIC:rs.Static,POSITION_TYPE_RELATIVE:rs.Relative,POSITION_TYPE_ABSOLUTE:rs.Absolute,PRINT_OPTIONS_LAYOUT:ns.Layout,PRINT_OPTIONS_STYLE:ns.Style,PRINT_OPTIONS_CHILDREN:ns.Children,UNIT_UNDEFINED:ai.Undefined,UNIT_POINT:ai.Point,UNIT_PERCENT:ai.Percent,UNIT_AUTO:ai.Auto,WRAP_NO_WRAP:is.NoWrap,WRAP_WRAP:is.Wrap,WRAP_WRAP_REVERSE:is.WrapReverse};Re.default=a0,Object.defineProperty(No,"__esModule",{value:!0}),No.default=A0;var Nr=l0(Re);function $A(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return($A=function(n){return n?t:e})(r)}function l0(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=$A(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var o=i?Object.getOwnPropertyDescriptor(r,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=r[s]}return n.default=r,t&&t.set(r,n),n}function A0(r){function e(i,s,o){const a=i[s];i[s]=function(){for(var l=arguments.length,A=new Array(l),c=0;c<l;c++)A[c]=arguments[c];return o.call(this,a,...A)}}for(const i of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const s={[Nr.Unit.Point]:r.Node.prototype[i],[Nr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[Nr.Unit.Auto]:r.Node.prototype[`${i}Auto`]};e(r.Node.prototype,i,function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),A=1;A<a;A++)l[A-1]=arguments[A];const c=l.pop();let u,h;if(c==="auto")u=Nr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?Nr.Unit.Percent:Nr.Unit.Point,h=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(h))throw new Error(`Invalid value ${c} for ${i}`);if(!s[u])throw new Error(`Failed to execute "${i}": Unsupported unit '${c}'`);return h!==void 0?s[u].call(this,...l,h):s[u].call(this,...l)})}function t(i){return r.MeasureCallback.implement({measure:function(){const{width:s,height:o}=i(...arguments);return{width:s??NaN,height:o??NaN}}})}e(r.Node.prototype,"setMeasureFunc",function(i,s){return s?i.call(this,t(s)):this.unsetMeasureFunc()});function n(i){return r.DirtiedCallback.implement({dirtied:i})}return e(r.Node.prototype,"setDirtiedFunc",function(i,s){i.call(this,n(s))}),e(r.Config.prototype,"free",function(){r.Config.destroy(this)}),e(r.Node,"create",(i,s)=>s?r.Node.createWithConfig(s):r.Node.createDefault()),e(r.Node.prototype,"free",function(){r.Node.destroy(this)}),e(r.Node.prototype,"freeRecursive",function(){for(let i=0,s=this.getChildCount();i<s;++i)this.getChild(0).freeRecursive();this.free()}),e(r.Node.prototype,"calculateLayout",function(i){let s=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]:Nr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...Nr.default}}var YA={exports:{}};(function(r,e){var t=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(i){i=i||{};var s;s||(s=typeof i<"u"?i:{});var o,a;s.ready=new Promise(function(C,B){o=C,a=B});var l=Object.assign({},s),A="";typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),n&&(A=n),A.indexOf("blob:")!==0?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="";var c=s.print||console.log.bind(console),u=s.printErr||console.warn.bind(console);Object.assign(s,l),l=null;var h;s.wasmBinary&&(h=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&j("no native wasm support detected");var d,f=!1;function g(C,B,L){L=B+L;for(var N="";!(B>=L);){var $=C[B++];if(!$)break;if($&128){var Z=C[B++]&63;if(($&224)==192)N+=String.fromCharCode(($&31)<<6|Z);else{var se=C[B++]&63;$=($&240)==224?($&15)<<12|Z<<6|se:($&7)<<18|Z<<12|se<<6|C[B++]&63,65536>$?N+=String.fromCharCode($):($-=65536,N+=String.fromCharCode(55296|$>>10,56320|$&1023))}}else N+=String.fromCharCode($)}return N}var p,y,Q,b,v,w,R,k,H;function V(){var C=d.buffer;p=C,s.HEAP8=y=new Int8Array(C),s.HEAP16=b=new Int16Array(C),s.HEAP32=w=new Int32Array(C),s.HEAPU8=Q=new Uint8Array(C),s.HEAPU16=v=new Uint16Array(C),s.HEAPU32=R=new Uint32Array(C),s.HEAPF32=k=new Float32Array(C),s.HEAPF64=H=new Float64Array(C)}var O,W=[],ie=[],te=[];function le(){var C=s.preRun.shift();W.unshift(C)}var D=0,P=null;function j(C){throw s.onAbort&&s.onAbort(C),C="Aborted("+C+")",u(C),f=!0,C=new WebAssembly.RuntimeError(C+". Build with -sASSERTIONS for more info."),a(C),C}function _(C){return C.startsWith("data:application/octet-stream;base64,")}var S;if(S="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gAABgA39/fABgAX8BfGADf399AX1gBX9/f39/AX9gAn9/AXxgAAF/YAZ/f31/fX8AYAR/f39/AX9gAn9/AX1gBn9/f39/fwF/YAV/f39/fwBg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gayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsOAEHILigCABEHABBQAAuXAgEDfyMAQRBrIgQkACAEIAE2AgwCQAJAIABFBEAgBCgCDCEBDAELIAQoAgwhASAAKAK4BCICRQ0AIAIoAgQhAyACLQAIQQhxBEAgAiAAQQVBAEG8ISABIAMREQAaDAILIAIgAEEFQbwhIAEgAxELABoMAQsCQEHoNi0AAEUEQEEcEB0iAkKAgID8AzcCFCACQgA3AgwgAkEANgIAIAJBADoACEEBIQMgAkEBNgIEQeQ2IAI2AgBB6DZBAToAAEHgNkHgNigCAEEBajYCAAwBC0HkNigCACICKAIEIQMgAi0ACEEIcUUNACACIABBBUEAQbwhIAEgAxERABoMAQsgAiAAQQVBvCEgASADEQsAGgsgBEEQaiQAC3cCAX8BfSAAQdAAaiEAIAFBAnRBwC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AAAAAIQEgACoCHCICQwAAAABdRQ0AIAKMIQELIAELhQECA38BfgJAIABCgICAgBBUBEAgACEFDAELA0AgAUEBayIBIABCCoAiBUL2AX4gAHynQTByOgAAIABC/////58BViECIAUhACACDQALCyAFpyICBEADQCABQQFrIgEgAkEKbiIDQfYBbCACakEwcjoAACACQQlLIQQgAyECIAQNAAsLIAELNwECf0EEEB0iAiABNgIAQQQQHSIDIAE2AgBBmTcgAEG6N0HqJEHCASACQbo3Qe4kQcMBIAMQBwteAQF/IABBADYCDCAAIAM2AhACQCABBEAgAUGAgICABE8NASABQQJ0EB0hBAsgACAENgIAIAAgBCACQQJ0aiICNgIIIAAgBCABQQJ0ajYCDCAAIAI2AgQgAA8LEFAAC9QBAgJ9AX8gAEHQAGohACABQQJ0QdAhaigCACEFAkACQAJAAn8gAUF+cUECRgRAIABBBSAFQY+evPwHEDMMAQsgACAFQY+evPwHEDILIgFB8OGD/AdGDQAgAUGPnrz8B0YNAkHwISEAAkAgAUGq1ar9B0cEQCABviIDIANbDQFB+CEhAAsgACoCACEDQwAAwH8hBCAAKAIEQQFrDgIDAQILIAFB/////3txQYCAgIACar4hAyABQYCAgIAEcUUNAgsgAyAClEMK1yM8lCEECyAEDwsgAwu4AgIHfwJ9IwBBEGsiAyQAAkAgACgCDCIBBEAgACoCiAQhCSAAKgKEBCEIAn0gAC0ABEEgcQRAIAAgCCAJQQAgAREmAAwBCyAAIAggCSABEScACyIIIAhbDQEgA0HRGjYCACAAIAMQLRAsAAsCQAJAIAAoArAEIgEgACgCrAQiBkcEQEEBIAEgBmtBAnUiASABQQFNGyEHA0AgBiAEQQJ0aigCACIBKAKkBEUEQCABKAIYIgVBgIAMcUGAgAhHBEAgBUENdkEHcSIFBH8gBQUgACgCGEEKdkEHcQtBBUYEQCAALQAYQQhxDQULIAEtAARBAnENBCACIAEgAhshAgsgBEEBaiIEIAdHDQELCyACDQILIAAqAogEIQgMAgsgASECCyACEEIgAioC6AGSIQgLIANBEGokACAIC28BA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GBApCyAOKgI4ITUgDigCMCEhIA4oAiwhGAJAAkACQAJAICdBAUYNAEMAAAAAIQICQAJAAkAgJCgCACIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iASABWw0BQfghIQULIAUqAgAhAkMAAMB/IQEgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhAQwBCyACIQELQwAAAAAhAgJAAkACQCAAKALYASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoBEUNAgJAAkAgACoCICIBIAFbBEAgASECDAELIAAqAhwiAkMAAAAAXkUNAQsgAiACXARAIDghAgwECyAAKgIgIQELIAEgAVwEQCAzIQIgACoCHCIBQwAAAABeRQ0DCyA4IQIgAUMAAA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IAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5gYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSET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iQAIAALOwEBfyABIAAoAgQiBUEBdWohASAAKAIAIQAgASACIAMgBCAFQQFxBH8gASgCACAAaigCAAUgAAsRHAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEQAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEQwACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQkAC2EBAn8jAEEQayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAI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oAgBBACABthAxEEQLEAAgACgCAEEAIAG2EC8QRAsRACAAKAIAQQFBqtWq/QcQPAsQACAAKAIAQQEgAbYQMRA8CxAAIAAoAgBBASABthAvEDwLEQAgACgCAEEAQarVqv0HEDwLEAAgACgCAEEAIAG2EDEQPAsQACAAKAIAQQAgAbYQLxA8C3ACAn0BfwJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsRACAAKAIAIAFBqtWq/QcQSwsQACAAKAIAIAEgArYQMRBLCxAAIAAoAgAgASACthAvEEsLcwEBfwJAIAAoAgAiACgCGCICQQR2QQdxIAFGDQAgACACQY9/cSAB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AAAALkbAACcGwAAsxsAAGZpaWkAAAAArBsAAJwbAACcGwAAtBsAAKwbAACcGwAAnBsAALQbAACdGwAAnBsAAJwbAACcGwAAnBsAALQbAACtGwAAnBsAAKwbAACcGwAArRsAAKwbAACcGwAAeRsAAKwbAACcGwAAkRsAAK0bAACdGwAAAAAAAKwbAACcGwAAuhsAALobAACzGwAAdmlpZGRpAACZGwAAnRsAQbAnC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBgSgLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!_(S)){var F=S;S=s.locateFile?s.locateFile(F,A):A+F}function J(){var C=S;try{if(C==S&&h)return new Uint8Array(h);if(_(C))try{var B=PT(C.slice(37)),L=new Uint8Array(B.length);for(C=0;C<B.length;++C)L[C]=B.charCodeAt(C);var N=L}catch{throw Error("Converting base64 string to bytes failed.")}else N=void 0;var $=N;if($)return $;throw"both async and sync fetching of the wasm failed"}catch(Z){j(Z)}}function Y(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return J()}):fetch(S,{credentials:"same-origin"}).then(function(C){if(!C.ok)throw"failed to load wasm binary file at '"+S+"'";return C.arrayBuffer()}).catch(function(){return J()})}function ne(C){for(;0<C.length;)C.shift()(s)}function ce(C){if(C===void 0)return"_unknown";C=C.replace(/[^a-zA-Z0-9_]/g,"$");var B=C.charCodeAt(0);return 48<=B&&57>=B?"_"+C:C}function pe(C,B){return C=ce(C),function(){return B.apply(this,arguments)}}var ge=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Se=[];function Le(C){var B=Error,L=pe(C,function(N){this.name=C,this.message=N,N=Error(N).stack,N!==void 0&&(this.stack=this.toString()+`
67
- `+N.replace(/^Error(:[^\n]*)?\n/,""))});return L.prototype=Object.create(B.prototype),L.prototype.constructor=L,L.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},L}var Ge=void 0;function fe(C){throw new Ge(C)}var Qe=C=>(C||fe("Cannot use deleted val. handle = "+C),ge[C].value),Me=C=>{switch(C){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var B=Se.length?Se.pop():ge.length;return ge[B]={fa:1,value:C},B}},we=void 0,We=void 0;function Te(C){for(var B="";Q[C];)B+=We[Q[C++]];return B}var T=[];function m(){for(;T.length;){var C=T.pop();C.L.Z=!1,C.delete()}}var E=void 0,x={};function M(C,B){for(B===void 0&&fe("ptr should not be undefined");C.P;)B=C.aa(B),C=C.P;return B}var z={};function X(C){C=Ef(C);var B=Te(C);return Dr(C),B}function Ie(C,B){var L=z[C];return L===void 0&&fe(B+" has unknown type "+X(C)),L}function be(){}var De=!1;function ke(C){--C.count.value,C.count.value===0&&(C.S?C.T.V(C.S):C.O.M.V(C.N))}function _e(C,B,L){return B===L?C:L.P===void 0?null:(C=_e(C,B,L.P),C===null?null:L.ma(C))}var Mt={};function ut(C,B){return B=M(C,B),x[B]}var Ut=void 0;function Er(C){throw new Ut(C)}function Ir(C,B){return B.O&&B.N||Er("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&Er("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Tt(Object.create(C,{L:{value:B}}))}function Tt(C){return typeof FinalizationRegistry>"u"?(Tt=B=>B,C):(De=new FinalizationRegistry(B=>{ke(B.L)}),Tt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Tt(C))}var q={};function de(C){for(;C.length;){var B=C.pop();C.pop()(B)}}function Ce(C){return this.fromWireType(w[C>>2])}var Pe={},Fe={};function qe(C,B,L){function N(oe){oe=L(oe),oe.length!==C.length&&Er("Mismatched type converter count");for(var Ae=0;Ae<C.length;++Ae)wt(C[Ae],oe[Ae])}C.forEach(function(oe){Fe[oe]=B});var $=Array(B.length),Z=[],se=0;B.forEach((oe,Ae)=>{z.hasOwnProperty(oe)?$[Ae]=z[oe]:(Z.push(oe),Pe.hasOwnProperty(oe)||(Pe[oe]=[]),Pe[oe].push(()=>{$[Ae]=z[oe],++se,se===Z.length&&N($)}))}),Z.length===0&&N($)}function xt(C){switch(C){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+C)}}function wt(C,B,L={}){if(!("argPackAdvance"in B))throw new TypeError("registerType registeredInstance requires argPackAdvance");var N=B.name;if(C||fe('type "'+N+'" must have a positive integer typeid pointer'),z.hasOwnProperty(C)){if(L.ta)return;fe("Cannot register type '"+N+"' twice")}z[C]=B,delete Fe[C],Pe.hasOwnProperty(C)&&(B=Pe[C],delete Pe[C],B.forEach($=>$()))}function Gn(C){fe(C.L.O.M.name+" instance already deleted")}function St(){}function hn(C,B,L){if(C[B].R===void 0){var N=C[B];C[B]=function(){return C[B].R.hasOwnProperty(arguments.length)||fe("Function '"+L+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+C[B].R+")!"),C[B].R[arguments.length].apply(this,arguments)},C[B].R=[],C[B].R[N.Y]=N}}function Hn(C,B){s.hasOwnProperty(C)?(fe("Cannot register public name '"+C+"' twice"),hn(s,C,C),s.hasOwnProperty(void 0)&&fe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),s[C].R[void 0]=B):s[C]=B}function $r(C,B,L,N,$,Z,se,oe){this.name=C,this.constructor=B,this.W=L,this.V=N,this.P=$,this.oa=Z,this.aa=se,this.ma=oe,this.ia=[]}function Li(C,B,L){for(;B!==L;)B.aa||fe("Expected null or instance of "+L.name+", got an instance of "+B.name),C=B.aa(C),B=B.P;return C}function Fi(C,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+$l(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),Li(B.L.N,B.L.O.M,this.M))}function $n(C,B){if(B===null){if(this.da&&fe("null is not a valid "+this.name),this.ca){var L=this.ea();return C!==null&&C.push(this.V,L),L}return 0}if(B.L||fe('Cannot pass "'+$l(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&B.L.O.ba&&fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name),L=Li(B.L.N,B.L.O.M,this.M),this.ca)switch(B.L.S===void 0&&fe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:B.L.T===this?L=B.L.S:fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name);break;case 1:L=B.L.S;break;case 2:if(B.L.T===this)L=B.L.S;else{var N=B.clone();L=this.wa(L,Me(function(){N.delete()})),C!==null&&C.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function BT(C,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+$l(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),B.L.O.ba&&fe("Cannot convert argument of type "+B.L.O.name+" to parameter type "+this.name),Li(B.L.N,B.L.O.M,this.M))}function Rr(C,B,L,N){this.name=C,this.M=B,this.da=L,this.ba=N,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,B.P!==void 0?this.toWireType=$n:(this.toWireType=N?Fi:BT,this.U=null)}function TT(C,B){s.hasOwnProperty(C)||Er("Replacing nonexistant public symbol"),s[C]=B,s[C].Y=void 0}function QT(C,B){var L=[];return function(){if(L.length=0,Object.assign(L,arguments),C.includes("j")){var N=s["dynCall_"+C];N=L&&L.length?N.apply(null,[B].concat(L)):N.call(null,B)}else N=O.get(B).apply(null,L);return N}}function rr(C,B){C=Te(C);var L=C.includes("j")?QT(C,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+C+": "+B),L}var ff=void 0;function co(C,B){function L(Z){$[Z]||z[Z]||(Fe[Z]?Fe[Z].forEach(L):(N.push(Z),$[Z]=!0))}var N=[],$={};throw B.forEach(L),new ff(C+": "+N.map(X).join([", "]))}function Ul(C,B,L,N,$){var Z=B.length;2>Z&&fe("argTypes array size mismatch! Must at least get return value and 'this' types!");var se=B[1]!==null&&L!==null,oe=!1;for(L=1;L<B.length;++L)if(B[L]!==null&&B[L].U===void 0){oe=!0;break}var Ae=B[0].name!=="void",ae=Z-2,ue=Array(ae),ye=[],Ue=[];return function(){if(arguments.length!==ae&&fe("function "+C+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ue.length=0,ye.length=se?2:1,ye[0]=$,se){var at=B[1].toWireType(Ue,this);ye[1]=at}for(var Ye=0;Ye<ae;++Ye)ue[Ye]=B[Ye+2].toWireType(Ue,arguments[Ye]),ye.push(ue[Ye]);if(Ye=N.apply(null,ye),oe)de(Ue);else for(var Gt=se?1:2;Gt<B.length;Gt++){var nr=Gt===1?at:ue[Gt-2];B[Gt].U!==null&&B[Gt].U(nr)}return at=Ae?B[0].fromWireType(Ye):void 0,at}}function Gl(C,B){for(var L=[],N=0;N<C;N++)L.push(R[B+4*N>>2]);return L}function Hl(C){4<C&&--ge[C].fa===0&&(ge[C]=void 0,Se.push(C))}function $l(C){if(C===null)return"null";var B=typeof C;return B==="object"||B==="array"||B==="function"?C.toString():""+C}function bT(C,B){switch(B){case 2:return function(L){return this.fromWireType(k[L>>2])};case 3:return function(L){return this.fromWireType(H[L>>3])};default:throw new TypeError("Unknown float type: "+C)}}function xT(C,B,L){switch(B){case 0:return L?function(N){return y[N]}:function(N){return Q[N]};case 1:return L?function(N){return b[N>>1]}:function(N){return v[N>>1]};case 2:return L?function(N){return w[N>>2]}:function(N){return R[N>>2]};default:throw new TypeError("Unknown integer type: "+C)}}function wT(C,B){for(var L="",N=0;!(N>=B/2);++N){var $=b[C+2*N>>1];if($==0)break;L+=String.fromCharCode($)}return L}function ST(C,B,L){if(L===void 0&&(L=2147483647),2>L)return 0;L-=2;var N=B;L=L<2*C.length?L/2:C.length;for(var $=0;$<L;++$)b[B>>1]=C.charCodeAt($),B+=2;return b[B>>1]=0,B-N}function RT(C){return 2*C.length}function DT(C,B){for(var L=0,N="";!(L>=B/4);){var $=w[C+4*L>>2];if($==0)break;++L,65536<=$?($-=65536,N+=String.fromCharCode(55296|$>>10,56320|$&1023)):N+=String.fromCharCode($)}return N}function _T(C,B,L){if(L===void 0&&(L=2147483647),4>L)return 0;var N=B;L=N+L-4;for(var $=0;$<C.length;++$){var Z=C.charCodeAt($);if(55296<=Z&&57343>=Z){var se=C.charCodeAt(++$);Z=65536+((Z&1023)<<10)|se&1023}if(w[B>>2]=Z,B+=4,B+4>L)break}return w[B>>2]=0,B-N}function LT(C){for(var B=0,L=0;L<C.length;++L){var N=C.charCodeAt(L);55296<=N&&57343>=N&&++L,B+=4}return B}var FT={};function gf(C){var B=FT[C];return B===void 0?Te(C):B}var uo=[];function kT(C){var B=uo.length;return uo.push(C),B}function NT(C,B){for(var L=Array(C),N=0;N<C;++N)L[N]=Ie(R[B+4*N>>2],"parameter "+N);return L}var pf=[],MT=[null,[],[]];Ge=s.BindingError=Le("BindingError"),s.count_emval_handles=function(){for(var C=0,B=5;B<ge.length;++B)ge[B]!==void 0&&++C;return C},s.get_first_emval=function(){for(var C=5;C<ge.length;++C)if(ge[C]!==void 0)return ge[C];return null},we=s.PureVirtualError=Le("PureVirtualError");for(var mf=Array(256),ho=0;256>ho;++ho)mf[ho]=String.fromCharCode(ho);We=mf,s.getInheritedInstanceCount=function(){return Object.keys(x).length},s.getLiveInheritedInstances=function(){var C=[],B;for(B in x)x.hasOwnProperty(B)&&C.push(x[B]);return C},s.flushPendingDeletes=m,s.setDelayFunction=function(C){E=C,T.length&&E&&E(m)},Ut=s.InternalError=Le("InternalError"),St.prototype.isAliasOf=function(C){if(!(this instanceof St&&C instanceof St))return!1;var B=this.L.O.M,L=this.L.N,N=C.L.O.M;for(C=C.L.N;B.P;)L=B.aa(L),B=B.P;for(;N.P;)C=N.aa(C),N=N.P;return B===N&&L===C},St.prototype.clone=function(){if(this.L.N||Gn(this),this.L.$)return this.L.count.value+=1,this;var C=Tt,B=Object,L=B.create,N=Object.getPrototypeOf(this),$=this.L;return C=C(L.call(B,N,{L:{value:{count:$.count,Z:$.Z,$:$.$,N:$.N,O:$.O,S:$.S,T:$.T}}})),C.L.count.value+=1,C.L.Z=!1,C},St.prototype.delete=function(){this.L.N||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),be(this),ke(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},St.prototype.isDeleted=function(){return!this.L.N},St.prototype.deleteLater=function(){return this.L.N||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),T.push(this),T.length===1&&E&&E(m),this.L.Z=!0,this},Rr.prototype.pa=function(C){return this.ja&&(C=this.ja(C)),C},Rr.prototype.ga=function(C){this.V&&this.V(C)},Rr.prototype.argPackAdvance=8,Rr.prototype.readValueFromPointer=Ce,Rr.prototype.deleteObject=function(C){C!==null&&C.delete()},Rr.prototype.fromWireType=function(C){function B(){return this.ca?Ir(this.M.W,{O:this.va,N:L,T:this,S:C}):Ir(this.M.W,{O:this,N:C})}var L=this.pa(C);if(!L)return this.ga(C),null;var N=ut(this.M,L);if(N!==void 0)return N.L.count.value===0?(N.L.N=L,N.L.S=C,N.clone()):(N=N.clone(),this.ga(C),N);if(N=this.M.oa(L),N=Mt[N],!N)return B.call(this);N=this.ba?N.ka:N.pointerType;var $=_e(L,this.M,N.M);return $===null?B.call(this):this.ca?Ir(N.M.W,{O:N,N:$,T:this,S:C}):Ir(N.M.W,{O:N,N:$})},ff=s.UnboundTypeError=Le("UnboundTypeError");var PT=typeof atob=="function"?atob:function(C){var B="",L=0;C=C.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(C.charAt(L++)),$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(C.charAt(L++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(C.charAt(L++)),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(C.charAt(L++));N=N<<2|$>>4,$=($&15)<<4|Z>>2;var oe=(Z&3)<<6|se;B+=String.fromCharCode(N),Z!==64&&(B+=String.fromCharCode($)),se!==64&&(B+=String.fromCharCode(oe))}while(L<C.length);return B},OT={p:function(C,B,L){C=Te(C),B=Ie(B,"wrapper"),L=Qe(L);var N=[].slice,$=B.M,Z=$.W,se=$.P.W,oe=$.P.constructor;C=pe(C,function(){$.P.ia.forEach((function(ae){if(this[ae]===se[ae])throw new we("Pure virtual function "+ae+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:Z}),this.__construct.apply(this,N.call(arguments))}),Z.__construct=function(){this===Z&&fe("Pass correct 'this' to __construct");var ae=oe.implement.apply(void 0,[this].concat(N.call(arguments)));be(ae);var ue=ae.L;ae.notifyOnDestruction(),ue.$=!0,Object.defineProperties(this,{L:{value:ue}}),Tt(this),ae=ue.N,ae=M($,ae),x.hasOwnProperty(ae)?fe("Tried to register registered instance: "+ae):x[ae]=this},Z.__destruct=function(){this===Z&&fe("Pass correct 'this' to __destruct"),be(this);var ae=this.L.N;ae=M($,ae),x.hasOwnProperty(ae)?delete x[ae]:fe("Tried to unregister unregistered instance: "+ae)},C.prototype=Object.create(Z);for(var Ae in L)C.prototype[Ae]=L[Ae];return Me(C)},j:function(C){var B=q[C];delete q[C];var L=B.ea,N=B.V,$=B.ha,Z=$.map(se=>se.sa).concat($.map(se=>se.ya));qe([C],Z,se=>{var oe={};return $.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ue=Ae.ra,at=se[ae+$.length],Ye=Ae.xa,Gt=Ae.za;oe[Ae.na]={read:nr=>ue.fromWireType(ye(Ue,nr)),write:(nr,ki)=>{var _r=[];Ye(Gt,nr,at.toWireType(_r,ki)),de(_r)}}}),[{name:B.name,fromWireType:function(Ae){var ae={},ue;for(ue in oe)ae[ue]=oe[ue].read(Ae);return N(Ae),ae},toWireType:function(Ae,ae){for(var ue in oe)if(!(ue in ae))throw new TypeError('Missing field: "'+ue+'"');var ye=L();for(ue in oe)oe[ue].write(ye,ae[ue]);return Ae!==null&&Ae.push(N,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:N}]})},v:function(){},B:function(C,B,L,N,$){var Z=xt(L);B=Te(B),wt(C,{name:B,fromWireType:function(se){return!!se},toWireType:function(se,oe){return oe?N:$},argPackAdvance:8,readValueFromPointer:function(se){if(L===1)var oe=y;else if(L===2)oe=b;else if(L===4)oe=w;else throw new TypeError("Unknown boolean type size: "+B);return this.fromWireType(oe[se>>Z])},U:null})},f:function(C,B,L,N,$,Z,se,oe,Ae,ae,ue,ye,Ue){ue=Te(ue),Z=rr($,Z),oe&&(oe=rr(se,oe)),ae&&(ae=rr(Ae,ae)),Ue=rr(ye,Ue);var at=ce(ue);Hn(at,function(){co("Cannot construct "+ue+" due to unbound types",[N])}),qe([C,B,L],N?[N]:[],function(Ye){if(Ye=Ye[0],N)var Gt=Ye.M,nr=Gt.W;else nr=St.prototype;Ye=pe(at,function(){if(Object.getPrototypeOf(this)!==ki)throw new Ge("Use 'new' to construct "+ue);if(_r.X===void 0)throw new Ge(ue+" has no accessible constructor");var vf=_r.X[arguments.length];if(vf===void 0)throw new Ge("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(_r.X).toString()+") parameters instead!");return vf.apply(this,arguments)});var ki=Object.create(nr,{constructor:{value:Ye}});Ye.prototype=ki;var _r=new $r(ue,Ye,ki,Ue,Gt,Z,oe,ae);Gt=new Rr(ue,_r,!0,!1),nr=new Rr(ue+"*",_r,!1,!1);var Cf=new Rr(ue+" const*",_r,!1,!0);return Mt[C]={pointerType:nr,ka:Cf},TT(at,Ye),[Gt,nr,Cf]})},c:function(C,B,L,N,$,Z,se){var oe=Gl(L,N);B=Te(B),Z=rr($,Z),qe([],[C],function(Ae){function ae(){co("Cannot call "+ue+" due to unbound types",oe)}Ae=Ae[0];var ue=Ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]);var ye=Ae.M.constructor;return ye[B]===void 0?(ae.Y=L-1,ye[B]=ae):(hn(ye,B,ue),ye[B].R[L-1]=ae),qe([],oe,function(Ue){return Ue=Ul(ue,[Ue[0],null].concat(Ue.slice(1)),null,Z,se),ye[B].R===void 0?(Ue.Y=L-1,ye[B]=Ue):ye[B].R[L-1]=Ue,[]}),[]})},o:function(C,B,L,N,$,Z){0<B||j();var se=Gl(B,L);$=rr(N,$),qe([],[C],function(oe){oe=oe[0];var Ae="constructor "+oe.name;if(oe.M.X===void 0&&(oe.M.X=[]),oe.M.X[B-1]!==void 0)throw new Ge("Cannot register multiple constructors with identical number of parameters ("+(B-1)+") for class '"+oe.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return oe.M.X[B-1]=()=>{co("Cannot construct "+oe.name+" due to unbound types",se)},qe([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Ul(Ae,ae,null,$,Z),[]}),[]})},a:function(C,B,L,N,$,Z,se,oe){var Ae=Gl(L,N);B=Te(B),Z=rr($,Z),qe([],[C],function(ae){function ue(){co("Cannot call "+ye+" due to unbound types",Ae)}ae=ae[0];var ye=ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]),oe&&ae.M.ia.push(B);var Ue=ae.M.W,at=Ue[B];return at===void 0||at.R===void 0&&at.className!==ae.name&&at.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ue[B]=ue):(hn(Ue,B,ye),Ue[B].R[L-2]=ue),qe([],Ae,function(Ye){return Ye=Ul(ye,Ye,ae,Z,se),Ue[B].R===void 0?(Ye.Y=L-2,Ue[B]=Ye):Ue[B].R[L-2]=Ye,[]}),[]})},A:function(C,B){B=Te(B),wt(C,{name:B,fromWireType:function(L){var N=Qe(L);return Hl(L),N},toWireType:function(L,N){return Me(N)},argPackAdvance:8,readValueFromPointer:Ce,U:null})},m:function(C,B,L){L=xt(L),B=Te(B),wt(C,{name:B,fromWireType:function(N){return N},toWireType:function(N,$){return $},argPackAdvance:8,readValueFromPointer:bT(B,L),U:null})},d:function(C,B,L,N,$){B=Te(B),$===-1&&($=4294967295),$=xt(L);var Z=oe=>oe;if(N===0){var se=32-8*L;Z=oe=>oe<<se>>>se}L=B.includes("unsigned")?function(oe,Ae){return Ae>>>0}:function(oe,Ae){return Ae},wt(C,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:xT(B,$,N!==0),U:null})},b:function(C,B,L){function N(Z){Z>>=2;var se=R;return new $(p,se[Z+1],se[Z])}var $=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][B];L=Te(L),wt(C,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(C,B){B=Te(B);var L=B==="std::string";wt(C,{name:B,fromWireType:function(N){var $=R[N>>2],Z=N+4;if(L)for(var se=Z,oe=0;oe<=$;++oe){var Ae=Z+oe;if(oe==$||Q[Ae]==0){if(se=se?g(Q,se,Ae-se):"",ae===void 0)var ae=se;else ae+="\0",ae+=se;se=Ae+1}}else{for(ae=Array($),oe=0;oe<$;++oe)ae[oe]=String.fromCharCode(Q[Z+oe]);ae=ae.join("")}return Dr(N),ae},toWireType:function(N,$){$ instanceof ArrayBuffer&&($=new Uint8Array($));var Z,se=typeof $=="string";if(se||$ instanceof Uint8Array||$ instanceof Uint8ClampedArray||$ instanceof Int8Array||fe("Cannot pass non-string to std::string"),L&&se){var oe=0;for(Z=0;Z<$.length;++Z){var Ae=$.charCodeAt(Z);127>=Ae?oe++:2047>=Ae?oe+=2:55296<=Ae&&57343>=Ae?(oe+=4,++Z):oe+=3}Z=oe}else Z=$.length;if(oe=Yl(4+Z+1),Ae=oe+4,R[oe>>2]=Z,L&&se){if(se=Ae,Ae=Z+1,Z=Q,0<Ae){Ae=se+Ae-1;for(var ae=0;ae<$.length;++ae){var ue=$.charCodeAt(ae);if(55296<=ue&&57343>=ue){var ye=$.charCodeAt(++ae);ue=65536+((ue&1023)<<10)|ye&1023}if(127>=ue){if(se>=Ae)break;Z[se++]=ue}else{if(2047>=ue){if(se+1>=Ae)break;Z[se++]=192|ue>>6}else{if(65535>=ue){if(se+2>=Ae)break;Z[se++]=224|ue>>12}else{if(se+3>=Ae)break;Z[se++]=240|ue>>18,Z[se++]=128|ue>>12&63}Z[se++]=128|ue>>6&63}Z[se++]=128|ue&63}}Z[se]=0}}else if(se)for(se=0;se<Z;++se)ae=$.charCodeAt(se),255<ae&&(Dr(Ae),fe("String has UTF-16 code units that do not fit in 8 bits")),Q[Ae+se]=ae;else for(se=0;se<Z;++se)Q[Ae+se]=$[se];return N!==null&&N.push(Dr,oe),oe},argPackAdvance:8,readValueFromPointer:Ce,U:function(N){Dr(N)}})},i:function(C,B,L){if(L=Te(L),B===2)var N=wT,$=ST,Z=RT,se=()=>v,oe=1;else B===4&&(N=DT,$=_T,Z=LT,se=()=>R,oe=2);wt(C,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ue=Ae+4,at=0;at<=ae;++at){var Ye=Ae+4+at*B;(at==ae||ue[Ye>>oe]==0)&&(Ue=N(Ue,Ye-Ue),ye===void 0?ye=Ue:(ye+="\0",ye+=Ue),Ue=Ye+B)}return Dr(Ae),ye},toWireType:function(Ae,ae){typeof ae!="string"&&fe("Cannot pass non-string to C++ string type "+L);var ue=Z(ae),ye=Yl(4+ue+B);return R[ye>>2]=ue>>oe,$(ae,ye+4,ue+B),Ae!==null&&Ae.push(Dr,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:function(Ae){Dr(Ae)}})},k:function(C,B,L,N,$,Z){q[C]={name:Te(B),ea:rr(L,N),V:rr($,Z),ha:[]}},h:function(C,B,L,N,$,Z,se,oe,Ae,ae){q[C].ha.push({na:Te(B),sa:L,qa:rr(N,$),ra:Z,ya:se,xa:rr(oe,Ae),za:ae})},C:function(C,B){B=Te(B),wt(C,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(C,B,L,N,$){C=uo[C],B=Qe(B),L=gf(L);var Z=[];return R[N>>2]=Me(Z),C(B,L,Z,$)},t:function(C,B,L,N){C=uo[C],B=Qe(B),L=gf(L),C(B,L,null,N)},g:Hl,l:function(C,B){var L=NT(C,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var $=pf[B];if($!==void 0)return $;var Z=Array(C-1);return $=kT((se,oe,Ae,ae)=>{for(var ue=0,ye=0;ye<C-1;++ye)Z[ye]=L[ye+1].readValueFromPointer(ae+ue),ue+=L[ye+1].argPackAdvance;for(se=se[oe].apply(se,Z),ye=0;ye<C-1;++ye)L[ye+1].la&&L[ye+1].la(Z[ye]);if(!N.ua)return N.toWireType(Ae,se)}),pf[B]=$},q:function(C){4<C&&(ge[C].fa+=1)},r:function(C){var B=Qe(C);de(B),Hl(C)},e:function(){j("")},x:function(C,B,L){Q.copyWithin(C,B,B+L)},w:function(C){var B=Q.length;if(C>>>=0,2147483648<C)return!1;for(var L=1;4>=L;L*=2){var N=B*(1+.2/L);N=Math.min(N,C+100663296);var $=Math;N=Math.max(C,N),$=$.min.call($,2147483648,N+(65536-N%65536)%65536);e:{try{d.grow($-p.byteLength+65535>>>16),V();var Z=1;break e}catch{}Z=void 0}if(Z)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(C,B,L,N){for(var $=0,Z=0;Z<L;Z++){var se=R[B>>2],oe=R[B+4>>2];B+=8;for(var Ae=0;Ae<oe;Ae++){var ae=Q[se+Ae],ue=MT[C];ae===0||ae===10?((C===1?c:u)(g(ue,0)),ue.length=0):ue.push(ae)}$+=oe}return R[N>>2]=$,0}};(function(){function C($){s.asm=$.exports,d=s.asm.D,V(),O=s.asm.I,ie.unshift(s.asm.E),D--,s.monitorRunDependencies&&s.monitorRunDependencies(D),D==0&&P&&($=P,P=null,$())}function B($){C($.instance)}function L($){return Y().then(function(Z){return WebAssembly.instantiate(Z,N)}).then(function(Z){return Z}).then($,function(Z){u("failed to asynchronously prepare wasm: "+Z),j(Z)})}var N={a:OT};if(D++,s.monitorRunDependencies&&s.monitorRunDependencies(D),s.instantiateWasm)try{return s.instantiateWasm(N,C)}catch($){u("Module.instantiateWasm callback failed with error: "+$),a($)}return function(){return h||typeof WebAssembly.instantiateStreaming!="function"||_(S)||typeof fetch!="function"?L(B):fetch(S,{credentials:"same-origin"}).then(function($){return WebAssembly.instantiateStreaming($,N).then(B,function(Z){return u("wasm streaming compile failed: "+Z),u("falling back to ArrayBuffer instantiation"),L(B)})})}().catch(a),{}})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.E).apply(null,arguments)};var Ef=s.___getTypeName=function(){return(Ef=s.___getTypeName=s.asm.F).apply(null,arguments)};s.__embind_initialize_bindings=function(){return(s.__embind_initialize_bindings=s.asm.G).apply(null,arguments)};var Yl=s._malloc=function(){return(Yl=s._malloc=s.asm.H).apply(null,arguments)},Dr=s._free=function(){return(Dr=s._free=s.asm.J).apply(null,arguments)};s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.K).apply(null,arguments)};var fo;P=function C(){fo||If(),fo||(P=C)};function If(){function C(){if(!fo&&(fo=!0,s.calledRun=!0,!f)){if(ne(ie),o(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var B=s.postRun.shift();te.unshift(B)}ne(te)}}if(!(0<D)){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)le();ne(W),0<D||(s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),C()},1)):C())}}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);0<s.preInit.length;)s.preInit.pop()();return If(),i.ready}})();r.exports=t})(YA);var c0=YA.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(No),n=Re;Object.keys(n).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in r&&r[a]===n[a]||Object.defineProperty(r,a,{enumerable:!0,get:function(){return n[a]}})});function i(a){return a&&a.__esModule?a:{default:a}}const s=c0;async function o(){return(0,t.default)(await s())}})(HA);function u0(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var h0=u0;/*!
65
+ `+p(_,F)):Y}}function X(_,S){var F;return S.cache&&S.name&&S.storage.templates.get(S.name)?S.storage.templates.get(S.name):(F=typeof _=="function"?_:P(_,S),S.cache&&S.name&&S.storage.templates.define(S.name,F),F)}le.l.bind(le),t.compile=P,t.compileScope=x,t.compileScopeIntoFunction=v,t.compileToString=p,t.defaultConfig=le,t.filters=te,t.getConfig=D,t.helpers=W,t.nativeHelpers=ie,t.parse=g,t.render=function(_,S,F,J){var Y=D(F||{});if(!Y.async)return X(_,Y)(S,Y);if(!J){if(typeof s=="function")return new s(function(ne,ce){try{ne(X(_,Y)(S,Y))}catch(pe){ce(pe)}});throw n("Please provide a callback function, this env doesn't support Promises")}try{X(_,Y)(S,Y,J)}catch(ne){return J(ne)}},t.templates=O,Object.defineProperty(t,"__esModule",{value:!0})})})(Eo,Eo.exports);var Ff=Eo.exports;const kf=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Nf(i,s)&&n||Object.defineProperty(r,t,s)},Nf=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Mf=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Pf=(r,e)=>`/* Wrapped ${r}*/
66
+ ${e}`,Of=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Uf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Gf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=Pf.bind(null,n,e.toString());Object.defineProperty(i,"name",Uf),Object.defineProperty(r,"toString",{...Of,value:i})};function Hf(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))kf(r,e,i,t);return Mf(r,e),Gf(r,e,n),r}const $f=new WeakMap;function qr(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,i=function(...s){const o=e(s);if(n.has(o))return n.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const A=await r.apply(this,s);try{return A}finally{t&&await t.set(o,A)}}finally{n.delete(o)}})();return n.set(o,a),a};return Hf(i,r,{ignoreNonConfigurable:!0}),$f.set(i,t),i}var nA={},Io={},Re={};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=Re.Wrap=Re.Unit=Re.PrintOptions=Re.PositionType=Re.Overflow=Re.NodeType=Re.MeasureMode=Re.LogLevel=Re.Justify=Re.Gutter=Re.FlexDirection=Re.ExperimentalFeature=Re.Errata=Re.Edge=Re.Display=Re.Direction=Re.Dimension=Re.Align=void 0;let yr=function(r){return r[r.Auto=0]="Auto",r[r.FlexStart=1]="FlexStart",r[r.Center=2]="Center",r[r.FlexEnd=3]="FlexEnd",r[r.Stretch=4]="Stretch",r[r.Baseline=5]="Baseline",r[r.SpaceBetween=6]="SpaceBetween",r[r.SpaceAround=7]="SpaceAround",r}({});Re.Align=yr;let Co=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=Co;let $i=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=$i;let vo=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=vo;let ir=function(r){return r[r.Left=0]="Left",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=3]="Bottom",r[r.Start=4]="Start",r[r.End=5]="End",r[r.Horizontal=6]="Horizontal",r[r.Vertical=7]="Vertical",r[r.All=8]="All",r}({});Re.Edge=ir;let ri=function(r){return r[r.None=0]="None",r[r.StretchFlexBasis=1]="StretchFlexBasis",r[r.All=2147483647]="All",r[r.Classic=2147483646]="Classic",r}({});Re.Errata=ri;let Yi=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=Yi;let ni=function(r){return r[r.Column=0]="Column",r[r.ColumnReverse=1]="ColumnReverse",r[r.Row=2]="Row",r[r.RowReverse=3]="RowReverse",r}({});Re.FlexDirection=ni;let Vi=function(r){return r[r.Column=0]="Column",r[r.Row=1]="Row",r[r.All=2]="All",r}({});Re.Gutter=Vi;let Xr=function(r){return r[r.FlexStart=0]="FlexStart",r[r.Center=1]="Center",r[r.FlexEnd=2]="FlexEnd",r[r.SpaceBetween=3]="SpaceBetween",r[r.SpaceAround=4]="SpaceAround",r[r.SpaceEvenly=5]="SpaceEvenly",r}({});Re.Justify=Xr;let jr=function(r){return r[r.Error=0]="Error",r[r.Warn=1]="Warn",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r[r.Verbose=4]="Verbose",r[r.Fatal=5]="Fatal",r}({});Re.LogLevel=jr;let Ki=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=Ki;let yo=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=yo;let Ji=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=Ji;let Wi=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=Wi;let qi=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=qi;let ii=function(r){return r[r.Undefined=0]="Undefined",r[r.Point=1]="Point",r[r.Percent=2]="Percent",r[r.Auto=3]="Auto",r}({});Re.Unit=ii;let Xi=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=Xi;var Yf={ALIGN_AUTO:yr.Auto,ALIGN_FLEX_START:yr.FlexStart,ALIGN_CENTER:yr.Center,ALIGN_FLEX_END:yr.FlexEnd,ALIGN_STRETCH:yr.Stretch,ALIGN_BASELINE:yr.Baseline,ALIGN_SPACE_BETWEEN:yr.SpaceBetween,ALIGN_SPACE_AROUND:yr.SpaceAround,DIMENSION_WIDTH:Co.Width,DIMENSION_HEIGHT:Co.Height,DIRECTION_INHERIT:$i.Inherit,DIRECTION_LTR:$i.LTR,DIRECTION_RTL:$i.RTL,DISPLAY_FLEX:vo.Flex,DISPLAY_NONE:vo.None,EDGE_LEFT:ir.Left,EDGE_TOP:ir.Top,EDGE_RIGHT:ir.Right,EDGE_BOTTOM:ir.Bottom,EDGE_START:ir.Start,EDGE_END:ir.End,EDGE_HORIZONTAL:ir.Horizontal,EDGE_VERTICAL:ir.Vertical,EDGE_ALL:ir.All,ERRATA_NONE:ri.None,ERRATA_STRETCH_FLEX_BASIS:ri.StretchFlexBasis,ERRATA_ALL:ri.All,ERRATA_CLASSIC:ri.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Yi.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Yi.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Yi.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ni.Column,FLEX_DIRECTION_COLUMN_REVERSE:ni.ColumnReverse,FLEX_DIRECTION_ROW:ni.Row,FLEX_DIRECTION_ROW_REVERSE:ni.RowReverse,GUTTER_COLUMN:Vi.Column,GUTTER_ROW:Vi.Row,GUTTER_ALL:Vi.All,JUSTIFY_FLEX_START:Xr.FlexStart,JUSTIFY_CENTER:Xr.Center,JUSTIFY_FLEX_END:Xr.FlexEnd,JUSTIFY_SPACE_BETWEEN:Xr.SpaceBetween,JUSTIFY_SPACE_AROUND:Xr.SpaceAround,JUSTIFY_SPACE_EVENLY:Xr.SpaceEvenly,LOG_LEVEL_ERROR:jr.Error,LOG_LEVEL_WARN:jr.Warn,LOG_LEVEL_INFO:jr.Info,LOG_LEVEL_DEBUG:jr.Debug,LOG_LEVEL_VERBOSE:jr.Verbose,LOG_LEVEL_FATAL:jr.Fatal,MEASURE_MODE_UNDEFINED:Ki.Undefined,MEASURE_MODE_EXACTLY:Ki.Exactly,MEASURE_MODE_AT_MOST:Ki.AtMost,NODE_TYPE_DEFAULT:yo.Default,NODE_TYPE_TEXT:yo.Text,OVERFLOW_VISIBLE:Ji.Visible,OVERFLOW_HIDDEN:Ji.Hidden,OVERFLOW_SCROLL:Ji.Scroll,POSITION_TYPE_STATIC:Wi.Static,POSITION_TYPE_RELATIVE:Wi.Relative,POSITION_TYPE_ABSOLUTE:Wi.Absolute,PRINT_OPTIONS_LAYOUT:qi.Layout,PRINT_OPTIONS_STYLE:qi.Style,PRINT_OPTIONS_CHILDREN:qi.Children,UNIT_UNDEFINED:ii.Undefined,UNIT_POINT:ii.Point,UNIT_PERCENT:ii.Percent,UNIT_AUTO:ii.Auto,WRAP_NO_WRAP:Xi.NoWrap,WRAP_WRAP:Xi.Wrap,WRAP_WRAP_REVERSE:Xi.WrapReverse};Re.default=Yf,Object.defineProperty(Io,"__esModule",{value:!0}),Io.default=Kf;var Nr=Vf(Re);function iA(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(iA=function(n){return n?t:e})(r)}function Vf(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=iA(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var o=i?Object.getOwnPropertyDescriptor(r,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=r[s]}return n.default=r,t&&t.set(r,n),n}function Kf(r){function e(i,s,o){const a=i[s];i[s]=function(){for(var l=arguments.length,A=new Array(l),c=0;c<l;c++)A[c]=arguments[c];return o.call(this,a,...A)}}for(const i of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const s={[Nr.Unit.Point]:r.Node.prototype[i],[Nr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[Nr.Unit.Auto]:r.Node.prototype[`${i}Auto`]};e(r.Node.prototype,i,function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),A=1;A<a;A++)l[A-1]=arguments[A];const c=l.pop();let u,h;if(c==="auto")u=Nr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?Nr.Unit.Percent:Nr.Unit.Point,h=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(h))throw new Error(`Invalid value ${c} for ${i}`);if(!s[u])throw new Error(`Failed to execute "${i}": Unsupported unit '${c}'`);return h!==void 0?s[u].call(this,...l,h):s[u].call(this,...l)})}function t(i){return r.MeasureCallback.implement({measure:function(){const{width:s,height:o}=i(...arguments);return{width:s??NaN,height:o??NaN}}})}e(r.Node.prototype,"setMeasureFunc",function(i,s){return s?i.call(this,t(s)):this.unsetMeasureFunc()});function n(i){return r.DirtiedCallback.implement({dirtied:i})}return e(r.Node.prototype,"setDirtiedFunc",function(i,s){i.call(this,n(s))}),e(r.Config.prototype,"free",function(){r.Config.destroy(this)}),e(r.Node,"create",(i,s)=>s?r.Node.createWithConfig(s):r.Node.createDefault()),e(r.Node.prototype,"free",function(){r.Node.destroy(this)}),e(r.Node.prototype,"freeRecursive",function(){for(let i=0,s=this.getChildCount();i<s;++i)this.getChild(0).freeRecursive();this.free()}),e(r.Node.prototype,"calculateLayout",function(i){let s=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]:Nr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...Nr.default}}var sA={exports:{}};(function(r,e){var t=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(i){i=i||{};var s;s||(s=typeof i<"u"?i:{});var o,a;s.ready=new Promise(function(y,B){o=y,a=B});var l=Object.assign({},s),A="";typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),n&&(A=n),A.indexOf("blob:")!==0?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="";var c=s.print||console.log.bind(console),u=s.printErr||console.warn.bind(console);Object.assign(s,l),l=null;var h;s.wasmBinary&&(h=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var d,f=!1;function g(y,B,L){L=B+L;for(var N="";!(B>=L);){var H=y[B++];if(!H)break;if(H&128){var Z=y[B++]&63;if((H&224)==192)N+=String.fromCharCode((H&31)<<6|Z);else{var se=y[B++]&63;H=(H&240)==224?(H&15)<<12|Z<<6|se:(H&7)<<18|Z<<12|se<<6|y[B++]&63,65536>H?N+=String.fromCharCode(H):(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023))}}else N+=String.fromCharCode(H)}return N}var p,C,Q,b,v,x,R,k,$;function K(){var y=d.buffer;p=y,s.HEAP8=C=new Int8Array(y),s.HEAP16=b=new Int16Array(y),s.HEAP32=x=new Int32Array(y),s.HEAPU8=Q=new Uint8Array(y),s.HEAPU16=v=new Uint16Array(y),s.HEAPU32=R=new Uint32Array(y),s.HEAPF32=k=new Float32Array(y),s.HEAPF64=$=new Float64Array(y)}var O,W=[],ie=[],te=[];function le(){var y=s.preRun.shift();W.unshift(y)}var D=0,P=null;function X(y){throw s.onAbort&&s.onAbort(y),y="Aborted("+y+")",u(y),f=!0,y=new WebAssembly.RuntimeError(y+". Build with -sASSERTIONS for more info."),a(y),y}function _(y){return y.startsWith("data:application/octet-stream;base64,")}var S;if(S="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/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BgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBAXI2AgAgAgJ/IAIoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFBHSABZyIAa3ZBBHMgAEECdGtB7gBqIAFB/x9NDQAaQT8gAUEeIABrdkECcyAAQQF0a0HHAGoiACAAQT9PGwsiAUEEdCIAQdAuajYCBCACIABB2C5qIgAoAgA2AgggACACNgIAIAIoAgggAjYCBEHYNkHYNikDAEIBIAGthoQ3AwALC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ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AIAIQIMAQtBAUHwIhALIQJBhDdBAToAAEGANyACNgIACyACIAAgAUEAEBMLDwAgASAAKAIAaiACOQMACw0AIAEgACgCAGorAwALCwAgAARAIAAQKQsLLwAgACAAIAGWIAG8Qf////8HcUGAgID8B0sbIAEgALxB/////wdxQYCAgPwHTRsLlgMCA34CfyAAvSICQjSIp0H/D3EiBEH/D0YEQCAARAAAAAAAAPA/oiIAIACjDwsgAkIBhiIBQoCAgICAgIDw/wBYBEAgAEQAAAAAAAAAAKIgACABQoCAgICAgIDw/wBRGw8LAn4gBEUEQEEAIQQgAkIMhiIBQgBZBEADQCAEQQFrIQQgAUIBhiIBQgBZDQALCyACQQEgBGuthgwBCyACQv////////8Hg0KAgICAgICACIQLIQEgBEH/B0oEQANAAkAgAUKAgICAgICACH0iA0IAUw0AIAMiAUIAUg0AIABEAAAAAAAAAACiDwsgAUIBhiEBIARBAWsiBEH/B0oNAAtB/wchBAsCQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQv////////8HWARAA0AgBEEBayEEIAFCgICAgICAgARUIQUgAUIBhiEBIAUNAAsLIAJCgICAgICAgICAf4MgAUKAgICAgICACH0gBK1CNIaEIAFBASAEa62IIARBAEobhL8LigEBA38DQCAAQQR0IgFB1C5qIAFB0C5qIgI2AgAgAUHYLmogAjYCACAAQQFqIgBBwABHDQALQTAQTxpB8DZBEDYCAEH0NkEANgIAEIQBQfQ2QaA3KAIANgIAQaA3QfA2NgIAQaQ3QcYBNgIAQag3QQA2AgAQdkGoN0GgNygCADYCAEGgN0GkNzYCAAukAwEHfyAABEAjAEEgayIGJAAgACgCACIBKAKoBCIDBEAgAyABEGsaIAFBADYCqAQLIAEoArAEIgIgASgCrAQiA0cEQEEBIAIgA2tBAnUiAiACQQFNGyEEQQAhAgNAIAMgAkECdGooAgBBADYCqAQgAkEBaiICIARHDQALCyABIAM2ArAEAkAgAyABQbQEaiICKAIARg0AIAZBCGpBAEEAIAIQ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CyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhAQwBCyACIQELQwAAAAAhAgJAAkACQCAAKALYASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoBEUNAgJAAkAgACoCICIBIAFbBEAgASECDAELIAAqAhwiAkMAAAAAXkUNAQsgAiACXARAIDghAgwECyAAKgIgIQELIAEgAVwEQCAzIQIgACoCHCIBQwAAAABeRQ0DCyA4IQIgAUMAAAAAXA0CIDMhAgwCCyA4IQILIAIgAlwNACACIDOTITUMAQsgM0MAAAAAXUUNACAzjCE1CyACITggKUUEQAJAIBggIUYEQEMAAAAAITQMAQtDAAAAACE5IBghBQNAIAUoAgAiDyATIA8qArQCIgEgQxAlITcCQCA1QwAAAABdBEAgNyAPED2MlCICQwAAAABeIA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wJAAkAgACgCrAQiAiAAKAKwBCIDRg0AA0AgAigCACABRg0BIAJBBGoiAiADRw0ACwwBCyACIANGDQAgAiACQQRqIgEgAyABaxA2GiAAIANBBGs2ArAEQQEPC0EACxMAIAAgASACEB8gACABIAIQIpILHAAgACABQQggAqcgAkIgiKcgA6cgA0IgiKcQFQsFABBQAAs5ACAARQRAQQAPCwJ/IAFBgH9xQYC/A0YgAUH/AE1yRQRAQdQ3QRk2AgBBfwwBCyAAIAE6AABBAQsLxAIAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAUEJaw4SAAoLDAoLAgMEBQwLDAwKCwcICQsgAiACKAIAIgFBBGo2AgAgACABKAIANgIADwsACyACIAIoAgAiAUEEajYCACAAIAEyAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEzAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEwAAA3AwAPCyACIAIoAgAiAUEEajYCACAAIAExAAA3AwAPCwALIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASsDADkDAA8LIAAgAiADEQEACw8LIAIgAigCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2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iwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5gYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSETIAGaIgG9IRkMAQsgBEGAEHEEQEEBIRFBnAkhEwwBC0GfCUGaCSAEQQFxIhEbIRMgEUUhFQsCQCAZQoCAgICAgID4/wCDQoCAgICAgID4/wBRBEAgAEEgIAIgEUEDaiIDIARB//97cRAoIAAgEyARECcgAEGTE0GDGyAFQSBxIgUbQbQWQYcbIA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hACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEQwACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQkAC2EBAn8jAEEQayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIA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wJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsRACAAKAIAIAFBqtWq/QcQSwsQACAAKAIAIAEgArYQMRBLCxAAIAAoAgAgASACthAvEEsLcwEBfwJAIAAoAgAiACgCGCICQQR2QQdxIAFGDQAgACACQY9/cSABQQR0QfAAcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt1AQF/AkAgACgCACIAKAIYIgJBEnZBA3EgAUYNACAAIAJB//9PcSABQRJ0QYCAMHFyNgIYA0AgAC0ABCIBQQ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AAuhsAALobAACzGwAAdmlpZGRpAACZGwAAnRsAQbAnC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBgSgLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!_(S)){var F=S;S=s.locateFile?s.locateFile(F,A):A+F}function J(){var y=S;try{if(y==S&&h)return new Uint8Array(h);if(_(y))try{var B=T1(y.slice(37)),L=new Uint8Array(B.length);for(y=0;y<B.length;++y)L[y]=B.charCodeAt(y);var N=L}catch{throw Error("Converting base64 string to bytes failed.")}else N=void 0;var H=N;if(H)return H;throw"both async and sync fetching of the wasm failed"}catch(Z){X(Z)}}function Y(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return J()}):fetch(S,{credentials:"same-origin"}).then(function(y){if(!y.ok)throw"failed to load wasm binary file at '"+S+"'";return y.arrayBuffer()}).catch(function(){return J()})}function ne(y){for(;0<y.length;)y.shift()(s)}function ce(y){if(y===void 0)return"_unknown";y=y.replace(/[^a-zA-Z0-9_]/g,"$");var B=y.charCodeAt(0);return 48<=B&&57>=B?"_"+y:y}function pe(y,B){return y=ce(y),function(){return B.apply(this,arguments)}}var ge=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Se=[];function Le(y){var B=Error,L=pe(y,function(N){this.name=y,this.message=N,N=Error(N).stack,N!==void 0&&(this.stack=this.toString()+`
67
+ `+N.replace(/^Error(:[^\n]*)?\n/,""))});return L.prototype=Object.create(B.prototype),L.prototype.constructor=L,L.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},L}var Ge=void 0;function fe(y){throw new Ge(y)}var Qe=y=>(y||fe("Cannot use deleted val. handle = "+y),ge[y].value),Me=y=>{switch(y){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var B=Se.length?Se.pop():ge.length;return ge[B]={fa:1,value:y},B}},we=void 0,qe=void 0;function Te(y){for(var B="";Q[y];)B+=qe[Q[y++]];return B}var T=[];function m(){for(;T.length;){var y=T.pop();y.L.Z=!1,y.delete()}}var E=void 0,w={};function M(y,B){for(B===void 0&&fe("ptr should not be undefined");y.P;)B=y.aa(B),y=y.P;return B}var z={};function j(y){y=kd(y);var B=Te(y);return _r(y),B}function Ie(y,B){var L=z[y];return L===void 0&&fe(B+" has unknown type "+j(y)),L}function be(){}var De=!1;function ke(y){--y.count.value,y.count.value===0&&(y.S?y.T.V(y.S):y.O.M.V(y.N))}function _e(y,B,L){return B===L?y:L.P===void 0?null:(y=_e(y,B,L.P),y===null?null:L.ma(y))}var Mt={};function ut(y,B){return B=M(y,B),w[B]}var Ut=void 0;function Er(y){throw new Ut(y)}function Ir(y,B){return B.O&&B.N||Er("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&Er("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Tt(Object.create(y,{L:{value:B}}))}function Tt(y){return typeof FinalizationRegistry>"u"?(Tt=B=>B,y):(De=new FinalizationRegistry(B=>{ke(B.L)}),Tt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Tt(y))}var q={};function de(y){for(;y.length;){var B=y.pop();y.pop()(B)}}function Ce(y){return this.fromWireType(x[y>>2])}var Pe={},Fe={};function Xe(y,B,L){function N(oe){oe=L(oe),oe.length!==y.length&&Er("Mismatched type converter count");for(var Ae=0;Ae<y.length;++Ae)wt(y[Ae],oe[Ae])}y.forEach(function(oe){Fe[oe]=B});var H=Array(B.length),Z=[],se=0;B.forEach((oe,Ae)=>{z.hasOwnProperty(oe)?H[Ae]=z[oe]:(Z.push(oe),Pe.hasOwnProperty(oe)||(Pe[oe]=[]),Pe[oe].push(()=>{H[Ae]=z[oe],++se,se===Z.length&&N(H)}))}),Z.length===0&&N(H)}function xt(y){switch(y){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+y)}}function wt(y,B,L={}){if(!("argPackAdvance"in B))throw new TypeError("registerType registeredInstance requires argPackAdvance");var N=B.name;if(y||fe('type "'+N+'" must have a positive integer typeid pointer'),z.hasOwnProperty(y)){if(L.ta)return;fe("Cannot register type '"+N+"' twice")}z[y]=B,delete Fe[y],Pe.hasOwnProperty(y)&&(B=Pe[y],delete Pe[y],B.forEach(H=>H()))}function Hn(y){fe(y.L.O.M.name+" instance already deleted")}function St(){}function hn(y,B,L){if(y[B].R===void 0){var N=y[B];y[B]=function(){return y[B].R.hasOwnProperty(arguments.length)||fe("Function '"+L+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+y[B].R+")!"),y[B].R[arguments.length].apply(this,arguments)},y[B].R=[],y[B].R[N.Y]=N}}function $n(y,B){s.hasOwnProperty(y)?(fe("Cannot register public name '"+y+"' twice"),hn(s,y,y),s.hasOwnProperty(void 0)&&fe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),s[y].R[void 0]=B):s[y]=B}function $r(y,B,L,N,H,Z,se,oe){this.name=y,this.constructor=B,this.W=L,this.V=N,this.P=H,this.oa=Z,this.aa=se,this.ma=oe,this.ia=[]}function Di(y,B,L){for(;B!==L;)B.aa||fe("Expected null or instance of "+L.name+", got an instance of "+B.name),y=B.aa(y),B=B.P;return y}function _i(y,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+xl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),Di(B.L.N,B.L.O.M,this.M))}function Yn(y,B){if(B===null){if(this.da&&fe("null is not a valid "+this.name),this.ca){var L=this.ea();return y!==null&&y.push(this.V,L),L}return 0}if(B.L||fe('Cannot pass "'+xl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&B.L.O.ba&&fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name),L=Di(B.L.N,B.L.O.M,this.M),this.ca)switch(B.L.S===void 0&&fe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:B.L.T===this?L=B.L.S:fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name);break;case 1:L=B.L.S;break;case 2:if(B.L.T===this)L=B.L.S;else{var N=B.clone();L=this.wa(L,Me(function(){N.delete()})),y!==null&&y.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function A1(y,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+xl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),B.L.O.ba&&fe("Cannot convert argument of type "+B.L.O.name+" to parameter type "+this.name),Di(B.L.N,B.L.O.M,this.M))}function Dr(y,B,L,N){this.name=y,this.M=B,this.da=L,this.ba=N,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,B.P!==void 0?this.toWireType=Yn:(this.toWireType=N?_i:A1,this.U=null)}function c1(y,B){s.hasOwnProperty(y)||Er("Replacing nonexistant public symbol"),s[y]=B,s[y].Y=void 0}function u1(y,B){var L=[];return function(){if(L.length=0,Object.assign(L,arguments),y.includes("j")){var N=s["dynCall_"+y];N=L&&L.length?N.apply(null,[B].concat(L)):N.call(null,B)}else N=O.get(B).apply(null,L);return N}}function rr(y,B){y=Te(y);var L=y.includes("j")?u1(y,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+y+": "+B),L}var Dd=void 0;function to(y,B){function L(Z){H[Z]||z[Z]||(Fe[Z]?Fe[Z].forEach(L):(N.push(Z),H[Z]=!0))}var N=[],H={};throw B.forEach(L),new Dd(y+": "+N.map(j).join([", "]))}function Tl(y,B,L,N,H){var Z=B.length;2>Z&&fe("argTypes array size mismatch! Must at least get return value and 'this' types!");var se=B[1]!==null&&L!==null,oe=!1;for(L=1;L<B.length;++L)if(B[L]!==null&&B[L].U===void 0){oe=!0;break}var Ae=B[0].name!=="void",ae=Z-2,ue=Array(ae),ye=[],Ue=[];return function(){if(arguments.length!==ae&&fe("function "+y+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ue.length=0,ye.length=se?2:1,ye[0]=H,se){var at=B[1].toWireType(Ue,this);ye[1]=at}for(var Ye=0;Ye<ae;++Ye)ue[Ye]=B[Ye+2].toWireType(Ue,arguments[Ye]),ye.push(ue[Ye]);if(Ye=N.apply(null,ye),oe)de(Ue);else for(var Gt=se?1:2;Gt<B.length;Gt++){var nr=Gt===1?at:ue[Gt-2];B[Gt].U!==null&&B[Gt].U(nr)}return at=Ae?B[0].fromWireType(Ye):void 0,at}}function Ql(y,B){for(var L=[],N=0;N<y;N++)L.push(R[B+4*N>>2]);return L}function bl(y){4<y&&--ge[y].fa===0&&(ge[y]=void 0,Se.push(y))}function xl(y){if(y===null)return"null";var B=typeof y;return B==="object"||B==="array"||B==="function"?y.toString():""+y}function h1(y,B){switch(B){case 2:return function(L){return this.fromWireType(k[L>>2])};case 3:return function(L){return this.fromWireType($[L>>3])};default:throw new TypeError("Unknown float type: "+y)}}function d1(y,B,L){switch(B){case 0:return L?function(N){return C[N]}:function(N){return Q[N]};case 1:return L?function(N){return b[N>>1]}:function(N){return v[N>>1]};case 2:return L?function(N){return x[N>>2]}:function(N){return R[N>>2]};default:throw new TypeError("Unknown integer type: "+y)}}function f1(y,B){for(var L="",N=0;!(N>=B/2);++N){var H=b[y+2*N>>1];if(H==0)break;L+=String.fromCharCode(H)}return L}function g1(y,B,L){if(L===void 0&&(L=2147483647),2>L)return 0;L-=2;var N=B;L=L<2*y.length?L/2:y.length;for(var H=0;H<L;++H)b[B>>1]=y.charCodeAt(H),B+=2;return b[B>>1]=0,B-N}function p1(y){return 2*y.length}function m1(y,B){for(var L=0,N="";!(L>=B/4);){var H=x[y+4*L>>2];if(H==0)break;++L,65536<=H?(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023)):N+=String.fromCharCode(H)}return N}function E1(y,B,L){if(L===void 0&&(L=2147483647),4>L)return 0;var N=B;L=N+L-4;for(var H=0;H<y.length;++H){var Z=y.charCodeAt(H);if(55296<=Z&&57343>=Z){var se=y.charCodeAt(++H);Z=65536+((Z&1023)<<10)|se&1023}if(x[B>>2]=Z,B+=4,B+4>L)break}return x[B>>2]=0,B-N}function I1(y){for(var B=0,L=0;L<y.length;++L){var N=y.charCodeAt(L);55296<=N&&57343>=N&&++L,B+=4}return B}var C1={};function _d(y){var B=C1[y];return B===void 0?Te(y):B}var ro=[];function v1(y){var B=ro.length;return ro.push(y),B}function y1(y,B){for(var L=Array(y),N=0;N<y;++N)L[N]=Ie(R[B+4*N>>2],"parameter "+N);return L}var Ld=[],B1=[null,[],[]];Ge=s.BindingError=Le("BindingError"),s.count_emval_handles=function(){for(var y=0,B=5;B<ge.length;++B)ge[B]!==void 0&&++y;return y},s.get_first_emval=function(){for(var y=5;y<ge.length;++y)if(ge[y]!==void 0)return ge[y];return null},we=s.PureVirtualError=Le("PureVirtualError");for(var Fd=Array(256),no=0;256>no;++no)Fd[no]=String.fromCharCode(no);qe=Fd,s.getInheritedInstanceCount=function(){return Object.keys(w).length},s.getLiveInheritedInstances=function(){var y=[],B;for(B in w)w.hasOwnProperty(B)&&y.push(w[B]);return y},s.flushPendingDeletes=m,s.setDelayFunction=function(y){E=y,T.length&&E&&E(m)},Ut=s.InternalError=Le("InternalError"),St.prototype.isAliasOf=function(y){if(!(this instanceof St&&y instanceof St))return!1;var B=this.L.O.M,L=this.L.N,N=y.L.O.M;for(y=y.L.N;B.P;)L=B.aa(L),B=B.P;for(;N.P;)y=N.aa(y),N=N.P;return B===N&&L===y},St.prototype.clone=function(){if(this.L.N||Hn(this),this.L.$)return this.L.count.value+=1,this;var y=Tt,B=Object,L=B.create,N=Object.getPrototypeOf(this),H=this.L;return y=y(L.call(B,N,{L:{value:{count:H.count,Z:H.Z,$:H.$,N:H.N,O:H.O,S:H.S,T:H.T}}})),y.L.count.value+=1,y.L.Z=!1,y},St.prototype.delete=function(){this.L.N||Hn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),be(this),ke(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},St.prototype.isDeleted=function(){return!this.L.N},St.prototype.deleteLater=function(){return this.L.N||Hn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),T.push(this),T.length===1&&E&&E(m),this.L.Z=!0,this},Dr.prototype.pa=function(y){return this.ja&&(y=this.ja(y)),y},Dr.prototype.ga=function(y){this.V&&this.V(y)},Dr.prototype.argPackAdvance=8,Dr.prototype.readValueFromPointer=Ce,Dr.prototype.deleteObject=function(y){y!==null&&y.delete()},Dr.prototype.fromWireType=function(y){function B(){return this.ca?Ir(this.M.W,{O:this.va,N:L,T:this,S:y}):Ir(this.M.W,{O:this,N:y})}var L=this.pa(y);if(!L)return this.ga(y),null;var N=ut(this.M,L);if(N!==void 0)return N.L.count.value===0?(N.L.N=L,N.L.S=y,N.clone()):(N=N.clone(),this.ga(y),N);if(N=this.M.oa(L),N=Mt[N],!N)return B.call(this);N=this.ba?N.ka:N.pointerType;var H=_e(L,this.M,N.M);return H===null?B.call(this):this.ca?Ir(N.M.W,{O:N,N:H,T:this,S:y}):Ir(N.M.W,{O:N,N:H})},Dd=s.UnboundTypeError=Le("UnboundTypeError");var T1=typeof atob=="function"?atob:function(y){var B="",L=0;y=y.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(y.charAt(L++)),H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(y.charAt(L++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(y.charAt(L++)),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(y.charAt(L++));N=N<<2|H>>4,H=(H&15)<<4|Z>>2;var oe=(Z&3)<<6|se;B+=String.fromCharCode(N),Z!==64&&(B+=String.fromCharCode(H)),se!==64&&(B+=String.fromCharCode(oe))}while(L<y.length);return B},Q1={p:function(y,B,L){y=Te(y),B=Ie(B,"wrapper"),L=Qe(L);var N=[].slice,H=B.M,Z=H.W,se=H.P.W,oe=H.P.constructor;y=pe(y,function(){H.P.ia.forEach((function(ae){if(this[ae]===se[ae])throw new we("Pure virtual function "+ae+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:Z}),this.__construct.apply(this,N.call(arguments))}),Z.__construct=function(){this===Z&&fe("Pass correct 'this' to __construct");var ae=oe.implement.apply(void 0,[this].concat(N.call(arguments)));be(ae);var ue=ae.L;ae.notifyOnDestruction(),ue.$=!0,Object.defineProperties(this,{L:{value:ue}}),Tt(this),ae=ue.N,ae=M(H,ae),w.hasOwnProperty(ae)?fe("Tried to register registered instance: "+ae):w[ae]=this},Z.__destruct=function(){this===Z&&fe("Pass correct 'this' to __destruct"),be(this);var ae=this.L.N;ae=M(H,ae),w.hasOwnProperty(ae)?delete w[ae]:fe("Tried to unregister unregistered instance: "+ae)},y.prototype=Object.create(Z);for(var Ae in L)y.prototype[Ae]=L[Ae];return Me(y)},j:function(y){var B=q[y];delete q[y];var L=B.ea,N=B.V,H=B.ha,Z=H.map(se=>se.sa).concat(H.map(se=>se.ya));Xe([y],Z,se=>{var oe={};return H.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ue=Ae.ra,at=se[ae+H.length],Ye=Ae.xa,Gt=Ae.za;oe[Ae.na]={read:nr=>ue.fromWireType(ye(Ue,nr)),write:(nr,Li)=>{var Lr=[];Ye(Gt,nr,at.toWireType(Lr,Li)),de(Lr)}}}),[{name:B.name,fromWireType:function(Ae){var ae={},ue;for(ue in oe)ae[ue]=oe[ue].read(Ae);return N(Ae),ae},toWireType:function(Ae,ae){for(var ue in oe)if(!(ue in ae))throw new TypeError('Missing field: "'+ue+'"');var ye=L();for(ue in oe)oe[ue].write(ye,ae[ue]);return Ae!==null&&Ae.push(N,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:N}]})},v:function(){},B:function(y,B,L,N,H){var Z=xt(L);B=Te(B),wt(y,{name:B,fromWireType:function(se){return!!se},toWireType:function(se,oe){return oe?N:H},argPackAdvance:8,readValueFromPointer:function(se){if(L===1)var oe=C;else if(L===2)oe=b;else if(L===4)oe=x;else throw new TypeError("Unknown boolean type size: "+B);return this.fromWireType(oe[se>>Z])},U:null})},f:function(y,B,L,N,H,Z,se,oe,Ae,ae,ue,ye,Ue){ue=Te(ue),Z=rr(H,Z),oe&&(oe=rr(se,oe)),ae&&(ae=rr(Ae,ae)),Ue=rr(ye,Ue);var at=ce(ue);$n(at,function(){to("Cannot construct "+ue+" due to unbound types",[N])}),Xe([y,B,L],N?[N]:[],function(Ye){if(Ye=Ye[0],N)var Gt=Ye.M,nr=Gt.W;else nr=St.prototype;Ye=pe(at,function(){if(Object.getPrototypeOf(this)!==Li)throw new Ge("Use 'new' to construct "+ue);if(Lr.X===void 0)throw new Ge(ue+" has no accessible constructor");var Pd=Lr.X[arguments.length];if(Pd===void 0)throw new Ge("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Lr.X).toString()+") parameters instead!");return Pd.apply(this,arguments)});var Li=Object.create(nr,{constructor:{value:Ye}});Ye.prototype=Li;var Lr=new $r(ue,Ye,Li,Ue,Gt,Z,oe,ae);Gt=new Dr(ue,Lr,!0,!1),nr=new Dr(ue+"*",Lr,!1,!1);var Md=new Dr(ue+" const*",Lr,!1,!0);return Mt[y]={pointerType:nr,ka:Md},c1(at,Ye),[Gt,nr,Md]})},c:function(y,B,L,N,H,Z,se){var oe=Ql(L,N);B=Te(B),Z=rr(H,Z),Xe([],[y],function(Ae){function ae(){to("Cannot call "+ue+" due to unbound types",oe)}Ae=Ae[0];var ue=Ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]);var ye=Ae.M.constructor;return ye[B]===void 0?(ae.Y=L-1,ye[B]=ae):(hn(ye,B,ue),ye[B].R[L-1]=ae),Xe([],oe,function(Ue){return Ue=Tl(ue,[Ue[0],null].concat(Ue.slice(1)),null,Z,se),ye[B].R===void 0?(Ue.Y=L-1,ye[B]=Ue):ye[B].R[L-1]=Ue,[]}),[]})},o:function(y,B,L,N,H,Z){0<B||X();var se=Ql(B,L);H=rr(N,H),Xe([],[y],function(oe){oe=oe[0];var Ae="constructor "+oe.name;if(oe.M.X===void 0&&(oe.M.X=[]),oe.M.X[B-1]!==void 0)throw new Ge("Cannot register multiple constructors with identical number of parameters ("+(B-1)+") for class '"+oe.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return oe.M.X[B-1]=()=>{to("Cannot construct "+oe.name+" due to unbound types",se)},Xe([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Tl(Ae,ae,null,H,Z),[]}),[]})},a:function(y,B,L,N,H,Z,se,oe){var Ae=Ql(L,N);B=Te(B),Z=rr(H,Z),Xe([],[y],function(ae){function ue(){to("Cannot call "+ye+" due to unbound types",Ae)}ae=ae[0];var ye=ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]),oe&&ae.M.ia.push(B);var Ue=ae.M.W,at=Ue[B];return at===void 0||at.R===void 0&&at.className!==ae.name&&at.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ue[B]=ue):(hn(Ue,B,ye),Ue[B].R[L-2]=ue),Xe([],Ae,function(Ye){return Ye=Tl(ye,Ye,ae,Z,se),Ue[B].R===void 0?(Ye.Y=L-2,Ue[B]=Ye):Ue[B].R[L-2]=Ye,[]}),[]})},A:function(y,B){B=Te(B),wt(y,{name:B,fromWireType:function(L){var N=Qe(L);return bl(L),N},toWireType:function(L,N){return Me(N)},argPackAdvance:8,readValueFromPointer:Ce,U:null})},m:function(y,B,L){L=xt(L),B=Te(B),wt(y,{name:B,fromWireType:function(N){return N},toWireType:function(N,H){return H},argPackAdvance:8,readValueFromPointer:h1(B,L),U:null})},d:function(y,B,L,N,H){B=Te(B),H===-1&&(H=4294967295),H=xt(L);var Z=oe=>oe;if(N===0){var se=32-8*L;Z=oe=>oe<<se>>>se}L=B.includes("unsigned")?function(oe,Ae){return Ae>>>0}:function(oe,Ae){return Ae},wt(y,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:d1(B,H,N!==0),U:null})},b:function(y,B,L){function N(Z){Z>>=2;var se=R;return new H(p,se[Z+1],se[Z])}var H=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][B];L=Te(L),wt(y,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(y,B){B=Te(B);var L=B==="std::string";wt(y,{name:B,fromWireType:function(N){var H=R[N>>2],Z=N+4;if(L)for(var se=Z,oe=0;oe<=H;++oe){var Ae=Z+oe;if(oe==H||Q[Ae]==0){if(se=se?g(Q,se,Ae-se):"",ae===void 0)var ae=se;else ae+="\0",ae+=se;se=Ae+1}}else{for(ae=Array(H),oe=0;oe<H;++oe)ae[oe]=String.fromCharCode(Q[Z+oe]);ae=ae.join("")}return _r(N),ae},toWireType:function(N,H){H instanceof ArrayBuffer&&(H=new Uint8Array(H));var Z,se=typeof H=="string";if(se||H instanceof Uint8Array||H instanceof Uint8ClampedArray||H instanceof Int8Array||fe("Cannot pass non-string to std::string"),L&&se){var oe=0;for(Z=0;Z<H.length;++Z){var Ae=H.charCodeAt(Z);127>=Ae?oe++:2047>=Ae?oe+=2:55296<=Ae&&57343>=Ae?(oe+=4,++Z):oe+=3}Z=oe}else Z=H.length;if(oe=wl(4+Z+1),Ae=oe+4,R[oe>>2]=Z,L&&se){if(se=Ae,Ae=Z+1,Z=Q,0<Ae){Ae=se+Ae-1;for(var ae=0;ae<H.length;++ae){var ue=H.charCodeAt(ae);if(55296<=ue&&57343>=ue){var ye=H.charCodeAt(++ae);ue=65536+((ue&1023)<<10)|ye&1023}if(127>=ue){if(se>=Ae)break;Z[se++]=ue}else{if(2047>=ue){if(se+1>=Ae)break;Z[se++]=192|ue>>6}else{if(65535>=ue){if(se+2>=Ae)break;Z[se++]=224|ue>>12}else{if(se+3>=Ae)break;Z[se++]=240|ue>>18,Z[se++]=128|ue>>12&63}Z[se++]=128|ue>>6&63}Z[se++]=128|ue&63}}Z[se]=0}}else if(se)for(se=0;se<Z;++se)ae=H.charCodeAt(se),255<ae&&(_r(Ae),fe("String has UTF-16 code units that do not fit in 8 bits")),Q[Ae+se]=ae;else for(se=0;se<Z;++se)Q[Ae+se]=H[se];return N!==null&&N.push(_r,oe),oe},argPackAdvance:8,readValueFromPointer:Ce,U:function(N){_r(N)}})},i:function(y,B,L){if(L=Te(L),B===2)var N=f1,H=g1,Z=p1,se=()=>v,oe=1;else B===4&&(N=m1,H=E1,Z=I1,se=()=>R,oe=2);wt(y,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ue=Ae+4,at=0;at<=ae;++at){var Ye=Ae+4+at*B;(at==ae||ue[Ye>>oe]==0)&&(Ue=N(Ue,Ye-Ue),ye===void 0?ye=Ue:(ye+="\0",ye+=Ue),Ue=Ye+B)}return _r(Ae),ye},toWireType:function(Ae,ae){typeof ae!="string"&&fe("Cannot pass non-string to C++ string type "+L);var ue=Z(ae),ye=wl(4+ue+B);return R[ye>>2]=ue>>oe,H(ae,ye+4,ue+B),Ae!==null&&Ae.push(_r,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:function(Ae){_r(Ae)}})},k:function(y,B,L,N,H,Z){q[y]={name:Te(B),ea:rr(L,N),V:rr(H,Z),ha:[]}},h:function(y,B,L,N,H,Z,se,oe,Ae,ae){q[y].ha.push({na:Te(B),sa:L,qa:rr(N,H),ra:Z,ya:se,xa:rr(oe,Ae),za:ae})},C:function(y,B){B=Te(B),wt(y,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(y,B,L,N,H){y=ro[y],B=Qe(B),L=_d(L);var Z=[];return R[N>>2]=Me(Z),y(B,L,Z,H)},t:function(y,B,L,N){y=ro[y],B=Qe(B),L=_d(L),y(B,L,null,N)},g:bl,l:function(y,B){var L=y1(y,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var H=Ld[B];if(H!==void 0)return H;var Z=Array(y-1);return H=v1((se,oe,Ae,ae)=>{for(var ue=0,ye=0;ye<y-1;++ye)Z[ye]=L[ye+1].readValueFromPointer(ae+ue),ue+=L[ye+1].argPackAdvance;for(se=se[oe].apply(se,Z),ye=0;ye<y-1;++ye)L[ye+1].la&&L[ye+1].la(Z[ye]);if(!N.ua)return N.toWireType(Ae,se)}),Ld[B]=H},q:function(y){4<y&&(ge[y].fa+=1)},r:function(y){var B=Qe(y);de(B),bl(y)},e:function(){X("")},x:function(y,B,L){Q.copyWithin(y,B,B+L)},w:function(y){var B=Q.length;if(y>>>=0,2147483648<y)return!1;for(var L=1;4>=L;L*=2){var N=B*(1+.2/L);N=Math.min(N,y+100663296);var H=Math;N=Math.max(y,N),H=H.min.call(H,2147483648,N+(65536-N%65536)%65536);e:{try{d.grow(H-p.byteLength+65535>>>16),K();var Z=1;break e}catch{}Z=void 0}if(Z)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(y,B,L,N){for(var H=0,Z=0;Z<L;Z++){var se=R[B>>2],oe=R[B+4>>2];B+=8;for(var Ae=0;Ae<oe;Ae++){var ae=Q[se+Ae],ue=B1[y];ae===0||ae===10?((y===1?c:u)(g(ue,0)),ue.length=0):ue.push(ae)}H+=oe}return R[N>>2]=H,0}};(function(){function y(H){s.asm=H.exports,d=s.asm.D,K(),O=s.asm.I,ie.unshift(s.asm.E),D--,s.monitorRunDependencies&&s.monitorRunDependencies(D),D==0&&P&&(H=P,P=null,H())}function B(H){y(H.instance)}function L(H){return Y().then(function(Z){return WebAssembly.instantiate(Z,N)}).then(function(Z){return Z}).then(H,function(Z){u("failed to asynchronously prepare wasm: "+Z),X(Z)})}var N={a:Q1};if(D++,s.monitorRunDependencies&&s.monitorRunDependencies(D),s.instantiateWasm)try{return s.instantiateWasm(N,y)}catch(H){u("Module.instantiateWasm callback failed with error: "+H),a(H)}return function(){return h||typeof WebAssembly.instantiateStreaming!="function"||_(S)||typeof fetch!="function"?L(B):fetch(S,{credentials:"same-origin"}).then(function(H){return WebAssembly.instantiateStreaming(H,N).then(B,function(Z){return u("wasm streaming compile failed: "+Z),u("falling back to ArrayBuffer instantiation"),L(B)})})}().catch(a),{}})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.E).apply(null,arguments)};var kd=s.___getTypeName=function(){return(kd=s.___getTypeName=s.asm.F).apply(null,arguments)};s.__embind_initialize_bindings=function(){return(s.__embind_initialize_bindings=s.asm.G).apply(null,arguments)};var wl=s._malloc=function(){return(wl=s._malloc=s.asm.H).apply(null,arguments)},_r=s._free=function(){return(_r=s._free=s.asm.J).apply(null,arguments)};s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.K).apply(null,arguments)};var io;P=function y(){io||Nd(),io||(P=y)};function Nd(){function y(){if(!io&&(io=!0,s.calledRun=!0,!f)){if(ne(ie),o(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var B=s.postRun.shift();te.unshift(B)}ne(te)}}if(!(0<D)){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)le();ne(W),0<D||(s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),y()},1)):y())}}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);0<s.preInit.length;)s.preInit.pop()();return Nd(),i.ready}})();r.exports=t})(sA);var Jf=sA.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(Io),n=Re;Object.keys(n).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in r&&r[a]===n[a]||Object.defineProperty(r,a,{enumerable:!0,get:function(){return n[a]}})});function i(a){return a&&a.__esModule?a:{default:a}}const s=Jf;async function o(){return(0,t.default)(await s())}})(nA);function Wf(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var qf=Wf;/*!
68
68
  * Determine if an object is a Buffer
69
69
  *
70
70
  * @author Feross Aboukhadijeh <https://feross.org>
71
71
  * @license MIT
72
- */var d0=function(r){return r!=null&&(VA(r)||f0(r)||!!r._isBuffer)};function VA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function f0(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&VA(r.slice(0,0))}var g0=h0,p0=d0,m0=typeof Float64Array<"u";function E0(r,e){return r[0]-e[0]}function I0(){var r=this.stride,e=new Array(r.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(r[t]),t];e.sort(E0);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function C0(r,e){var t=["View",e,"d",r].join("");e<0&&(t="View_Nil"+r);var n=r==="generic";if(e===-1){var i="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(i);return g()}else if(e===0){var i="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",i);return g(ss[r][0])}var i=["'use strict'"],s=g0(e),o=s.map(function(p){return"i"+p}),a="this.offset+"+s.map(function(p){return"this.stride["+p+"]*i"+p}).join("+"),l=s.map(function(p){return"b"+p}).join(","),A=s.map(function(p){return"c"+p}).join(",");i.push("function "+t+"(a,"+l+","+A+",d){this.data=a","this.shape=["+l+"]","this.stride=["+A+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+r+"'","proto.dimension="+e),i.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+s.map(function(p){return"this.shape["+p+"]"}).join("*"),"}})"),e===1?i.push("proto.order=[0]"):(i.push("Object.defineProperty(proto,'order',{get:"),e<4?(i.push("function "+t+"_order(){"),e===2?i.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),n?i.push("return this.data.set("+a+",v)}"):i.push("return this.data["+a+"]=v}"),i.push("proto.get=function "+t+"_get("+o.join(",")+"){"),n?i.push("return this.data.get("+a+")}"):i.push("return this.data["+a+"]}"),i.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),i.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+s.map(function(p){return["(typeof i",p,"!=='number'||i",p,"<0)?this.shape[",p,"]:i",p,"|0"].join("")}).join(",")+","+s.map(function(p){return"this.stride["+p+"]"}).join(",")+",this.offset)}");var c=s.map(function(p){return"a"+p+"=this.shape["+p+"]"}),u=s.map(function(p){return"c"+p+"=this.stride["+p+"]"});i.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+u.join(","));for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){d=i"+h+"|0;b+=c"+h+"*d;a"+h+"-=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"c"+p}).join(",")+",b)}"),i.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+s.map(function(p){return"a"+p+"=this.shape["+p+"]"}).join(",")+","+s.map(function(p){return"b"+p+"=this.stride["+p+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'){d=i"+h+"|0;if(d<0){c+=b"+h+"*(a"+h+"-1);a"+h+"=ceil(-a"+h+"/d)}else{a"+h+"=ceil(a"+h+"/d)}b"+h+"*=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"b"+p}).join(",")+",c)}");for(var d=new Array(e),f=new Array(e),h=0;h<e;++h)d[h]="a[i"+h+"]",f[h]="b[i"+h+"]";i.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(p,y){return p+"=("+p+"===undefined?"+y+":"+p+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+d.join(",")+","+f.join(",")+",this.offset)}"),i.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){c=(c+this.stride["+h+"]*i"+h+")|0}else{a.push(this.shape["+h+"]);b.push(this.stride["+h+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+s.map(function(p){return"shape["+p+"]"}).join(",")+","+s.map(function(p){return"stride["+p+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",i.join(`
73
- `));return g(ss[r],I0)}function v0(r){if(p0(r))return"buffer";if(m0)switch(Object.prototype.toString.call(r)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(r)?"array":"generic"}var ss={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function y0(r,e,t,n){if(r===void 0){var A=ss.array[0];return A([])}else typeof r=="number"&&(r=[r]);e===void 0&&(e=[r.length]);var i=e.length;if(t===void 0){t=new Array(i);for(var s=i-1,o=1;s>=0;--s)t[s]=o,o*=e[s]}if(n===void 0){n=0;for(var s=0;s<i;++s)t[s]<0&&(n-=(e[s]-1)*t[s])}for(var a=v0(r),l=ss[a];l.length<=i+1;)l.push(C0(a,l.length-1));var A=l[i+1];return A(r,e,t,n)}var B0=y0,KA={};function T0(r,e){for(var t=1,n=r.length,i=r[0],s=r[0],o=1;o<n;++o)if(s=i,i=r[o],e(i,s)){if(o===t){t++;continue}r[t++]=i}return r.length=t,r}function Q0(r){for(var e=1,t=r.length,n=r[0],i=r[0],s=1;s<t;++s,i=n)if(i=n,n=r[s],n!==i){if(s===e){e++;continue}r[e++]=n}return r.length=e,r}function b0(r,e,t){return r.length===0?r:e?(t||r.sort(e),T0(r,e)):(t||r.sort(),Q0(r))}var x0=b0,w0=x0;function JA(r,e,t){var n=r.length,i=e.arrayArgs.length,s=e.indexArgs.length>0,o=[],a=[],l=0,A=0,c,u;for(c=0;c<n;++c)a.push(["i",c,"=0"].join(""));for(u=0;u<i;++u)for(c=0;c<n;++c)A=l,l=r[c],c===0?a.push(["d",u,"s",c,"=t",u,"p",l].join("")):a.push(["d",u,"s",c,"=(t",u,"p",l,"-s",A,"*t",u,"p",A,")"].join(""));for(a.length>0&&o.push("var "+a.join(",")),c=n-1;c>=0;--c)l=r[c],o.push(["for(i",c,"=0;i",c,"<s",l,";++i",c,"){"].join(""));for(o.push(t),c=0;c<n;++c){for(A=l,l=r[c],u=0;u<i;++u)o.push(["p",u,"+=d",u,"s",c].join(""));s&&(c>0&&o.push(["index[",A,"]-=s",A].join("")),o.push(["++index[",l,"]"].join(""))),o.push("}")}return o.join(`
74
- `)}function S0(r,e,t,n){for(var i=e.length,s=t.arrayArgs.length,o=t.blockSize,a=t.indexArgs.length>0,l=[],A=0;A<s;++A)l.push(["var offset",A,"=p",A].join(""));for(var A=r;A<i;++A)l.push(["for(var j"+A+"=SS[",e[A],"]|0;j",A,">0;){"].join("")),l.push(["if(j",A,"<",o,"){"].join("")),l.push(["s",e[A],"=j",A].join("")),l.push(["j",A,"=0"].join("")),l.push(["}else{s",e[A],"=",o].join("")),l.push(["j",A,"-=",o,"}"].join("")),a&&l.push(["index[",e[A],"]=j",A].join(""));for(var A=0;A<s;++A){for(var c=["offset"+A],u=r;u<i;++u)c.push(["j",u,"*t",A,"p",e[u]].join(""));l.push(["p",A,"=(",c.join("+"),")"].join(""))}l.push(JA(e,t,n));for(var A=r;A<i;++A)l.push("}");return l.join(`
75
- `)}function R0(r){for(var e=0,t=r[0].length;e<t;){for(var n=1;n<r.length;++n)if(r[n][e]!==r[0][e])return e;++e}return e}function Uo(r,e,t){for(var n=r.body,i=[],s=[],o=0;o<r.args.length;++o){var a=r.args[o];if(!(a.count<=0)){var l=new RegExp(a.name,"g"),A="",c=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var u=e.offsetArgIndex.indexOf(o),h=e.offsetArgs[u];c=h.array,A="+q"+u;case"array":A="p"+c+A;var d="l"+o,f="a"+c;if(e.arrayBlockIndices[c]===0)a.count===1?t[c]==="generic"?a.lvalue?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),s.push([f,".set(",A,",",d,")"].join(""))):n=n.replace(l,[f,".get(",A,")"].join("")):n=n.replace(l,[f,"[",A,"]"].join("")):t[c]==="generic"?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,".set(",A,",",d,")"].join(""))):(i.push(["var ",d,"=",f,"[",A,"]"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,"[",A,"]=",d].join("")));else{for(var g=[a.name],p=[A],y=0;y<Math.abs(e.arrayBlockIndices[c]);y++)g.push("\\s*\\[([^\\]]+)\\]"),p.push("$"+(y+1)+"*t"+c+"b"+y);if(l=new RegExp(g.join(""),"g"),A=p.join("+"),t[c]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[f,"[",A,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape");break}}}return[i.join(`
72
+ */var Xf=function(r){return r!=null&&(oA(r)||jf(r)||!!r._isBuffer)};function oA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function jf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&oA(r.slice(0,0))}var zf=qf,Zf=Xf,eg=typeof Float64Array<"u";function tg(r,e){return r[0]-e[0]}function rg(){var r=this.stride,e=new Array(r.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(r[t]),t];e.sort(tg);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function ng(r,e){var t=["View",e,"d",r].join("");e<0&&(t="View_Nil"+r);var n=r==="generic";if(e===-1){var i="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(i);return g()}else if(e===0){var i="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",i);return g(ji[r][0])}var i=["'use strict'"],s=zf(e),o=s.map(function(p){return"i"+p}),a="this.offset+"+s.map(function(p){return"this.stride["+p+"]*i"+p}).join("+"),l=s.map(function(p){return"b"+p}).join(","),A=s.map(function(p){return"c"+p}).join(",");i.push("function "+t+"(a,"+l+","+A+",d){this.data=a","this.shape=["+l+"]","this.stride=["+A+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+r+"'","proto.dimension="+e),i.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+s.map(function(p){return"this.shape["+p+"]"}).join("*"),"}})"),e===1?i.push("proto.order=[0]"):(i.push("Object.defineProperty(proto,'order',{get:"),e<4?(i.push("function "+t+"_order(){"),e===2?i.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),n?i.push("return this.data.set("+a+",v)}"):i.push("return this.data["+a+"]=v}"),i.push("proto.get=function "+t+"_get("+o.join(",")+"){"),n?i.push("return this.data.get("+a+")}"):i.push("return this.data["+a+"]}"),i.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),i.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+s.map(function(p){return["(typeof i",p,"!=='number'||i",p,"<0)?this.shape[",p,"]:i",p,"|0"].join("")}).join(",")+","+s.map(function(p){return"this.stride["+p+"]"}).join(",")+",this.offset)}");var c=s.map(function(p){return"a"+p+"=this.shape["+p+"]"}),u=s.map(function(p){return"c"+p+"=this.stride["+p+"]"});i.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+u.join(","));for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){d=i"+h+"|0;b+=c"+h+"*d;a"+h+"-=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"c"+p}).join(",")+",b)}"),i.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+s.map(function(p){return"a"+p+"=this.shape["+p+"]"}).join(",")+","+s.map(function(p){return"b"+p+"=this.stride["+p+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'){d=i"+h+"|0;if(d<0){c+=b"+h+"*(a"+h+"-1);a"+h+"=ceil(-a"+h+"/d)}else{a"+h+"=ceil(a"+h+"/d)}b"+h+"*=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"b"+p}).join(",")+",c)}");for(var d=new Array(e),f=new Array(e),h=0;h<e;++h)d[h]="a[i"+h+"]",f[h]="b[i"+h+"]";i.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(p,C){return p+"=("+p+"===undefined?"+C+":"+p+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+d.join(",")+","+f.join(",")+",this.offset)}"),i.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){c=(c+this.stride["+h+"]*i"+h+")|0}else{a.push(this.shape["+h+"]);b.push(this.stride["+h+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+s.map(function(p){return"shape["+p+"]"}).join(",")+","+s.map(function(p){return"stride["+p+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",i.join(`
73
+ `));return g(ji[r],rg)}function ig(r){if(Zf(r))return"buffer";if(eg)switch(Object.prototype.toString.call(r)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(r)?"array":"generic"}var ji={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function sg(r,e,t,n){if(r===void 0){var A=ji.array[0];return A([])}else typeof r=="number"&&(r=[r]);e===void 0&&(e=[r.length]);var i=e.length;if(t===void 0){t=new Array(i);for(var s=i-1,o=1;s>=0;--s)t[s]=o,o*=e[s]}if(n===void 0){n=0;for(var s=0;s<i;++s)t[s]<0&&(n-=(e[s]-1)*t[s])}for(var a=ig(r),l=ji[a];l.length<=i+1;)l.push(ng(a,l.length-1));var A=l[i+1];return A(r,e,t,n)}var og=sg,aA={};function ag(r,e){for(var t=1,n=r.length,i=r[0],s=r[0],o=1;o<n;++o)if(s=i,i=r[o],e(i,s)){if(o===t){t++;continue}r[t++]=i}return r.length=t,r}function lg(r){for(var e=1,t=r.length,n=r[0],i=r[0],s=1;s<t;++s,i=n)if(i=n,n=r[s],n!==i){if(s===e){e++;continue}r[e++]=n}return r.length=e,r}function Ag(r,e,t){return r.length===0?r:e?(t||r.sort(e),ag(r,e)):(t||r.sort(),lg(r))}var cg=Ag,ug=cg;function lA(r,e,t){var n=r.length,i=e.arrayArgs.length,s=e.indexArgs.length>0,o=[],a=[],l=0,A=0,c,u;for(c=0;c<n;++c)a.push(["i",c,"=0"].join(""));for(u=0;u<i;++u)for(c=0;c<n;++c)A=l,l=r[c],c===0?a.push(["d",u,"s",c,"=t",u,"p",l].join("")):a.push(["d",u,"s",c,"=(t",u,"p",l,"-s",A,"*t",u,"p",A,")"].join(""));for(a.length>0&&o.push("var "+a.join(",")),c=n-1;c>=0;--c)l=r[c],o.push(["for(i",c,"=0;i",c,"<s",l,";++i",c,"){"].join(""));for(o.push(t),c=0;c<n;++c){for(A=l,l=r[c],u=0;u<i;++u)o.push(["p",u,"+=d",u,"s",c].join(""));s&&(c>0&&o.push(["index[",A,"]-=s",A].join("")),o.push(["++index[",l,"]"].join(""))),o.push("}")}return o.join(`
74
+ `)}function hg(r,e,t,n){for(var i=e.length,s=t.arrayArgs.length,o=t.blockSize,a=t.indexArgs.length>0,l=[],A=0;A<s;++A)l.push(["var offset",A,"=p",A].join(""));for(var A=r;A<i;++A)l.push(["for(var j"+A+"=SS[",e[A],"]|0;j",A,">0;){"].join("")),l.push(["if(j",A,"<",o,"){"].join("")),l.push(["s",e[A],"=j",A].join("")),l.push(["j",A,"=0"].join("")),l.push(["}else{s",e[A],"=",o].join("")),l.push(["j",A,"-=",o,"}"].join("")),a&&l.push(["index[",e[A],"]=j",A].join(""));for(var A=0;A<s;++A){for(var c=["offset"+A],u=r;u<i;++u)c.push(["j",u,"*t",A,"p",e[u]].join(""));l.push(["p",A,"=(",c.join("+"),")"].join(""))}l.push(lA(e,t,n));for(var A=r;A<i;++A)l.push("}");return l.join(`
75
+ `)}function dg(r){for(var e=0,t=r[0].length;e<t;){for(var n=1;n<r.length;++n)if(r[n][e]!==r[0][e])return e;++e}return e}function Bo(r,e,t){for(var n=r.body,i=[],s=[],o=0;o<r.args.length;++o){var a=r.args[o];if(!(a.count<=0)){var l=new RegExp(a.name,"g"),A="",c=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var u=e.offsetArgIndex.indexOf(o),h=e.offsetArgs[u];c=h.array,A="+q"+u;case"array":A="p"+c+A;var d="l"+o,f="a"+c;if(e.arrayBlockIndices[c]===0)a.count===1?t[c]==="generic"?a.lvalue?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),s.push([f,".set(",A,",",d,")"].join(""))):n=n.replace(l,[f,".get(",A,")"].join("")):n=n.replace(l,[f,"[",A,"]"].join("")):t[c]==="generic"?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,".set(",A,",",d,")"].join(""))):(i.push(["var ",d,"=",f,"[",A,"]"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,"[",A,"]=",d].join("")));else{for(var g=[a.name],p=[A],C=0;C<Math.abs(e.arrayBlockIndices[c]);C++)g.push("\\s*\\[([^\\]]+)\\]"),p.push("$"+(C+1)+"*t"+c+"b"+C);if(l=new RegExp(g.join(""),"g"),A=p.join("+"),t[c]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[f,"[",A,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape");break}}}return[i.join(`
76
76
  `),n,s.join(`
77
77
  `)].join(`
78
- `).trim()}function D0(r){for(var e=new Array(r.length),t=!0,n=0;n<r.length;++n){var i=r[n],s=i.match(/\d+/);s?s=s[0]:s="",i.charAt(0)===0?e[n]="u"+i.charAt(1)+s:e[n]=i.charAt(0)+s,n>0&&(t=t&&e[n]===e[n-1])}return t?e[0]:e.join("")}function _0(r,e){for(var t=e[1].length-Math.abs(r.arrayBlockIndices[0])|0,n=new Array(r.arrayArgs.length),i=new Array(r.arrayArgs.length),s=0;s<r.arrayArgs.length;++s)i[s]=e[2*s],n[s]=e[2*s+1];for(var o=[],a=[],l=[],A=[],c=[],s=0;s<r.arrayArgs.length;++s){r.arrayBlockIndices[s]<0?(l.push(0),A.push(t),o.push(t),a.push(t+r.arrayBlockIndices[s])):(l.push(r.arrayBlockIndices[s]),A.push(r.arrayBlockIndices[s]+t),o.push(0),a.push(r.arrayBlockIndices[s]));for(var u=[],h=0;h<n[s].length;h++)l[s]<=n[s][h]&&n[s][h]<A[s]&&u.push(n[s][h]-l[s]);c.push(u)}for(var d=["SS"],f=["'use strict'"],g=[],h=0;h<t;++h)g.push(["s",h,"=SS[",h,"]"].join(""));for(var s=0;s<r.arrayArgs.length;++s){d.push("a"+s),d.push("t"+s),d.push("p"+s);for(var h=0;h<t;++h)g.push(["t",s,"p",h,"=t",s,"[",l[s]+h,"]"].join(""));for(var h=0;h<Math.abs(r.arrayBlockIndices[s]);++h)g.push(["t",s,"b",h,"=t",s,"[",o[s]+h,"]"].join(""))}for(var s=0;s<r.scalarArgs.length;++s)d.push("Y"+s);if(r.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),r.indexArgs.length>0){for(var p=new Array(t),s=0;s<t;++s)p[s]="0";g.push(["index=[",p.join(","),"]"].join(""))}for(var s=0;s<r.offsetArgs.length;++s){for(var y=r.offsetArgs[s],Q=[],h=0;h<y.offset.length;++h)y.offset[h]!==0&&(y.offset[h]===1?Q.push(["t",y.array,"p",h].join("")):Q.push([y.offset[h],"*t",y.array,"p",h].join("")));Q.length===0?g.push("q"+s+"=0"):g.push(["q",s,"=",Q.join("+")].join(""))}var b=w0([].concat(r.pre.thisVars).concat(r.body.thisVars).concat(r.post.thisVars));g=g.concat(b),g.length>0&&f.push("var "+g.join(","));for(var s=0;s<r.arrayArgs.length;++s)f.push("p"+s+"|=0");r.pre.body.length>3&&f.push(Uo(r.pre,r,i));var v=Uo(r.body,r,i),w=R0(c);w<t?f.push(S0(w,c[0],r,v)):f.push(JA(c[0],r,v)),r.post.body.length>3&&f.push(Uo(r.post,r,i)),r.debug&&console.log("-----Generated cwise routine for ",e,`:
78
+ `).trim()}function fg(r){for(var e=new Array(r.length),t=!0,n=0;n<r.length;++n){var i=r[n],s=i.match(/\d+/);s?s=s[0]:s="",i.charAt(0)===0?e[n]="u"+i.charAt(1)+s:e[n]=i.charAt(0)+s,n>0&&(t=t&&e[n]===e[n-1])}return t?e[0]:e.join("")}function gg(r,e){for(var t=e[1].length-Math.abs(r.arrayBlockIndices[0])|0,n=new Array(r.arrayArgs.length),i=new Array(r.arrayArgs.length),s=0;s<r.arrayArgs.length;++s)i[s]=e[2*s],n[s]=e[2*s+1];for(var o=[],a=[],l=[],A=[],c=[],s=0;s<r.arrayArgs.length;++s){r.arrayBlockIndices[s]<0?(l.push(0),A.push(t),o.push(t),a.push(t+r.arrayBlockIndices[s])):(l.push(r.arrayBlockIndices[s]),A.push(r.arrayBlockIndices[s]+t),o.push(0),a.push(r.arrayBlockIndices[s]));for(var u=[],h=0;h<n[s].length;h++)l[s]<=n[s][h]&&n[s][h]<A[s]&&u.push(n[s][h]-l[s]);c.push(u)}for(var d=["SS"],f=["'use strict'"],g=[],h=0;h<t;++h)g.push(["s",h,"=SS[",h,"]"].join(""));for(var s=0;s<r.arrayArgs.length;++s){d.push("a"+s),d.push("t"+s),d.push("p"+s);for(var h=0;h<t;++h)g.push(["t",s,"p",h,"=t",s,"[",l[s]+h,"]"].join(""));for(var h=0;h<Math.abs(r.arrayBlockIndices[s]);++h)g.push(["t",s,"b",h,"=t",s,"[",o[s]+h,"]"].join(""))}for(var s=0;s<r.scalarArgs.length;++s)d.push("Y"+s);if(r.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),r.indexArgs.length>0){for(var p=new Array(t),s=0;s<t;++s)p[s]="0";g.push(["index=[",p.join(","),"]"].join(""))}for(var s=0;s<r.offsetArgs.length;++s){for(var C=r.offsetArgs[s],Q=[],h=0;h<C.offset.length;++h)C.offset[h]!==0&&(C.offset[h]===1?Q.push(["t",C.array,"p",h].join("")):Q.push([C.offset[h],"*t",C.array,"p",h].join("")));Q.length===0?g.push("q"+s+"=0"):g.push(["q",s,"=",Q.join("+")].join(""))}var b=ug([].concat(r.pre.thisVars).concat(r.body.thisVars).concat(r.post.thisVars));g=g.concat(b),g.length>0&&f.push("var "+g.join(","));for(var s=0;s<r.arrayArgs.length;++s)f.push("p"+s+"|=0");r.pre.body.length>3&&f.push(Bo(r.pre,r,i));var v=Bo(r.body,r,i),x=dg(c);x<t?f.push(hg(x,c[0],r,v)):f.push(lA(c[0],r,v)),r.post.body.length>3&&f.push(Bo(r.post,r,i)),r.debug&&console.log("-----Generated cwise routine for ",e,`:
79
79
  `+f.join(`
80
80
  `)+`
81
- ----------`);var R=[r.funcName||"unnamed","_cwise_loop_",n[0].join("s"),"m",w,D0(i)].join(""),k=new Function(["function ",R,"(",d.join(","),"){",f.join(`
82
- `),"} return ",R].join(""));return k()}var L0=_0,F0=L0;function k0(r){var e=["'use strict'","var CACHED={}"],t=[],n=r.funcName+"_cwise_thunk";e.push(["return function ",n,"(",r.shimArgs.join(","),"){"].join(""));for(var i=[],s=[],o=[["array",r.arrayArgs[0],".shape.slice(",Math.max(0,r.arrayBlockIndices[0]),r.arrayBlockIndices[0]<0?","+r.arrayBlockIndices[0]+")":")"].join("")],a=[],l=[],A=0;A<r.arrayArgs.length;++A){var c=r.arrayArgs[A];t.push(["t",c,"=array",c,".dtype,","r",c,"=array",c,".order"].join("")),i.push("t"+c),i.push("r"+c),s.push("t"+c),s.push("r"+c+".join()"),o.push("array"+c+".data"),o.push("array"+c+".stride"),o.push("array"+c+".offset|0"),A>0&&(a.push("array"+r.arrayArgs[0]+".shape.length===array"+c+".shape.length+"+(Math.abs(r.arrayBlockIndices[0])-Math.abs(r.arrayBlockIndices[A]))),l.push("array"+r.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[0])+"]===array"+c+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[A])+"]"))}r.arrayArgs.length>1&&(e.push("if (!("+a.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+r.arrayArgs[0]+".shape.length-"+Math.abs(r.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var A=0;A<r.scalarArgs.length;++A)o.push("scalar"+r.scalarArgs[A]);t.push(["type=[",s.join(","),"].join()"].join("")),t.push("proc=CACHED[type]"),e.push("var "+t.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",i.join(","),"])}","return proc(",o.join(","),")}"].join("")),r.debug&&console.log(`-----Generated thunk:
81
+ ----------`);var R=[r.funcName||"unnamed","_cwise_loop_",n[0].join("s"),"m",x,fg(i)].join(""),k=new Function(["function ",R,"(",d.join(","),"){",f.join(`
82
+ `),"} return ",R].join(""));return k()}var pg=gg,mg=pg;function Eg(r){var e=["'use strict'","var CACHED={}"],t=[],n=r.funcName+"_cwise_thunk";e.push(["return function ",n,"(",r.shimArgs.join(","),"){"].join(""));for(var i=[],s=[],o=[["array",r.arrayArgs[0],".shape.slice(",Math.max(0,r.arrayBlockIndices[0]),r.arrayBlockIndices[0]<0?","+r.arrayBlockIndices[0]+")":")"].join("")],a=[],l=[],A=0;A<r.arrayArgs.length;++A){var c=r.arrayArgs[A];t.push(["t",c,"=array",c,".dtype,","r",c,"=array",c,".order"].join("")),i.push("t"+c),i.push("r"+c),s.push("t"+c),s.push("r"+c+".join()"),o.push("array"+c+".data"),o.push("array"+c+".stride"),o.push("array"+c+".offset|0"),A>0&&(a.push("array"+r.arrayArgs[0]+".shape.length===array"+c+".shape.length+"+(Math.abs(r.arrayBlockIndices[0])-Math.abs(r.arrayBlockIndices[A]))),l.push("array"+r.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[0])+"]===array"+c+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[A])+"]"))}r.arrayArgs.length>1&&(e.push("if (!("+a.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+r.arrayArgs[0]+".shape.length-"+Math.abs(r.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var A=0;A<r.scalarArgs.length;++A)o.push("scalar"+r.scalarArgs[A]);t.push(["type=[",s.join(","),"].join()"].join("")),t.push("proc=CACHED[type]"),e.push("var "+t.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",i.join(","),"])}","return proc(",o.join(","),")}"].join("")),r.debug&&console.log(`-----Generated thunk:
83
83
  `+e.join(`
84
84
  `)+`
85
85
  ----------`);var u=new Function("compile",e.join(`
86
- `));return u(F0.bind(void 0,r))}var N0=k0,M0=N0;function P0(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function O0(r){var e=new P0;e.pre=r.pre,e.body=r.body,e.post=r.post;var t=r.args.slice(0);e.argTypes=t;for(var n=0;n<t.length;++n){var i=t[n];if(i==="array"||typeof i=="object"&&i.blockIndices){if(e.argTypes[n]="array",e.arrayArgs.push(n),e.arrayBlockIndices.push(i.blockIndices?i.blockIndices:0),e.shimArgs.push("array"+n),n<e.pre.args.length&&e.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array args");if(n<e.post.args.length&&e.post.args[n].count>0)throw new Error("cwise: post() block may not reference array args")}else if(i==="scalar")e.scalarArgs.push(n),e.shimArgs.push("scalar"+n);else if(i==="index"){if(e.indexArgs.push(n),n<e.pre.args.length&&e.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array index");if(n<e.body.args.length&&e.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array index");if(n<e.post.args.length&&e.post.args[n].count>0)throw new Error("cwise: post() block may not reference array index")}else if(i==="shape"){if(e.shapeArgs.push(n),n<e.pre.args.length&&e.pre.args[n].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(n<e.body.args.length&&e.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array shape");if(n<e.post.args.length&&e.post.args[n].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof i=="object"&&i.offset)e.argTypes[n]="offset",e.offsetArgs.push({array:i.array,offset:i.offset}),e.offsetArgIndex.push(n);else throw new Error("cwise: Unknown argument type "+t[n])}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>t.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>t.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>t.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!r.printCode||!!r.debug,e.funcName=r.funcName||"cwise",e.blockSize=r.blockSize||64,M0(e)}var U0=O0;(function(r){var e=U0,t={body:"",args:[],thisVars:[],localVars:[]};function n(h){if(!h)return t;for(var d=0;d<h.args.length;++d){var f=h.args[d];d===0?h.args[d]={name:f,lvalue:!0,rvalue:!!h.rvalue,count:h.count||1}:h.args[d]={name:f,lvalue:!1,rvalue:!0,count:1}}return h.thisVars||(h.thisVars=[]),h.localVars||(h.localVars=[]),h}function i(h){return e({args:h.args,pre:n(h.pre),body:n(h.body),post:n(h.proc),funcName:h.funcName})}function s(h){for(var d=[],f=0;f<h.args.length;++f)d.push("a"+f);var g=new Function("P",["return function ",h.funcName,"_ndarrayops(",d.join(","),") {P(",d.join(","),");return a0}"].join(""));return g(i(h))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var h in o){var d=o[h];r[h]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+d+"c"},funcName:h}),r[h+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a"+d+"=b"},rvalue:!0,funcName:h+"eq"}),r[h+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+d+"s"},funcName:h+"s"}),r[h+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a"+d+"=s"},rvalue:!0,funcName:h+"seq"})}})();var a={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var h in a){var d=a[h];r[h]=s({args:["array","array"],body:{args:["a","b"],body:"a="+d+"b"},funcName:h}),r[h+"eq"]=s({args:["array"],body:{args:["a"],body:"a="+d+"a"},rvalue:!0,count:2,funcName:h+"eq"})}})();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var h in l){var d=l[h];r[h]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+d+"c"},funcName:h}),r[h+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+d+"s"},funcName:h+"s"}),r[h+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a=a"+d+"b"},rvalue:!0,count:2,funcName:h+"eq"}),r[h+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+d+"s"},rvalue:!0,count:2,funcName:h+"seq"})}})();var A=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var h=0;h<A.length;++h){var d=A[h];r[d]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:d}),r[d+"eq"]=s({args:["array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"eq"})}})();var c=["max","min","atan2","pow"];(function(){for(var h=0;h<c.length;++h){var d=c[h];r[d]=s({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:d}),r[d+"s"]=s({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:d+"s"}),r[d+"eq"]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"eq"}),r[d+"seq"]=s({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"seq"})}})();var u=["atan2","pow"];(function(){for(var h=0;h<u.length;++h){var d=u[h];r[d+"op"]=s({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:d+"op"}),r[d+"ops"]=s({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:d+"ops"}),r[d+"opeq"]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"opeq"}),r[d+"opseq"]=s({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"opseq"})}})(),r.any=e({args:["array"],pre:t,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=e({args:["array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=e({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=e({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.argmin=e({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.argmax=e({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=s({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=s({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=s({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=e({args:["array","array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})(KA);var Ne={},ze={},Go=32;ze.INT_BITS=Go,ze.INT_MAX=2147483647,ze.INT_MIN=-1<<Go-1,ze.sign=function(r){return(r>0)-(r<0)},ze.abs=function(r){var e=r>>Go-1;return(r^e)-e},ze.min=function(r,e){return e^(r^e)&-(r<e)},ze.max=function(r,e){return r^(r^e)&-(r<e)},ze.isPow2=function(r){return!(r&r-1)&&!!r},ze.log2=function(r){var e,t;return e=(r>65535)<<4,r>>>=e,t=(r>255)<<3,r>>>=t,e|=t,t=(r>15)<<2,r>>>=t,e|=t,t=(r>3)<<1,r>>>=t,e|=t,e|r>>1},ze.log10=function(r){return r>=1e9?9:r>=1e8?8:r>=1e7?7:r>=1e6?6:r>=1e5?5:r>=1e4?4:r>=1e3?3:r>=100?2:r>=10?1:0},ze.popCount=function(r){return r=r-(r>>>1&1431655765),r=(r&858993459)+(r>>>2&858993459),(r+(r>>>4)&252645135)*16843009>>>24};function WA(r){var e=32;return r&=-r,r&&e--,r&65535&&(e-=16),r&16711935&&(e-=8),r&252645135&&(e-=4),r&858993459&&(e-=2),r&1431655765&&(e-=1),e}ze.countTrailingZeros=WA,ze.nextPow2=function(r){return r+=r===0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1},ze.prevPow2=function(r){return r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r-(r>>>1)},ze.parity=function(r){return r^=r>>>16,r^=r>>>8,r^=r>>>4,r&=15,27030>>>r&1};var li=new Array(256);(function(r){for(var e=0;e<256;++e){var t=e,n=e,i=7;for(t>>>=1;t;t>>>=1)n<<=1,n|=t&1,--i;r[e]=n<<i&255}})(li),ze.reverse=function(r){return li[r&255]<<24|li[r>>>8&255]<<16|li[r>>>16&255]<<8|li[r>>>24&255]},ze.interleave2=function(r,e){return r&=65535,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e&=65535,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1},ze.deinterleave2=function(r,e){return r=r>>>e&1431655765,r=(r|r>>>1)&858993459,r=(r|r>>>2)&252645135,r=(r|r>>>4)&16711935,r=(r|r>>>16)&65535,r<<16>>16},ze.interleave3=function(r,e,t){return r&=1023,r=(r|r<<16)&4278190335,r=(r|r<<8)&251719695,r=(r|r<<4)&3272356035,r=(r|r<<2)&1227133513,e&=1023,e=(e|e<<16)&4278190335,e=(e|e<<8)&251719695,e=(e|e<<4)&3272356035,e=(e|e<<2)&1227133513,r|=e<<1,t&=1023,t=(t|t<<16)&4278190335,t=(t|t<<8)&251719695,t=(t|t<<4)&3272356035,t=(t|t<<2)&1227133513,r|t<<2},ze.deinterleave3=function(r,e){return r=r>>>e&1227133513,r=(r|r>>>2)&3272356035,r=(r|r>>>4)&251719695,r=(r|r>>>8)&4278190335,r=(r|r>>>16)&1023,r<<22>>22},ze.nextCombination=function(r){var e=r|r-1;return e+1|(~e&-~e)-1>>>WA(r)+1};function qA(r,e,t){var n=r[t]|0;if(n<=0)return[];var i=new Array(n),s;if(t===r.length-1)for(s=0;s<n;++s)i[s]=e;else for(s=0;s<n;++s)i[s]=qA(r,e,t+1);return i}function G0(r,e){var t,n;for(t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function H0(r,e){switch(typeof e>"u"&&(e=0),typeof r){case"number":if(r>0)return G0(r|0,e);break;case"object":if(typeof r.length=="number")return qA(r,e,0);break}return[]}var $0=H0,jA={},os={};os.byteLength=K0,os.toByteArray=W0,os.fromByteArray=X0;for(var sr=[],Ht=[],Y0=typeof Uint8Array<"u"?Uint8Array:Array,Ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En=0,V0=Ho.length;En<V0;++En)sr[En]=Ho[En],Ht[Ho.charCodeAt(En)]=En;Ht[45]=62,Ht[95]=63;function XA(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function K0(r){var e=XA(r),t=e[0],n=e[1];return(t+n)*3/4-n}function J0(r,e,t){return(e+t)*3/4-t}function W0(r){var e,t=XA(r),n=t[0],i=t[1],s=new Y0(J0(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Ht[r.charCodeAt(l)]<<18|Ht[r.charCodeAt(l+1)]<<12|Ht[r.charCodeAt(l+2)]<<6|Ht[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Ht[r.charCodeAt(l)]<<2|Ht[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Ht[r.charCodeAt(l)]<<10|Ht[r.charCodeAt(l+1)]<<4|Ht[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function q0(r){return sr[r>>18&63]+sr[r>>12&63]+sr[r>>6&63]+sr[r&63]}function j0(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(q0(n));return i.join("")}function X0(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(j0(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(sr[e>>2]+sr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),i.join("")}var $o={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */$o.read=function(r,e,t,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,A=l>>1,c=-7,u=t?i-1:0,h=t?-1:1,d=r[e+u];for(u+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+r[e+u],u+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=o*256+r[e+u],u+=h,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-A}return(d?-1:1)*o*Math.pow(2,s-n)},$o.write=function(r,e,t,n,i,s){var o,a,l,A=s*8-i-1,c=(1<<A)-1,u=c>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,f=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=h/l:e+=h*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;r[t+d]=a&255,d+=f,a/=256,i-=8);for(o=o<<i|a,A+=i;A>0;r[t+d]=o&255,d+=f,o/=256,A-=8);r[t+d-f]|=g*128};/*!
86
+ `));return u(mg.bind(void 0,r))}var Ig=Eg,Cg=Ig;function vg(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function yg(r){var e=new vg;e.pre=r.pre,e.body=r.body,e.post=r.post;var t=r.args.slice(0);e.argTypes=t;for(var n=0;n<t.length;++n){var i=t[n];if(i==="array"||typeof i=="object"&&i.blockIndices){if(e.argTypes[n]="array",e.arrayArgs.push(n),e.arrayBlockIndices.push(i.blockIndices?i.blockIndices:0),e.shimArgs.push("array"+n),n<e.pre.args.length&&e.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array args");if(n<e.post.args.length&&e.post.args[n].count>0)throw new Error("cwise: post() block may not reference array args")}else if(i==="scalar")e.scalarArgs.push(n),e.shimArgs.push("scalar"+n);else if(i==="index"){if(e.indexArgs.push(n),n<e.pre.args.length&&e.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array index");if(n<e.body.args.length&&e.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array index");if(n<e.post.args.length&&e.post.args[n].count>0)throw new Error("cwise: post() block may not reference array index")}else if(i==="shape"){if(e.shapeArgs.push(n),n<e.pre.args.length&&e.pre.args[n].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(n<e.body.args.length&&e.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array shape");if(n<e.post.args.length&&e.post.args[n].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof i=="object"&&i.offset)e.argTypes[n]="offset",e.offsetArgs.push({array:i.array,offset:i.offset}),e.offsetArgIndex.push(n);else throw new Error("cwise: Unknown argument type "+t[n])}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>t.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>t.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>t.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!r.printCode||!!r.debug,e.funcName=r.funcName||"cwise",e.blockSize=r.blockSize||64,Cg(e)}var Bg=yg;(function(r){var e=Bg,t={body:"",args:[],thisVars:[],localVars:[]};function n(h){if(!h)return t;for(var d=0;d<h.args.length;++d){var f=h.args[d];d===0?h.args[d]={name:f,lvalue:!0,rvalue:!!h.rvalue,count:h.count||1}:h.args[d]={name:f,lvalue:!1,rvalue:!0,count:1}}return h.thisVars||(h.thisVars=[]),h.localVars||(h.localVars=[]),h}function i(h){return e({args:h.args,pre:n(h.pre),body:n(h.body),post:n(h.proc),funcName:h.funcName})}function s(h){for(var d=[],f=0;f<h.args.length;++f)d.push("a"+f);var g=new Function("P",["return function ",h.funcName,"_ndarrayops(",d.join(","),") {P(",d.join(","),");return a0}"].join(""));return g(i(h))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var h in o){var d=o[h];r[h]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+d+"c"},funcName:h}),r[h+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a"+d+"=b"},rvalue:!0,funcName:h+"eq"}),r[h+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+d+"s"},funcName:h+"s"}),r[h+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a"+d+"=s"},rvalue:!0,funcName:h+"seq"})}})();var a={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var h in a){var d=a[h];r[h]=s({args:["array","array"],body:{args:["a","b"],body:"a="+d+"b"},funcName:h}),r[h+"eq"]=s({args:["array"],body:{args:["a"],body:"a="+d+"a"},rvalue:!0,count:2,funcName:h+"eq"})}})();var l={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var h in l){var d=l[h];r[h]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+d+"c"},funcName:h}),r[h+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+d+"s"},funcName:h+"s"}),r[h+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a=a"+d+"b"},rvalue:!0,count:2,funcName:h+"eq"}),r[h+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+d+"s"},rvalue:!0,count:2,funcName:h+"seq"})}})();var A=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var h=0;h<A.length;++h){var d=A[h];r[d]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:d}),r[d+"eq"]=s({args:["array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"eq"})}})();var c=["max","min","atan2","pow"];(function(){for(var h=0;h<c.length;++h){var d=c[h];r[d]=s({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:d}),r[d+"s"]=s({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:d+"s"}),r[d+"eq"]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"eq"}),r[d+"seq"]=s({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"seq"})}})();var u=["atan2","pow"];(function(){for(var h=0;h<u.length;++h){var d=u[h];r[d+"op"]=s({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:d+"op"}),r[d+"ops"]=s({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:d+"ops"}),r[d+"opeq"]=s({args:["array","array"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"opeq"}),r[d+"opseq"]=s({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+d,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:d+"opseq"})}})(),r.any=e({args:["array"],pre:t,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=e({args:["array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=e({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=e({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.argmin=e({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.argmax=e({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=s({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=s({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=s({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=e({args:["array","array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})(aA);var Ne={},ze={},To=32;ze.INT_BITS=To,ze.INT_MAX=2147483647,ze.INT_MIN=-1<<To-1,ze.sign=function(r){return(r>0)-(r<0)},ze.abs=function(r){var e=r>>To-1;return(r^e)-e},ze.min=function(r,e){return e^(r^e)&-(r<e)},ze.max=function(r,e){return r^(r^e)&-(r<e)},ze.isPow2=function(r){return!(r&r-1)&&!!r},ze.log2=function(r){var e,t;return e=(r>65535)<<4,r>>>=e,t=(r>255)<<3,r>>>=t,e|=t,t=(r>15)<<2,r>>>=t,e|=t,t=(r>3)<<1,r>>>=t,e|=t,e|r>>1},ze.log10=function(r){return r>=1e9?9:r>=1e8?8:r>=1e7?7:r>=1e6?6:r>=1e5?5:r>=1e4?4:r>=1e3?3:r>=100?2:r>=10?1:0},ze.popCount=function(r){return r=r-(r>>>1&1431655765),r=(r&858993459)+(r>>>2&858993459),(r+(r>>>4)&252645135)*16843009>>>24};function AA(r){var e=32;return r&=-r,r&&e--,r&65535&&(e-=16),r&16711935&&(e-=8),r&252645135&&(e-=4),r&858993459&&(e-=2),r&1431655765&&(e-=1),e}ze.countTrailingZeros=AA,ze.nextPow2=function(r){return r+=r===0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1},ze.prevPow2=function(r){return r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r-(r>>>1)},ze.parity=function(r){return r^=r>>>16,r^=r>>>8,r^=r>>>4,r&=15,27030>>>r&1};var si=new Array(256);(function(r){for(var e=0;e<256;++e){var t=e,n=e,i=7;for(t>>>=1;t;t>>>=1)n<<=1,n|=t&1,--i;r[e]=n<<i&255}})(si),ze.reverse=function(r){return si[r&255]<<24|si[r>>>8&255]<<16|si[r>>>16&255]<<8|si[r>>>24&255]},ze.interleave2=function(r,e){return r&=65535,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e&=65535,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1},ze.deinterleave2=function(r,e){return r=r>>>e&1431655765,r=(r|r>>>1)&858993459,r=(r|r>>>2)&252645135,r=(r|r>>>4)&16711935,r=(r|r>>>16)&65535,r<<16>>16},ze.interleave3=function(r,e,t){return r&=1023,r=(r|r<<16)&4278190335,r=(r|r<<8)&251719695,r=(r|r<<4)&3272356035,r=(r|r<<2)&1227133513,e&=1023,e=(e|e<<16)&4278190335,e=(e|e<<8)&251719695,e=(e|e<<4)&3272356035,e=(e|e<<2)&1227133513,r|=e<<1,t&=1023,t=(t|t<<16)&4278190335,t=(t|t<<8)&251719695,t=(t|t<<4)&3272356035,t=(t|t<<2)&1227133513,r|t<<2},ze.deinterleave3=function(r,e){return r=r>>>e&1227133513,r=(r|r>>>2)&3272356035,r=(r|r>>>4)&251719695,r=(r|r>>>8)&4278190335,r=(r|r>>>16)&1023,r<<22>>22},ze.nextCombination=function(r){var e=r|r-1;return e+1|(~e&-~e)-1>>>AA(r)+1};function cA(r,e,t){var n=r[t]|0;if(n<=0)return[];var i=new Array(n),s;if(t===r.length-1)for(s=0;s<n;++s)i[s]=e;else for(s=0;s<n;++s)i[s]=cA(r,e,t+1);return i}function Tg(r,e){var t,n;for(t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Qg(r,e){switch(typeof e>"u"&&(e=0),typeof r){case"number":if(r>0)return Tg(r|0,e);break;case"object":if(typeof r.length=="number")return cA(r,e,0);break}return[]}var bg=Qg,uA={},zi={};zi.byteLength=Sg,zi.toByteArray=Dg,zi.fromByteArray=Fg;for(var sr=[],Ht=[],xg=typeof Uint8Array<"u"?Uint8Array:Array,Qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En=0,wg=Qo.length;En<wg;++En)sr[En]=Qo[En],Ht[Qo.charCodeAt(En)]=En;Ht[45]=62,Ht[95]=63;function hA(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Sg(r){var e=hA(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Rg(r,e,t){return(e+t)*3/4-t}function Dg(r){var e,t=hA(r),n=t[0],i=t[1],s=new xg(Rg(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Ht[r.charCodeAt(l)]<<18|Ht[r.charCodeAt(l+1)]<<12|Ht[r.charCodeAt(l+2)]<<6|Ht[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Ht[r.charCodeAt(l)]<<2|Ht[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Ht[r.charCodeAt(l)]<<10|Ht[r.charCodeAt(l+1)]<<4|Ht[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function _g(r){return sr[r>>18&63]+sr[r>>12&63]+sr[r>>6&63]+sr[r&63]}function Lg(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(_g(n));return i.join("")}function Fg(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(Lg(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(sr[e>>2]+sr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),i.join("")}var bo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */bo.read=function(r,e,t,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,A=l>>1,c=-7,u=t?i-1:0,h=t?-1:1,d=r[e+u];for(u+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+r[e+u],u+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=o*256+r[e+u],u+=h,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-A}return(d?-1:1)*o*Math.pow(2,s-n)},bo.write=function(r,e,t,n,i,s){var o,a,l,A=s*8-i-1,c=(1<<A)-1,u=c>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,f=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=h/l:e+=h*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;r[t+d]=a&255,d+=f,a/=256,i-=8);for(o=o<<i|a,A+=i;A>0;r[t+d]=o&255,d+=f,o/=256,A-=8);r[t+d-f]|=g*128};/*!
87
87
  * The buffer module from node.js, for the browser.
88
88
  *
89
89
  * @author Feross Aboukhadijeh <https://feross.org>
90
90
  * @license MIT
91
- */(function(r){var e=os,t=$o,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=Q,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var T=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(T,m),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');var m=new Uint8Array(T);return Object.setPrototypeOf(m,a.prototype),m}function a(T,m,E){if(typeof T=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(T)}return l(T,m,E)}a.poolSize=8192;function l(T,m,E){if(typeof T=="string")return h(T,m);if(ArrayBuffer.isView(T))return f(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(we(T,ArrayBuffer)||T&&we(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(we(T,SharedArrayBuffer)||T&&we(T.buffer,SharedArrayBuffer)))return g(T,m,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var x=T.valueOf&&T.valueOf();if(x!=null&&x!==T)return a.from(x,m,E);var M=p(T);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),m,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,m,E){return l(T,m,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function c(T,m,E){return A(T),T<=0?o(T):m!==void 0?typeof E=="string"?o(T).fill(m,E):o(T).fill(m):o(T)}a.alloc=function(T,m,E){return c(T,m,E)};function u(T){return A(T),o(T<0?0:y(T)|0)}a.allocUnsafe=function(T){return u(T)},a.allocUnsafeSlow=function(T){return u(T)};function h(T,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);var E=b(T,m)|0,x=o(E),M=x.write(T,m);return M!==E&&(x=x.slice(0,M)),x}function d(T){for(var m=T.length<0?0:y(T.length)|0,E=o(m),x=0;x<m;x+=1)E[x]=T[x]&255;return E}function f(T){if(we(T,Uint8Array)){var m=new Uint8Array(T);return g(m.buffer,m.byteOffset,m.byteLength)}return d(T)}function g(T,m,E){if(m<0||T.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<m+(E||0))throw new RangeError('"length" is outside of buffer bounds');var x;return m===void 0&&E===void 0?x=new Uint8Array(T):E===void 0?x=new Uint8Array(T,m):x=new Uint8Array(T,m,E),Object.setPrototypeOf(x,a.prototype),x}function p(T){if(a.isBuffer(T)){var m=y(T.length)|0,E=o(m);return E.length===0||T.copy(E,0,0,m),E}if(T.length!==void 0)return typeof T.length!="number"||We(T.length)?o(0):d(T);if(T.type==="Buffer"&&Array.isArray(T.data))return d(T.data)}function y(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function Q(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,E){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),we(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(m)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===E)return 0;for(var x=m.length,M=E.length,z=0,X=Math.min(x,M);z<X;++z)if(m[z]!==E[z]){x=m[z],M=E[z];break}return x<M?-1:M<x?1:0},a.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(m,E){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);var x;if(E===void 0)for(E=0,x=0;x<m.length;++x)E+=m[x].length;var M=a.allocUnsafe(E),z=0;for(x=0;x<m.length;++x){var X=m[x];if(we(X,Uint8Array))z+X.length>M.length?a.from(X).copy(M,z):Uint8Array.prototype.set.call(M,X,z);else if(a.isBuffer(X))X.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=X.length}return M};function b(T,m){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||we(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&E===0)return 0;for(var M=!1;;)switch(m){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Le(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Qe(T).length;default:if(M)return x?-1:Le(T).length;m=(""+m).toLowerCase(),M=!0}}a.byteLength=b;function v(T,m,E){var x=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,m>>>=0,E<=m))return"";for(T||(T="utf8");;)switch(T){case"hex":return S(this,m,E);case"utf8":case"utf-8":return le(this,m,E);case"ascii":return j(this,m,E);case"latin1":case"binary":return _(this,m,E);case"base64":return te(this,m,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,m,E);default:if(x)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),x=!0}}a.prototype._isBuffer=!0;function w(T,m,E){var x=T[m];T[m]=T[E],T[E]=x}a.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<m;E+=2)w(this,E,E+1);return this},a.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<m;E+=4)w(this,E,E+3),w(this,E+1,E+2);return this},a.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<m;E+=8)w(this,E,E+7),w(this,E+1,E+6),w(this,E+2,E+5),w(this,E+3,E+4);return this},a.prototype.toString=function(){var m=this.length;return m===0?"":arguments.length===0?le(this,0,m):v.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){var m="",E=r.INSPECT_MAX_BYTES;return m=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(m+=" ... "),"<Buffer "+m+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(m,E,x,M,z){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(E===void 0&&(E=0),x===void 0&&(x=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),E<0||x>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&E>=x)return 0;if(M>=z)return-1;if(E>=x)return 1;if(E>>>=0,x>>>=0,M>>>=0,z>>>=0,this===m)return 0;for(var X=z-M,Ie=x-E,be=Math.min(X,Ie),De=this.slice(M,z),ke=m.slice(E,x),_e=0;_e<be;++_e)if(De[_e]!==ke[_e]){X=De[_e],Ie=ke[_e];break}return X<Ie?-1:Ie<X?1:0};function R(T,m,E,x,M){if(T.length===0)return-1;if(typeof E=="string"?(x=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,We(E)&&(E=M?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(M)return-1;E=T.length-1}else if(E<0)if(M)E=0;else return-1;if(typeof m=="string"&&(m=a.from(m,x)),a.isBuffer(m))return m.length===0?-1:k(T,m,E,x,M);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?M?Uint8Array.prototype.indexOf.call(T,m,E):Uint8Array.prototype.lastIndexOf.call(T,m,E):k(T,[m],E,x,M);throw new TypeError("val must be string, number or Buffer")}function k(T,m,E,x,M){var z=1,X=T.length,Ie=m.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(T.length<2||m.length<2)return-1;z=2,X/=2,Ie/=2,E/=2}function be(ut,Ut){return z===1?ut[Ut]:ut.readUInt16BE(Ut*z)}var De;if(M){var ke=-1;for(De=E;De<X;De++)if(be(T,De)===be(m,ke===-1?0:De-ke)){if(ke===-1&&(ke=De),De-ke+1===Ie)return ke*z}else ke!==-1&&(De-=De-ke),ke=-1}else for(E+Ie>X&&(E=X-Ie),De=E;De>=0;De--){for(var _e=!0,Mt=0;Mt<Ie;Mt++)if(be(T,De+Mt)!==be(m,Mt)){_e=!1;break}if(_e)return De}return-1}a.prototype.includes=function(m,E,x){return this.indexOf(m,E,x)!==-1},a.prototype.indexOf=function(m,E,x){return R(this,m,E,x,!0)},a.prototype.lastIndexOf=function(m,E,x){return R(this,m,E,x,!1)};function H(T,m,E,x){E=Number(E)||0;var M=T.length-E;x?(x=Number(x),x>M&&(x=M)):x=M;var z=m.length;x>z/2&&(x=z/2);for(var X=0;X<x;++X){var Ie=parseInt(m.substr(X*2,2),16);if(We(Ie))return X;T[E+X]=Ie}return X}function V(T,m,E,x){return Me(Le(m,T.length-E),T,E,x)}function O(T,m,E,x){return Me(Ge(m),T,E,x)}function W(T,m,E,x){return Me(Qe(m),T,E,x)}function ie(T,m,E,x){return Me(fe(m,T.length-E),T,E,x)}a.prototype.write=function(m,E,x,M){if(E===void 0)M="utf8",x=this.length,E=0;else if(x===void 0&&typeof E=="string")M=E,x=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(x)?(x=x>>>0,M===void 0&&(M="utf8")):(M=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var z=this.length-E;if((x===void 0||x>z)&&(x=z),m.length>0&&(x<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");for(var X=!1;;)switch(M){case"hex":return H(this,m,E,x);case"utf8":case"utf-8":return V(this,m,E,x);case"ascii":case"latin1":case"binary":return O(this,m,E,x);case"base64":return W(this,m,E,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,E,x);default:if(X)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),X=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function te(T,m,E){return m===0&&E===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(m,E))}function le(T,m,E){E=Math.min(T.length,E);for(var x=[],M=m;M<E;){var z=T[M],X=null,Ie=z>239?4:z>223?3:z>191?2:1;if(M+Ie<=E){var be,De,ke,_e;switch(Ie){case 1:z<128&&(X=z);break;case 2:be=T[M+1],(be&192)===128&&(_e=(z&31)<<6|be&63,_e>127&&(X=_e));break;case 3:be=T[M+1],De=T[M+2],(be&192)===128&&(De&192)===128&&(_e=(z&15)<<12|(be&63)<<6|De&63,_e>2047&&(_e<55296||_e>57343)&&(X=_e));break;case 4:be=T[M+1],De=T[M+2],ke=T[M+3],(be&192)===128&&(De&192)===128&&(ke&192)===128&&(_e=(z&15)<<18|(be&63)<<12|(De&63)<<6|ke&63,_e>65535&&_e<1114112&&(X=_e))}}X===null?(X=65533,Ie=1):X>65535&&(X-=65536,x.push(X>>>10&1023|55296),X=56320|X&1023),x.push(X),M+=Ie}return P(x)}var D=4096;function P(T){var m=T.length;if(m<=D)return String.fromCharCode.apply(String,T);for(var E="",x=0;x<m;)E+=String.fromCharCode.apply(String,T.slice(x,x+=D));return E}function j(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]&127);return x}function _(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]);return x}function S(T,m,E){var x=T.length;(!m||m<0)&&(m=0),(!E||E<0||E>x)&&(E=x);for(var M="",z=m;z<E;++z)M+=Te[T[z]];return M}function F(T,m,E){for(var x=T.slice(m,E),M="",z=0;z<x.length-1;z+=2)M+=String.fromCharCode(x[z]+x[z+1]*256);return M}a.prototype.slice=function(m,E){var x=this.length;m=~~m,E=E===void 0?x:~~E,m<0?(m+=x,m<0&&(m=0)):m>x&&(m=x),E<0?(E+=x,E<0&&(E=0)):E>x&&(E=x),E<m&&(E=m);var M=this.subarray(m,E);return Object.setPrototypeOf(M,a.prototype),M};function J(T,m,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+m>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m],z=1,X=0;++X<E&&(z*=256);)M+=this[m+X]*z;return M},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m+--E],z=1;E>0&&(z*=256);)M+=this[m+--E]*z;return M},a.prototype.readUint8=a.prototype.readUInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m],z=1,X=0;++X<E&&(z*=256);)M+=this[m+X]*z;return z*=128,M>=z&&(M-=Math.pow(2,8*E)),M},a.prototype.readIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=E,z=1,X=this[m+--M];M>0&&(z*=256);)X+=this[m+--M]*z;return z*=128,X>=z&&(X-=Math.pow(2,8*E)),X},a.prototype.readInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,E){m=m>>>0,E||J(m,2,this.length);var x=this[m]|this[m+1]<<8;return x&32768?x|4294901760:x},a.prototype.readInt16BE=function(m,E){m=m>>>0,E||J(m,2,this.length);var x=this[m+1]|this[m]<<8;return x&32768?x|4294901760:x},a.prototype.readInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readFloatLE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!1,52,8)};function Y(T,m,E,x,M,z){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>M||m<z)throw new RangeError('"value" argument is out of bounds');if(E+x>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var X=1,Ie=0;for(this[E]=m&255;++Ie<x&&(X*=256);)this[E+Ie]=m/X&255;return E+x},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var X=x-1,Ie=1;for(this[E+X]=m&255;--X>=0&&(Ie*=256);)this[E+X]=m/Ie&255;return E+x},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,255,0),this[E]=m&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E+3]=m>>>24,this[E+2]=m>>>16,this[E+1]=m>>>8,this[E]=m&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4},a.prototype.writeIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var X=0,Ie=1,be=0;for(this[E]=m&255;++X<x&&(Ie*=256);)m<0&&be===0&&this[E+X-1]!==0&&(be=1),this[E+X]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var X=x-1,Ie=1,be=0;for(this[E+X]=m&255;--X>=0&&(Ie*=256);)m<0&&be===0&&this[E+X+1]!==0&&(be=1),this[E+X]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,127,-128),m<0&&(m=255+m+1),this[E]=m&255,E+1},a.prototype.writeInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),this[E]=m&255,this[E+1]=m>>>8,this[E+2]=m>>>16,this[E+3]=m>>>24,E+4},a.prototype.writeInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4};function ne(T,m,E,x,M,z){if(E+x>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ce(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,4),t.write(T,m,E,x,23,4),E+4}a.prototype.writeFloatLE=function(m,E,x){return ce(this,m,E,!0,x)},a.prototype.writeFloatBE=function(m,E,x){return ce(this,m,E,!1,x)};function pe(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,8),t.write(T,m,E,x,52,8),E+8}a.prototype.writeDoubleLE=function(m,E,x){return pe(this,m,E,!0,x)},a.prototype.writeDoubleBE=function(m,E,x){return pe(this,m,E,!1,x)},a.prototype.copy=function(m,E,x,M){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(x||(x=0),!M&&M!==0&&(M=this.length),E>=m.length&&(E=m.length),E||(E=0),M>0&&M<x&&(M=x),M===x||m.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-E<M-x&&(M=m.length-E+x);var z=M-x;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,x,M):Uint8Array.prototype.set.call(m,this.subarray(x,M),E),z},a.prototype.fill=function(m,E,x,M){if(typeof m=="string"){if(typeof E=="string"?(M=E,E=0,x=this.length):typeof x=="string"&&(M=x,x=this.length),M!==void 0&&typeof M!="string")throw new TypeError("encoding must be a string");if(typeof M=="string"&&!a.isEncoding(M))throw new TypeError("Unknown encoding: "+M);if(m.length===1){var z=m.charCodeAt(0);(M==="utf8"&&z<128||M==="latin1")&&(m=z)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(E<0||this.length<E||this.length<x)throw new RangeError("Out of range index");if(x<=E)return this;E=E>>>0,x=x===void 0?this.length:x>>>0,m||(m=0);var X;if(typeof m=="number")for(X=E;X<x;++X)this[X]=m;else{var Ie=a.isBuffer(m)?m:a.from(m,M),be=Ie.length;if(be===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(X=0;X<x-E;++X)this[X+E]=Ie[X%be]}return this};var ge=/[^+/0-9A-Za-z-_]/g;function Se(T){if(T=T.split("=")[0],T=T.trim().replace(ge,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Le(T,m){m=m||1/0;for(var E,x=T.length,M=null,z=[],X=0;X<x;++X){if(E=T.charCodeAt(X),E>55295&&E<57344){if(!M){if(E>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(X+1===x){(m-=3)>-1&&z.push(239,191,189);continue}M=E;continue}if(E<56320){(m-=3)>-1&&z.push(239,191,189),M=E;continue}E=(M-55296<<10|E-56320)+65536}else M&&(m-=3)>-1&&z.push(239,191,189);if(M=null,E<128){if((m-=1)<0)break;z.push(E)}else if(E<2048){if((m-=2)<0)break;z.push(E>>6|192,E&63|128)}else if(E<65536){if((m-=3)<0)break;z.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((m-=4)<0)break;z.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return z}function Ge(T){for(var m=[],E=0;E<T.length;++E)m.push(T.charCodeAt(E)&255);return m}function fe(T,m){for(var E,x,M,z=[],X=0;X<T.length&&!((m-=2)<0);++X)E=T.charCodeAt(X),x=E>>8,M=E%256,z.push(M),z.push(x);return z}function Qe(T){return e.toByteArray(Se(T))}function Me(T,m,E,x){for(var M=0;M<x&&!(M+E>=m.length||M>=T.length);++M)m[M+E]=T[M];return M}function we(T,m){return T instanceof m||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===m.name}function We(T){return T!==T}var Te=function(){for(var T="0123456789abcdef",m=new Array(256),E=0;E<16;++E)for(var x=E*16,M=0;M<16;++M)m[x+M]=T[E]+T[M];return m}()})(jA);var Mr=ze,vt=$0,zA=jA.Buffer;mn.__TYPEDARRAY_POOL||(mn.__TYPEDARRAY_POOL={UINT8:vt([32,0]),UINT16:vt([32,0]),UINT32:vt([32,0]),BIGUINT64:vt([32,0]),INT8:vt([32,0]),INT16:vt([32,0]),INT32:vt([32,0]),BIGINT64:vt([32,0]),FLOAT:vt([32,0]),DOUBLE:vt([32,0]),DATA:vt([32,0]),UINT8C:vt([32,0]),BUFFER:vt([32,0])});var z0=typeof Uint8ClampedArray<"u",Z0=typeof BigUint64Array<"u",ep=typeof BigInt64Array<"u",rt=mn.__TYPEDARRAY_POOL;rt.UINT8C||(rt.UINT8C=vt([32,0])),rt.BIGUINT64||(rt.BIGUINT64=vt([32,0])),rt.BIGINT64||(rt.BIGINT64=vt([32,0])),rt.BUFFER||(rt.BUFFER=vt([32,0]));var as=rt.DATA,ls=rt.BUFFER;Ne.free=function(e){if(zA.isBuffer(e))ls[Mr.log2(e.length)].push(e);else{if(Object.prototype.toString.call(e)!=="[object ArrayBuffer]"&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=Mr.log2(t)|0;as[n].push(e)}};function ZA(r){if(r){var e=r.length||r.byteLength,t=Mr.log2(e);as[t].push(r)}}function tp(r){ZA(r.buffer)}Ne.freeUint8=Ne.freeUint16=Ne.freeUint32=Ne.freeBigUint64=Ne.freeInt8=Ne.freeInt16=Ne.freeInt32=Ne.freeBigInt64=Ne.freeFloat32=Ne.freeFloat=Ne.freeFloat64=Ne.freeDouble=Ne.freeUint8Clamped=Ne.freeDataView=tp,Ne.freeArrayBuffer=ZA,Ne.freeBuffer=function(e){ls[Mr.log2(e.length)].push(e)},Ne.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Dt(e);switch(t){case"uint8":return Yo(e);case"uint16":return ec(e);case"uint32":return tc(e);case"int8":return rc(e);case"int16":return nc(e);case"int32":return ic(e);case"float":case"float32":return sc(e);case"double":case"float64":return oc(e);case"uint8_clamped":return ac(e);case"bigint64":return Ac(e);case"biguint64":return lc(e);case"buffer":return uc(e);case"data":case"dataview":return cc(e);default:return null}return null};function Dt(e){var e=Mr.nextPow2(e),t=Mr.log2(e),n=as[t];return n.length>0?n.pop():new ArrayBuffer(e)}Ne.mallocArrayBuffer=Dt;function Yo(r){return new Uint8Array(Dt(r),0,r)}Ne.mallocUint8=Yo;function ec(r){return new Uint16Array(Dt(2*r),0,r)}Ne.mallocUint16=ec;function tc(r){return new Uint32Array(Dt(4*r),0,r)}Ne.mallocUint32=tc;function rc(r){return new Int8Array(Dt(r),0,r)}Ne.mallocInt8=rc;function nc(r){return new Int16Array(Dt(2*r),0,r)}Ne.mallocInt16=nc;function ic(r){return new Int32Array(Dt(4*r),0,r)}Ne.mallocInt32=ic;function sc(r){return new Float32Array(Dt(4*r),0,r)}Ne.mallocFloat32=Ne.mallocFloat=sc;function oc(r){return new Float64Array(Dt(8*r),0,r)}Ne.mallocFloat64=Ne.mallocDouble=oc;function ac(r){return z0?new Uint8ClampedArray(Dt(r),0,r):Yo(r)}Ne.mallocUint8Clamped=ac;function lc(r){return Z0?new BigUint64Array(Dt(8*r),0,r):null}Ne.mallocBigUint64=lc;function Ac(r){return ep?new BigInt64Array(Dt(8*r),0,r):null}Ne.mallocBigInt64=Ac;function cc(r){return new DataView(Dt(r),0,r)}Ne.mallocDataView=cc;function uc(r){r=Mr.nextPow2(r);var e=Mr.log2(r),t=ls[e];return t.length>0?t.pop():new zA(r)}Ne.mallocBuffer=uc,Ne.clearCache=function(){for(var e=0;e<32;++e)rt.UINT8[e].length=0,rt.UINT16[e].length=0,rt.UINT32[e].length=0,rt.INT8[e].length=0,rt.INT16[e].length=0,rt.INT32[e].length=0,rt.FLOAT[e].length=0,rt.DOUBLE[e].length=0,rt.BIGUINT64[e].length=0,rt.BIGINT64[e].length=0,rt.UINT8C[e].length=0,as[e].length=0,ls[e].length=0};var As=B0,Vo=KA,In=Ne,rp=ap,cs=null,Ko=null,us=null;function np(r){cs=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],Ko=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],us=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function hc(r){return typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof ImageData<"u"&&r instanceof ImageData}var dc=function(r,e){Vo.muls(r,e,255)};function Jo(r,e,t){var n=r.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||t<0||t>i)throw new Error("gl-texture2d: Invalid texture size");return r._shape=[e,t],r.bind(),n.texImage2D(n.TEXTURE_2D,0,r.format,e,t,0,r.format,r.type,null),r._mipLevels=[0],r}function hs(r,e,t,n,i,s){this.gl=r,this.handle=e,this.format=i,this.type=s,this._shape=[t,n],this._mipLevels=[0],this._magFilter=r.NEAREST,this._minFilter=r.NEAREST,this._wrapS=r.CLAMP_TO_EDGE,this._wrapT=r.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,a=[this._wrapS,this._wrapT];Object.defineProperties(a,[{get:function(){return o._wrapS},set:function(A){return o.wrapS=A}},{get:function(){return o._wrapT},set:function(A){return o.wrapT=A}}]),this._wrapVector=a;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(A){return o.width=A}},{get:function(){return o._shape[1]},set:function(A){return o.height=A}}]),this._shapeVector=l}var Ai=hs.prototype;Object.defineProperties(Ai,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&cs.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),Ko.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r),this._minFilter=r}},magFilter:{get:function(){return this._magFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&cs.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),Ko.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),this._magFilter=r}},mipSamples:{get:function(){return this._anisoSamples},set:function(r){var e=this._anisoSamples;if(this._anisoSamples=Math.max(r,1)|0,e!==this._anisoSamples){var t=this.gl.getExtension("EXT_texture_filter_anisotropic");t&&this.gl.texParameterf(this.gl.TEXTURE_2D,t.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(r){if(this.bind(),us.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,r),this._wrapS=r}},wrapT:{get:function(){return this._wrapT},set:function(r){if(this.bind(),us.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,r),this._wrapT=r}},wrap:{get:function(){return this._wrapVector},set:function(r){if(Array.isArray(r)||(r=[r,r]),r.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(us.indexOf(r[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);this._wrapS=r[0],this._wrapT=r[1];var t=this.gl;return this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT),r}},shape:{get:function(){return this._shapeVector},set:function(r){if(!Array.isArray(r))r=[r|0,r|0];else if(r.length!==2)throw new Error("gl-texture2d: Invalid texture shape");return Jo(this,r[0]|0,r[1]|0),[r[0]|0,r[1]|0]}},width:{get:function(){return this._shape[0]},set:function(r){return r=r|0,Jo(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,Jo(this,this._shape[0],r),r}}}),Ai.bind=function(r){var e=this.gl;return r!==void 0&&e.activeTexture(e.TEXTURE0+(r|0)),e.bindTexture(e.TEXTURE_2D,this.handle),r!==void 0?r|0:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},Ai.dispose=function(){this.gl.deleteTexture(this.handle)},Ai.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var r=Math.min(this._shape[0],this._shape[1]),e=0;r>0;++e,r>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},Ai.setPixels=function(r,e,t,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=t,t=e[1]|0,e=e[0]|0):(e=e||0,t=t||0),n=n||0;var s=hc(r)?r:r.raw;if(s){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,t,this.format,this.type,s)}else if(r.shape&&r.stride&&r.data){if(r.shape.length<2||e+r.shape[1]>this._shape[1]>>>n||t+r.shape[0]>this._shape[0]>>>n||e<0||t<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");ip(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function fc(r,e){return r.length===3?e[2]===1&&e[1]===r[0]*r[2]&&e[0]===r[2]:e[0]===1&&e[1]===r[0]}function ip(r,e,t,n,i,s,o,a){var l=a.dtype,A=a.shape.slice();if(A.length<2||A.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,u=0,h=fc(A,a.stride.slice());if(l==="float32"?c=r.FLOAT:l==="float64"?(c=r.FLOAT,h=!1,l="float32"):l==="uint8"?c=r.UNSIGNED_BYTE:(c=r.UNSIGNED_BYTE,h=!1,l="uint8"),A.length===2)u=r.LUMINANCE,A=[A[0],A[1],1],a=As(a.data,A,[a.stride[0],a.stride[1],1],a.offset);else if(A.length===3){if(A[2]===1)u=r.ALPHA;else if(A[2]===2)u=r.LUMINANCE_ALPHA;else if(A[2]===3)u=r.RGB;else if(A[2]===4)u=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");A[2]}else throw new Error("gl-texture2d: Invalid shape for texture");if((u===r.LUMINANCE||u===r.ALPHA)&&(i===r.LUMINANCE||i===r.ALPHA)&&(u=i),u!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var d=a.size,f=o.indexOf(n)<0;if(f&&o.push(n),c===s&&h)a.offset===0&&a.data.length===d?f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data):f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data.subarray(a.offset,a.offset+d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data.subarray(a.offset,a.offset+d));else{var g;s===r.FLOAT?g=In.mallocFloat32(d):g=In.mallocUint8(d);var p=As(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?dc(p,a):Vo.assign(p,a),f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,g.subarray(0,d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,g.subarray(0,d)),s===r.FLOAT?In.freeFloat32(g):In.freeUint8(g)}}function Wo(r){var e=r.createTexture();return r.bindTexture(r.TEXTURE_2D,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e}function gc(r,e,t,n,i){var s=r.getParameter(r.MAX_TEXTURE_SIZE);if(e<0||e>s||t<0||t>s)throw new Error("gl-texture2d: Invalid texture shape");if(i===r.FLOAT&&!r.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=Wo(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new hs(r,o,e,t,n,i)}function sp(r,e,t,n,i,s){var o=Wo(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new hs(r,o,t,n,i,s)}function op(r,e){var t=e.dtype,n=e.shape.slice(),i=r.getParameter(r.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=fc(n,e.stride.slice()),o=0;t==="float32"?o=r.FLOAT:t==="float64"?(o=r.FLOAT,s=!1,t="float32"):t==="uint8"?o=r.UNSIGNED_BYTE:(o=r.UNSIGNED_BYTE,s=!1,t="uint8");var a=0;if(n.length===2)a=r.LUMINANCE,n=[n[0],n[1],1],e=As(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else if(n.length===3)if(n[2]===1)a=r.ALPHA;else if(n[2]===2)a=r.LUMINANCE_ALPHA;else if(n[2]===3)a=r.RGB;else if(n[2]===4)a=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");else throw new Error("gl-texture2d: Invalid shape for texture");o===r.FLOAT&&!r.getExtension("OES_texture_float")&&(o=r.UNSIGNED_BYTE,s=!1);var l,A,c=e.size;if(s)e.offset===0&&e.data.length===c?l=e.data:l=e.data.subarray(e.offset,e.offset+c);else{var u=[n[2],n[2]*n[0],1];A=In.malloc(c,t);var h=As(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?dc(h,e):Vo.assign(h,e),l=A.subarray(0,c)}var d=Wo(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||In.free(A),new hs(r,d,n[0],n[1],a,o)}function ap(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(cs||np(r),typeof arguments[1]=="number")return gc(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return gc(r,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(typeof arguments[1]=="object"){var e=arguments[1],t=hc(e)?e:e.raw;if(t)return sp(r,t,e.width|0,e.height|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return op(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const ds=Fo(rp);var pc={},mc=lp;function lp(r,e){for(var t={},n=0;n<r.length;++n)for(var i=r[n].name,s=i.split("."),o=t,a=0;a<s.length;++a){var l=s[a].split("[");if(l.length>1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var A=1;A<l.length;++A){var c=parseInt(l[A]);A<l.length-1||a<s.length-1?(c in o||(A<l.length-1?o[c]=[]:o[c]={}),o=o[c]):e?o[c]=n:o[c]=r[n].type}}else a<s.length-1?(l[0]in o||(o[l[0]]={}),o=o[l[0]]):e?o[l[0]]=n:o[l[0]]=r[n].type}return t}function ci(r,e,t){this.shortMessage=e||"",this.longMessage=t||"",this.rawError=r||"",this.message="gl-shader: "+(e||r||"")+(t?`
92
- `+t:""),this.stack=new Error().stack}ci.prototype=new Error,ci.prototype.name="GLError",ci.prototype.constructor=ci;var fs=ci,Ap=mc,zr=fs,cp=up;function Ec(r){return function(){return r}}function qo(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function up(r,e,t,n){function i(u){return function(h,d,f){return h.getUniform(d.program,f[u])}}function s(u){return function(d){for(var f=o("",u),g=0;g<f.length;++g){var p=f[g],y=p[0],Q=p[1];if(n[Q]){var b=d;if(typeof y=="string"&&(y.indexOf(".")===0||y.indexOf("[")===0)){var v=y;if(y.indexOf(".")===0&&(v=y.slice(1)),v.indexOf("]")===v.length-1){var w=v.indexOf("["),R=v.slice(0,w),k=v.slice(w+1,v.length-1);b=R?d[R][k]:d[k]}else b=d[v]}var H=t[Q].type,V;switch(H){case"bool":case"int":case"sampler2D":case"samplerCube":r.uniform1i(n[Q],b);break;case"float":r.uniform1f(n[Q],b);break;default:var O=H.indexOf("vec");if(0<=O&&O<=1&&H.length===4+O){if(V=H.charCodeAt(H.length-1)-48,V<2||V>4)throw new zr("","Invalid data type");switch(H.charAt(0)){case"b":case"i":r["uniform"+V+"iv"](n[Q],b);break;case"v":r["uniform"+V+"fv"](n[Q],b);break;default:throw new zr("","Unrecognized data type for vector "+name+": "+H)}}else if(H.indexOf("mat")===0&&H.length===4){if(V=H.charCodeAt(H.length-1)-48,V<2||V>4)throw new zr("","Invalid uniform dimension type for matrix "+name+": "+H);r["uniformMatrix"+V+"fv"](n[Q],!1,b);break}else throw new zr("","Unknown uniform data type for "+name+": "+H)}}}}}function o(u,h){if(typeof h!="object")return[[u,h]];var d=[];for(var f in h){var g=h[f],p=u;parseInt(f)+""===f?p+="["+f+"]":p+="."+f,typeof g=="object"?d.push.apply(d,o(p,g)):d.push([p,g])}return d}function a(u){switch(u){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var h=u.indexOf("vec");if(0<=h&&h<=1&&u.length===4+h){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new zr("","Invalid data type");return u.charAt(0)==="b"?qo(d,!1):qo(d,0)}else if(u.indexOf("mat")===0&&u.length===4){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new zr("","Invalid uniform dimension type for matrix "+name+": "+u);return qo(d*d,0)}else throw new zr("","Unknown uniform data type for "+name+": "+u)}}function l(u,h,d){if(typeof d=="object"){var f=A(d);Object.defineProperty(u,h,{get:Ec(f),set:s(d),enumerable:!0,configurable:!1})}else n[d]?Object.defineProperty(u,h,{get:i(d),set:s(d),enumerable:!0,configurable:!1}):u[h]=a(t[d].type)}function A(u){var h;if(Array.isArray(u)){h=new Array(u.length);for(var d=0;d<u.length;++d)l(h,d,u[d])}else{h={};for(var f in u)l(h,f,u[f])}return h}var c=Ap(t,!0);return{get:Ec(A(c)),set:s(c),enumerable:!0,configurable:!0}}var hp=gp,jo=fs;function Ic(r,e,t,n,i,s){this._gl=r,this._wrapper=e,this._index=t,this._locations=n,this._dimension=i,this._constFunc=s}var Xo=Ic.prototype;Xo.pointer=function(e,t,n,i){var s=this,o=s._gl,a=s._locations[s._index];o.vertexAttribPointer(a,s._dimension,e||o.FLOAT,!!t,n||0,i||0),o.enableVertexAttribArray(a)},Xo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(Xo,"location",{get:function(){return this._locations[this._index]},set:function(r){return r!==this._locations[this._index]&&(this._locations[this._index]=r|0,this._wrapper.program=null),r|0}});var dp=[function(r,e,t){return t.length===void 0?r.vertexAttrib1f(e,t):r.vertexAttrib1fv(e,t)},function(r,e,t,n){return t.length===void 0?r.vertexAttrib2f(e,t,n):r.vertexAttrib2fv(e,t)},function(r,e,t,n,i){return t.length===void 0?r.vertexAttrib3f(e,t,n,i):r.vertexAttrib3fv(e,t)},function(r,e,t,n,i,s){return t.length===void 0?r.vertexAttrib4f(e,t,n,i,s):r.vertexAttrib4fv(e,t)}];function zo(r,e,t,n,i,s,o){var a=dp[i],l=new Ic(r,e,t,n,i,a);Object.defineProperty(s,o,{set:function(A){return r.disableVertexAttribArray(n[t]),a(r,n[t],A),A},get:function(){return l},enumerable:!0})}function fp(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)zo(r,e,t[A],n,i,a,A),l[A]=a[A];Object.defineProperty(a,"location",{set:function(h){if(Array.isArray(h))for(var d=0;d<i;++d)l[d].location=h[d];else for(var d=0;d<i;++d)l[d].location=h+d;return h},get:function(){for(var h=new Array(i),d=0;d<i;++d)h[d]=n[t[d]];return h},enumerable:!0}),a.pointer=function(h,d,f,g){h=h||r.FLOAT,d=!!d,f=f||i*i,g=g||0;for(var p=0;p<i;++p){var y=n[t[p]];r.vertexAttribPointer(y,i,h,d,f,g+p*i),r.enableVertexAttribArray(y)}};var c=new Array(i),u=r["vertexAttrib"+i+"fv"];Object.defineProperty(s,o,{set:function(h){for(var d=0;d<i;++d){var f=n[t[d]];if(r.disableVertexAttribArray(f),Array.isArray(h[0]))u.call(r,f,h[d]);else{for(var g=0;g<i;++g)c[g]=h[i*d+g];u.call(r,f,c)}}return h},get:function(){return a},enumerable:!0})}function gp(r,e,t,n){for(var i={},s=0,o=t.length;s<o;++s){var a=t[s],l=a.name,A=a.type,c=a.locations;switch(A){case"bool":case"int":case"float":zo(r,e,c[0],n,1,i,l);break;default:if(A.indexOf("vec")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new jo("","Invalid data type for attribute "+l+": "+A);zo(r,e,c[0],n,u,i,l)}else if(A.indexOf("mat")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new jo("","Invalid data type for attribute "+l+": "+A);fp(r,e,c,n,u,i,l)}else throw new jo("","Unknown data type for attribute "+l+": "+A);break}}return i}var Zo={},Cc={};(function(r){(function(){var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(a){return i(o(a),arguments)}function n(a,l){return t.apply(null,[a].concat(l||[]))}function i(a,l){var A=1,c=a.length,u,h="",d,f,g,p,y,Q,b,v;for(d=0;d<c;d++)if(typeof a[d]=="string")h+=a[d];else if(typeof a[d]=="object"){if(g=a[d],g.keys)for(u=l[A],f=0;f<g.keys.length;f++){if(u==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[f],g.keys[f-1]));u=u[g.keys[f]]}else g.param_no?u=l[g.param_no]:u=l[A++];if(e.not_type.test(g.type)&&e.not_primitive.test(g.type)&&u instanceof Function&&(u=u()),e.numeric_arg.test(g.type)&&typeof u!="number"&&isNaN(u))throw new TypeError(t("[sprintf] expecting number but found %T",u));switch(e.number.test(g.type)&&(b=u>=0),g.type){case"b":u=parseInt(u,10).toString(2);break;case"c":u=String.fromCharCode(parseInt(u,10));break;case"d":case"i":u=parseInt(u,10);break;case"j":u=JSON.stringify(u,null,g.width?parseInt(g.width):0);break;case"e":u=g.precision?parseFloat(u).toExponential(g.precision):parseFloat(u).toExponential();break;case"f":u=g.precision?parseFloat(u).toFixed(g.precision):parseFloat(u);break;case"g":u=g.precision?String(Number(u.toPrecision(g.precision))):parseFloat(u);break;case"o":u=(parseInt(u,10)>>>0).toString(8);break;case"s":u=String(u),u=g.precision?u.substring(0,g.precision):u;break;case"t":u=String(!!u),u=g.precision?u.substring(0,g.precision):u;break;case"T":u=Object.prototype.toString.call(u).slice(8,-1).toLowerCase(),u=g.precision?u.substring(0,g.precision):u;break;case"u":u=parseInt(u,10)>>>0;break;case"v":u=u.valueOf(),u=g.precision?u.substring(0,g.precision):u;break;case"x":u=(parseInt(u,10)>>>0).toString(16);break;case"X":u=(parseInt(u,10)>>>0).toString(16).toUpperCase();break}e.json.test(g.type)?h+=u:(e.number.test(g.type)&&(!b||g.sign)?(v=b?"+":"-",u=u.toString().replace(e.sign,"")):v="",y=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",Q=g.width-(v+u).length,p=g.width&&Q>0?y.repeat(Q):"",h+=g.align?v+u+p:y==="0"?v+p+u:p+v+u)}return h}var s=Object.create(null);function o(a){if(s[a])return s[a];for(var l=a,A,c=[],u=0;l;){if((A=e.text.exec(l))!==null)c.push(A[0]);else if((A=e.modulo.exec(l))!==null)c.push("%");else if((A=e.placeholder.exec(l))!==null){if(A[2]){u|=1;var h=[],d=A[2],f=[];if((f=e.key.exec(d))!==null)for(h.push(f[1]);(d=d.substring(f[0].length))!=="";)if((f=e.key_access.exec(d))!==null)h.push(f[1]);else if((f=e.index_access.exec(d))!==null)h.push(f[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");A[2]=h}else u|=2;if(u===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:A[0],param_no:A[1],keys:A[2],sign:A[3],pad_char:A[4],align:A[5],width:A[6],precision:A[7],type:A[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(A[0].length)}return s[a]=c}r.sprintf=t,r.vsprintf=n,typeof window<"u"&&(window.sprintf=t,window.vsprintf=n)})()})(Cc);var pp={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},mp=pp,Ep=function(e){return mp[e]},vc=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],Ip=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],yc=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],Cp=vc,vp=Cp.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),ea=yc;ea=ea.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var yp=ea.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),Bp=Lp,Tp=vc,Bc=Ip,Qp=yc,bp=vp,xp=yp,Xt=999,Tc=9999,ta=0,ra=1,Qc=2,bc=3,xc=4,ui=5,wp=6,Sp=7,Rp=8,wc=9,Dp=10,Sc=11,_p=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function Lp(r){var e=0,t=0,n=Xt,i,s,o=[],a=[],l=1,A=0,c=0,u=!1,h=!1,d="",f;r=r||{};var g=Qp,p=Tp;r.version==="300 es"&&(g=xp,p=bp);for(var y={},Q={},e=0;e<g.length;e++)y[g[e]]=!0;for(var e=0;e<p.length;e++)Q[p[e]]=!0;return function(j){return a=[],j!==null?v(j):w()};function b(j){j.length&&a.push({type:_p[n],data:j,position:c,line:l,column:A})}function v(j){e=0,j.toString&&(j=j.toString()),d+=j.replace(/\r\n/g,`
93
- `),f=d.length;for(var _;i=d[e],e<f;){switch(_=e,n){case ta:e=O();break;case ra:e=V();break;case Qc:e=H();break;case bc:e=W();break;case xc:e=le();break;case Sc:e=te();break;case ui:e=D();break;case Tc:e=P();break;case wc:e=k();break;case Xt:e=R();break}if(_!==e)switch(d[_]){case`
94
- `:A=0,++l;break;default:++A;break}}return t+=e,d=d.slice(e),a}function w(j){return o.length&&b(o.join("")),n=Dp,b("(eof)"),a}function R(){return o=o.length?[]:o,s==="/"&&i==="*"?(c=t+e-1,n=ta,s=i,e+1):s==="/"&&i==="/"?(c=t+e-1,n=ra,s=i,e+1):i==="#"?(n=Qc,c=t+e,e):/\s/.test(i)?(n=wc,c=t+e,e):(u=/\d/.test(i),h=/[^\w_]/.test(i),c=t+e,n=u?xc:h?bc:Tc,e)}function k(){return/[^\s]/g.test(i)?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function H(){return(i==="\r"||i===`
95
- `)&&s!=="\\"?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function V(){return H()}function O(){return i==="/"&&s==="*"?(o.push(i),b(o.join("")),n=Xt,e+1):(o.push(i),s=i,e+1)}function W(){if(s==="."&&/\d/.test(i))return n=ui,e;if(s==="/"&&i==="*")return n=ta,e;if(s==="/"&&i==="/")return n=ra,e;if(i==="."&&o.length){for(;ie(o););return n=ui,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=Xt,e+1}var j=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||j){for(;ie(o););return n=Xt,e}return o.push(i),s=i,e+1}function ie(j){var _=0,S,F;do{if(S=Bc.indexOf(j.slice(0,j.length+_).join("")),F=Bc[S],S===-1){if(_--+j.length>0)continue;F=j.slice(0,1).join("")}return b(F),c+=F.length,o=o.slice(F.length),o.length}while(!0)}function te(){return/[^a-fA-F0-9]/.test(i)?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=ui,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=Sc,o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function D(){return i==="f"&&(o.push(i),s=i,e+=1),/[eE]/.test(i)||(i==="-"||i==="+")&&/[eE]/.test(s)?(o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function P(){if(/[^\d\w_]/.test(i)){var j=o.join("");return Q[j]?n=Rp:y[j]?n=Sp:n=wp,b(o.join("")),n=Xt,e}return o.push(i),s=i,e+1}}var Fp=Bp,kp=Np;function Np(r,e){var t=Fp(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var Mp=function(e){return atob(e)},Pp=kp,Op=Mp,Up=Gp;function Gp(r){for(var e=Array.isArray(r)?r:Pp(r),t=0;t<e.length;t++){var n=e[t];if(n.type==="preprocessor"){var i=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(i&&i[2]){var s=i[1],o=i[2];return(s?Op(o):o).trim()}}}}/*!
91
+ */(function(r){var e=zi,t=bo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=Q,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var T=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(T,m),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');var m=new Uint8Array(T);return Object.setPrototypeOf(m,a.prototype),m}function a(T,m,E){if(typeof T=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(T)}return l(T,m,E)}a.poolSize=8192;function l(T,m,E){if(typeof T=="string")return h(T,m);if(ArrayBuffer.isView(T))return f(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(we(T,ArrayBuffer)||T&&we(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(we(T,SharedArrayBuffer)||T&&we(T.buffer,SharedArrayBuffer)))return g(T,m,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var w=T.valueOf&&T.valueOf();if(w!=null&&w!==T)return a.from(w,m,E);var M=p(T);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),m,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,m,E){return l(T,m,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function c(T,m,E){return A(T),T<=0?o(T):m!==void 0?typeof E=="string"?o(T).fill(m,E):o(T).fill(m):o(T)}a.alloc=function(T,m,E){return c(T,m,E)};function u(T){return A(T),o(T<0?0:C(T)|0)}a.allocUnsafe=function(T){return u(T)},a.allocUnsafeSlow=function(T){return u(T)};function h(T,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);var E=b(T,m)|0,w=o(E),M=w.write(T,m);return M!==E&&(w=w.slice(0,M)),w}function d(T){for(var m=T.length<0?0:C(T.length)|0,E=o(m),w=0;w<m;w+=1)E[w]=T[w]&255;return E}function f(T){if(we(T,Uint8Array)){var m=new Uint8Array(T);return g(m.buffer,m.byteOffset,m.byteLength)}return d(T)}function g(T,m,E){if(m<0||T.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<m+(E||0))throw new RangeError('"length" is outside of buffer bounds');var w;return m===void 0&&E===void 0?w=new Uint8Array(T):E===void 0?w=new Uint8Array(T,m):w=new Uint8Array(T,m,E),Object.setPrototypeOf(w,a.prototype),w}function p(T){if(a.isBuffer(T)){var m=C(T.length)|0,E=o(m);return E.length===0||T.copy(E,0,0,m),E}if(T.length!==void 0)return typeof T.length!="number"||qe(T.length)?o(0):d(T);if(T.type==="Buffer"&&Array.isArray(T.data))return d(T.data)}function C(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function Q(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,E){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),we(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(m)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===E)return 0;for(var w=m.length,M=E.length,z=0,j=Math.min(w,M);z<j;++z)if(m[z]!==E[z]){w=m[z],M=E[z];break}return w<M?-1:M<w?1:0},a.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(m,E){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);var w;if(E===void 0)for(E=0,w=0;w<m.length;++w)E+=m[w].length;var M=a.allocUnsafe(E),z=0;for(w=0;w<m.length;++w){var j=m[w];if(we(j,Uint8Array))z+j.length>M.length?a.from(j).copy(M,z):Uint8Array.prototype.set.call(M,j,z);else if(a.isBuffer(j))j.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=j.length}return M};function b(T,m){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||we(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&E===0)return 0;for(var M=!1;;)switch(m){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Le(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Qe(T).length;default:if(M)return w?-1:Le(T).length;m=(""+m).toLowerCase(),M=!0}}a.byteLength=b;function v(T,m,E){var w=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,m>>>=0,E<=m))return"";for(T||(T="utf8");;)switch(T){case"hex":return S(this,m,E);case"utf8":case"utf-8":return le(this,m,E);case"ascii":return X(this,m,E);case"latin1":case"binary":return _(this,m,E);case"base64":return te(this,m,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,m,E);default:if(w)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),w=!0}}a.prototype._isBuffer=!0;function x(T,m,E){var w=T[m];T[m]=T[E],T[E]=w}a.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<m;E+=2)x(this,E,E+1);return this},a.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<m;E+=4)x(this,E,E+3),x(this,E+1,E+2);return this},a.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<m;E+=8)x(this,E,E+7),x(this,E+1,E+6),x(this,E+2,E+5),x(this,E+3,E+4);return this},a.prototype.toString=function(){var m=this.length;return m===0?"":arguments.length===0?le(this,0,m):v.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){var m="",E=r.INSPECT_MAX_BYTES;return m=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(m+=" ... "),"<Buffer "+m+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(m,E,w,M,z){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(E===void 0&&(E=0),w===void 0&&(w=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),E<0||w>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&E>=w)return 0;if(M>=z)return-1;if(E>=w)return 1;if(E>>>=0,w>>>=0,M>>>=0,z>>>=0,this===m)return 0;for(var j=z-M,Ie=w-E,be=Math.min(j,Ie),De=this.slice(M,z),ke=m.slice(E,w),_e=0;_e<be;++_e)if(De[_e]!==ke[_e]){j=De[_e],Ie=ke[_e];break}return j<Ie?-1:Ie<j?1:0};function R(T,m,E,w,M){if(T.length===0)return-1;if(typeof E=="string"?(w=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,qe(E)&&(E=M?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(M)return-1;E=T.length-1}else if(E<0)if(M)E=0;else return-1;if(typeof m=="string"&&(m=a.from(m,w)),a.isBuffer(m))return m.length===0?-1:k(T,m,E,w,M);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?M?Uint8Array.prototype.indexOf.call(T,m,E):Uint8Array.prototype.lastIndexOf.call(T,m,E):k(T,[m],E,w,M);throw new TypeError("val must be string, number or Buffer")}function k(T,m,E,w,M){var z=1,j=T.length,Ie=m.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(T.length<2||m.length<2)return-1;z=2,j/=2,Ie/=2,E/=2}function be(ut,Ut){return z===1?ut[Ut]:ut.readUInt16BE(Ut*z)}var De;if(M){var ke=-1;for(De=E;De<j;De++)if(be(T,De)===be(m,ke===-1?0:De-ke)){if(ke===-1&&(ke=De),De-ke+1===Ie)return ke*z}else ke!==-1&&(De-=De-ke),ke=-1}else for(E+Ie>j&&(E=j-Ie),De=E;De>=0;De--){for(var _e=!0,Mt=0;Mt<Ie;Mt++)if(be(T,De+Mt)!==be(m,Mt)){_e=!1;break}if(_e)return De}return-1}a.prototype.includes=function(m,E,w){return this.indexOf(m,E,w)!==-1},a.prototype.indexOf=function(m,E,w){return R(this,m,E,w,!0)},a.prototype.lastIndexOf=function(m,E,w){return R(this,m,E,w,!1)};function $(T,m,E,w){E=Number(E)||0;var M=T.length-E;w?(w=Number(w),w>M&&(w=M)):w=M;var z=m.length;w>z/2&&(w=z/2);for(var j=0;j<w;++j){var Ie=parseInt(m.substr(j*2,2),16);if(qe(Ie))return j;T[E+j]=Ie}return j}function K(T,m,E,w){return Me(Le(m,T.length-E),T,E,w)}function O(T,m,E,w){return Me(Ge(m),T,E,w)}function W(T,m,E,w){return Me(Qe(m),T,E,w)}function ie(T,m,E,w){return Me(fe(m,T.length-E),T,E,w)}a.prototype.write=function(m,E,w,M){if(E===void 0)M="utf8",w=this.length,E=0;else if(w===void 0&&typeof E=="string")M=E,w=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var z=this.length-E;if((w===void 0||w>z)&&(w=z),m.length>0&&(w<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");for(var j=!1;;)switch(M){case"hex":return $(this,m,E,w);case"utf8":case"utf-8":return K(this,m,E,w);case"ascii":case"latin1":case"binary":return O(this,m,E,w);case"base64":return W(this,m,E,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,E,w);default:if(j)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),j=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function te(T,m,E){return m===0&&E===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(m,E))}function le(T,m,E){E=Math.min(T.length,E);for(var w=[],M=m;M<E;){var z=T[M],j=null,Ie=z>239?4:z>223?3:z>191?2:1;if(M+Ie<=E){var be,De,ke,_e;switch(Ie){case 1:z<128&&(j=z);break;case 2:be=T[M+1],(be&192)===128&&(_e=(z&31)<<6|be&63,_e>127&&(j=_e));break;case 3:be=T[M+1],De=T[M+2],(be&192)===128&&(De&192)===128&&(_e=(z&15)<<12|(be&63)<<6|De&63,_e>2047&&(_e<55296||_e>57343)&&(j=_e));break;case 4:be=T[M+1],De=T[M+2],ke=T[M+3],(be&192)===128&&(De&192)===128&&(ke&192)===128&&(_e=(z&15)<<18|(be&63)<<12|(De&63)<<6|ke&63,_e>65535&&_e<1114112&&(j=_e))}}j===null?(j=65533,Ie=1):j>65535&&(j-=65536,w.push(j>>>10&1023|55296),j=56320|j&1023),w.push(j),M+=Ie}return P(w)}var D=4096;function P(T){var m=T.length;if(m<=D)return String.fromCharCode.apply(String,T);for(var E="",w=0;w<m;)E+=String.fromCharCode.apply(String,T.slice(w,w+=D));return E}function X(T,m,E){var w="";E=Math.min(T.length,E);for(var M=m;M<E;++M)w+=String.fromCharCode(T[M]&127);return w}function _(T,m,E){var w="";E=Math.min(T.length,E);for(var M=m;M<E;++M)w+=String.fromCharCode(T[M]);return w}function S(T,m,E){var w=T.length;(!m||m<0)&&(m=0),(!E||E<0||E>w)&&(E=w);for(var M="",z=m;z<E;++z)M+=Te[T[z]];return M}function F(T,m,E){for(var w=T.slice(m,E),M="",z=0;z<w.length-1;z+=2)M+=String.fromCharCode(w[z]+w[z+1]*256);return M}a.prototype.slice=function(m,E){var w=this.length;m=~~m,E=E===void 0?w:~~E,m<0?(m+=w,m<0&&(m=0)):m>w&&(m=w),E<0?(E+=w,E<0&&(E=0)):E>w&&(E=w),E<m&&(E=m);var M=this.subarray(m,E);return Object.setPrototypeOf(M,a.prototype),M};function J(T,m,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+m>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,E,w){m=m>>>0,E=E>>>0,w||J(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return M},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,E,w){m=m>>>0,E=E>>>0,w||J(m,E,this.length);for(var M=this[m+--E],z=1;E>0&&(z*=256);)M+=this[m+--E]*z;return M},a.prototype.readUint8=a.prototype.readUInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readIntLE=function(m,E,w){m=m>>>0,E=E>>>0,w||J(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return z*=128,M>=z&&(M-=Math.pow(2,8*E)),M},a.prototype.readIntBE=function(m,E,w){m=m>>>0,E=E>>>0,w||J(m,E,this.length);for(var M=E,z=1,j=this[m+--M];M>0&&(z*=256);)j+=this[m+--M]*z;return z*=128,j>=z&&(j-=Math.pow(2,8*E)),j},a.prototype.readInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,E){m=m>>>0,E||J(m,2,this.length);var w=this[m]|this[m+1]<<8;return w&32768?w|4294901760:w},a.prototype.readInt16BE=function(m,E){m=m>>>0,E||J(m,2,this.length);var w=this[m+1]|this[m]<<8;return w&32768?w|4294901760:w},a.prototype.readInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readFloatLE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!1,52,8)};function Y(T,m,E,w,M,z){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>M||m<z)throw new RangeError('"value" argument is out of bounds');if(E+w>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,E,w,M){if(m=+m,E=E>>>0,w=w>>>0,!M){var z=Math.pow(2,8*w)-1;Y(this,m,E,w,z,0)}var j=1,Ie=0;for(this[E]=m&255;++Ie<w&&(j*=256);)this[E+Ie]=m/j&255;return E+w},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,E,w,M){if(m=+m,E=E>>>0,w=w>>>0,!M){var z=Math.pow(2,8*w)-1;Y(this,m,E,w,z,0)}var j=w-1,Ie=1;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)this[E+j]=m/Ie&255;return E+w},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,1,255,0),this[E]=m&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,2,65535,0),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,2,65535,0),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,4,4294967295,0),this[E+3]=m>>>24,this[E+2]=m>>>16,this[E+1]=m>>>8,this[E]=m&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,4,4294967295,0),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4},a.prototype.writeIntLE=function(m,E,w,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*w-1);Y(this,m,E,w,z-1,-z)}var j=0,Ie=1,be=0;for(this[E]=m&255;++j<w&&(Ie*=256);)m<0&&be===0&&this[E+j-1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+w},a.prototype.writeIntBE=function(m,E,w,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*w-1);Y(this,m,E,w,z-1,-z)}var j=w-1,Ie=1,be=0;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)m<0&&be===0&&this[E+j+1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+w},a.prototype.writeInt8=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,1,127,-128),m<0&&(m=255+m+1),this[E]=m&255,E+1},a.prototype.writeInt16LE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,2,32767,-32768),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeInt16BE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,2,32767,-32768),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeInt32LE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,4,2147483647,-2147483648),this[E]=m&255,this[E+1]=m>>>8,this[E+2]=m>>>16,this[E+3]=m>>>24,E+4},a.prototype.writeInt32BE=function(m,E,w){return m=+m,E=E>>>0,w||Y(this,m,E,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4};function ne(T,m,E,w,M,z){if(E+w>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ce(T,m,E,w,M){return m=+m,E=E>>>0,M||ne(T,m,E,4),t.write(T,m,E,w,23,4),E+4}a.prototype.writeFloatLE=function(m,E,w){return ce(this,m,E,!0,w)},a.prototype.writeFloatBE=function(m,E,w){return ce(this,m,E,!1,w)};function pe(T,m,E,w,M){return m=+m,E=E>>>0,M||ne(T,m,E,8),t.write(T,m,E,w,52,8),E+8}a.prototype.writeDoubleLE=function(m,E,w){return pe(this,m,E,!0,w)},a.prototype.writeDoubleBE=function(m,E,w){return pe(this,m,E,!1,w)},a.prototype.copy=function(m,E,w,M){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),E>=m.length&&(E=m.length),E||(E=0),M>0&&M<w&&(M=w),M===w||m.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-E<M-w&&(M=m.length-E+w);var z=M-w;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,w,M):Uint8Array.prototype.set.call(m,this.subarray(w,M),E),z},a.prototype.fill=function(m,E,w,M){if(typeof m=="string"){if(typeof E=="string"?(M=E,E=0,w=this.length):typeof w=="string"&&(M=w,w=this.length),M!==void 0&&typeof M!="string")throw new TypeError("encoding must be a string");if(typeof M=="string"&&!a.isEncoding(M))throw new TypeError("Unknown encoding: "+M);if(m.length===1){var z=m.charCodeAt(0);(M==="utf8"&&z<128||M==="latin1")&&(m=z)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(E<0||this.length<E||this.length<w)throw new RangeError("Out of range index");if(w<=E)return this;E=E>>>0,w=w===void 0?this.length:w>>>0,m||(m=0);var j;if(typeof m=="number")for(j=E;j<w;++j)this[j]=m;else{var Ie=a.isBuffer(m)?m:a.from(m,M),be=Ie.length;if(be===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(j=0;j<w-E;++j)this[j+E]=Ie[j%be]}return this};var ge=/[^+/0-9A-Za-z-_]/g;function Se(T){if(T=T.split("=")[0],T=T.trim().replace(ge,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Le(T,m){m=m||1/0;for(var E,w=T.length,M=null,z=[],j=0;j<w;++j){if(E=T.charCodeAt(j),E>55295&&E<57344){if(!M){if(E>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(j+1===w){(m-=3)>-1&&z.push(239,191,189);continue}M=E;continue}if(E<56320){(m-=3)>-1&&z.push(239,191,189),M=E;continue}E=(M-55296<<10|E-56320)+65536}else M&&(m-=3)>-1&&z.push(239,191,189);if(M=null,E<128){if((m-=1)<0)break;z.push(E)}else if(E<2048){if((m-=2)<0)break;z.push(E>>6|192,E&63|128)}else if(E<65536){if((m-=3)<0)break;z.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((m-=4)<0)break;z.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return z}function Ge(T){for(var m=[],E=0;E<T.length;++E)m.push(T.charCodeAt(E)&255);return m}function fe(T,m){for(var E,w,M,z=[],j=0;j<T.length&&!((m-=2)<0);++j)E=T.charCodeAt(j),w=E>>8,M=E%256,z.push(M),z.push(w);return z}function Qe(T){return e.toByteArray(Se(T))}function Me(T,m,E,w){for(var M=0;M<w&&!(M+E>=m.length||M>=T.length);++M)m[M+E]=T[M];return M}function we(T,m){return T instanceof m||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===m.name}function qe(T){return T!==T}var Te=function(){for(var T="0123456789abcdef",m=new Array(256),E=0;E<16;++E)for(var w=E*16,M=0;M<16;++M)m[w+M]=T[E]+T[M];return m}()})(uA);var Mr=ze,vt=bg,dA=uA.Buffer;mn.__TYPEDARRAY_POOL||(mn.__TYPEDARRAY_POOL={UINT8:vt([32,0]),UINT16:vt([32,0]),UINT32:vt([32,0]),BIGUINT64:vt([32,0]),INT8:vt([32,0]),INT16:vt([32,0]),INT32:vt([32,0]),BIGINT64:vt([32,0]),FLOAT:vt([32,0]),DOUBLE:vt([32,0]),DATA:vt([32,0]),UINT8C:vt([32,0]),BUFFER:vt([32,0])});var kg=typeof Uint8ClampedArray<"u",Ng=typeof BigUint64Array<"u",Mg=typeof BigInt64Array<"u",nt=mn.__TYPEDARRAY_POOL;nt.UINT8C||(nt.UINT8C=vt([32,0])),nt.BIGUINT64||(nt.BIGUINT64=vt([32,0])),nt.BIGINT64||(nt.BIGINT64=vt([32,0])),nt.BUFFER||(nt.BUFFER=vt([32,0]));var Zi=nt.DATA,es=nt.BUFFER;Ne.free=function(e){if(dA.isBuffer(e))es[Mr.log2(e.length)].push(e);else{if(Object.prototype.toString.call(e)!=="[object ArrayBuffer]"&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=Mr.log2(t)|0;Zi[n].push(e)}};function fA(r){if(r){var e=r.length||r.byteLength,t=Mr.log2(e);Zi[t].push(r)}}function Pg(r){fA(r.buffer)}Ne.freeUint8=Ne.freeUint16=Ne.freeUint32=Ne.freeBigUint64=Ne.freeInt8=Ne.freeInt16=Ne.freeInt32=Ne.freeBigInt64=Ne.freeFloat32=Ne.freeFloat=Ne.freeFloat64=Ne.freeDouble=Ne.freeUint8Clamped=Ne.freeDataView=Pg,Ne.freeArrayBuffer=fA,Ne.freeBuffer=function(e){es[Mr.log2(e.length)].push(e)},Ne.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Dt(e);switch(t){case"uint8":return xo(e);case"uint16":return gA(e);case"uint32":return pA(e);case"int8":return mA(e);case"int16":return EA(e);case"int32":return IA(e);case"float":case"float32":return CA(e);case"double":case"float64":return vA(e);case"uint8_clamped":return yA(e);case"bigint64":return TA(e);case"biguint64":return BA(e);case"buffer":return bA(e);case"data":case"dataview":return QA(e);default:return null}return null};function Dt(e){var e=Mr.nextPow2(e),t=Mr.log2(e),n=Zi[t];return n.length>0?n.pop():new ArrayBuffer(e)}Ne.mallocArrayBuffer=Dt;function xo(r){return new Uint8Array(Dt(r),0,r)}Ne.mallocUint8=xo;function gA(r){return new Uint16Array(Dt(2*r),0,r)}Ne.mallocUint16=gA;function pA(r){return new Uint32Array(Dt(4*r),0,r)}Ne.mallocUint32=pA;function mA(r){return new Int8Array(Dt(r),0,r)}Ne.mallocInt8=mA;function EA(r){return new Int16Array(Dt(2*r),0,r)}Ne.mallocInt16=EA;function IA(r){return new Int32Array(Dt(4*r),0,r)}Ne.mallocInt32=IA;function CA(r){return new Float32Array(Dt(4*r),0,r)}Ne.mallocFloat32=Ne.mallocFloat=CA;function vA(r){return new Float64Array(Dt(8*r),0,r)}Ne.mallocFloat64=Ne.mallocDouble=vA;function yA(r){return kg?new Uint8ClampedArray(Dt(r),0,r):xo(r)}Ne.mallocUint8Clamped=yA;function BA(r){return Ng?new BigUint64Array(Dt(8*r),0,r):null}Ne.mallocBigUint64=BA;function TA(r){return Mg?new BigInt64Array(Dt(8*r),0,r):null}Ne.mallocBigInt64=TA;function QA(r){return new DataView(Dt(r),0,r)}Ne.mallocDataView=QA;function bA(r){r=Mr.nextPow2(r);var e=Mr.log2(r),t=es[e];return t.length>0?t.pop():new dA(r)}Ne.mallocBuffer=bA,Ne.clearCache=function(){for(var e=0;e<32;++e)nt.UINT8[e].length=0,nt.UINT16[e].length=0,nt.UINT32[e].length=0,nt.INT8[e].length=0,nt.INT16[e].length=0,nt.INT32[e].length=0,nt.FLOAT[e].length=0,nt.DOUBLE[e].length=0,nt.BIGUINT64[e].length=0,nt.BIGINT64[e].length=0,nt.UINT8C[e].length=0,Zi[e].length=0,es[e].length=0};var ts=og,wo=aA,In=Ne,Og=Yg,rs=null,So=null,ns=null;function Ug(r){rs=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],So=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],ns=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function xA(r){return typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof ImageData<"u"&&r instanceof ImageData}var wA=function(r,e){wo.muls(r,e,255)};function Ro(r,e,t){var n=r.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||t<0||t>i)throw new Error("gl-texture2d: Invalid texture size");return r._shape=[e,t],r.bind(),n.texImage2D(n.TEXTURE_2D,0,r.format,e,t,0,r.format,r.type,null),r._mipLevels=[0],r}function is(r,e,t,n,i,s){this.gl=r,this.handle=e,this.format=i,this.type=s,this._shape=[t,n],this._mipLevels=[0],this._magFilter=r.NEAREST,this._minFilter=r.NEAREST,this._wrapS=r.CLAMP_TO_EDGE,this._wrapT=r.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,a=[this._wrapS,this._wrapT];Object.defineProperties(a,[{get:function(){return o._wrapS},set:function(A){return o.wrapS=A}},{get:function(){return o._wrapT},set:function(A){return o.wrapT=A}}]),this._wrapVector=a;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(A){return o.width=A}},{get:function(){return o._shape[1]},set:function(A){return o.height=A}}]),this._shapeVector=l}var oi=is.prototype;Object.defineProperties(oi,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&rs.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),So.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r),this._minFilter=r}},magFilter:{get:function(){return this._magFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&rs.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),So.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),this._magFilter=r}},mipSamples:{get:function(){return this._anisoSamples},set:function(r){var e=this._anisoSamples;if(this._anisoSamples=Math.max(r,1)|0,e!==this._anisoSamples){var t=this.gl.getExtension("EXT_texture_filter_anisotropic");t&&this.gl.texParameterf(this.gl.TEXTURE_2D,t.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(r){if(this.bind(),ns.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,r),this._wrapS=r}},wrapT:{get:function(){return this._wrapT},set:function(r){if(this.bind(),ns.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,r),this._wrapT=r}},wrap:{get:function(){return this._wrapVector},set:function(r){if(Array.isArray(r)||(r=[r,r]),r.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(ns.indexOf(r[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);this._wrapS=r[0],this._wrapT=r[1];var t=this.gl;return this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT),r}},shape:{get:function(){return this._shapeVector},set:function(r){if(!Array.isArray(r))r=[r|0,r|0];else if(r.length!==2)throw new Error("gl-texture2d: Invalid texture shape");return Ro(this,r[0]|0,r[1]|0),[r[0]|0,r[1]|0]}},width:{get:function(){return this._shape[0]},set:function(r){return r=r|0,Ro(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,Ro(this,this._shape[0],r),r}}}),oi.bind=function(r){var e=this.gl;return r!==void 0&&e.activeTexture(e.TEXTURE0+(r|0)),e.bindTexture(e.TEXTURE_2D,this.handle),r!==void 0?r|0:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},oi.dispose=function(){this.gl.deleteTexture(this.handle)},oi.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var r=Math.min(this._shape[0],this._shape[1]),e=0;r>0;++e,r>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},oi.setPixels=function(r,e,t,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=t,t=e[1]|0,e=e[0]|0):(e=e||0,t=t||0),n=n||0;var s=xA(r)?r:r.raw;if(s){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,t,this.format,this.type,s)}else if(r.shape&&r.stride&&r.data){if(r.shape.length<2||e+r.shape[1]>this._shape[1]>>>n||t+r.shape[0]>this._shape[0]>>>n||e<0||t<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");Gg(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function SA(r,e){return r.length===3?e[2]===1&&e[1]===r[0]*r[2]&&e[0]===r[2]:e[0]===1&&e[1]===r[0]}function Gg(r,e,t,n,i,s,o,a){var l=a.dtype,A=a.shape.slice();if(A.length<2||A.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,u=0,h=SA(A,a.stride.slice());if(l==="float32"?c=r.FLOAT:l==="float64"?(c=r.FLOAT,h=!1,l="float32"):l==="uint8"?c=r.UNSIGNED_BYTE:(c=r.UNSIGNED_BYTE,h=!1,l="uint8"),A.length===2)u=r.LUMINANCE,A=[A[0],A[1],1],a=ts(a.data,A,[a.stride[0],a.stride[1],1],a.offset);else if(A.length===3){if(A[2]===1)u=r.ALPHA;else if(A[2]===2)u=r.LUMINANCE_ALPHA;else if(A[2]===3)u=r.RGB;else if(A[2]===4)u=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");A[2]}else throw new Error("gl-texture2d: Invalid shape for texture");if((u===r.LUMINANCE||u===r.ALPHA)&&(i===r.LUMINANCE||i===r.ALPHA)&&(u=i),u!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var d=a.size,f=o.indexOf(n)<0;if(f&&o.push(n),c===s&&h)a.offset===0&&a.data.length===d?f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data):f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data.subarray(a.offset,a.offset+d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data.subarray(a.offset,a.offset+d));else{var g;s===r.FLOAT?g=In.mallocFloat32(d):g=In.mallocUint8(d);var p=ts(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?wA(p,a):wo.assign(p,a),f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,g.subarray(0,d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,g.subarray(0,d)),s===r.FLOAT?In.freeFloat32(g):In.freeUint8(g)}}function Do(r){var e=r.createTexture();return r.bindTexture(r.TEXTURE_2D,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e}function RA(r,e,t,n,i){var s=r.getParameter(r.MAX_TEXTURE_SIZE);if(e<0||e>s||t<0||t>s)throw new Error("gl-texture2d: Invalid texture shape");if(i===r.FLOAT&&!r.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=Do(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new is(r,o,e,t,n,i)}function Hg(r,e,t,n,i,s){var o=Do(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new is(r,o,t,n,i,s)}function $g(r,e){var t=e.dtype,n=e.shape.slice(),i=r.getParameter(r.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=SA(n,e.stride.slice()),o=0;t==="float32"?o=r.FLOAT:t==="float64"?(o=r.FLOAT,s=!1,t="float32"):t==="uint8"?o=r.UNSIGNED_BYTE:(o=r.UNSIGNED_BYTE,s=!1,t="uint8");var a=0;if(n.length===2)a=r.LUMINANCE,n=[n[0],n[1],1],e=ts(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else if(n.length===3)if(n[2]===1)a=r.ALPHA;else if(n[2]===2)a=r.LUMINANCE_ALPHA;else if(n[2]===3)a=r.RGB;else if(n[2]===4)a=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");else throw new Error("gl-texture2d: Invalid shape for texture");o===r.FLOAT&&!r.getExtension("OES_texture_float")&&(o=r.UNSIGNED_BYTE,s=!1);var l,A,c=e.size;if(s)e.offset===0&&e.data.length===c?l=e.data:l=e.data.subarray(e.offset,e.offset+c);else{var u=[n[2],n[2]*n[0],1];A=In.malloc(c,t);var h=ts(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?wA(h,e):wo.assign(h,e),l=A.subarray(0,c)}var d=Do(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||In.free(A),new is(r,d,n[0],n[1],a,o)}function Yg(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(rs||Ug(r),typeof arguments[1]=="number")return RA(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return RA(r,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(typeof arguments[1]=="object"){var e=arguments[1],t=xA(e)?e:e.raw;if(t)return Hg(r,t,e.width|0,e.height|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return $g(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const ss=mo(Og);var DA={},_A=Vg;function Vg(r,e){for(var t={},n=0;n<r.length;++n)for(var i=r[n].name,s=i.split("."),o=t,a=0;a<s.length;++a){var l=s[a].split("[");if(l.length>1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var A=1;A<l.length;++A){var c=parseInt(l[A]);A<l.length-1||a<s.length-1?(c in o||(A<l.length-1?o[c]=[]:o[c]={}),o=o[c]):e?o[c]=n:o[c]=r[n].type}}else a<s.length-1?(l[0]in o||(o[l[0]]={}),o=o[l[0]]):e?o[l[0]]=n:o[l[0]]=r[n].type}return t}function ai(r,e,t){this.shortMessage=e||"",this.longMessage=t||"",this.rawError=r||"",this.message="gl-shader: "+(e||r||"")+(t?`
92
+ `+t:""),this.stack=new Error().stack}ai.prototype=new Error,ai.prototype.name="GLError",ai.prototype.constructor=ai;var os=ai,Kg=_A,zr=os,Jg=Wg;function LA(r){return function(){return r}}function _o(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Wg(r,e,t,n){function i(u){return function(h,d,f){return h.getUniform(d.program,f[u])}}function s(u){return function(d){for(var f=o("",u),g=0;g<f.length;++g){var p=f[g],C=p[0],Q=p[1];if(n[Q]){var b=d;if(typeof C=="string"&&(C.indexOf(".")===0||C.indexOf("[")===0)){var v=C;if(C.indexOf(".")===0&&(v=C.slice(1)),v.indexOf("]")===v.length-1){var x=v.indexOf("["),R=v.slice(0,x),k=v.slice(x+1,v.length-1);b=R?d[R][k]:d[k]}else b=d[v]}var $=t[Q].type,K;switch($){case"bool":case"int":case"sampler2D":case"samplerCube":r.uniform1i(n[Q],b);break;case"float":r.uniform1f(n[Q],b);break;default:var O=$.indexOf("vec");if(0<=O&&O<=1&&$.length===4+O){if(K=$.charCodeAt($.length-1)-48,K<2||K>4)throw new zr("","Invalid data type");switch($.charAt(0)){case"b":case"i":r["uniform"+K+"iv"](n[Q],b);break;case"v":r["uniform"+K+"fv"](n[Q],b);break;default:throw new zr("","Unrecognized data type for vector "+name+": "+$)}}else if($.indexOf("mat")===0&&$.length===4){if(K=$.charCodeAt($.length-1)-48,K<2||K>4)throw new zr("","Invalid uniform dimension type for matrix "+name+": "+$);r["uniformMatrix"+K+"fv"](n[Q],!1,b);break}else throw new zr("","Unknown uniform data type for "+name+": "+$)}}}}}function o(u,h){if(typeof h!="object")return[[u,h]];var d=[];for(var f in h){var g=h[f],p=u;parseInt(f)+""===f?p+="["+f+"]":p+="."+f,typeof g=="object"?d.push.apply(d,o(p,g)):d.push([p,g])}return d}function a(u){switch(u){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var h=u.indexOf("vec");if(0<=h&&h<=1&&u.length===4+h){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new zr("","Invalid data type");return u.charAt(0)==="b"?_o(d,!1):_o(d,0)}else if(u.indexOf("mat")===0&&u.length===4){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new zr("","Invalid uniform dimension type for matrix "+name+": "+u);return _o(d*d,0)}else throw new zr("","Unknown uniform data type for "+name+": "+u)}}function l(u,h,d){if(typeof d=="object"){var f=A(d);Object.defineProperty(u,h,{get:LA(f),set:s(d),enumerable:!0,configurable:!1})}else n[d]?Object.defineProperty(u,h,{get:i(d),set:s(d),enumerable:!0,configurable:!1}):u[h]=a(t[d].type)}function A(u){var h;if(Array.isArray(u)){h=new Array(u.length);for(var d=0;d<u.length;++d)l(h,d,u[d])}else{h={};for(var f in u)l(h,f,u[f])}return h}var c=Kg(t,!0);return{get:LA(A(c)),set:s(c),enumerable:!0,configurable:!0}}var qg=zg,Lo=os;function FA(r,e,t,n,i,s){this._gl=r,this._wrapper=e,this._index=t,this._locations=n,this._dimension=i,this._constFunc=s}var Fo=FA.prototype;Fo.pointer=function(e,t,n,i){var s=this,o=s._gl,a=s._locations[s._index];o.vertexAttribPointer(a,s._dimension,e||o.FLOAT,!!t,n||0,i||0),o.enableVertexAttribArray(a)},Fo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(Fo,"location",{get:function(){return this._locations[this._index]},set:function(r){return r!==this._locations[this._index]&&(this._locations[this._index]=r|0,this._wrapper.program=null),r|0}});var Xg=[function(r,e,t){return t.length===void 0?r.vertexAttrib1f(e,t):r.vertexAttrib1fv(e,t)},function(r,e,t,n){return t.length===void 0?r.vertexAttrib2f(e,t,n):r.vertexAttrib2fv(e,t)},function(r,e,t,n,i){return t.length===void 0?r.vertexAttrib3f(e,t,n,i):r.vertexAttrib3fv(e,t)},function(r,e,t,n,i,s){return t.length===void 0?r.vertexAttrib4f(e,t,n,i,s):r.vertexAttrib4fv(e,t)}];function ko(r,e,t,n,i,s,o){var a=Xg[i],l=new FA(r,e,t,n,i,a);Object.defineProperty(s,o,{set:function(A){return r.disableVertexAttribArray(n[t]),a(r,n[t],A),A},get:function(){return l},enumerable:!0})}function jg(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)ko(r,e,t[A],n,i,a,A),l[A]=a[A];Object.defineProperty(a,"location",{set:function(h){if(Array.isArray(h))for(var d=0;d<i;++d)l[d].location=h[d];else for(var d=0;d<i;++d)l[d].location=h+d;return h},get:function(){for(var h=new Array(i),d=0;d<i;++d)h[d]=n[t[d]];return h},enumerable:!0}),a.pointer=function(h,d,f,g){h=h||r.FLOAT,d=!!d,f=f||i*i,g=g||0;for(var p=0;p<i;++p){var C=n[t[p]];r.vertexAttribPointer(C,i,h,d,f,g+p*i),r.enableVertexAttribArray(C)}};var c=new Array(i),u=r["vertexAttrib"+i+"fv"];Object.defineProperty(s,o,{set:function(h){for(var d=0;d<i;++d){var f=n[t[d]];if(r.disableVertexAttribArray(f),Array.isArray(h[0]))u.call(r,f,h[d]);else{for(var g=0;g<i;++g)c[g]=h[i*d+g];u.call(r,f,c)}}return h},get:function(){return a},enumerable:!0})}function zg(r,e,t,n){for(var i={},s=0,o=t.length;s<o;++s){var a=t[s],l=a.name,A=a.type,c=a.locations;switch(A){case"bool":case"int":case"float":ko(r,e,c[0],n,1,i,l);break;default:if(A.indexOf("vec")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new Lo("","Invalid data type for attribute "+l+": "+A);ko(r,e,c[0],n,u,i,l)}else if(A.indexOf("mat")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new Lo("","Invalid data type for attribute "+l+": "+A);jg(r,e,c,n,u,i,l)}else throw new Lo("","Unknown data type for attribute "+l+": "+A);break}}return i}var No={},kA={};(function(r){(function(){var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(a){return i(o(a),arguments)}function n(a,l){return t.apply(null,[a].concat(l||[]))}function i(a,l){var A=1,c=a.length,u,h="",d,f,g,p,C,Q,b,v;for(d=0;d<c;d++)if(typeof a[d]=="string")h+=a[d];else if(typeof a[d]=="object"){if(g=a[d],g.keys)for(u=l[A],f=0;f<g.keys.length;f++){if(u==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[f],g.keys[f-1]));u=u[g.keys[f]]}else g.param_no?u=l[g.param_no]:u=l[A++];if(e.not_type.test(g.type)&&e.not_primitive.test(g.type)&&u instanceof Function&&(u=u()),e.numeric_arg.test(g.type)&&typeof u!="number"&&isNaN(u))throw new TypeError(t("[sprintf] expecting number but found %T",u));switch(e.number.test(g.type)&&(b=u>=0),g.type){case"b":u=parseInt(u,10).toString(2);break;case"c":u=String.fromCharCode(parseInt(u,10));break;case"d":case"i":u=parseInt(u,10);break;case"j":u=JSON.stringify(u,null,g.width?parseInt(g.width):0);break;case"e":u=g.precision?parseFloat(u).toExponential(g.precision):parseFloat(u).toExponential();break;case"f":u=g.precision?parseFloat(u).toFixed(g.precision):parseFloat(u);break;case"g":u=g.precision?String(Number(u.toPrecision(g.precision))):parseFloat(u);break;case"o":u=(parseInt(u,10)>>>0).toString(8);break;case"s":u=String(u),u=g.precision?u.substring(0,g.precision):u;break;case"t":u=String(!!u),u=g.precision?u.substring(0,g.precision):u;break;case"T":u=Object.prototype.toString.call(u).slice(8,-1).toLowerCase(),u=g.precision?u.substring(0,g.precision):u;break;case"u":u=parseInt(u,10)>>>0;break;case"v":u=u.valueOf(),u=g.precision?u.substring(0,g.precision):u;break;case"x":u=(parseInt(u,10)>>>0).toString(16);break;case"X":u=(parseInt(u,10)>>>0).toString(16).toUpperCase();break}e.json.test(g.type)?h+=u:(e.number.test(g.type)&&(!b||g.sign)?(v=b?"+":"-",u=u.toString().replace(e.sign,"")):v="",C=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",Q=g.width-(v+u).length,p=g.width&&Q>0?C.repeat(Q):"",h+=g.align?v+u+p:C==="0"?v+p+u:p+v+u)}return h}var s=Object.create(null);function o(a){if(s[a])return s[a];for(var l=a,A,c=[],u=0;l;){if((A=e.text.exec(l))!==null)c.push(A[0]);else if((A=e.modulo.exec(l))!==null)c.push("%");else if((A=e.placeholder.exec(l))!==null){if(A[2]){u|=1;var h=[],d=A[2],f=[];if((f=e.key.exec(d))!==null)for(h.push(f[1]);(d=d.substring(f[0].length))!=="";)if((f=e.key_access.exec(d))!==null)h.push(f[1]);else if((f=e.index_access.exec(d))!==null)h.push(f[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");A[2]=h}else u|=2;if(u===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:A[0],param_no:A[1],keys:A[2],sign:A[3],pad_char:A[4],align:A[5],width:A[6],precision:A[7],type:A[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(A[0].length)}return s[a]=c}r.sprintf=t,r.vsprintf=n,typeof window<"u"&&(window.sprintf=t,window.vsprintf=n)})()})(kA);var Zg={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},e0=Zg,t0=function(e){return e0[e]},NA=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],r0=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],MA=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],n0=NA,i0=n0.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),Mo=MA;Mo=Mo.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var s0=Mo.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),o0=p0,a0=NA,PA=r0,l0=MA,A0=i0,c0=s0,jt=999,OA=9999,Po=0,Oo=1,UA=2,GA=3,HA=4,li=5,u0=6,h0=7,d0=8,$A=9,f0=10,YA=11,g0=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function p0(r){var e=0,t=0,n=jt,i,s,o=[],a=[],l=1,A=0,c=0,u=!1,h=!1,d="",f;r=r||{};var g=l0,p=a0;r.version==="300 es"&&(g=c0,p=A0);for(var C={},Q={},e=0;e<g.length;e++)C[g[e]]=!0;for(var e=0;e<p.length;e++)Q[p[e]]=!0;return function(X){return a=[],X!==null?v(X):x()};function b(X){X.length&&a.push({type:g0[n],data:X,position:c,line:l,column:A})}function v(X){e=0,X.toString&&(X=X.toString()),d+=X.replace(/\r\n/g,`
93
+ `),f=d.length;for(var _;i=d[e],e<f;){switch(_=e,n){case Po:e=O();break;case Oo:e=K();break;case UA:e=$();break;case GA:e=W();break;case HA:e=le();break;case YA:e=te();break;case li:e=D();break;case OA:e=P();break;case $A:e=k();break;case jt:e=R();break}if(_!==e)switch(d[_]){case`
94
+ `:A=0,++l;break;default:++A;break}}return t+=e,d=d.slice(e),a}function x(X){return o.length&&b(o.join("")),n=f0,b("(eof)"),a}function R(){return o=o.length?[]:o,s==="/"&&i==="*"?(c=t+e-1,n=Po,s=i,e+1):s==="/"&&i==="/"?(c=t+e-1,n=Oo,s=i,e+1):i==="#"?(n=UA,c=t+e,e):/\s/.test(i)?(n=$A,c=t+e,e):(u=/\d/.test(i),h=/[^\w_]/.test(i),c=t+e,n=u?HA:h?GA:OA,e)}function k(){return/[^\s]/g.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function $(){return(i==="\r"||i===`
95
+ `)&&s!=="\\"?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function K(){return $()}function O(){return i==="/"&&s==="*"?(o.push(i),b(o.join("")),n=jt,e+1):(o.push(i),s=i,e+1)}function W(){if(s==="."&&/\d/.test(i))return n=li,e;if(s==="/"&&i==="*")return n=Po,e;if(s==="/"&&i==="/")return n=Oo,e;if(i==="."&&o.length){for(;ie(o););return n=li,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=jt,e+1}var X=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||X){for(;ie(o););return n=jt,e}return o.push(i),s=i,e+1}function ie(X){var _=0,S,F;do{if(S=PA.indexOf(X.slice(0,X.length+_).join("")),F=PA[S],S===-1){if(_--+X.length>0)continue;F=X.slice(0,1).join("")}return b(F),c+=F.length,o=o.slice(F.length),o.length}while(!0)}function te(){return/[^a-fA-F0-9]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=li,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=YA,o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function D(){return i==="f"&&(o.push(i),s=i,e+=1),/[eE]/.test(i)||(i==="-"||i==="+")&&/[eE]/.test(s)?(o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function P(){if(/[^\d\w_]/.test(i)){var X=o.join("");return Q[X]?n=d0:C[X]?n=h0:n=u0,b(o.join("")),n=jt,e}return o.push(i),s=i,e+1}}var m0=o0,E0=I0;function I0(r,e){var t=m0(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var C0=function(e){return atob(e)},v0=E0,y0=C0,B0=T0;function T0(r){for(var e=Array.isArray(r)?r:v0(r),t=0;t<e.length;t++){var n=e[t];if(n.type==="preprocessor"){var i=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(i&&i[2]){var s=i[1],o=i[2];return(s?y0(o):o).trim()}}}}/*!
96
96
  * repeat-string <https://github.com/jonschlinkert/repeat-string>
97
97
  *
98
98
  * Copyright (c) 2014-2015, Jon Schlinkert.
99
99
  * Licensed under the MIT License.
100
- */var Br="",na,Hp=$p;function $p(r,e){if(typeof r!="string")throw new TypeError("expected a string");if(e===1)return r;if(e===2)return r+r;var t=r.length*e;if(na!==r||typeof na>"u")na=r,Br="";else if(Br.length>=t)return Br.substr(0,t);for(;t>Br.length&&e>1;)e&1&&(Br+=r),e>>=1,r+=r;return Br+=r,Br=Br.substr(0,t),Br}/*!
100
+ */var Br="",Uo,Q0=b0;function b0(r,e){if(typeof r!="string")throw new TypeError("expected a string");if(e===1)return r;if(e===2)return r+r;var t=r.length*e;if(Uo!==r||typeof Uo>"u")Uo=r,Br="";else if(Br.length>=t)return Br.substr(0,t);for(;t>Br.length&&e>1;)e&1&&(Br+=r),e>>=1,r+=r;return Br+=r,Br=Br.substr(0,t),Br}/*!
101
101
  * pad-left <https://github.com/jonschlinkert/pad-left>
102
102
  *
103
103
  * Copyright (c) 2014-2015, Jon Schlinkert.
104
104
  * Licensed under the MIT license.
105
- */var Yp=Hp,Vp=function(e,t,n){return n=typeof n<"u"?n+"":" ",Yp(n,t)+e},Kp=Vp,Jp=Wp;function Wp(r,e,t){e=typeof e=="number"?e:1,t=t||": ";var n=r.split(/\r?\n/),i=String(n.length+e-1).length;return n.map(function(s,o){var a=o+e,l=String(a).length,A=Kp(a,i-l);return A+t+s}).join(`
106
- `)}var gs=Cc.sprintf,qp=Ep,jp=Up,Xp=Jp,zp=Zp;function Zp(r,e,t){var n=jp(e)||"of unknown name (see npm glsl-shader-name)",i="unknown type";t!==void 0&&(i=t===qp.FRAGMENT_SHADER?"fragment":"vertex");for(var s=gs(`Error compiling %s shader %s:
107
- `,i,n),o=gs("%s%s",s,r),a=r.split(`
108
- `),l={},A=0;A<a.length;A++){var c=a[A];if(!(c===""||c==="\0")){var u=parseInt(c.split(":")[2]);if(isNaN(u))throw new Error(gs("Could not parse error: %s",c));l[u]=c}}for(var h=Xp(e).split(`
105
+ */var x0=Q0,w0=function(e,t,n){return n=typeof n<"u"?n+"":" ",x0(n,t)+e},S0=w0,R0=D0;function D0(r,e,t){e=typeof e=="number"?e:1,t=t||": ";var n=r.split(/\r?\n/),i=String(n.length+e-1).length;return n.map(function(s,o){var a=o+e,l=String(a).length,A=S0(a,i-l);return A+t+s}).join(`
106
+ `)}var as=kA.sprintf,_0=t0,L0=B0,F0=R0,k0=N0;function N0(r,e,t){var n=L0(e)||"of unknown name (see npm glsl-shader-name)",i="unknown type";t!==void 0&&(i=t===_0.FRAGMENT_SHADER?"fragment":"vertex");for(var s=as(`Error compiling %s shader %s:
107
+ `,i,n),o=as("%s%s",s,r),a=r.split(`
108
+ `),l={},A=0;A<a.length;A++){var c=a[A];if(!(c===""||c==="\0")){var u=parseInt(c.split(":")[2]);if(isNaN(u))throw new Error(as("Could not parse error: %s",c));l[u]=c}}for(var h=F0(e).split(`
109
109
  `),A=0;A<h.length;A++)if(!(!l[A+3]&&!l[A+2]&&!l[A+1])){var d=h[A];if(s+=d+`
110
- `,l[A+1]){var f=l[A+1];f=f.substr(f.split(":",3).join(":").length+1).trim(),s+=gs(`^^^ %s
110
+ `,l[A+1]){var f=l[A+1];f=f.substr(f.split(":",3).join(":").length+1).trim(),s+=as(`^^^ %s
111
111
 
112
- `,f)}}return{long:s.trim(),short:o.trim()}}var ia,Rc;function em(){if(Rc)return ia;Rc=1,ia=r;function r(e,t){var n={identity:t},i=e.valueOf;return Object.defineProperty(e,"valueOf",{value:function(s){return s!==t?i.apply(this,arguments):n},writable:!0}),n}return ia}var sa,Dc;function tm(){if(Dc)return sa;Dc=1;var r=em();sa=e;function e(){var t={};return function(n){if((typeof n!="object"||n===null)&&typeof n!="function")throw new Error("Weakmap-shim: Key must be object");var i=n.valueOf(t);return i&&i.identity===t?i:r(n,t)}}return sa}var oa,_c;function rm(){if(_c)return oa;_c=1;var r=tm();oa=e;function e(){var t=r();return{get:function(n,i){var s=t(n);return s.hasOwnProperty("value")?s.value:i},set:function(n,i){return t(n).value=i,this},has:function(n){return"value"in t(n)},delete:function(n){return delete t(n).value}}}return oa}Zo.shader=lm,Zo.program=Am;var aa=fs,nm=zp,im=typeof WeakMap>"u"?rm():WeakMap,Lc=new im,sm=0;function Fc(r,e,t,n,i,s,o){this.id=r,this.src=e,this.type=t,this.shader=n,this.count=s,this.programs=[],this.cache=o}Fc.prototype.dispose=function(){if(--this.count===0){for(var r=this.cache,e=r.gl,t=this.programs,n=0,i=t.length;n<i;++n){var s=r.programs[t[n]];s&&(delete r.programs[n],e.deleteProgram(s))}e.deleteShader(this.shader),delete r.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};function kc(r){this.gl=r,this.shaders=[{},{}],this.programs={}}var Nc=kc.prototype;function om(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS)){var i=r.getShaderInfoLog(n);try{var s=nm(i,t,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new aa(i,`Error compiling shader:
113
- `+i)}throw new aa(i,s.short,s.long)}return n}Nc.getShaderReference=function(r,e){var t=this.gl,n=this.shaders[r===t.FRAGMENT_SHADER|0],i=n[e];if(!i||!t.isShader(i.shader)){var s=om(t,r,e);i=n[e]=new Fc(sm++,e,r,s,[],1,this)}else i.count+=1;return i};function am(r,e,t,n,i){var s=r.createProgram();r.attachShader(s,e),r.attachShader(s,t);for(var o=0;o<n.length;++o)r.bindAttribLocation(s,i[o],n[o]);if(r.linkProgram(s),!r.getProgramParameter(s,r.LINK_STATUS)){var a=r.getProgramInfoLog(s);throw new aa(a,"Error linking program: "+a)}return s}Nc.getProgram=function(r,e,t,n){var i=[r.id,e.id,t.join(":"),n.join(":")].join("@"),s=this.programs[i];return(!s||!this.gl.isProgram(s))&&(this.programs[i]=s=am(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function Mc(r){var e=Lc.get(r);return e||(e=new kc(r),Lc.set(r,e)),e}function lm(r,e,t){return Mc(r).getShaderReference(e,t)}function Am(r,e,t,n,i){return Mc(r).getProgram(e,t,n,i)}var la={};la.uniforms=cm,la.attributes=um;var Pc={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},ps=null;function Oc(r,e){if(!ps){var t=Object.keys(Pc);ps={};for(var n=0;n<t.length;++n){var i=t[n];ps[r[i]]=Pc[i]}}return ps[e]}function cm(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=[],i=0;i<t;++i){var s=r.getActiveUniform(e,i);if(s){var o=Oc(r,s.type);if(s.size>1)for(var a=0;a<s.size;++a)n.push({name:s.name.replace("[0]","["+a+"]"),type:o});else n.push({name:s.name,type:o})}}return n}function um(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),n=[],i=0;i<t;++i){var s=r.getActiveAttrib(e,i);s&&n.push({name:s.name,type:Oc(r,s.type)})}return n}var hm=cp,dm=hp,Uc=mc,Aa=Zo,Gc=la,fm=fs;function Hc(r){this.gl=r,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var ca=Hc.prototype;ca.bind=function(){this.program||this._relink();var r,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),t=this.gl.lastAttribCount;if(e>t)for(r=t;r<e;r++)this.gl.enableVertexAttribArray(r);else if(t>e)for(r=e;r<t;r++)this.gl.disableVertexAttribArray(r);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},ca.dispose=function(){for(var r=this.gl.lastAttribCount,e=0;e<r;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null};function gm(r,e){return r.name<e.name?-1:1}ca.update=function(r,e,t,n){if(!e||arguments.length===1){var i=r;r=i.vertex,e=i.fragment,t=i.uniforms,n=i.attributes}var s=this,o=s.gl,a=s._vref;s._vref=Aa.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=Aa.shader(o,o.FRAGMENT_SHADER,e),l&&l.dispose(),s.fragShader=s._fref.shader,!t||!n){var A=o.createProgram();if(o.attachShader(A,s.fragShader),o.attachShader(A,s.vertShader),o.linkProgram(A),!o.getProgramParameter(A,o.LINK_STATUS)){var c=o.getProgramInfoLog(A);throw new fm(c,"Error linking program:"+c)}t=t||Gc.uniforms(o,A),n=n||Gc.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(gm);var u=[],h=[],d=[],f;for(f=0;f<n.length;++f){var g=n[f];if(g.type.indexOf("mat")>=0){for(var p=g.type.charAt(g.type.length-1)|0,y=new Array(p),Q=0;Q<p;++Q)y[Q]=d.length,h.push(g.name+"["+Q+"]"),typeof g.location=="number"?d.push(g.location+Q):Array.isArray(g.location)&&g.location.length===p&&typeof g.location[Q]=="number"?d.push(g.location[Q]|0):d.push(-1);u.push({name:g.name,type:g.type,locations:y})}else u.push({name:g.name,type:g.type,locations:[d.length]}),h.push(g.name),typeof g.location=="number"?d.push(g.location|0):d.push(-1)}var b=0;for(f=0;f<d.length;++f)if(d[f]<0){for(;d.indexOf(b)>=0;)b+=1;d[f]=b}var v=new Array(t.length);function w(){s.program=Aa.program(o,s._vref,s._fref,h,d);for(var R=0;R<t.length;++R)v[R]=o.getUniformLocation(s.program,t[R].name)}w(),s._relink=w,s.types={uniforms:Uc(t),attributes:Uc(n)},s.attributes=dm(o,s,u,d),Object.defineProperty(s,"uniforms",hm(o,s,t,v))};function pm(r,e,t,n,i){var s=new Hc(r);return s.update(e,t,n,i),s}var mm=pm;Object.defineProperty(pc,"__esModule",{value:!0});var Em=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Im=mm,Cm=vm(Im);function vm(r){return r&&r.__esModule?r:{default:r}}var ym=`attribute vec2 _p;
112
+ `,f)}}return{long:s.trim(),short:o.trim()}}var Go,VA;function M0(){if(VA)return Go;VA=1,Go=r;function r(e,t){var n={identity:t},i=e.valueOf;return Object.defineProperty(e,"valueOf",{value:function(s){return s!==t?i.apply(this,arguments):n},writable:!0}),n}return Go}var Ho,KA;function P0(){if(KA)return Ho;KA=1;var r=M0();Ho=e;function e(){var t={};return function(n){if((typeof n!="object"||n===null)&&typeof n!="function")throw new Error("Weakmap-shim: Key must be object");var i=n.valueOf(t);return i&&i.identity===t?i:r(n,t)}}return Ho}var $o,JA;function O0(){if(JA)return $o;JA=1;var r=P0();$o=e;function e(){var t=r();return{get:function(n,i){var s=t(n);return s.hasOwnProperty("value")?s.value:i},set:function(n,i){return t(n).value=i,this},has:function(n){return"value"in t(n)},delete:function(n){return delete t(n).value}}}return $o}No.shader=V0,No.program=K0;var Yo=os,U0=k0,G0=typeof WeakMap>"u"?O0():WeakMap,WA=new G0,H0=0;function qA(r,e,t,n,i,s,o){this.id=r,this.src=e,this.type=t,this.shader=n,this.count=s,this.programs=[],this.cache=o}qA.prototype.dispose=function(){if(--this.count===0){for(var r=this.cache,e=r.gl,t=this.programs,n=0,i=t.length;n<i;++n){var s=r.programs[t[n]];s&&(delete r.programs[n],e.deleteProgram(s))}e.deleteShader(this.shader),delete r.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};function XA(r){this.gl=r,this.shaders=[{},{}],this.programs={}}var jA=XA.prototype;function $0(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS)){var i=r.getShaderInfoLog(n);try{var s=U0(i,t,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new Yo(i,`Error compiling shader:
113
+ `+i)}throw new Yo(i,s.short,s.long)}return n}jA.getShaderReference=function(r,e){var t=this.gl,n=this.shaders[r===t.FRAGMENT_SHADER|0],i=n[e];if(!i||!t.isShader(i.shader)){var s=$0(t,r,e);i=n[e]=new qA(H0++,e,r,s,[],1,this)}else i.count+=1;return i};function Y0(r,e,t,n,i){var s=r.createProgram();r.attachShader(s,e),r.attachShader(s,t);for(var o=0;o<n.length;++o)r.bindAttribLocation(s,i[o],n[o]);if(r.linkProgram(s),!r.getProgramParameter(s,r.LINK_STATUS)){var a=r.getProgramInfoLog(s);throw new Yo(a,"Error linking program: "+a)}return s}jA.getProgram=function(r,e,t,n){var i=[r.id,e.id,t.join(":"),n.join(":")].join("@"),s=this.programs[i];return(!s||!this.gl.isProgram(s))&&(this.programs[i]=s=Y0(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function zA(r){var e=WA.get(r);return e||(e=new XA(r),WA.set(r,e)),e}function V0(r,e,t){return zA(r).getShaderReference(e,t)}function K0(r,e,t,n,i){return zA(r).getProgram(e,t,n,i)}var Vo={};Vo.uniforms=J0,Vo.attributes=W0;var ZA={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},ls=null;function ec(r,e){if(!ls){var t=Object.keys(ZA);ls={};for(var n=0;n<t.length;++n){var i=t[n];ls[r[i]]=ZA[i]}}return ls[e]}function J0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=[],i=0;i<t;++i){var s=r.getActiveUniform(e,i);if(s){var o=ec(r,s.type);if(s.size>1)for(var a=0;a<s.size;++a)n.push({name:s.name.replace("[0]","["+a+"]"),type:o});else n.push({name:s.name,type:o})}}return n}function W0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),n=[],i=0;i<t;++i){var s=r.getActiveAttrib(e,i);s&&n.push({name:s.name,type:ec(r,s.type)})}return n}var q0=Jg,X0=qg,tc=_A,Ko=No,rc=Vo,j0=os;function nc(r){this.gl=r,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var Jo=nc.prototype;Jo.bind=function(){this.program||this._relink();var r,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),t=this.gl.lastAttribCount;if(e>t)for(r=t;r<e;r++)this.gl.enableVertexAttribArray(r);else if(t>e)for(r=e;r<t;r++)this.gl.disableVertexAttribArray(r);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},Jo.dispose=function(){for(var r=this.gl.lastAttribCount,e=0;e<r;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null};function z0(r,e){return r.name<e.name?-1:1}Jo.update=function(r,e,t,n){if(!e||arguments.length===1){var i=r;r=i.vertex,e=i.fragment,t=i.uniforms,n=i.attributes}var s=this,o=s.gl,a=s._vref;s._vref=Ko.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=Ko.shader(o,o.FRAGMENT_SHADER,e),l&&l.dispose(),s.fragShader=s._fref.shader,!t||!n){var A=o.createProgram();if(o.attachShader(A,s.fragShader),o.attachShader(A,s.vertShader),o.linkProgram(A),!o.getProgramParameter(A,o.LINK_STATUS)){var c=o.getProgramInfoLog(A);throw new j0(c,"Error linking program:"+c)}t=t||rc.uniforms(o,A),n=n||rc.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(z0);var u=[],h=[],d=[],f;for(f=0;f<n.length;++f){var g=n[f];if(g.type.indexOf("mat")>=0){for(var p=g.type.charAt(g.type.length-1)|0,C=new Array(p),Q=0;Q<p;++Q)C[Q]=d.length,h.push(g.name+"["+Q+"]"),typeof g.location=="number"?d.push(g.location+Q):Array.isArray(g.location)&&g.location.length===p&&typeof g.location[Q]=="number"?d.push(g.location[Q]|0):d.push(-1);u.push({name:g.name,type:g.type,locations:C})}else u.push({name:g.name,type:g.type,locations:[d.length]}),h.push(g.name),typeof g.location=="number"?d.push(g.location|0):d.push(-1)}var b=0;for(f=0;f<d.length;++f)if(d[f]<0){for(;d.indexOf(b)>=0;)b+=1;d[f]=b}var v=new Array(t.length);function x(){s.program=Ko.program(o,s._vref,s._fref,h,d);for(var R=0;R<t.length;++R)v[R]=o.getUniformLocation(s.program,t[R].name)}x(),s._relink=x,s.types={uniforms:tc(t),attributes:tc(n)},s.attributes=X0(o,s,u,d),Object.defineProperty(s,"uniforms",q0(o,s,t,v))};function Z0(r,e,t,n,i){var s=new nc(r);return s.update(e,t,n,i),s}var ep=Z0;Object.defineProperty(DA,"__esModule",{value:!0});var tp=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},rp=ep,np=ip(rp);function ip(r){return r&&r.__esModule?r:{default:r}}var sp=`attribute vec2 _p;
114
114
  varying vec2 _uv;
115
115
  void main() {
116
116
  gl_Position = vec4(_p,0.0,1.0);
117
117
  _uv = vec2(0.5, 0.5) * (_p+vec2(1.0, 1.0));
118
- }`,Bm={cover:function(e){return".5+(uv-.5)*vec2(min(ratio/"+e+",1.),min("+e+"/ratio,1.))"},contain:function(e){return".5+(uv-.5)*vec2(max(ratio/"+e+",1.),max("+e+"/ratio,1.))"},stretch:function(){return"uv"}},Tm=function(e,t){var n=Bm[t];if(!n)throw new Error("invalid resizeMode="+t);return"precision highp float;varying vec2 _uv;uniform sampler2D from, to;uniform float progress, ratio, _fromR, _toR;vec4 getFromColor(vec2 uv){return texture2D(from,"+n("_fromR")+");}vec4 getToColor(vec2 uv){return texture2D(to,"+n("_toR")+`);}
118
+ }`,op={cover:function(e){return".5+(uv-.5)*vec2(min(ratio/"+e+",1.),min("+e+"/ratio,1.))"},contain:function(e){return".5+(uv-.5)*vec2(max(ratio/"+e+",1.),max("+e+"/ratio,1.))"},stretch:function(){return"uv"}},ap=function(e,t){var n=op[t];if(!n)throw new Error("invalid resizeMode="+t);return"precision highp float;varying vec2 _uv;uniform sampler2D from, to;uniform float progress, ratio, _fromR, _toR;vec4 getFromColor(vec2 uv){return texture2D(from,"+n("_fromR")+");}vec4 getToColor(vec2 uv){return texture2D(to,"+n("_toR")+`);}
119
119
  `+e+`
120
- void main(){gl_FragColor=transition(_uv);}`},$c=pc.default=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=Em({resizeMode:"cover"},t),i=n.resizeMode,s=(0,Cm.default)(r,ym,Tm(e.glsl,i));return s.bind(),s.attributes._p.pointer(),{draw:function(a,l,A){var c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:r.drawingBufferWidth,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:r.drawingBufferHeight,h=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};s.bind(),s.uniforms.ratio=c/u,s.uniforms.progress=a,s.uniforms.from=l.bind(0),s.uniforms.to=A.bind(1),s.uniforms._fromR=l.shape[0]/l.shape[1],s.uniforms._toR=A.shape[0]/A.shape[1];var d=2;for(var f in e.paramsTypes){var g=f in h?h[f]:e.defaultParams[f];if(e.paramsTypes[f]==="sampler2D")if(!g)console.warn("uniform["+f+"]: A texture MUST be defined for uniform sampler2D of a texture");else{if(typeof g.bind!="function")throw new Error("uniform["+f+"]: A gl-texture2d API-like object was expected");s.uniforms[f]=g.bind(d++)}else s.uniforms[f]=g}r.drawArrays(r.TRIANGLES,0,3)},dispose:function(){s.dispose()}}},Qm=[{name:"Bounce",paramsTypes:{shadow_colour:"vec4",shadow_height:"float",bounces:"float"},defaultParams:{shadow_colour:[0,0,0,.6],shadow_height:.075,bounces:3},glsl:`// Author: Adrian Purser
120
+ void main(){gl_FragColor=transition(_uv);}`},ic=DA.default=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=tp({resizeMode:"cover"},t),i=n.resizeMode,s=(0,np.default)(r,sp,ap(e.glsl,i));return s.bind(),s.attributes._p.pointer(),{draw:function(a,l,A){var c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:r.drawingBufferWidth,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:r.drawingBufferHeight,h=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};s.bind(),s.uniforms.ratio=c/u,s.uniforms.progress=a,s.uniforms.from=l.bind(0),s.uniforms.to=A.bind(1),s.uniforms._fromR=l.shape[0]/l.shape[1],s.uniforms._toR=A.shape[0]/A.shape[1];var d=2;for(var f in e.paramsTypes){var g=f in h?h[f]:e.defaultParams[f];if(e.paramsTypes[f]==="sampler2D")if(!g)console.warn("uniform["+f+"]: A texture MUST be defined for uniform sampler2D of a texture");else{if(typeof g.bind!="function")throw new Error("uniform["+f+"]: A gl-texture2d API-like object was expected");s.uniforms[f]=g.bind(d++)}else s.uniforms[f]=g}r.drawArrays(r.TRIANGLES,0,3)},dispose:function(){s.dispose()}}},lp=[{name:"Bounce",paramsTypes:{shadow_colour:"vec4",shadow_height:"float",bounces:"float"},defaultParams:{shadow_colour:[0,0,0,.6],shadow_height:.075,bounces:3},glsl:`// Author: Adrian Purser
121
121
  // License: MIT
122
122
 
123
123
  uniform vec4 shadow_colour; // = vec4(0.,0.,0.,.6)
@@ -2450,46 +2450,46 @@ vec4 transition(vec2 uv) {
2450
2450
  vec4 b=getToColor(p);
2451
2451
  return mix(a, b, step(0.0+p.y,progress));
2452
2452
  }
2453
- `,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const Yc=Fo(Qm);var Vc;function bm(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function xm(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function Kc({resolution:r,aspectRatio:e}){const t=bm(r),n=xm(e),i=n>=1,s=Math.min(i?t*n:t/n,t),o=Math.max(i?t*n:t/n,t);return{resolution:t,aspectRatio:n,height:i?s:o,width:i?o:s}}function wm(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function Jc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function Sm(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:y="start",alignSelf:Q,justify:b="start"}=t,v={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(v[i]),s){const{top:H,right:V,bottom:O,left:W}=wm(s,n);typeof H<"u"&&e.setPosition(r.EDGE_TOP,H),typeof V<"u"&&e.setPosition(r.EDGE_RIGHT,V),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof W<"u"&&e.setPosition(r.EDGE_LEFT,W)}const w={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(w[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[y]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:H,right:V,bottom:O,left:W}=Jc(f,n);e.setMargin(r.EDGE_TOP,H),e.setMargin(r.EDGE_RIGHT,V),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,W)}if(g){const{top:H,right:V,bottom:O,left:W}=Jc(g,n);e.setPadding(r.EDGE_TOP,H),e.setPadding(r.EDGE_RIGHT,V),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,W)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}function Wc(r,e,t,n=0){var i;const s=r.Node.create(),{layout:o,renderer:a,options:l}=t;Sm(r,s,{layout:o}),e.insertChild(s,n);const A={node:s,options:l,renderer:a,childNodes:((i=t.children)==null?void 0:i.map((c,u)=>Wc(r,s,c,u)))??[]};return e.calculateLayout(),A}function qc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout();return e.map(({node:o,renderer:a,options:l,childNodes:A})=>{const{top:c,left:u,width:h,height:d}=o.getComputedLayout(),f=t+u,g=n+c;return{x:s+f,y:i+g,width:h,height:d,options:l,renderer:a,childNodes:qc(r,A,f,g)}})}function ua(r,e){r.forEach(({node:t,options:n,renderer:i,childNodes:s})=>{const{width:o,height:a}=i;if(o&&typeof o=="function"){const l=o({node:t,options:n,measureCanvas:e});t.setWidth(l)}if(ua(s,e),a&&typeof a=="function"){const l=a({node:t,options:n,measureCanvas:e});t.setHeight(l)}ua(s,e)})}function Rm({yoga:r,recipe:e,measureCanvas:t}){const n=r.Node.create(),i=Wc(r,n,e);ua([i],t),n.calculateLayout();const{top:s,left:o,width:a,height:l}=n.getComputedLayout(),A={x:o,y:s,width:a,height:l,options:e.options,renderer:e.renderer,childNodes:qc(n,[i])};return n.freeRecursive(),A}function jc({context:r,word:e,maxW:t=1/0}){const n=[],i=r.measureText(e);if(i.width<t)return[{text:e,metrics:i}];for(let s=0;s<e.length;s++){const o=n[n.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=r.measureText(a);l.width<t?n[o?n.length-1:0]={text:a,metrics:l}:n.push({text:e[s],metrics:r.measureText(e[s])})}return n}const Dm=Vi(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(hi,e[0].toString()),t.split(`
2454
- `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...jc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(hi,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},jc({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`});Vi(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=Dm({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(hi))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`}),Vi(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(hi,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(hi,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});const _m={linear:Og,easeIn:_o,easeInOut:Gg,easeOut:Ug,circIn:UA,circInOut:Hg,circOut:GA,backIn:Lo,backInOut:Yg,backOut:$g,anticipate:Vg,bounceIn:qg,bounceInOut:jg,bounceOut:ji};Vi((r,e,{clamp:t=!0,ease:n="easeIn",...i}={})=>Lg(r,e,{...i,clamp:t,ease:_m[n]}),{cacheKey:([r,e,t])=>JSON.stringify({from:r,to:e,options:t})});const Xc=[{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 Lm({text:r,font:e}){let t=e;return Xc.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}const hi=/(?<value>\d+\.?\d*)(?=px)/;let ms;const Fm=new Uint8Array(16);function km(){if(!ms&&(ms=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ms))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ms(Fm)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function Nm(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const zc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Mm(r,e,t){if(zc.randomUUID&&!e&&!r)return zc.randomUUID();r=r||{};const n=r.random||(r.rng||km)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return Nm(n)}function Zc(r,e){if(e.renderer.type===r)return e;if(e.children)for(const t of e.children){const n=Zc(r,t);if(n)return n}}function Pm(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function Om(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const Um=ii(()=>HA.loadYoga());Xg.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Om(r)}"`:Pm(r)||Array.isArray(r)?JSON.stringify(r):r);const Gm="3",Hm=(((Vc=Yc)==null?void 0:Vc.default)??Yc).reduce((r,e)=>(r[e.name]=e,r),{});function $m({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ds)==null?void 0:s.default)??ds)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ds)==null?void 0:o.default)??ds)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=$c)==null?void 0:a.default)??$c)(l,Hm[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Ym(){return document.createElement("canvas")}function Es(r){let e=0;for(const t of r)Array.isArray(t)?e+=Es(t):e+=t;return e}function Vm(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}async function eu({layout:r,canvases:e,sceneTime:t}){await r.renderer.render({canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,options:r.options});for await(const n of r.childNodes)await eu({layout:n,canvases:e,sceneTime:t})}async function tu({config:r,canvasFactory:e=Ym}){const t=await Um();async function n(a,l=0){var A;const{x:c=0,y:u=0,scale:h=1,duration:d}=a,f=await e(),g=await e(),p=await e(),y=await e(),Q=await e(),b=await e(),v=Rm({yoga:t,recipe:a.recipe,measureCanvas:y}),w=async k=>{const H=Math.max(0,k-l);Q.width=Q.height=0,Q.width=v.width,Q.height=v.height,await eu({layout:v,sceneTime:H,canvases:{sceneCanvas:Q,cropCanvas:f,letterboxCanvas:g,posterCanvas:p}})};function R(k){const H=[];k.renderer.type!=="null"&&H.push({id:Mm(),type:"scene",x:k.x,y:k.y,scale:h,duration:d,recipe:{layout:{width:k.width,height:k.height},renderer:k.renderer,options:k.options}});for(const V of k.childNodes)H.push(...R(V));return H}return{x:c,y:u,scale:h,draw:w,start:l,duration:d,layout:v,sceneCanvas:Q,transitionCanvas:b,id:a.id,config:a,childScenes:R(v),video:(A=Zc("video",a.recipe))==null?void 0:A.options}}const i=await Promise.all(r.tracks.map(async a=>{const l=Vm(a),A=await Promise.all(a.reduce((d,f,g)=>{if(f.type!=="scene")return d;const p=Es(l.slice(0,g));return d.push(n(f,p)),d},[])),c=a.reduce((d,f,g)=>{if(f.type!=="gap")return d;const p=Es(l.slice(0,g));return d.push({id:f.id,start:p,config:f,duration:f.duration}),d},[]),u=a.reduce((d,f,g)=>{if(f.type!=="transition")return d;const p=f.duration,y=Es(l.slice(0,g))-p;return d.push({id:f.id,name:f.name,start:y,duration:p,config:f,to:A.find(({id:Q})=>{var b;return Q===((b=a[g+1])==null?void 0:b.id)}),from:A.find(({id:Q})=>{var b;return Q===((b=a[g-1])==null?void 0:b.id)})}),d},[]),h=a.map(({id:d})=>A.find(({id:f})=>f===d)??c.find(({id:f})=>f===d)??u.find(({id:f})=>f===d)).filter(Boolean);return{drawScenes:A,gapScenes:c,transitions:u,scenes:h,config:a,videoScenes:A.filter(({video:d})=>!!d),duration:Math.max(...h.map(({start:d,duration:f})=>d+f)),trackCanvas:await e()}})),s=await e();return{draw:async({canvas:a,currentTime:l})=>{const A=a.getContext("2d");if(A){A.globalAlpha=1,A.globalCompositeOperation="source-over",A.clearRect(0,0,a.width,a.height),A.save(),A.fillStyle="black",A.fillRect(0,0,a.width,a.height),A.restore();for await(const{drawScenes:c,transitions:u,trackCanvas:h}of i){h.width=h.height=0,h.width=a.width,h.height=a.height;const d=c.filter(({start:g,duration:p})=>l>=g&&l<g+p);if(d.length<=0)continue;const f=u.find(({start:g,duration:p})=>l>=g&&l<g+p);for await(const{id:g,x:p,y,scale:Q,start:b,duration:v,sceneCanvas:w,transitionCanvas:R,draw:k}of d)if(await(k==null?void 0:k(l)),!f)A.drawImage(w,p,y,w.width*Q,w.height*Q);else{const{name:H,to:V,from:O,duration:W}=f;s.width=s.height=R.width=R.height=0,s.width=R.width=w.width,s.height=R.height=w.height;const ie=(V==null?void 0:V.id)===g,te=(O==null?void 0:O.id)===g,le=ie&&V.sceneCanvas||s,D=te&&O.sceneCanvas||s,P=ie?Math.min(1,Math.max(0,(l-b)/W)):Math.min(1,Math.max(0,1-(b+v-l)/W));$m({name:H,progress:P,to:le,from:D,canvas:R});const j=h.getContext("2d");if(!j)return;j.globalCompositeOperation="lighter",j.drawImage(R,p,y,R.width*Q,R.height*Q)}A.drawImage(h,0,0,h.width,h.height)}}},tracks:i,audioTracks:r.audioTracks,duration:Math.max(...i.map(({duration:a})=>a),...r.audioTracks.map(({start:a,duration:l})=>a+l))}}const Km={name:"@vouchfor/embeds",version:"0.0.0-experiment.f77dbf9",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:"experiment",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":"0.0.0-experiment.f77dbf9","@vouchfor/media-player":"0.0.0-experiment.f77dbf9",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":"0.0.0-experiment.f77dbf9","@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 Jm(r){const{publicApiUrl:e}=Yi(r),t=Fr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Wm(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Fr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=Fr();return e||(e=Jm(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Fr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=Fr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function qm(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function jm(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Km.version,templateVersion:Gm,...n}}const ru=1;class Xm{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=qm(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=Yi(this.host.env),{client:n,tab:i,request:s,visitor:o}=Wm(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":jm(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+ru&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+ru&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ha={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mn<"u"&&mn,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var P={next:function(){var j=D.shift();return{done:j===void 0,value:j}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(D){this.map={},D instanceof g?D.forEach(function(P,j){this.append(j,P)},this):Array.isArray(D)?D.forEach(function(P){this.append(P[0],P[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(P){this.append(P,D[P])},this)}g.prototype.append=function(D,P){D=h(D),P=d(P);var j=this.map[D];this.map[D]=j?j+", "+P:P},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,P){this.map[h(D)]=d(P)},g.prototype.forEach=function(D,P){for(var j in this.map)this.map.hasOwnProperty(j)&&D.call(P,this.map[j],j,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(P,j){D.push(j)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(P){D.push(P)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(P,j){D.push([j,P])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function y(D){return new Promise(function(P,j){D.onload=function(){P(D.result)},D.onerror=function(){j(D.error)}})}function Q(D){var P=new FileReader,j=y(P);return P.readAsArrayBuffer(D),j}function b(D){var P=new FileReader,j=y(P);return P.readAsText(D),j}function v(D){for(var P=new Uint8Array(D),j=new Array(P.length),_=0;_<P.length;_++)j[_]=String.fromCharCode(P[_]);return j.join("")}function w(D){if(D.slice)return D.slice(0);var P=new Uint8Array(D.byteLength);return P.set(new Uint8Array(D)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=w(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=w(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(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(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(D){var P=D.toUpperCase();return k.indexOf(P)>-1?P:D}function V(D,P){if(!(this instanceof V))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var j=P.body;if(D instanceof V){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,P.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!j&&D._bodyInit!=null&&(j=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=H(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&j)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(j),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}V.prototype.clone=function(){return new V(this,{body:this._bodyInit})};function O(D){var P=new FormData;return D.trim().split("&").forEach(function(j){if(j){var _=j.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function W(D){var P=new g,j=D.replace(/\r?\n[\t ]+/g," ");return j.split("\r").map(function(_){return _.indexOf(`
2455
- `)===0?_.substr(1,_.length):_}).forEach(function(_){var S=_.split(":"),F=S.shift().trim();if(F){var J=S.join(":").trim();P.append(F,J)}}),P}R.call(V.prototype);function ie(D,P){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new g(P.headers),this.url=P.url||"",this._initBody(D)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var D=new ie(null,{status:0,statusText:""});return D.type="error",D};var te=[301,302,303,307,308];ie.redirect=function(D,P){if(te.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:D}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,j){this.message=P,this.name=j;var _=Error(P);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(D,P){return new Promise(function(j,_){var S=new V(D,P);if(S.signal&&S.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function J(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:W(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){j(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){_(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof g)?Object.getOwnPropertyNames(P.headers).forEach(function(ne){F.setRequestHeader(ne,d(P.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",J),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",J)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=V,a.Response=ie),o.Headers=g,o.Request=V,o.Response=ie,o.fetch=le,o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=t.fetch?t:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(ha,ha.exports);var zm=ha.exports;const nu=Fo(zm);async function Zm(r){var e;try{if((e=await nu(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function da({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),n=t==null?void 0:t.find(s=>s.startsWith("blob:")),i=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(n||i)return n??i;if(t.length>0){const s=t.map(o=>Zm(o));e=(await Promise.all(s)).find(Boolean)}return e}async function eE(r){try{return(await nu(r)).text()}catch{return null}}async function tE(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?eE(r):r}const rE=ii(async({original:r,translation:e,originalLanguage:t="",translationLanguage:n=""},{language:i})=>{var s,o;const a={[(s=n==null?void 0:n.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(i&&a[i])??r;return l?tE(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function nE(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var n;return{text:(n=t.alternatives[0])==null?void 0:n.content,start:t.start_time,end:t.end_time}}))??[]}const iE=ii(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([da({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input]}),da({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),da({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,n,i,s,o,a,l,A,c,u;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function iu(r){var e,t,n,i,s,o,a,l,A,c,u,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(i=(n=r==null?void 0:r.answer)==null?void 0:n.contact)==null?void 0:i.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const sE=ii(async(r,e,t)=>{var n,i,s;const o=(n=e==null?void 0:e.answer)==null?void 0:n.id;return((s=(i=r==null?void 0:r.questions)==null?void 0:i.items)==null?void 0:s.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var n;return JSON.stringify({index:t,rootData:e,allQuestions:(n=r==null?void 0:r.questions)==null?void 0:n.items})}});async function fa({data:r,rootData:e,index:t},n){var i,s,o,a,l,A,c,u,h,d,f,g,p,y,Q,b,v,w,R,k,H,V,O,W;const[ie,te,le]=await Promise.all([sE(r,e,t),iE(e),rE({original:((s=(i=e==null?void 0:e.answer)==null?void 0:i.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.translation)??((u=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:u.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},n)]),D=iu(e);return{...te,...D,key:ie,captions:le,wordTimings:nE((y=e==null?void 0:e.answer)==null?void 0:y.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(w=(v=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:v[t-1])==null?void 0:w.answer)==null?void 0:R.label)??((V=(H=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:H[t-1])==null?void 0:V.title)??null:null,isFirstInstanceOfName:t?((W=(O=r==null?void 0:r.questions)==null?void 0:O.items)==null?void 0:W.findIndex(P=>iu(P).name===D.name))===t:!0}}const Is={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 oE({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((n,i)=>{var s,o,a,l,A,c,u;const h=(a=(o=(s=i==null?void 0:i.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(A=(l=i==null?void 0:i.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&Is[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:Is[h]}),d&&Is[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:Is[d]}),n},[]))??[]}/**
2453
+ `,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const sc=mo(lp);var oc;function Ap(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function cp(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function Wo({resolution:r,aspectRatio:e}){const t=Ap(r),n=cp(e),i=n>=1,s=Math.min(i?t*n:t/n,t),o=Math.max(i?t*n:t/n,t);return{resolution:t,aspectRatio:n,height:i?s:o,width:i?o:s}}const Ai=/(?<value>\d+\.?\d*)(?=px)/;function ac({context:r,word:e,maxW:t=1/0}){const n=[],i=r.measureText(e);if(Math.floor(i.width)<=t)return[{text:e,metrics:i}];for(let s=0;s<e.length;s++){const o=n[n.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=r.measureText(a);l.width<t?n[o?n.length-1:0]={text:a,metrics:l}:n.push({text:e[s],metrics:r.measureText(e[s])})}return n}const up=po(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(Ai,e[0].toString()),t.split(`
2454
+ `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...ac({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(Ai,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},ac({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),lc=[{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 hp({text:r,font:e}){let t=e;return lc.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}po(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(Ai,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(Ai,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let As;const dp=new Uint8Array(16);function fp(){if(!As&&(As=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!As))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return As(dp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function gp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const Ac={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pp(r,e,t){if(Ac.randomUUID&&!e&&!r)return Ac.randomUUID();r=r||{};const n=r.random||(r.rng||fp)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return gp(n)}po(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=up({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(Ai))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`});function mp(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function Ep(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const Ip=qr(()=>nA.loadYoga());Ff.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Ep(r)}"`:mp(r)||Array.isArray(r)?JSON.stringify(r):r);const Cp="3";function vp(r){return typeof r=="number"?{topLeft:r,topRight:r,bottomRight:r,bottomLeft:r}:{topLeft:(r==null?void 0:r.topLeft)??0,topRight:(r==null?void 0:r.topRight)??0,bottomRight:(r==null?void 0:r.bottomRight)??0,bottomLeft:(r==null?void 0:r.bottomLeft)??0}}function yp(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function cc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function uc(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:C="start",alignSelf:Q,justify:b="start"}=t??{},v={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(v[i]),s){const{top:$,right:K,bottom:O,left:W}=yp(s,n);typeof $<"u"&&e.setPosition(r.EDGE_TOP,$),typeof K<"u"&&e.setPosition(r.EDGE_RIGHT,K),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof W<"u"&&e.setPosition(r.EDGE_LEFT,W)}const x={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(x[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[C]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:$,right:K,bottom:O,left:W}=cc(f,n);e.setMargin(r.EDGE_TOP,$),e.setMargin(r.EDGE_RIGHT,K),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,W)}if(g){const{top:$,right:K,bottom:O,left:W}=cc(g,n);e.setPadding(r.EDGE_TOP,$),e.setPadding(r.EDGE_RIGHT,K),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,W)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}async function hc({yoga:r,index:e,parent:t,element:n,resolvers:i}){var s,o;const{type:a,layout:l={},config:A,options:c,renderer:u}=n,h=r.Node.create();uc(r,h,{layout:l}),t.insertChild(h,e);let d=null;i&&((u==null?void 0:u.type)==="text"||(u==null?void 0:u.type)==="image"||(u==null?void 0:u.type)==="video")&&(d=await((s=i[u.type])==null?void 0:s.call(i,{config:A,options:c}))??null);const f=[];for await(const[g,p]of((o=n.children)==null?void 0:o.entries())??[])f.push(await hc({yoga:r,index:g,parent:h,element:p,resolvers:i}));return t.calculateLayout(),{type:a,node:h,radius:vp(l.radius),element:n,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function dc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=n+o,h=e.childNodes.map(d=>dc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function qo(r,e,t){for await(const{node:n,options:i,dependencies:s,renderer:o,childNodes:a}of e){if(o){const{width:l,height:A}=o;if(l){const c=await l({node:n,options:i,dependencies:s,measureCanvas:t});n.setWidth(c)}if(await qo(r,a,t),A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}}await qo(r,a,t)}r.calculateLayout()}async function fc({root:r,resolvers:e,measureCanvas:t}){const n=await Ip(),i=n.Node.create();uc(n,i,{layout:r.layout});const s=await hc({yoga:n,index:0,parent:i,element:r.element,resolvers:e});await qo(i,[s],t);const{top:o,left:a,width:l,height:A}=i.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:dc(i,s)};return i.freeRecursive(),c}async function Bp({scene:r,start:e=0}){const{root:t,duration:n}=r,i=await fc({root:t});return{type:r.type,start:e,duration:n,layout:i,id:r.id,config:r}}async function gc(){return document.createElement("canvas")}function Cn(r){let e=0;for(const t of r)Array.isArray(t)?e+=Cn(t):e+=t;return e}function Tp(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function pc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return pc(t)}).filter(Boolean))??[]}}function mc({node:r,duration:e}){const t=[];r.type==="recipe"&&t.push({id:pp(),type:"scene",x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:pc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}})}});for(const n of r.childNodes)t.push(...mc({node:n,duration:e}));return t}async function Ec({node:r,canvases:e,sceneTime:t}){var n,i;await((i=(n=r.renderer)==null?void 0:n.render)==null?void 0:i.call(n,{canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,radius:r.radius,options:r.options,dependencies:r.dependencies}));const{sceneCanvas:s}=e,o=s.getContext("2d");o&&(o.strokeStyle="red",o.strokeRect(r.x,r.y,r.width,r.height));for await(const a of r.childNodes)await Ec({node:a,canvases:e,sceneTime:t})}async function Qp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await Ec({node:n,canvases:e,sceneTime:t})}async function bp({scene:r,start:e=0,resolvers:t,rootWidth:n,rootHeight:i,canvasFactory:s=gc}){var o,a;const{x:l,y:A,width:c,height:u,root:h,duration:d}=r,f=await s(),g=await s(),p=await s(),C=await s(),Q=await s(),b=await s(),v=await fc({root:{...h,layout:{...h.layout,width:n,height:i},element:{...h.element,layout:{...h.element.layout,...typeof l=="number"&&typeof A=="number"?{position:"absolute",inset:{top:A,left:l}}:{},width:c??((o=h.element.layout)==null?void 0:o.width),height:u??((a=h.element.layout)==null?void 0:a.height)}}},resolvers:t,measureCanvas:b}),x=async R=>{const k=Math.max(0,R-e);f.width=f.height=0,f.width=n,f.height=i,await Qp({layout:v,sceneTime:k,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:C,posterCanvas:Q}})};return{type:r.type,draw:x,start:e,duration:d,layout:v,sceneCanvas:f,transitionCanvas:g,id:r.id,config:r,childScenes:mc({node:v.node,duration:d})}}function xp(r){return r.some(({type:e})=>e==="scene"||e==="transition")}function wp(r){return r.type==="video"}const Sp=(((oc=sc)==null?void 0:oc.default)??sc).reduce((r,e)=>(r[e.name]=e,r),{});function Rp({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ss)==null?void 0:s.default)??ss)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ss)==null?void 0:o.default)??ss)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=ic)==null?void 0:a.default)??ic)(l,Sp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Ic({config:r,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i=gc}){const s=await Promise.all(r.tracks.map(async l=>{const A=Tp(l);if(!xp(l)){const f=await Promise.all(l.reduce((C,Q,b)=>{if(Q.type!=="audio")return C;const v=Cn(A.slice(0,b));return C.push(Bp({scene:Q,start:v})),C},[])),g=l.reduce((C,Q,b)=>{if(Q.type!=="gap")return C;const v=Cn(A.slice(0,b));return C.push({type:Q.type,id:Q.id,start:v,config:Q,duration:Q.duration}),C},[]),p=l.map(({id:C})=>f.find(({id:Q})=>Q===C)??g.find(({id:Q})=>Q===C)).filter(Boolean);return{type:"audio",scenes:f,gapScenes:g,mergedScenes:p,config:l,duration:Math.max(...p.map(({start:C,duration:Q})=>C+Q))}}const c=await Promise.all(l.reduce((f,g,p)=>{if(g.type!=="scene")return f;const C=Cn(A.slice(0,p));return f.push(bp({scene:g,start:C,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i})),f},[])),u=l.reduce((f,g,p)=>{if(g.type!=="gap")return f;const C=Cn(A.slice(0,p));return f.push({type:g.type,id:g.id,start:C,config:g,duration:g.duration}),f},[]),h=l.reduce((f,g,p)=>{if(g.type!=="transition")return f;const C=g.duration,Q=Cn(A.slice(0,p))-C;return f.push({type:g.type,id:g.id,name:g.name,start:Q,duration:C,config:g,to:c.find(({id:b})=>{var v;return b===((v=l[p+1])==null?void 0:v.id)}),from:c.find(({id:b})=>{var v;return b===((v=l[p-1])==null?void 0:v.id)})}),f},[]),d=l.map(({id:f})=>c.find(({id:g})=>g===f)??u.find(({id:g})=>g===f)??h.find(({id:g})=>g===f)).filter(Boolean);return{type:"video",scenes:c,gapScenes:u,transitions:h,mergedScenes:d,config:l,duration:Math.max(...d.map(({start:f,duration:g})=>f+g)),trackCanvas:await i()}}));console.log({tracks:s});const o=await i();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const u of s){if(!wp(u))return;const{scenes:h,transitions:d,trackCanvas:f}=u;f.width=f.height=0,f.width=l.width,f.height=l.height;const g=h.filter(({start:C,duration:Q})=>A>=C&&A<C+Q);if(g.length<=0)continue;const p=d.find(({start:C,duration:Q})=>A>=C&&A<C+Q);for await(const{id:C,start:Q,duration:b,sceneCanvas:v,transitionCanvas:x,draw:R}of g)if(await(R==null?void 0:R(A)),!p)c.drawImage(v,0,0,v.width,v.height);else{const{name:k,to:$,from:K,duration:O}=p;o.width=o.height=x.width=x.height=0,o.width=x.width=v.width,o.height=x.height=v.height;const W=($==null?void 0:$.id)===C,ie=(K==null?void 0:K.id)===C,te=W&&$.sceneCanvas||o,le=ie&&K.sceneCanvas||o,D=W?Math.min(1,Math.max(0,(A-Q)/O)):Math.min(1,Math.max(0,1-(Q+b-A)/O));Rp({name:k,progress:D,to:te,from:le,canvas:x});const P=f.getContext("2d");if(!P)return;P.globalCompositeOperation="lighter",P.drawImage(x,0,0,x.width,x.height)}c.drawImage(f,0,0,f.width,f.height)}}},tracks:s,duration:Math.max(...s.map(({duration:l})=>l))}}const Dp={name:"@vouchfor/embeds",version:"0.0.0-experiment.f90d920",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:"experiment",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":"0.0.0-experiment.f90d920","@vouchfor/media-player":"0.0.0-experiment.f90d920",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":"0.0.0-experiment.f90d920","@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 _p(r){const{publicApiUrl:e}=Hi(r),t=kr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Lp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:kr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=kr();return e||(e=_p(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=kr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=kr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function Fp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function kp(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Dp.version,templateVersion:Cp,...n}}const Cc=1;class Np{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=Fp(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=Hi(this.host.env),{client:n,tab:i,request:s,visitor:o}=Lp(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":kp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+Cc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+Cc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Xo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mn<"u"&&mn,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var P={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(D){this.map={},D instanceof g?D.forEach(function(P,X){this.append(X,P)},this):Array.isArray(D)?D.forEach(function(P){this.append(P[0],P[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(P){this.append(P,D[P])},this)}g.prototype.append=function(D,P){D=h(D),P=d(P);var X=this.map[D];this.map[D]=X?X+", "+P:P},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,P){this.map[h(D)]=d(P)},g.prototype.forEach=function(D,P){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(P,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(P,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(P){D.push(P)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(P,X){D.push([X,P])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function C(D){return new Promise(function(P,X){D.onload=function(){P(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var P=new FileReader,X=C(P);return P.readAsArrayBuffer(D),X}function b(D){var P=new FileReader,X=C(P);return P.readAsText(D),X}function v(D){for(var P=new Uint8Array(D),X=new Array(P.length),_=0;_<P.length;_++)X[_]=String.fromCharCode(P[_]);return X.join("")}function x(D){if(D.slice)return D.slice(0);var P=new Uint8Array(D.byteLength);return P.set(new Uint8Array(D)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=x(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=x(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(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(Q)}),this.text=function(){var D=p(this);if(D)return D;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(v(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(D){var P=D.toUpperCase();return k.indexOf(P)>-1?P:D}function K(D,P){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var X=P.body;if(D instanceof K){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,P.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=$(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}K.prototype.clone=function(){return new K(this,{body:this._bodyInit})};function O(D){var P=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function W(D){var P=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
2455
+ `)===0?_.substr(1,_.length):_}).forEach(function(_){var S=_.split(":"),F=S.shift().trim();if(F){var J=S.join(":").trim();P.append(F,J)}}),P}R.call(K.prototype);function ie(D,P){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new g(P.headers),this.url=P.url||"",this._initBody(D)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var D=new ie(null,{status:0,statusText:""});return D.type="error",D};var te=[301,302,303,307,308];ie.redirect=function(D,P){if(te.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:D}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,X){this.message=P,this.name=X;var _=Error(P);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(D,P){return new Promise(function(X,_){var S=new K(D,P);if(S.signal&&S.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function J(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:W(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){X(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){_(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof g)?Object.getOwnPropertyNames(P.headers).forEach(function(ne){F.setRequestHeader(ne,d(P.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",J),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",J)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=K,a.Response=ie),o.Headers=g,o.Request=K,o.Response=ie,o.fetch=le,o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=t.fetch?t:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Xo,Xo.exports);var Mp=Xo.exports;const vc=mo(Mp);async function Pp(r){var e;try{if((e=await vc(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function jo({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),n=t==null?void 0:t.find(s=>s.startsWith("blob:")),i=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(n||i)return n??i;if(t.length>0){const s=t.map(o=>Pp(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Op(r){try{return(await vc(r)).text()}catch{return null}}async function Up(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Op(r):r}const Gp=qr(async({original:r,translation:e,originalLanguage:t="",translationLanguage:n=""},{language:i})=>{var s,o;const a={[(s=n==null?void 0:n.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(i&&a[i])??r;return l?Up(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Hp(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var n;return{text:(n=t.alternatives[0])==null?void 0:n.content,start:t.start_time,end:t.end_time}}))??[]}const $p=qr(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([jo({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input]}),jo({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),jo({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,n,i,s,o,a,l,A,c,u;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function yc(r){var e,t,n,i,s,o,a,l,A,c,u,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(i=(n=r==null?void 0:r.answer)==null?void 0:n.contact)==null?void 0:i.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const Yp=qr(async(r,e,t)=>{var n,i,s;const o=(n=e==null?void 0:e.answer)==null?void 0:n.id;return((s=(i=r==null?void 0:r.questions)==null?void 0:i.items)==null?void 0:s.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var n;return JSON.stringify({index:t,rootData:e,allQuestions:(n=r==null?void 0:r.questions)==null?void 0:n.items})}});async function zo({data:r,rootData:e,index:t},n){var i,s,o,a,l,A,c,u,h,d,f,g,p,C,Q,b,v,x,R,k,$,K,O,W;const[ie,te,le]=await Promise.all([Yp(r,e,t),$p(e),Gp({original:((s=(i=e==null?void 0:e.answer)==null?void 0:i.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.translation)??((u=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:u.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},n)]),D=yc(e);return{...te,...D,key:ie,captions:le,wordTimings:Hp((C=e==null?void 0:e.answer)==null?void 0:C.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(x=(v=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:v[t-1])==null?void 0:x.answer)==null?void 0:R.label)??((K=($=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:$[t-1])==null?void 0:K.title)??null:null,isFirstInstanceOfName:t?((W=(O=r==null?void 0:r.questions)==null?void 0:O.items)==null?void 0:W.findIndex(P=>yc(P).name===D.name))===t:!0}}const cs={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 Vp({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((n,i)=>{var s,o,a,l,A,c,u;const h=(a=(o=(s=i==null?void 0:i.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(A=(l=i==null?void 0:i.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&cs[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:cs[h]}),d&&cs[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:cs[d]}),n},[]))??[]}/**
2456
2456
  * @license
2457
2457
  * Copyright 2018 Google LLC
2458
2458
  * SPDX-License-Identifier: BSD-3-Clause
2459
- */const Ve=pn(class extends Zn{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="class"||((e=r.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(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var n,i;if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!((n=this.nt)!=null&&n.has(s))&&this.st.add(s);return this.render(e)}const t=r.element.classList;for(const s of this.st)s in e||(t.remove(s),this.st.delete(s));for(const s in e){const o=!!e[s];o===this.st.has(s)||(i=this.nt)!=null&&i.has(s)||(o?(t.add(s),this.st.add(s)):(t.remove(s),this.st.delete(s)))}return jt}});/**
2459
+ */const Ve=pn(class extends ei{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="class"||((e=r.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(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var n,i;if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!((n=this.nt)!=null&&n.has(s))&&this.st.add(s);return this.render(e)}const t=r.element.classList;for(const s of this.st)s in e||(t.remove(s),this.st.delete(s));for(const s in e){const o=!!e[s];o===this.st.has(s)||(i=this.nt)!=null&&i.has(s)||(o?(t.add(s),this.st.add(s)):(t.remove(s),this.st.delete(s)))}return Xt}});/**
2460
2460
  * @license
2461
2461
  * Copyright 2018 Google LLC
2462
2462
  * SPDX-License-Identifier: BSD-3-Clause
2463
- */const su="important",aE=" !"+su,di=pn(class extends Zn{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="style"||((e=r.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(r){return Object.keys(r).reduce((e,t)=>{const n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const s=typeof i=="string"&&i.endsWith(aE);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?su:""):t[n]=i}}return jt}});function lE(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ou={exports:{}};(function(r,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,A,c){if(c=c||{},l=l.trim(),A=A.trim(),!A){if(!c.alwaysNormalize)return l;var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse base URL.");return u.path=a.normalizePath(u.path),a.buildURLFromParts(u)}var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return c.alwaysNormalize?(h.path=a.normalizePath(h.path),a.buildURLFromParts(h)):A;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var f=i.exec(d.path);d.netLoc=f[1],d.path=f[2]}d.netLoc&&!d.path&&(d.path="/");var g={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(g.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)g.path=d.path,h.params||(g.params=d.params,h.query||(g.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+h.path;g.path=a.normalizePath(y)}return g.path===null&&(g.path=c.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(g)},parseURL:function(l){var A=n.exec(l);return A?{scheme:A[1]||"",netLoc:A[2]||"",path:A[3]||"",params:A[4]||"",query:A[5]||"",fragment:A[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=a})()})(ou);var ga=ou.exports;function au(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ht(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?au(Object(t),!0).forEach(function(n){uE(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):au(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function AE(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cE(r){var e=AE(r,"string");return typeof e=="symbol"?e:String(e)}function uE(r,e,t){return e=cE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function it(){return it=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},it.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},hE=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=dE},dE=Number.MAX_SAFE_INTEGER||9007199254740991;let I=function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r}({}),Be=function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r}({}),K=function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.UNKNOWN="unknown",r}({});const Zr=function(){},pa={trace:Zr,debug:Zr,log:Zr,warn:Zr,info:Zr,error:Zr};let fi=pa;function fE(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):Zr}function gE(r,...e){e.forEach(function(t){fi[t]=r[t]?r[t].bind(r):fE(t)})}function pE(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){gE(r,"debug","log","info","warn","error");try{fi.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{fi=pa}}else fi=pa}const U=fi,mE=/^(\d+)x(\d+)$/,lu=/(.+?)=(".*?"|.*?)(?:,|$)/g;class je{constructor(e){typeof e=="string"&&(e=je.parseAttrList(e)),it(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 n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=mE.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const n={},i='"';for(lu.lastIndex=0;(t=lu.exec(e))!==null;){let s=t[2];s.indexOf(i)===0&&s.lastIndexOf(i)===s.length-1&&(s=s.slice(1,-1));const o=t[1].trim();n[o]=s}return n}}function EE(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function IE(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class Au{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const n=t.attr;for(const i in n)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==n[i]){U.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=it(new je({}),n,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=new Date(this.attr["END-DATE"]);he(n.getTime())&&(this._endDate=n)}}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(he(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&&he(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Cs{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 He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class cu{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}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=ga.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class ma extends cu{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 Cs,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 n=Object.keys(this.levelkeys);if(n.length===1)return this._decryptdata=this.levelkeys[n[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!he(this.programDateTime))return null;const e=he(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),n=t.length;if(n>1||n===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,n,i,s,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null}}class CE extends cu{constructor(e,t,n,i,s){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Cs,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=i;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.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 vE=10;class yE{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>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?he(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||vE}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 Ea(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function BE(r){const e=Ia(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function TE(r){const e=function(n,i,s){const o=n[i];n[i]=n[s],n[s]=o};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function QE(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",o=i[1];s?(n.splice(-1,1),t=Ea(o)):t=BE(o)}}return t}function Ia(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const Cn=typeof self<"u"?self:void 0;var Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},_t={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function uu(r){switch(r){case _t.FAIRPLAY:return Je.FAIRPLAY;case _t.PLAYREADY:return Je.PLAYREADY;case _t.WIDEVINE:return Je.WIDEVINE;case _t.CLEARKEY:return Je.CLEARKEY}}var hu={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function bE(r){if(r===hu.WIDEVINE)return Je.WIDEVINE}function du(r){switch(r){case Je.FAIRPLAY:return _t.FAIRPLAY;case Je.PLAYREADY:return _t.PLAYREADY;case Je.WIDEVINE:return _t.WIDEVINE;case Je.CLEARKEY:return _t.CLEARKEY}}function Ca(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[Je.FAIRPLAY,Je.WIDEVINE,Je.PLAYREADY,Je.CLEARKEY].filter(i=>!!e[i]):[];return!n[Je.WIDEVINE]&&t&&n.push(Je.WIDEVINE),n}const fu=function(r){return Cn!=null&&(r=Cn.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function xE(r,e,t,n){let i;switch(r){case Je.FAIRPLAY:i=["cenc","sinf"];break;case Je.WIDEVINE:case Je.PLAYREADY:i=["cenc"];break;case Je.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return wE(i,e,t,n)}function wE(r,e,t,n){return[{initDataTypes:r,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs="${s}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs="${s}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function en(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const va=(r,e)=>e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,gu=(r,e)=>e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,gi=(r,e)=>{const t=e;let n=0;for(;va(r,e);){n+=10;const i=vs(r,e+6);n+=i,gu(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},vs=(r,e)=>{let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t},SE=(r,e)=>va(r,e)&&vs(r,e+6)+10<=r.length-e,ya=r=>{const e=mu(r);for(let t=0;t<e.length;t++){const n=e[t];if(pu(n))return kE(n)}},pu=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",RE=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=vs(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},mu=r=>{let e=0;const t=[];for(;va(r,e);){const n=vs(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=RE(r.subarray(e)),o=DE(s);o&&t.push(o),e+=s.size+10}gu(r,e)&&(e+=10)}return t},DE=r=>r.type==="PRIV"?_E(r):r.type[0]==="W"?FE(r):LE(r),_E=r=>{if(r.size<2)return;const e=or(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},LE=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data.subarray(1));return{key:r.type,data:e}},FE=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data);return{key:r.type,data:e}},kE=r=>{if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}},or=(r,e=!1)=>{const t=NE();if(t){const A=t.decode(r);if(e){const c=A.indexOf("\0");return c!==-1?A.substring(0,c):A}return A.replace(/\0/g,"")}const n=r.length;let i,s,o,a="",l=0;for(;l<n;){if(i=r[l++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=r[l++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=r[l++],o=r[l++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(o&63)<<0);break}}return a};let Ba;function NE(){if(!navigator.userAgent.includes("PlayStation 4"))return!Ba&&typeof self.TextDecoder<"u"&&(Ba=new self.TextDecoder("utf-8")),Ba}const ar={hexDump:function(r){let e="";for(let t=0;t<r.length;t++){let n=r[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}},ys=Math.pow(2,32)-1,ME=[].push,Eu={video:1,audio:2,id3:3,text:4};function ct(r){return String.fromCharCode.apply(null,r)}function Iu(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=vu(r,e);return t<0?4294967296+t:t}function Cu(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function vu(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function Ta(r,e,t){r[e]=t>>24,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255}function PE(r){const e=r.byteLength;for(let t=0;t<e;){const n=me(r,t);if(n>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=n>1?t+n:e}return!1}function xe(r,e){const t=[];if(!e.length)return t;const n=r.byteLength;for(let i=0;i<n;){const s=me(r,i),o=ct(r.subarray(i+4,i+8)),a=s>1?i+s:n;if(o===e[0])if(e.length===1)t.push(r.subarray(i+8,a));else{const l=xe(r.subarray(i+8,a),e.slice(1));l.length&&ME.apply(t,l)}i=a}return t}function OE(r){const e=[],t=r[0];let n=8;const i=me(r,n);n+=4;let s=0,o=0;t===0?(s=me(r,n),o=me(r,n+4),n+=8):(s=Cu(r,n),o=Cu(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Iu(r,n);n+=2;for(let A=0;A<l;A++){let c=n;const u=me(r,c);c+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return U.warn("SIDX has hierarchical references (not supported)"),null;const f=me(r,c);c+=4,e.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/i,start:a,end:a+h-1}}),a+=h,c+=4,n=c}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function yu(r){const e=[],t=xe(r,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],o=xe(s,["tkhd"])[0];if(o){let a=o[0];const l=me(o,a===0?12:20),A=xe(s,["mdia","mdhd"])[0];if(A){a=A[0];const c=me(A,a===0?12:20),u=xe(s,["mdia","hdlr"])[0];if(u){const h=ct(u.subarray(8,12)),d={soun:He.AUDIO,vide:He.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=UE(f);e[l]={timescale:c,type:d},e[d]=ht({timescale:c,id:l},g)}}}}}return xe(r,["moov","mvex","trex"]).forEach(i=>{const s=me(i,4),o=e[s];o&&(o.default={duration:me(i,12),flags:me(i,20)})}),e}function UE(r){const e=r.subarray(8),t=e.subarray(86),n=ct(e.subarray(4,8));let i=n;const s=n==="enca"||n==="encv";if(s){const a=xe(e,[n])[0].subarray(n==="enca"?28:78);xe(a,["sinf"]).forEach(A=>{const c=xe(A,["schm"])[0];if(c){const u=ct(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ct(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+Bs(o[1])+Bs(o[2])+Bs(o[3]);break}case"mp4a":{const o=xe(e,[n])[0],a=xe(o.subarray(28),["esds"])[0];if(a&&a.length>12){let l=4;if(a[l++]!==3)break;l=Qa(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=Qa(a,l);const c=a[l++];if(c===64)i+="."+Bs(c);else break;if(l+=12,a[l++]!==5)break;l=Qa(a,l);const u=a[l++];let h=(u&248)>>3;h===31&&(h+=1+((u&7)<<3)+((a[l]&224)>>5)),i+="."+h}break}case"hvc1":case"hev1":{const o=xe(t,["hvcC"])[0],a=o[1],l=["","A","B","C"][a>>6],A=a&31,c=me(o,2),u=(a&32)>>5?"H":"L",h=o[12],d=o.subarray(6,12);i+="."+l+A,i+="."+c.toString(16).toUpperCase(),i+="."+u+h;let f="";for(let g=d.length;g--;){const p=d[g];(p||f)&&(f="."+p.toString(16).toUpperCase()+f)}i+=f;break}case"dvh1":case"dvhe":{const o=xe(t,["dvcC"])[0],a=o[2]>>1&127,l=o[2]<<5&32|o[3]>>3&31;i+="."+lr(a)+"."+lr(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+lr(a)+"."+lr(l)+"."+lr(A);break}case"av01":{const o=xe(t,["av1C"])[0],a=o[1]>>>5,l=o[1]&31,A=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,u=(o[2]&32)>>5,h=a===2&&c?u?12:10:c?10:8,d=(o[2]&16)>>4,f=(o[2]&8)>>3,g=(o[2]&4)>>2,p=o[2]&3;i+="."+a+"."+lr(l)+A+"."+lr(h)+"."+d+"."+f+g+p+"."+lr(1)+"."+lr(1)+"."+lr(1)+"."+0;break}}return{codec:i,encrypted:s}}function Qa(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function Bs(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function lr(r){return(r<10?"0":"")+r}function GE(r,e){if(!r||!e)return r;const t=e.keyId;return t&&e.isCommonEncryption&&xe(r,["moov","trak"]).forEach(i=>{const o=xe(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=xe(o,["enca"]);const l=a.length>0;l||(a=xe(o,["encv"])),a.forEach(A=>{const c=l?A.subarray(28):A.subarray(78);xe(c,["sinf"]).forEach(h=>{const d=Bu(h);if(d){const f=d.subarray(8,24);f.some(g=>g!==0)||(U.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${ar.hexDump(f)} -> ${ar.hexDump(t)}`),d.set(t,8))}})})}),r}function Bu(r){const e=xe(r,["schm"])[0];if(e){const t=ct(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function HE(r,e){return xe(e,["moof","traf"]).reduce((t,n)=>{const i=xe(n,["tfdt"])[0],s=i[0],o=xe(n,["tfhd"]).reduce((a,l)=>{const A=me(l,4),c=r[A];if(c){let u=me(i,4);if(s===1){if(u===ys)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=ys+1,u+=me(i,8)}const h=c.timescale||9e4,d=u/h;if(he(d)&&(a===null||d<a))return d}return a},null);return o!==null&&he(o)&&(t===null||o<t)?o:t},null)}function $E(r,e){let t=0,n=0,i=0;const s=xe(r,["moof","traf"]);for(let o=0;o<s.length;o++){const a=s[o],l=xe(a,["tfhd"])[0],A=me(l,4),c=e[A];if(!c)continue;const u=c.default,h=me(l,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=me(l,12):d=me(l,8));const f=c.timescale||9e4,g=xe(a,["trun"]);for(let p=0;p<g.length;p++){if(t=YE(g[p]),!t&&d){const y=me(g[p],4);t=d*y}c.type===He.VIDEO?n+=t/f:c.type===He.AUDIO&&(i+=t/f)}}if(n===0&&i===0){let o=1/0,a=0,l=0;const A=xe(r,["sidx"]);for(let c=0;c<A.length;c++){const u=OE(A[c]);if(u!=null&&u.references){o=Math.min(o,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,h+u.earliestPresentationTime/u.timescale),l=a-o}}if(l&&he(l))return l}return n||i}function YE(r){const e=me(r,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let n=0;const i=me(r,4);for(let s=0;s<i;s++){if(e&256){const o=me(r,t);n+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return n}function VE(r,e,t){xe(e,["moof","traf"]).forEach(n=>{xe(n,["tfhd"]).forEach(i=>{const s=me(i,4),o=r[s];if(!o)return;const a=o.timescale||9e4;xe(n,["tfdt"]).forEach(l=>{const A=l[0],c=t*a;if(c){let u=me(l,4);if(A===0)u-=c,u=Math.max(u,0),Ta(l,4,u);else{u*=Math.pow(2,32),u+=me(l,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(ys+1)),d=Math.floor(u%(ys+1));Ta(l,4,h),Ta(l,8,d)}}})})})}function KE(r){const e={valid:null,remainder:null},t=xe(r,["moof"]);if(t.length<2)return e.remainder=r,e;const n=t[t.length-1];return e.valid=en(r,0,n.byteOffset-8),e.remainder=en(r,n.byteOffset-8),e}function $t(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Tu(r,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let o=!1;return xe(n,["moof"]).map(l=>{const A=l.byteOffset-8;xe(l,["traf"]).map(u=>{const h=xe(u,["tfdt"]).map(d=>{const f=d[0];let g=me(d,4);return f===1&&(g*=Math.pow(2,32),g+=me(d,8)),g/i})[0];return h!==void 0&&(r=h),xe(u,["tfhd"]).map(d=>{const f=me(d,4),g=me(d,0)&16777215,p=(g&1)!==0,y=(g&2)!==0,Q=(g&8)!==0;let b=0;const v=(g&16)!==0;let w=0;const R=(g&32)!==0;let k=8;f===s&&(p&&(k+=8),y&&(k+=4),Q&&(b=me(d,k),k+=4),v&&(w=me(d,k),k+=4),R&&(k+=4),e.type==="video"&&(o=JE(e.codec)),xe(u,["trun"]).map(H=>{const V=H[0],O=me(H,0)&16777215,W=(O&1)!==0;let ie=0;const te=(O&4)!==0,le=(O&256)!==0;let D=0;const P=(O&512)!==0;let j=0;const _=(O&1024)!==0,S=(O&2048)!==0;let F=0;const J=me(H,4);let Y=8;W&&(ie=me(H,Y),Y+=4),te&&(Y+=4);let ne=ie+A;for(let ce=0;ce<J;ce++){if(le?(D=me(H,Y),Y+=4):D=b,P?(j=me(H,Y),Y+=4):j=w,_&&(Y+=4),S&&(V===0?F=me(H,Y):F=vu(H,Y),Y+=4),e.type===He.VIDEO){let pe=0;for(;pe<j;){const ge=me(n,ne);if(ne+=4,WE(o,n[ne])){const Se=n.subarray(ne,ne+ge);Qu(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=D/i}}))})})}),t}function JE(r){if(!r)return!1;const e=r.indexOf("."),t=e<0?r:r.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function WE(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Qu(r,e,t,n){const i=bu(r);let s=0;s+=e;let o=0,a=0,l=0;for(;s<i.length;){o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);const A=i.length-s;let c=s;if(a<A)s+=a;else if(a>A){U.error(`Malformed SEI payload. ${a} is too small, only ${A} bytes left to parse.`);break}if(o===4){if(i[c++]===181){const h=Iu(i,c);if(c+=2,h===49){const d=me(i,c);if(c+=4,d===1195456820){const f=i[c++];if(f===3){const g=i[c++],p=31&g,y=64&g,Q=y?2+p*3:0,b=new Uint8Array(Q);if(y){b[0]=g;for(let v=1;v<Q;v++)b[v]=i[c++]}n.push({type:f,payloadType:o,pts:t,bytes:b})}}}}}else if(o===5&&a>16){const u=[];for(let f=0;f<16;f++){const g=i[c++].toString(16);u.push(g.length==1?"0"+g:g),(f===3||f===5||f===7||f===9)&&u.push("-")}const h=a-16,d=new Uint8Array(h);for(let f=0;f<h;f++)d[f]=i[c++];n.push({payloadType:o,pts:t,uuid:u.join(""),userData:or(d),userDataBytes:d})}}}function bu(r){const e=r.byteLength,t=[];let n=1;for(;n<e-2;)r[n]===0&&r[n+1]===0&&r[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return r;const i=e-t.length,s=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),s[n]=r[o];return s}function qE(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1,i=me(r,12),s=me(r,16),a=me(r,20),l=me(r,24),A=28}else if(e===1){A+=4,i=me(r,A),A+=4;const u=me(r,A);A+=4;const h=me(r,A);for(A+=4,o=4294967296*u+h,hE(o)||(o=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(r,A),A+=4,l=me(r,A),A+=4;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1}const c=r.subarray(A,r.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:c}}function jE(r,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(r,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function XE(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let n,i;if(e){n=1,i=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const l=e[a];if(l.byteLength!==16)throw new RangeError("Invalid key");i.set(l,a*16)}}else n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),jE([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function zE(r){if(!(r instanceof ArrayBuffer)||r.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(r),n=t.getUint32(0);if(r.byteLength!==n&&n>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=ar.hexDump(new Uint8Array(r,12,16));const s=t.getUint32(28);if(e.version===0){if(n-32<s)return null;e.data=new Uint8Array(r,32,s)}else if(e.version===1){e.kids=[];for(let o=0;o<s;o++)e.kids.push(new Uint8Array(r,32+o*16,16))}return e}let Ts={};class pi{static clearKeyUriToKeyIdMap(){Ts={}}constructor(e,t,n,i=[1],s=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=n,this.keyFormatVersions=i,this.iv=s,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 _t.FAIRPLAY:case _t.WIDEVINE:case _t.PLAYREADY:case _t.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&&U.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=ZE(e);return new pi(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=QE(this.uri);if(t)switch(this.keyFormat){case _t.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case _t.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=XE(n,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),o=s.substring(s.indexOf("<"),s.length),A=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(A){const c=A.childNodes[0]?A.childNodes[0].nodeValue:A.getAttribute("VALUE");if(c){const u=Ea(c).subarray(0,16);TE(u),this.keyId=u}}break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=Ts[this.uri];if(!n){const i=Object.keys(Ts).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),Ts[this.uri]=n}this.keyId=n}return this}}function ZE(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const xu=/\{\$([a-zA-Z0-9-_]+)\}/g;function wu(r){return xu.test(r)}function Lt(r,e,t){if(r.variableList!==null||r.hasVariableRefs)for(let n=t.length;n--;){const i=t[n],s=e[i];s&&(e[i]=ba(r,s))}}function ba(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(xu,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Su(r,e,t){let n=r.variableList;n||(r.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(i))s=o.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(o){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else i=e.NAME,s=e.VALUE;i in n?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function eI(r,e,t){const n=e.IMPORT;if(t&&n in t){let i=r.variableList;i||(r.variableList=i={}),i[n]=t[n]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function tn(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function tI(r){return typeof self<"u"&&r===self.ManagedMediaSource}const Qs={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 rI(r,e){const t=Qs[e];return!!t&&!!t[r.slice(0,4)]}function xa(r,e,t=!0){return!r.split(",").some(n=>!Ru(n,e,t))}function Ru(r,e,t=!0){var n;const i=tn(t);return(n=i==null?void 0:i.isTypeSupported(mi(r,e)))!=null?n:!1}function mi(r,e){return`${e}/mp4;codecs="${r}"`}function Du(r){if(r){const e=r.substring(0,4);return Qs.video[e]}return 2}function bs(r){return r.split(",").reduce((e,t)=>{const n=Qs.video[t];return n?(n*2+e)/(e?3:2):(Qs.audio[t]+e)/(e?2:1)},0)}const wa={};function nI(r,e=!0){if(wa[r])return wa[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Ru(t[n],"audio",e))return wa[r]=t[n],t[n];return r}const iI=/flac|opus/i;function xs(r,e=!0){return r.replace(iI,t=>nI(t.toLowerCase(),e))}function _u(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function sI(r){const e=r.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 r}const Lu=/#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,Fu=/#EXT-X-MEDIA:(.*)/g,oI=/^#EXT(?:INF|-X-TARGETDURATION):/m,ku=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"),aI=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 Ar{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return ga.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return oI.test(e)}static parseMasterPlaylist(e,t){const n=wu(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];Lu.lastIndex=0;let o;for(;(o=Lu.exec(e))!=null;)if(o[1]){var a;const A=new je(o[1]);Lt(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=ba(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:Ar.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),lI(A.CODECS,u),(a=u.unknownCodecs)!=null&&a.length||s.push(u),i.levels.push(u)}else if(o[3]){const A=o[3],c=o[4];switch(A){case"SESSION-DATA":{const u=new je(c);Lt(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[h]=u);break}case"SESSION-KEY":{const u=Nu(c,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):U.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const u=new je(c);Lt(i,u,["NAME","VALUE","QUERYPARAM"]),Su(i,u,t)}break}case"CONTENT-STEERING":{const u=new je(c);Lt(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:Ar.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=Mu(c);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},o=n.levels,a={AUDIO:o.map(A=>({id:A.attrs.AUDIO,audioCodec:A.audioCodec})),SUBTITLES:o.map(A=>({id:A.attrs.SUBTITLES,textCodec:A.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(Fu.lastIndex=0;(i=Fu.exec(e))!==null;){const A=new je(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,Lt(n,A,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=A.LANGUAGE,f=A["ASSOC-LANGUAGE"],g=A.CHANNELS,p=A.CHARACTERISTICS,y=A["INSTREAM-ID"],Q={attrs:A,bitrate:0,id:l++,groupId:A["GROUP-ID"]||"",name:A.NAME||d||"",type:c,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:d,url:A.URI?Ar.resolve(A.URI,t):""};if(f&&(Q.assocLang=f),g&&(Q.channels=g),p&&(Q.characteristics=p),y&&(Q.instreamId=y),u!=null&&u.length){const b=Ar.findGroup(u,Q.groupId)||u[0];Pu(Q,b,"audioCodec"),Pu(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new yE(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new ma(i,t),p,y,Q,b=-1,v=!1,w=null;for(ku.lastIndex=0,a.m3u8=e,a.hasVariableRefs=wu(e);(p=ku.exec(e))!==null;){v&&(v=!1,g=new ma(i,t),g.start=h,g.sn=c,g.cc=d,g.level=n,A&&(g.initSegment=A,g.rawProgramDateTime=A.rawProgramDateTime,A.rawProgramDateTime=null,w&&(g.setByteRange(w),w=null)));const V=p[1];if(V){g.duration=parseFloat(V);const O=(" "+p[2]).slice(1);g.title=O||null,g.tagList.push(O?["INF",V,O]:["INF",V])}else if(p[3]){if(he(g.duration)){g.start=h,Q&&Gu(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=ba(a,O),Ou(g,f),f=g,h+=g.duration,c++,u=0,v=!0}}else if(p[4]){const O=(" "+p[4]).slice(1);f?g.setByteRange(O,f):g.setByteRange(O)}else if(p[5])g.rawProgramDateTime=(" "+p[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),b===-1&&(b=l.length);else{if(p=p[0].match(aI),!p){U.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const O=(" "+p[y]).slice(1),W=(" "+p[y+1]).slice(1),ie=p[y+2]?(" "+p[y+2]).slice(1):"";switch(O){case"PLAYLIST-TYPE":a.type=W.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(W);break;case"SKIP":{const te=new je(W);Lt(a,te,["RECENTLY-REMOVED-DATERANGES"]);const le=te.decimalInteger("SKIPPED-SEGMENTS");if(he(le)){a.skippedSegments=le;for(let P=le;P--;)l.unshift(null);c+=le}const D=te.enumeratedString("RECENTLY-REMOVED-DATERANGES");D&&(a.recentlyRemovedDateranges=D.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(W),1);break;case"VERSION":a.version=parseInt(W);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(W||ie)&&g.tagList.push(ie?[W,ie]:[W]);break;case"DISCONTINUITY":d++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([O]);break;case"BITRATE":g.tagList.push([O,W]);break;case"DATERANGE":{const te=new je(W);Lt(a,te,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Lt(a,te,te.clientAttrs);const le=new Au(te,a.dateRanges[te.ID]);le.isValid||a.skippedSegments?a.dateRanges[le.id]=le:U.warn(`Ignoring invalid DATERANGE tag: "${W}"`),g.tagList.push(["EXT-X-DATERANGE",W]);break}case"DEFINE":{{const te=new je(W);Lt(a,te,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in te?eI(a,te,o):Su(a,te,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(W);break;case"KEY":{const te=Nu(W,t,a);if(te.isSupported()){if(te.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[te.keyFormat]&&(Q=it({},Q)),Q[te.keyFormat]=te}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${W}"`);break}case"START":a.startTimeOffset=Mu(W);break;case"MAP":{const te=new je(W);if(Lt(a,te,["BYTERANGE","URI"]),g.duration){const le=new ma(i,t);Uu(le,te,n,Q),A=le,g.initSegment=A,A.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=A.rawProgramDateTime)}else{const le=g.byteRangeEndOffset;if(le){const D=g.byteRangeStartOffset;w=`${le-D}@${D}`}else w=null;Uu(g,te,n,Q),A=g,v=!0}break}case"SERVER-CONTROL":{const te=new je(W);a.canBlockReload=te.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=te.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&te.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=te.optionalFloat("PART-HOLD-BACK",0),a.holdBack=te.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const te=new je(W);a.partTarget=te.decimalFloatingPoint("PART-TARGET");break}case"PART":{let te=a.partList;te||(te=a.partList=[]);const le=u>0?te[te.length-1]:void 0,D=u++,P=new je(W);Lt(a,P,["BYTERANGE","URI"]);const j=new CE(P,g,t,D,le);te.push(j),g.duration+=j.duration;break}case"PRELOAD-HINT":{const te=new je(W);Lt(a,te,["URI"]),a.preloadHint=te;break}case"RENDITION-REPORT":{const te=new je(W);Lt(a,te,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(te);break}default:U.warn(`line parsed but not handled: ${p}`);break}}}f&&!f.relurl?(l.pop(),h-=f.duration,a.partList&&(a.fragmentHint=f)):a.partList&&(Ou(g,f),g.cc=d,a.fragmentHint=g,Q&&Gu(g,Q,a));const R=l.length,k=l[0],H=l[R-1];if(h+=a.skippedSegments*a.targetduration,h>0&&R&&H){a.averagetargetduration=h/R;const V=H.sn;a.endSN=V!=="initSegment"?V:0,a.live||(H.endList=!0),k&&(a.startCC=k.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,b>0&&AI(l,b),a}}function Nu(r,e,t){var n,i;const s=new je(r);Lt(t,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(n=s.METHOD)!=null?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),A=s.KEYFORMATVERSIONS,c=(i=s.KEYFORMAT)!=null?i:"identity";a&&s.IV&&!l&&U.error(`Invalid IV: ${s.IV}`);const u=a?Ar.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new pi(o,u,c,h,l)}function Mu(r){const t=new je(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function lI(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>rI(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function Pu(r,e,t){const n=e[t];n&&(r[t]=n)}function AI(r,e){let t=r[e];for(let n=e;n--;){const i=r[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function Ou(r,e){r.rawProgramDateTime?r.programDateTime=Date.parse(r.rawProgramDateTime):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime),he(r.programDateTime)||(r.programDateTime=null,r.rawProgramDateTime=null)}function Uu(r,e,t,n){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",n&&(r.levelkeys=n),r.initSegment=null}function Gu(r,e,t){r.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(r)}var Oe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Hu(r){const{type:e}=r;switch(e){case Oe.AUDIO_TRACK:return Ee.AUDIO;case Oe.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function Sa(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class cI{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,o=new s(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:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Oe.MANIFEST,url:n,deliveryDirectives:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:o,deliveryDirectives:a}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:Oe.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.AUDIO_TRACK,url:s,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.SUBTITLE_TRACK,url:s,deliveryDirectives:o})}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const A=i.context;if(A&&A.url===e.url&&A.level===e.level){U.trace("[playlist-loader]: playlist request ongoing");return}U.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===Oe.MANIFEST?s=n.manifestLoadPolicy.default:s=it({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),he((t=e.deliveryDirectives)==null?void 0:t.part)){let A;if(e.type===Oe.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Oe.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Oe.SUBTITLE_TRACK&&e.id!==null&&(A=this.hls.subtitleTracks[e.id].details),A){const c=A.partTarget,u=A.targetduration;if(c&&u){const h=Math.max(c*3,u*.8)*1e3;s=it({},s,{maxTimeToFirstByteMs:Math.min(h,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(A,c,u,h)=>{const d=this.getInternalLoader(u);this.resetInternalLoader(u.type);const f=A.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(A,u,new Error("no EXTM3U delimiter"),h||null,c);return}c.parsing.start=performance.now(),Ar.isMediaPlaylist(f)?this.handleTrackOrLevelPlaylist(A,c,u,h||null,d):this.handleMasterPlaylist(A,c,u,h)},onError:(A,c,u,h)=>{this.handleNetworkError(c,u,!1,A,h)},onTimeout:(A,c,u)=>{this.handleNetworkError(c,u,!0,void 0,A)}};i.load(e,a,l)}handleMasterPlaylist(e,t,n,i){const s=this.hls,o=e.data,a=Sa(e,n),l=Ar.parseMasterPlaylist(o,a);if(l.playlistParsingError){this.handleManifestParsingError(e,n,l.playlistParsingError,i,t);return}const{contentSteering:A,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f}=l;this.variableList=f;const{AUDIO:g=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=Ar.parseMasterPlaylistMedia(o,a,l);g.length&&!g.some(b=>!b.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new je({}),bitrate:0,url:""})),s.trigger(I.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:p,captions:y,contentSteering:A,url:a,stats:t,networkDetails:i,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(e,t,n,i,s){const o=this.hls,{id:a,level:l,type:A}=n,c=Sa(e,n),u=0,h=he(l)?l:he(a)?a:0,d=Hu(n),f=Ar.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Oe.MANIFEST){const g={attrs:new je({}),bitrate:0,details:f,name:"",url:c};o.trigger(I.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=f,this.handlePlaylistLoaded(f,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:t.type===Oe.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let o=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Oe.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Oe.AUDIO_TRACK||e.type===Oe.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);U.warn(`[playlist-loader]: ${o}`);let l=K.UNKNOWN,A=!1;const c=this.getInternalLoader(e);switch(e.type){case Oe.MANIFEST:l=n?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,A=!0;break;case Oe.LEVEL:l=n?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,A=!1;break;case Oe.AUDIO_TRACK:l=n?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Oe.SUBTITLE_TRACK:l=n?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,A=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Be.NETWORK_ERROR,details:l,fatal:A,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:s};if(i){const h=(t==null?void 0:t.url)||e.url;u.response=ht({url:h,data:void 0},i)}this.hls.trigger(I.ERROR,u)}handlePlaylistLoaded(e,t,n,i,s,o){const a=this.hls,{type:l,level:A,id:c,groupId:u,deliveryDirectives:h}=i,d=Sa(t,i),f=Hu(i),g=typeof i.level=="number"&&f===Ee.MAIN?A:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Oe.MANIFEST:case Oe.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function $u(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function Yu(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){U.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){U.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function vn(r){const e=r.mode;if(e==="disabled"&&(r.mode="hidden"),r.cues)for(let t=r.cues.length;t--;)r.removeCue(r.cues[t]);e==="disabled"&&(r.mode=e)}function Ra(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=hI(r.cues,e,t);for(let o=0;o<s.length;o++)(!n||n(s[o]))&&r.removeCue(s[o])}i==="disabled"&&(r.mode=i)}function uI(r,e){if(e<r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let n=0,i=t;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<r[s].startTime)i=s-1;else if(e>r[s].startTime&&n<t)n=s+1;else return s}return r[n].startTime-e<e-r[i].startTime?n:i}function hI(r,e,t){const n=[],i=uI(r,e);if(i>-1)for(let s=i,o=r.length;s<o;s++){const a=r[s];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function ws(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(r[t])}return e}var zt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const dI=.25;function Da(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Vu(r,e,t,n,i){let s=new r(e,t,"");try{s.value=n,i&&(s.type=i)}catch{s=new r(e,t,JSON.stringify(i?ht({type:i},n):n))}return s}const Ss=(()=>{const r=Da();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function _a(r,e){return r.getTime()/1e3-e}function fI(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class gI{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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(vn(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return $u(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:i}}}=this;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Da();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===zt.emsg&&!n||!i)continue;const A=mu(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>Ss&&(u=Ss),u-c<=0&&(u=c+dI);for(let d=0;d<A.length;d++){const f=A[d];if(!pu(f)){this.updateId3CueEnds(c,l);const g=Vu(o,c,u,f,l);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const o=i[s];o.type===t&&o.startTime<e&&o.endTime===Ss&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(s&&(a||l)){let A;i==="audio"?A=c=>c.type===zt.audioId3&&l:i==="video"?A=c=>c.type===zt.emsg&&a:A=c=>c.type===zt.audioId3&&l||c.type===zt.emsg&&a,Ra(s,t,n,A)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:n,id3Track:i}=this,{dateRanges:s}=t,o=Object.keys(s);if(i){const c=Object.keys(n).filter(u=>!o.includes(u));for(let u=c.length;u--;){const h=c[u];Object.keys(n[h].cues).forEach(d=>{i.removeCue(n[h].cues[d])}),delete n[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!he(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=a.programDateTime/1e3-a.start,A=Da();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=_a(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,y=Ss;const Q=h.endDate;if(Q)y=_a(Q,l),p=!0;else if(h.endOnNext&&!p){const v=o.reduce((w,R)=>{if(R!==h.id){const k=s[R];if(k.class===h.class&&k.startDate>h.startDate&&(!w||h.startDate<w.startDate))return k}return w},null);v&&(y=_a(v.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let v=0;v<b.length;v++){const w=b[v];if(!EE(w))continue;const R=g[w];if(R)p&&!f.durationKnown&&(R.endTime=y);else if(A){let k=h.attr[w];IE(w)&&(k=fI(k));const H=Vu(A,d,y,{key:w,data:k},zt.dateRange);H&&(H.id=u,this.id3Track.addCue(H),g[w]=H)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class pI{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:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let A=a&&n||t;(l.liveSyncDuration||l.liveSyncDurationCount||A===0)&&(A=s!==void 0?s:o*i);const c=i;return A+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(e===null||t===null||n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,o=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,s),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 n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(I.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 n;t.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,(n=this.levelDetails)!=null&&n.live&&U.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 n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=n-o,l=Math.min(this.maxLatency,o+t.targetduration);if(a<l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}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 La=["NONE","TYPE-0","TYPE-1",null];function mI(r){return La.indexOf(r)>-1}const Rs=["SDR","PQ","HLG"];function EI(r){return!!r&&Rs.indexOf(r)>-1}var Ds={No:"",Yes:"YES",v2:"v2"};function Ku(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?Ds.v2:Ds.Yes:Ds.No}class Ju{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){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 yn{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 Wu(this._audioGroups,e)}hasSubtitleGroup(e){return Wu(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 Wu(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function Fa(r,e){const t=e.startPTS;if(he(t)){let n=0,i;e.sn>r.sn?(n=t-r.start,i=r):(n=r.start-t,i=e),i.duration!==n&&(i.duration=n)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.start=r.start+(r.minEndPTS-r.start):e.start=r.start+r.duration:e.start=Math.max(r.start-e.duration,0)}function qu(r,e,t,n,i,s){n-t<=0&&(U.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let a=t,l=n;const A=e.startPTS,c=e.endPTS;if(he(A)){const p=Math.abs(A-t);he(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,A),t=Math.min(t,A),i=Math.min(i,e.startDTS),l=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=n-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=l,e.endDTS=s;const h=e.sn;if(!r||h<r.startSN||h>r.endSN)return 0;let d;const f=h-r.startSN,g=r.fragments;for(g[f]=e,d=f;d>0;d--)Fa(g[d],g[d-1]);for(d=f;d<g.length-1;d++)Fa(g[d],g[d+1]);return r.fragmentHint&&Fa(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function II(r,e){let t=null;const n=r.fragments;for(let l=n.length-1;l>=0;l--){const A=n[l].initSegment;if(A){t=A;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let i=0,s;if(yI(r,e,(l,A)=>{l.relurl&&(i=l.cc-A.cc),he(l.startPTS)&&he(l.endPTS)&&(A.start=A.startPTS=l.startPTS,A.startDTS=l.startDTS,A.maxStartPTS=l.maxStartPTS,A.endPTS=l.endPTS,A.endDTS=l.endDTS,A.minEndPTS=l.minEndPTS,A.duration=l.endPTS-l.startPTS,A.duration&&(s=A),e.PTSKnown=e.alignedSliding=!0),A.elementaryStreams=l.elementaryStreams,A.loader=l.loader,A.stats=l.stats,l.initSegment&&(A.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(A=>{var c;A&&(!A.initSegment||A.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(A.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=CI(r.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(i){U.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<o.length;l++)o[l].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),vI(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?qu(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):ju(r,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const l=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=l),e.driftEndTime=a,e.driftEnd=l}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime}function CI(r,e,t){const n=it({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new Au(e[i].attr,n[i]);s.isValid?n[i]=s:U.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),n}function vI(r,e,t){if(r&&e){let n=0;for(let i=0,s=r.length;i<=s;i++){const o=r[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function yI(r,e,t){const n=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,s=(r.fragmentHint?1:0)+(n?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,o=e.startSN-r.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let A=i;A<=s;A++){const c=l[o+A];let u=a[A];n&&!u&&A<n&&(u=e.fragments[A]=c),c&&u&&t(c,u)}}function ju(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||ka(e,n[t].start)}function ka(r,e){if(e){const t=r.fragments;for(let n=r.skippedSegments;n<t.length;n++)t[n].start+=e;r.fragmentHint&&(r.fragmentHint.start+=e)}}function BI(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const n=r.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function TI(r,e,t){if(!(r!=null&&r.details))return null;const n=r.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e)?i:e<n.startSN&&t&&t.sn===e?t:null}function Xu(r,e,t){var n;return r!=null&&r.details?zu((n=r.details)==null?void 0:n.partList,e,t):null}function zu(r,e,t){if(r)for(let n=r.length;n--;){const i=r[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function Zu(r){r.forEach((e,t)=>{const{details:n}=e;n!=null&&n.fragments&&n.fragments.forEach(i=>{i.level=t})})}function _s(r){switch(r.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function eh(r,e){const t=_s(e);return r.default[`${t?"timeout":"error"}Retry`]}function Na(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function th(r){return ht(ht({},r),{errorRetry:null,timeoutRetry:null})}function Ls(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(QI(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function QI(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const rh={search:function(r,e){let t=0,n=r.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=r[i];const o=e(s);if(o>0)t=i+1;else if(o<0)n=i-1;else return s}return null}};function bI(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!he(e))return null;const n=r[0].programDateTime;if(e<(n||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let s=0;s<r.length;++s){const o=r[s];if(wI(e,t,o))return o}return null}function Fs(r,e,t=0,n=0,i=.005){let s=null;if(r){s=e[r.sn-e[0].sn+1]||null;const a=r.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!r||r.level===s.level)&&Ma(t,n,s)===0||xI(s,r,Math.min(i,n))))return s;const o=rh.search(e,Ma.bind(null,t,n));return o&&(o!==r||!s)?o:s}function xI(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return r.start<=n}return!1}function Ma(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=r?1:t.start-n>r&&t.start?-1:0}function wI(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function SI(r,e){return rh.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var Bt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class RI{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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.ERROR,this.onError,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.ERROR,this.onError,this),e.off(I.ERROR,this.onErrorOut,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.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)===Ee.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n,i;if(t.fatal)return;const s=this.hls,o=t.context;switch(t.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case K.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Bt.SendAlternateToPenaltyBox;return}case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var a,l;const A=t.parent===Ee.MAIN?t.level:s.loadLevel;t.details===K.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(l=a.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,A):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,A))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const A=s.levels[s.loadLevel];if(A&&(o.type===Oe.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Oe.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=Bt.SendAlternateToPenaltyBox,t.errorAction.flags=Zt.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const A=s.levels[s.loadLevel],c=A==null?void 0:A.attrs["HDCP-LEVEL"];c?t.errorAction={action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:s.loadLevel);return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}t.type===Be.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 n=this.hls,i=eh(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ls(i,s,_s(e),e.response))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:i,retryCount:s};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=s),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:o}=t.config,a=eh(e.details.startsWith("key")?o:s,e),l=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(i&&(e.details!==K.FRAG_GAP&&i.fragmentError++,Ls(a,l,_s(e),e.response)))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:a,retryCount:l};const A=this.getLevelSwitchAction(e,n);return a&&(A.retryConfig=a,A.retryCount=l),A}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,o;const A=e.details;i.loadError++,A===K.BUFFER_APPEND_ERROR&&i.fragmentError++;let c=-1;const{levels:u,loadLevel:h,minAutoLevel:d,maxAutoLevel:f}=n;n.autoLevelEnabled||(n.loadLevel=-1);const g=(s=e.frag)==null?void 0:s.type,y=(g===Ee.AUDIO&&A===K.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(A===K.BUFFER_ADD_CODEC_ERROR||A===K.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:R})=>i.audioCodec!==R),b=e.sourceBufferName==="video"&&(A===K.BUFFER_ADD_CODEC_ERROR||A===K.BUFFER_APPEND_ERROR)&&u.some(({codecSet:R,audioCodec:k})=>i.codecSet!==R&&i.audioCodec===k),{type:v,groupId:w}=(o=e.context)!=null?o:{};for(let R=u.length;R--;){const k=(R+h)%u.length;if(k!==h&&k>=d&&k<=f&&u[k].loadError===0){var a,l;const H=u[k];if(A===K.FRAG_GAP&&g===Ee.MAIN&&e.frag){const V=u[k].details;if(V){const O=Fs(e.frag,V.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(v===Oe.AUDIO_TRACK&&H.hasAudioGroup(w)||v===Oe.SUBTITLE_TRACK&&H.hasSubtitleGroup(w))continue;if(g===Ee.AUDIO&&(a=i.audioGroups)!=null&&a.some(V=>H.hasAudioGroup(V))||g===Ee.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(V=>H.hasSubtitleGroup(V))||y&&i.audioCodec===H.audioCodec||!y&&i.audioCodec!==H.audioCodec||b&&i.codecSet===H.codecSet)continue}c=k;break}}if(c>-1&&n.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Bt.SendAlternateToPenaltyBox,flags:Zt.None,nextAutoLevel:c}}return{action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case Bt.DoNothing:break;case Bt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==K.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,n=e.errorAction;if(!n)return;const{flags:i,hdcpLevel:s,nextAutoLevel:o}=n;switch(i){case Zt.None:this.switchLevel(e,o);break;case Zt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=La[La.indexOf(s)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.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 Pa{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=U.log.bind(U,`${t}:`),this.warn=U.warn.bind(U,`${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,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(A){U.warn(`Could not construct new URL for Rendition Report: ${A}`),l=a.URI||""}if(l===e){s=o;break}else l===e.substring(0,l.length)&&(s=o)}if(s!==-1){const o=i[s],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=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);l>=0&&c>t.partTarget&&(l+=1)}const A=n&&Ku(n);return new Ju(a,l>=0?l:void 0,A)}}}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,n){const{details:i,stats:s}=t,o=self.performance.now(),a=s.loading.first?Math.max(0,o-s.loading.first):0;if(i.advancedDateTime=Date.now()-a,i.live||n!=null&&n.live){if(i.reloaded(n),n&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),n&&i.fragments.length>0&&II(n,i),!this.canLoad||!i.live)return;let l,A,c;if(i.canBlockReload&&i.endSN&&i.advanced){const p=this.hls.config.lowLatencyMode,y=i.lastPartSn,Q=i.endSN,b=i.lastPartIndex,v=b!==-1,w=y===Q,R=p?0:b;v?(A=w?Q+1:y,c=w?R:b+1):A=Q+1;const k=i.age,H=k+i.ageHeader;let V=Math.min(H-i.partTarget,i.targetduration*1.5);if(V>0){if(n&&V>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${V} with playlist age: ${i.age}`),V=0;else{const O=Math.floor(V/i.targetduration);if(A+=O,c!==void 0){const W=Math.round(V%i.targetduration/i.partTarget);c+=W}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${k.toFixed(2)}s goal: ${V} skip sn ${O} to part ${c}`)}i.tuneInGoal=V}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c),p||!w){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,d=(i.edge-h)*1e3,f=BI(i,d);i.updated&&o>this.requestScheduled+f&&(this.requestScheduled=s.loading.start),A!==void 0&&i.canBlockReload?this.requestScheduled=s.loading.first+f-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+f<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=f);let g=this.requestScheduled-o;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),g)}else this.clearTimer()}getDeliveryDirectives(e,t,n,i){let s=Ku(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=Ds.No),new Ju(n,i,s)}checkRetry(e){const t=e.details,n=_s(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===Bt.RetryRequest||!i.resolved&&s===Bt.SendAlternateToPenaltyBox);if(l){var A;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(n&&(A=e.context)!=null&&A.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=Na(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,i.resolved=!0}return l}}class Bn{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 DI{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Bn(e),this.fast_=new Bn(t),this.defaultTTFB_=i,this.ttfb_=new Bn(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new Bn(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Bn(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Bn(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const nh={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ih={};function _I(r,e,t,n,i,s){const o=r.audioCodec?r.audioGroups:null,a=s==null?void 0:s.audioCodec,l=s==null?void 0:s.channels,A=l?parseInt(l):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((u,h)=>{if(h){const d=e.groups[h];if(!d)throw new Error(`Audio track group ${h} not found`);Object.keys(d.channels).forEach(f=>{u[f]=(u[f]||0)+d.channels[f]})}return u},{2:0})}catch{return!0}return r.videoCodec!==void 0&&(r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(n,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!c&&he(A)&&Object.keys(c).some(u=>parseInt(u)>A)}function LI(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(nh);const s={width:r.width,height:r.height,bitrate:Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)),framerate:r.frameRate||30},o=r.videoRange;o!=="SDR"&&(s.transferFunction=o.toLowerCase());const a=n.split(",").map(l=>({type:"media-source",video:ht(ht({},s),{},{contentType:mi(l,"video")})}));return i&&r.audioGroups&&r.audioGroups.forEach(l=>{var A;l&&((A=e.groups[l])==null||A.tracks.forEach(c=>{if(c.groupId===l){const u=c.channels||"",h=parseFloat(u);he(h)&&h>2&&a.push.apply(a,i.split(",").map(d=>({type:"media-source",audio:{contentType:mi(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=FI(l);return ih[A]||(ih[A]=t.decodingInfo(l))})).then(l=>({supported:!l.some(A=>!A.supported),configurations:a,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:a,decodingInfoResults:[],error:l}))}function FI(r){const{audio:e,video:t}=r,n=t||e;if(n){const i=n.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function kI(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function NI(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||Rs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:kI(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function MI(r,e,t,n,i){const s=Object.keys(r),o=n==null?void 0:n.channels,a=n==null?void 0:n.audioCodec,l=o&&parseInt(o)===2;let A=!0,c=!1,u=1/0,h=1/0,d=1/0,f=0,g=[];const{preferHDR:p,allowedVideoRanges:y}=NI(e,i);for(let w=s.length;w--;){const R=r[s[w]];A=R.channels[2]>0,u=Math.min(u,R.minHeight),h=Math.min(h,R.minFramerate),d=Math.min(d,R.minBitrate);const k=y.filter(H=>R.videoRanges[H]>0);k.length>0&&(c=!0,g=k)}u=he(u)?u:0,h=he(h)?h:0;const Q=Math.max(1080,u),b=Math.max(30,h);return d=he(d)?d:t,t=Math.max(d,t),c||(e=void 0,g=[]),{codecSet:s.reduce((w,R)=>{const k=r[R];if(R===w)return w;if(k.minBitrate>t)return Tr(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),w;if(!k.hasDefaultAudio)return Tr(R,"no renditions with default or auto-select sound found"),w;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Tr(R,`audio codec preference "${a}" not found`),w;if(o&&!l){if(!k.channels[o])return Tr(R,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),w}else if((!a||l)&&A&&k.channels[2]===0)return Tr(R,"no renditions with stereo sound found"),w;return k.minHeight>Q?(Tr(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),w):k.minFramerate>b?(Tr(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),w):g.some(H=>k.videoRanges[H]>0)?k.maxScore<f?(Tr(R,`max score of ${k.maxScore} < selected max of ${f}`),w):w&&(bs(R)>=bs(w)||k.fragmentError>r[w].fragmentError)?w:(f=k.maxScore,R):(Tr(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),w)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Tr(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function PI(r){return r.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function OI(r,e,t,n){return r.slice(t,n+1).reduce((i,s)=>{if(!s.codecSet)return i;const o=s.audioGroups;let a=i[s.codecSet];a||(i[s.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,s.bitrate);const l=Math.min(s.height,s.width);return a.minHeight=Math.min(a.minHeight,l),a.minFramerate=Math.min(a.minFramerate,s.frameRate),a.maxScore=Math.max(a.maxScore,s.score),a.fragmentError+=s.fragmentError,a.videoRanges[s.videoRange]=(a.videoRanges[s.videoRange]||0)+1,o&&o.forEach(A=>{if(!A)return;const c=e.groups[A];c&&(a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(u=>{a.channels[u]=(a.channels[u]||0)+c.channels[u]}))}),i},{})}function cr(r,e,t){if("attrs"in r){const n=e.indexOf(r);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(Tn(r,i,t))return n}return-1}function Tn(r,e,t){const{groupId:n,name:i,lang:s,assocLang:o,characteristics:a,default:l}=r,A=r.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||e.lang===s)&&(s===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(A===void 0||e.forced===A)&&(a===void 0||UI(a,e.characteristics))&&(t===void 0||t(r,e))}function UI(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Qn(r,e){const{audioCodec:t,channels:n}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function GI(r,e,t,n,i){const s=e[n],a=e.reduce((h,d,f)=>{const g=d.uri;return(h[g]||(h[g]=[])).push(f),h},{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=s.videoRange,A=s.frameRate,c=s.codecSet.substring(0,4),u=sh(e,n,h=>{if(h.videoRange!==l||h.frameRate!==A||h.codecSet.substring(0,4)!==c)return!1;const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1});return u>-1?u:sh(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1})}function sh(r,e,t){for(let n=e;n;n--)if(t(r[n]))return n;for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return-1}class HI{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:n,hls:i}=this,{autoLevelEnabled:s,media:o}=i;if(!t||!o)return;const a=performance.now(),l=n?n.stats:t.stats,A=n?n.duration:t.duration,c=a-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||o.paused||!o.playbackRate||!o.readyState)return;const h=i.mainForwardBufferInfo;if(h===null)return;const d=this.bwEstimator.getEstimateTTFB(),f=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(A/(f*2))))return;const g=h.len/f,p=l.loading.first?l.loading.first-l.loading.start:-1,y=l.loaded&&p>-1,Q=this.getBwEstimate(),b=i.levels,v=b[t.level],w=l.total||Math.max(l.loaded,Math.round(A*v.averageBitrate/8));let R=y?c-p:c;R<1&&y&&(R=Math.min(c,l.loaded*8/Q));const k=y?l.loaded*1e3/R:0,H=k?(w-l.loaded)/k:w*8/Q+d/1e3;if(H<=g)return;const V=k?k*8:Q;let O=Number.POSITIVE_INFINITY,W;for(W=t.level-1;W>u;W--){const te=b[W].maxBitrate;if(O=this.getTimeToLoadFrag(d/1e3,V,A*te,!b[W].details),O<g)break}if(O>=H||O>A*10)return;i.nextLoadLevel=i.nextAutoLevel=W,y?this.bwEstimator.sample(c-Math.min(d,p),l.loaded):this.bwEstimator.sampleTTFB(c);const ie=b[W].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ie&&this.resetEstimator(ie),this.clearTimer(),U.warn(`[abr] Fragment ${t.sn}${n?" part "+n.index:""} of level ${t.level} is loading too slowly;
2463
+ */const Bc="important",Kp=" !"+Bc,ci=pn(class extends ei{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="style"||((e=r.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(r){return Object.keys(r).reduce((e,t)=>{const n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const s=typeof i=="string"&&i.endsWith(Kp);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?Bc:""):t[n]=i}}return Xt}});function Jp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Tc={exports:{}};(function(r,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,A,c){if(c=c||{},l=l.trim(),A=A.trim(),!A){if(!c.alwaysNormalize)return l;var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse base URL.");return u.path=a.normalizePath(u.path),a.buildURLFromParts(u)}var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return c.alwaysNormalize?(h.path=a.normalizePath(h.path),a.buildURLFromParts(h)):A;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var f=i.exec(d.path);d.netLoc=f[1],d.path=f[2]}d.netLoc&&!d.path&&(d.path="/");var g={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(g.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)g.path=d.path,h.params||(g.params=d.params,h.query||(g.query=d.query));else{var p=d.path,C=p.substring(0,p.lastIndexOf("/")+1)+h.path;g.path=a.normalizePath(C)}return g.path===null&&(g.path=c.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(g)},parseURL:function(l){var A=n.exec(l);return A?{scheme:A[1]||"",netLoc:A[2]||"",path:A[3]||"",params:A[4]||"",query:A[5]||"",fragment:A[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=a})()})(Tc);var Zo=Tc.exports;function Qc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ht(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qc(Object(t),!0).forEach(function(n){Xp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Wp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qp(r){var e=Wp(r,"string");return typeof e=="symbol"?e:String(e)}function Xp(r,e,t){return e=qp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function it(){return it=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},it.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},jp=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=zp},zp=Number.MAX_SAFE_INTEGER||9007199254740991;let I=function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r}({}),Be=function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r}({}),V=function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.UNKNOWN="unknown",r}({});const Zr=function(){},ea={trace:Zr,debug:Zr,log:Zr,warn:Zr,info:Zr,error:Zr};let ui=ea;function Zp(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):Zr}function em(r,...e){e.forEach(function(t){ui[t]=r[t]?r[t].bind(r):Zp(t)})}function tm(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){em(r,"debug","log","info","warn","error");try{ui.log(`Debug logs enabled for "${e}" in hls.js version 1.5.17`)}catch{ui=ea}}else ui=ea}const U=ui,rm=/^(\d+)x(\d+)$/,bc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class je{constructor(e){typeof e=="string"&&(e=je.parseAttrList(e)),it(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 n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=rm.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const n={},i='"';for(bc.lastIndex=0;(t=bc.exec(e))!==null;){let s=t[2];s.indexOf(i)===0&&s.lastIndexOf(i)===s.length-1&&(s=s.slice(1,-1));const o=t[1].trim();n[o]=s}return n}}function nm(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function im(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class xc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const n=t.attr;for(const i in n)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==n[i]){U.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=it(new je({}),n,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=new Date(this.attr["END-DATE"]);he(n.getTime())&&(this._endDate=n)}}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(he(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&&he(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class us{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 He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class wc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}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=Zo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class ta extends wc{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 us,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 n=Object.keys(this.levelkeys);if(n.length===1)return this._decryptdata=this.levelkeys[n[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!he(this.programDateTime))return null;const e=he(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),n=t.length;if(n>1||n===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,n,i,s,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null}}class sm extends wc{constructor(e,t,n,i,s){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new us,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=i;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.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 om=10;class am{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>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?he(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||om}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 ra(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function lm(r){const e=na(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Am(r){const e=function(n,i,s){const o=n[i];n[i]=n[s],n[s]=o};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function cm(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",o=i[1];s?(n.splice(-1,1),t=ra(o)):t=lm(o)}}return t}function na(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const vn=typeof self<"u"?self:void 0;var Ke={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},_t={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Sc(r){switch(r){case _t.FAIRPLAY:return Ke.FAIRPLAY;case _t.PLAYREADY:return Ke.PLAYREADY;case _t.WIDEVINE:return Ke.WIDEVINE;case _t.CLEARKEY:return Ke.CLEARKEY}}var hi={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Rc(r){if(r===hi.WIDEVINE)return Ke.WIDEVINE;if(r===hi.PLAYREADY)return Ke.PLAYREADY;if(r===hi.CENC||r===hi.CLEARKEY)return Ke.CLEARKEY}function Dc(r){switch(r){case Ke.FAIRPLAY:return _t.FAIRPLAY;case Ke.PLAYREADY:return _t.PLAYREADY;case Ke.WIDEVINE:return _t.WIDEVINE;case Ke.CLEARKEY:return _t.CLEARKEY}}function ia(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[Ke.FAIRPLAY,Ke.WIDEVINE,Ke.PLAYREADY,Ke.CLEARKEY].filter(i=>!!e[i]):[];return!n[Ke.WIDEVINE]&&t&&n.push(Ke.WIDEVINE),n}const _c=function(r){return vn!=null&&(r=vn.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function um(r,e,t,n){let i;switch(r){case Ke.FAIRPLAY:i=["cenc","sinf"];break;case Ke.WIDEVINE:case Ke.PLAYREADY:i=["cenc"];break;case Ke.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return hm(i,e,t,n)}function hm(r,e,t,n){return[{initDataTypes:r,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs="${s}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs="${s}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function en(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const sa=(r,e)=>e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,Lc=(r,e)=>e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,di=(r,e)=>{const t=e;let n=0;for(;sa(r,e);){n+=10;const i=hs(r,e+6);n+=i,Lc(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},hs=(r,e)=>{let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t},dm=(r,e)=>sa(r,e)&&hs(r,e+6)+10<=r.length-e,oa=r=>{const e=kc(r);for(let t=0;t<e.length;t++){const n=e[t];if(Fc(n))return Im(n)}},Fc=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",fm=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=hs(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},kc=r=>{let e=0;const t=[];for(;sa(r,e);){const n=hs(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=fm(r.subarray(e)),o=gm(s);o&&t.push(o),e+=s.size+10}Lc(r,e)&&(e+=10)}return t},gm=r=>r.type==="PRIV"?pm(r):r.type[0]==="W"?Em(r):mm(r),pm=r=>{if(r.size<2)return;const e=or(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},mm=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data.subarray(1));return{key:r.type,data:e}},Em=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data);return{key:r.type,data:e}},Im=r=>{if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}},or=(r,e=!1)=>{const t=Cm();if(t){const A=t.decode(r);if(e){const c=A.indexOf("\0");return c!==-1?A.substring(0,c):A}return A.replace(/\0/g,"")}const n=r.length;let i,s,o,a="",l=0;for(;l<n;){if(i=r[l++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=r[l++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=r[l++],o=r[l++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(o&63)<<0);break}}return a};let aa;function Cm(){if(!navigator.userAgent.includes("PlayStation 4"))return!aa&&typeof self.TextDecoder<"u"&&(aa=new self.TextDecoder("utf-8")),aa}const ar={hexDump:function(r){let e="";for(let t=0;t<r.length;t++){let n=r[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}},ds=Math.pow(2,32)-1,vm=[].push,Nc={video:1,audio:2,id3:3,text:4};function ct(r){return String.fromCharCode.apply(null,r)}function Mc(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=Oc(r,e);return t<0?4294967296+t:t}function Pc(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function Oc(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function la(r,e,t){r[e]=t>>24,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255}function ym(r){const e=r.byteLength;for(let t=0;t<e;){const n=me(r,t);if(n>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=n>1?t+n:e}return!1}function xe(r,e){const t=[];if(!e.length)return t;const n=r.byteLength;for(let i=0;i<n;){const s=me(r,i),o=ct(r.subarray(i+4,i+8)),a=s>1?i+s:n;if(o===e[0])if(e.length===1)t.push(r.subarray(i+8,a));else{const l=xe(r.subarray(i+8,a),e.slice(1));l.length&&vm.apply(t,l)}i=a}return t}function Bm(r){const e=[],t=r[0];let n=8;const i=me(r,n);n+=4;let s=0,o=0;t===0?(s=me(r,n),o=me(r,n+4),n+=8):(s=Pc(r,n),o=Pc(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Mc(r,n);n+=2;for(let A=0;A<l;A++){let c=n;const u=me(r,c);c+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return U.warn("SIDX has hierarchical references (not supported)"),null;const f=me(r,c);c+=4,e.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/i,start:a,end:a+h-1}}),a+=h,c+=4,n=c}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function Uc(r){const e=[],t=xe(r,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],o=xe(s,["tkhd"])[0];if(o){let a=o[0];const l=me(o,a===0?12:20),A=xe(s,["mdia","mdhd"])[0];if(A){a=A[0];const c=me(A,a===0?12:20),u=xe(s,["mdia","hdlr"])[0];if(u){const h=ct(u.subarray(8,12)),d={soun:He.AUDIO,vide:He.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=Tm(f);e[l]={timescale:c,type:d},e[d]=ht({timescale:c,id:l},g)}}}}}return xe(r,["moov","mvex","trex"]).forEach(i=>{const s=me(i,4),o=e[s];o&&(o.default={duration:me(i,12),flags:me(i,20)})}),e}function Tm(r){const e=r.subarray(8),t=e.subarray(86),n=ct(e.subarray(4,8));let i=n;const s=n==="enca"||n==="encv";if(s){const a=xe(e,[n])[0].subarray(n==="enca"?28:78);xe(a,["sinf"]).forEach(A=>{const c=xe(A,["schm"])[0];if(c){const u=ct(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ct(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+fs(o[1])+fs(o[2])+fs(o[3]);break}case"mp4a":{const o=xe(e,[n])[0],a=xe(o.subarray(28),["esds"])[0];if(a&&a.length>12){let l=4;if(a[l++]!==3)break;l=Aa(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=Aa(a,l);const c=a[l++];if(c===64)i+="."+fs(c);else break;if(l+=12,a[l++]!==5)break;l=Aa(a,l);const u=a[l++];let h=(u&248)>>3;h===31&&(h+=1+((u&7)<<3)+((a[l]&224)>>5)),i+="."+h}break}case"hvc1":case"hev1":{const o=xe(t,["hvcC"])[0],a=o[1],l=["","A","B","C"][a>>6],A=a&31,c=me(o,2),u=(a&32)>>5?"H":"L",h=o[12],d=o.subarray(6,12);i+="."+l+A,i+="."+c.toString(16).toUpperCase(),i+="."+u+h;let f="";for(let g=d.length;g--;){const p=d[g];(p||f)&&(f="."+p.toString(16).toUpperCase()+f)}i+=f;break}case"dvh1":case"dvhe":{const o=xe(t,["dvcC"])[0],a=o[2]>>1&127,l=o[2]<<5&32|o[3]>>3&31;i+="."+lr(a)+"."+lr(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+lr(a)+"."+lr(l)+"."+lr(A);break}case"av01":{const o=xe(t,["av1C"])[0],a=o[1]>>>5,l=o[1]&31,A=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,u=(o[2]&32)>>5,h=a===2&&c?u?12:10:c?10:8,d=(o[2]&16)>>4,f=(o[2]&8)>>3,g=(o[2]&4)>>2,p=o[2]&3;i+="."+a+"."+lr(l)+A+"."+lr(h)+"."+d+"."+f+g+p+"."+lr(1)+"."+lr(1)+"."+lr(1)+"."+0;break}}return{codec:i,encrypted:s}}function Aa(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function fs(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function lr(r){return(r<10?"0":"")+r}function Qm(r,e){if(!r||!e)return r;const t=e.keyId;return t&&e.isCommonEncryption&&xe(r,["moov","trak"]).forEach(i=>{const o=xe(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=xe(o,["enca"]);const l=a.length>0;l||(a=xe(o,["encv"])),a.forEach(A=>{const c=l?A.subarray(28):A.subarray(78);xe(c,["sinf"]).forEach(h=>{const d=Gc(h);if(d){const f=d.subarray(8,24);f.some(g=>g!==0)||(U.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${ar.hexDump(f)} -> ${ar.hexDump(t)}`),d.set(t,8))}})})}),r}function Gc(r){const e=xe(r,["schm"])[0];if(e){const t=ct(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return null}function bm(r,e){return xe(e,["moof","traf"]).reduce((t,n)=>{const i=xe(n,["tfdt"])[0],s=i[0],o=xe(n,["tfhd"]).reduce((a,l)=>{const A=me(l,4),c=r[A];if(c){let u=me(i,4);if(s===1){if(u===ds)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=ds+1,u+=me(i,8)}const h=c.timescale||9e4,d=u/h;if(he(d)&&(a===null||d<a))return d}return a},null);return o!==null&&he(o)&&(t===null||o<t)?o:t},null)}function xm(r,e){let t=0,n=0,i=0;const s=xe(r,["moof","traf"]);for(let o=0;o<s.length;o++){const a=s[o],l=xe(a,["tfhd"])[0],A=me(l,4),c=e[A];if(!c)continue;const u=c.default,h=me(l,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=me(l,12):d=me(l,8));const f=c.timescale||9e4,g=xe(a,["trun"]);for(let p=0;p<g.length;p++){if(t=wm(g[p]),!t&&d){const C=me(g[p],4);t=d*C}c.type===He.VIDEO?n+=t/f:c.type===He.AUDIO&&(i+=t/f)}}if(n===0&&i===0){let o=1/0,a=0,l=0;const A=xe(r,["sidx"]);for(let c=0;c<A.length;c++){const u=Bm(A[c]);if(u!=null&&u.references){o=Math.min(o,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,h+u.earliestPresentationTime/u.timescale),l=a-o}}if(l&&he(l))return l}return n||i}function wm(r){const e=me(r,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let n=0;const i=me(r,4);for(let s=0;s<i;s++){if(e&256){const o=me(r,t);n+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return n}function Sm(r,e,t){xe(e,["moof","traf"]).forEach(n=>{xe(n,["tfhd"]).forEach(i=>{const s=me(i,4),o=r[s];if(!o)return;const a=o.timescale||9e4;xe(n,["tfdt"]).forEach(l=>{const A=l[0],c=t*a;if(c){let u=me(l,4);if(A===0)u-=c,u=Math.max(u,0),la(l,4,u);else{u*=Math.pow(2,32),u+=me(l,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(ds+1)),d=Math.floor(u%(ds+1));la(l,4,h),la(l,8,d)}}})})})}function Rm(r){const e={valid:null,remainder:null},t=xe(r,["moof"]);if(t.length<2)return e.remainder=r,e;const n=t[t.length-1];return e.valid=en(r,0,n.byteOffset-8),e.remainder=en(r,n.byteOffset-8),e}function $t(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Hc(r,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let o=!1;return xe(n,["moof"]).map(l=>{const A=l.byteOffset-8;xe(l,["traf"]).map(u=>{const h=xe(u,["tfdt"]).map(d=>{const f=d[0];let g=me(d,4);return f===1&&(g*=Math.pow(2,32),g+=me(d,8)),g/i})[0];return h!==void 0&&(r=h),xe(u,["tfhd"]).map(d=>{const f=me(d,4),g=me(d,0)&16777215,p=(g&1)!==0,C=(g&2)!==0,Q=(g&8)!==0;let b=0;const v=(g&16)!==0;let x=0;const R=(g&32)!==0;let k=8;f===s&&(p&&(k+=8),C&&(k+=4),Q&&(b=me(d,k),k+=4),v&&(x=me(d,k),k+=4),R&&(k+=4),e.type==="video"&&(o=Dm(e.codec)),xe(u,["trun"]).map($=>{const K=$[0],O=me($,0)&16777215,W=(O&1)!==0;let ie=0;const te=(O&4)!==0,le=(O&256)!==0;let D=0;const P=(O&512)!==0;let X=0;const _=(O&1024)!==0,S=(O&2048)!==0;let F=0;const J=me($,4);let Y=8;W&&(ie=me($,Y),Y+=4),te&&(Y+=4);let ne=ie+A;for(let ce=0;ce<J;ce++){if(le?(D=me($,Y),Y+=4):D=b,P?(X=me($,Y),Y+=4):X=x,_&&(Y+=4),S&&(K===0?F=me($,Y):F=Oc($,Y),Y+=4),e.type===He.VIDEO){let pe=0;for(;pe<X;){const ge=me(n,ne);if(ne+=4,_m(o,n[ne])){const Se=n.subarray(ne,ne+ge);$c(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=D/i}}))})})}),t}function Dm(r){if(!r)return!1;const e=r.indexOf("."),t=e<0?r:r.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function _m(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function $c(r,e,t,n){const i=Yc(r);let s=0;s+=e;let o=0,a=0,l=0;for(;s<i.length;){o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);const A=i.length-s;let c=s;if(a<A)s+=a;else if(a>A){U.error(`Malformed SEI payload. ${a} is too small, only ${A} bytes left to parse.`);break}if(o===4){if(i[c++]===181){const h=Mc(i,c);if(c+=2,h===49){const d=me(i,c);if(c+=4,d===1195456820){const f=i[c++];if(f===3){const g=i[c++],p=31&g,C=64&g,Q=C?2+p*3:0,b=new Uint8Array(Q);if(C){b[0]=g;for(let v=1;v<Q;v++)b[v]=i[c++]}n.push({type:f,payloadType:o,pts:t,bytes:b})}}}}}else if(o===5&&a>16){const u=[];for(let f=0;f<16;f++){const g=i[c++].toString(16);u.push(g.length==1?"0"+g:g),(f===3||f===5||f===7||f===9)&&u.push("-")}const h=a-16,d=new Uint8Array(h);for(let f=0;f<h;f++)d[f]=i[c++];n.push({payloadType:o,pts:t,uuid:u.join(""),userData:or(d),userDataBytes:d})}}}function Yc(r){const e=r.byteLength,t=[];let n=1;for(;n<e-2;)r[n]===0&&r[n+1]===0&&r[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return r;const i=e-t.length,s=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),s[n]=r[o];return s}function Lm(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1,i=me(r,12),s=me(r,16),a=me(r,20),l=me(r,24),A=28}else if(e===1){A+=4,i=me(r,A),A+=4;const u=me(r,A);A+=4;const h=me(r,A);for(A+=4,o=4294967296*u+h,jp(o)||(o=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(r,A),A+=4,l=me(r,A),A+=4;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1}const c=r.subarray(A,r.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:c}}function Fm(r,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(r,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function km(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let n,i;if(e){n=1,i=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const l=e[a];if(l.byteLength!==16)throw new RangeError("Invalid key");i.set(l,a*16)}}else n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),Fm([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function Nm(r){const e=[];if(r instanceof ArrayBuffer){const t=r.byteLength;let n=0;for(;n+32<t;){const i=new DataView(r,n),s=Mm(i);e.push(s),n+=s.size}}return e}function Mm(r){const e=r.getUint32(0),t=r.byteOffset,n=r.byteLength;if(n<e)return{offset:t,size:n};if(r.getUint32(4)!==1886614376)return{offset:t,size:e};const s=r.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const o=r.buffer,a=ar.hexDump(new Uint8Array(o,t+12,16)),l=r.getUint32(28);let A=null,c=null;if(s===0){if(e-32<l||l<22)return{offset:t,size:e};c=new Uint8Array(o,t+32,l)}else if(s===1){if(!l||n<t+32+l*16+16)return{offset:t,size:e};A=[];for(let u=0;u<l;u++)A.push(new Uint8Array(o,t+32+u*16,16))}return{version:s,systemId:a,kids:A,data:c,offset:t,size:e}}let gs={};class fi{static clearKeyUriToKeyIdMap(){gs={}}constructor(e,t,n,i=[1],s=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=n,this.keyFormatVersions=i,this.iv=s,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 _t.FAIRPLAY:case _t.WIDEVINE:case _t.PLAYREADY:case _t.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&&U.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=Pm(e);return new fi(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=cm(this.uri);if(t)switch(this.keyFormat){case _t.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case _t.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=km(n,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),o=s.substring(s.indexOf("<"),s.length),A=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(A){const c=A.childNodes[0]?A.childNodes[0].nodeValue:A.getAttribute("VALUE");if(c){const u=ra(c).subarray(0,16);Am(u),this.keyId=u}}break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=gs[this.uri];if(!n){const i=Object.keys(gs).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),gs[this.uri]=n}this.keyId=n}return this}}function Pm(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const Vc=/\{\$([a-zA-Z0-9-_]+)\}/g;function Kc(r){return Vc.test(r)}function Lt(r,e,t){if(r.variableList!==null||r.hasVariableRefs)for(let n=t.length;n--;){const i=t[n],s=e[i];s&&(e[i]=ca(r,s))}}function ca(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(Vc,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Jc(r,e,t){let n=r.variableList;n||(r.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(i))s=o.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(o){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else i=e.NAME,s=e.VALUE;i in n?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function Om(r,e,t){const n=e.IMPORT;if(t&&n in t){let i=r.variableList;i||(r.variableList=i={}),i[n]=t[n]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function tn(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Um(r){return typeof self<"u"&&r===self.ManagedMediaSource}const ps={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 Gm(r,e){const t=ps[e];return!!t&&!!t[r.slice(0,4)]}function ua(r,e,t=!0){return!r.split(",").some(n=>!Wc(n,e,t))}function Wc(r,e,t=!0){var n;const i=tn(t);return(n=i==null?void 0:i.isTypeSupported(gi(r,e)))!=null?n:!1}function gi(r,e){return`${e}/mp4;codecs="${r}"`}function qc(r){if(r){const e=r.substring(0,4);return ps.video[e]}return 2}function ms(r){return r.split(",").reduce((e,t)=>{const n=ps.video[t];return n?(n*2+e)/(e?3:2):(ps.audio[t]+e)/(e?2:1)},0)}const ha={};function Hm(r,e=!0){if(ha[r])return ha[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Wc(t[n],"audio",e))return ha[r]=t[n],t[n];return r}const $m=/flac|opus/i;function Es(r,e=!0){return r.replace($m,t=>Hm(t.toLowerCase(),e))}function Xc(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function Ym(r){const e=r.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");if(n.length>2){let i=n.shift()+".";i+=parseInt(n.shift()).toString(16),i+=("000"+parseInt(n.shift()).toString(16)).slice(-4),e[t]=i}}return e.join(",")}const jc=/#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,zc=/#EXT-X-MEDIA:(.*)/g,Vm=/^#EXT(?:INF|-X-TARGETDURATION):/m,Zc=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"),Km=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 Ar{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return Zo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Vm.test(e)}static parseMasterPlaylist(e,t){const n=Kc(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];jc.lastIndex=0;let o;for(;(o=jc.exec(e))!=null;)if(o[1]){var a;const A=new je(o[1]);Lt(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=ca(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:Ar.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),Jm(A.CODECS,u),(a=u.unknownCodecs)!=null&&a.length||s.push(u),i.levels.push(u)}else if(o[3]){const A=o[3],c=o[4];switch(A){case"SESSION-DATA":{const u=new je(c);Lt(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[h]=u);break}case"SESSION-KEY":{const u=eu(c,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):U.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const u=new je(c);Lt(i,u,["NAME","VALUE","QUERYPARAM"]),Jc(i,u,t)}break}case"CONTENT-STEERING":{const u=new je(c);Lt(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:Ar.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=tu(c);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},o=n.levels,a={AUDIO:o.map(A=>({id:A.attrs.AUDIO,audioCodec:A.audioCodec})),SUBTITLES:o.map(A=>({id:A.attrs.SUBTITLES,textCodec:A.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(zc.lastIndex=0;(i=zc.exec(e))!==null;){const A=new je(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,Lt(n,A,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=A.LANGUAGE,f=A["ASSOC-LANGUAGE"],g=A.CHANNELS,p=A.CHARACTERISTICS,C=A["INSTREAM-ID"],Q={attrs:A,bitrate:0,id:l++,groupId:A["GROUP-ID"]||"",name:A.NAME||d||"",type:c,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:d,url:A.URI?Ar.resolve(A.URI,t):""};if(f&&(Q.assocLang=f),g&&(Q.channels=g),p&&(Q.characteristics=p),C&&(Q.instreamId=C),u!=null&&u.length){const b=Ar.findGroup(u,Q.groupId)||u[0];ru(Q,b,"audioCodec"),ru(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new am(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new ta(i,t),p,C,Q,b=-1,v=!1,x=null;for(Zc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Kc(e);(p=Zc.exec(e))!==null;){v&&(v=!1,g=new ta(i,t),g.start=h,g.sn=c,g.cc=d,g.level=n,A&&(g.initSegment=A,g.rawProgramDateTime=A.rawProgramDateTime,A.rawProgramDateTime=null,x&&(g.setByteRange(x),x=null)));const K=p[1];if(K){g.duration=parseFloat(K);const O=(" "+p[2]).slice(1);g.title=O||null,g.tagList.push(O?["INF",K,O]:["INF",K])}else if(p[3]){if(he(g.duration)){g.start=h,Q&&su(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=ca(a,O),nu(g,f),f=g,h+=g.duration,c++,u=0,v=!0}}else if(p[4]){const O=(" "+p[4]).slice(1);f?g.setByteRange(O,f):g.setByteRange(O)}else if(p[5])g.rawProgramDateTime=(" "+p[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),b===-1&&(b=l.length);else{if(p=p[0].match(Km),!p){U.warn("No matches on slow regex match for level playlist!");continue}for(C=1;C<p.length&&!(typeof p[C]<"u");C++);const O=(" "+p[C]).slice(1),W=(" "+p[C+1]).slice(1),ie=p[C+2]?(" "+p[C+2]).slice(1):"";switch(O){case"PLAYLIST-TYPE":a.type=W.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(W);break;case"SKIP":{const te=new je(W);Lt(a,te,["RECENTLY-REMOVED-DATERANGES"]);const le=te.decimalInteger("SKIPPED-SEGMENTS");if(he(le)){a.skippedSegments=le;for(let P=le;P--;)l.unshift(null);c+=le}const D=te.enumeratedString("RECENTLY-REMOVED-DATERANGES");D&&(a.recentlyRemovedDateranges=D.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(W),1);break;case"VERSION":a.version=parseInt(W);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(W||ie)&&g.tagList.push(ie?[W,ie]:[W]);break;case"DISCONTINUITY":d++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([O]);break;case"BITRATE":g.tagList.push([O,W]);break;case"DATERANGE":{const te=new je(W);Lt(a,te,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Lt(a,te,te.clientAttrs);const le=new xc(te,a.dateRanges[te.ID]);le.isValid||a.skippedSegments?a.dateRanges[le.id]=le:U.warn(`Ignoring invalid DATERANGE tag: "${W}"`),g.tagList.push(["EXT-X-DATERANGE",W]);break}case"DEFINE":{{const te=new je(W);Lt(a,te,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in te?Om(a,te,o):Jc(a,te,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(W);break;case"KEY":{const te=eu(W,t,a);if(te.isSupported()){if(te.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[te.keyFormat]&&(Q=it({},Q)),Q[te.keyFormat]=te}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${W}"`);break}case"START":a.startTimeOffset=tu(W);break;case"MAP":{const te=new je(W);if(Lt(a,te,["BYTERANGE","URI"]),g.duration){const le=new ta(i,t);iu(le,te,n,Q),A=le,g.initSegment=A,A.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=A.rawProgramDateTime)}else{const le=g.byteRangeEndOffset;if(le){const D=g.byteRangeStartOffset;x=`${le-D}@${D}`}else x=null;iu(g,te,n,Q),A=g,v=!0}break}case"SERVER-CONTROL":{const te=new je(W);a.canBlockReload=te.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=te.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&te.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=te.optionalFloat("PART-HOLD-BACK",0),a.holdBack=te.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const te=new je(W);a.partTarget=te.decimalFloatingPoint("PART-TARGET");break}case"PART":{let te=a.partList;te||(te=a.partList=[]);const le=u>0?te[te.length-1]:void 0,D=u++,P=new je(W);Lt(a,P,["BYTERANGE","URI"]);const X=new sm(P,g,t,D,le);te.push(X),g.duration+=X.duration;break}case"PRELOAD-HINT":{const te=new je(W);Lt(a,te,["URI"]),a.preloadHint=te;break}case"RENDITION-REPORT":{const te=new je(W);Lt(a,te,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(te);break}default:U.warn(`line parsed but not handled: ${p}`);break}}}f&&!f.relurl?(l.pop(),h-=f.duration,a.partList&&(a.fragmentHint=f)):a.partList&&(nu(g,f),g.cc=d,a.fragmentHint=g,Q&&su(g,Q,a));const R=l.length,k=l[0],$=l[R-1];if(h+=a.skippedSegments*a.targetduration,h>0&&R&&$){a.averagetargetduration=h/R;const K=$.sn;a.endSN=K!=="initSegment"?K:0,a.live||($.endList=!0),k&&(a.startCC=k.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,b>0&&Wm(l,b),a}}function eu(r,e,t){var n,i;const s=new je(r);Lt(t,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(n=s.METHOD)!=null?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),A=s.KEYFORMATVERSIONS,c=(i=s.KEYFORMAT)!=null?i:"identity";a&&s.IV&&!l&&U.error(`Invalid IV: ${s.IV}`);const u=a?Ar.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new fi(o,u,c,h,l)}function tu(r){const t=new je(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function Jm(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>Gm(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function ru(r,e,t){const n=e[t];n&&(r[t]=n)}function Wm(r,e){let t=r[e];for(let n=e;n--;){const i=r[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function nu(r,e){r.rawProgramDateTime?r.programDateTime=Date.parse(r.rawProgramDateTime):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime),he(r.programDateTime)||(r.programDateTime=null,r.rawProgramDateTime=null)}function iu(r,e,t,n){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",n&&(r.levelkeys=n),r.initSegment=null}function su(r,e,t){r.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(r)}var Oe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function ou(r){const{type:e}=r;switch(e){case Oe.AUDIO_TRACK:return Ee.AUDIO;case Oe.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function da(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class qm{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,o=new s(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:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Oe.MANIFEST,url:n,deliveryDirectives:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:o,deliveryDirectives:a}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:Oe.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.AUDIO_TRACK,url:s,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.SUBTITLE_TRACK,url:s,deliveryDirectives:o})}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const A=i.context;if(A&&A.url===e.url&&A.level===e.level){U.trace("[playlist-loader]: playlist request ongoing");return}U.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===Oe.MANIFEST?s=n.manifestLoadPolicy.default:s=it({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),he((t=e.deliveryDirectives)==null?void 0:t.part)){let A;if(e.type===Oe.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Oe.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Oe.SUBTITLE_TRACK&&e.id!==null&&(A=this.hls.subtitleTracks[e.id].details),A){const c=A.partTarget,u=A.targetduration;if(c&&u){const h=Math.max(c*3,u*.8)*1e3;s=it({},s,{maxTimeToFirstByteMs:Math.min(h,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(A,c,u,h)=>{const d=this.getInternalLoader(u);this.resetInternalLoader(u.type);const f=A.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(A,u,new Error("no EXTM3U delimiter"),h||null,c);return}c.parsing.start=performance.now(),Ar.isMediaPlaylist(f)?this.handleTrackOrLevelPlaylist(A,c,u,h||null,d):this.handleMasterPlaylist(A,c,u,h)},onError:(A,c,u,h)=>{this.handleNetworkError(c,u,!1,A,h)},onTimeout:(A,c,u)=>{this.handleNetworkError(c,u,!0,void 0,A)}};i.load(e,a,l)}handleMasterPlaylist(e,t,n,i){const s=this.hls,o=e.data,a=da(e,n),l=Ar.parseMasterPlaylist(o,a);if(l.playlistParsingError){this.handleManifestParsingError(e,n,l.playlistParsingError,i,t);return}const{contentSteering:A,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f}=l;this.variableList=f;const{AUDIO:g=[],SUBTITLES:p,"CLOSED-CAPTIONS":C}=Ar.parseMasterPlaylistMedia(o,a,l);g.length&&!g.some(b=>!b.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new je({}),bitrate:0,url:""})),s.trigger(I.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:p,captions:C,contentSteering:A,url:a,stats:t,networkDetails:i,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(e,t,n,i,s){const o=this.hls,{id:a,level:l,type:A}=n,c=da(e,n),u=0,h=he(l)?l:he(a)?a:0,d=ou(n),f=Ar.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Oe.MANIFEST){const g={attrs:new je({}),bitrate:0,details:f,name:"",url:c};o.trigger(I.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=f,this.handlePlaylistLoaded(f,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.MANIFEST_PARSING_ERROR,fatal:t.type===Oe.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let o=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Oe.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Oe.AUDIO_TRACK||e.type===Oe.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);U.warn(`[playlist-loader]: ${o}`);let l=V.UNKNOWN,A=!1;const c=this.getInternalLoader(e);switch(e.type){case Oe.MANIFEST:l=n?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,A=!0;break;case Oe.LEVEL:l=n?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,A=!1;break;case Oe.AUDIO_TRACK:l=n?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Oe.SUBTITLE_TRACK:l=n?V.SUBTITLE_TRACK_LOAD_TIMEOUT:V.SUBTITLE_LOAD_ERROR,A=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Be.NETWORK_ERROR,details:l,fatal:A,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:s};if(i){const h=(t==null?void 0:t.url)||e.url;u.response=ht({url:h,data:void 0},i)}this.hls.trigger(I.ERROR,u)}handlePlaylistLoaded(e,t,n,i,s,o){const a=this.hls,{type:l,level:A,id:c,groupId:u,deliveryDirectives:h}=i,d=da(t,i),f=ou(i),g=typeof i.level=="number"&&f===Ee.MAIN?A:void 0;if(!e.fragments.length){const C=new Error("No Segments found in Playlist");a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:C,reason:C.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Oe.MANIFEST:case Oe.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function au(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function lu(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){U.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){U.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function yn(r){const e=r.mode;if(e==="disabled"&&(r.mode="hidden"),r.cues)for(let t=r.cues.length;t--;)r.removeCue(r.cues[t]);e==="disabled"&&(r.mode=e)}function fa(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=jm(r.cues,e,t);for(let o=0;o<s.length;o++)(!n||n(s[o]))&&r.removeCue(s[o])}i==="disabled"&&(r.mode=i)}function Xm(r,e){if(e<r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let n=0,i=t;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<r[s].startTime)i=s-1;else if(e>r[s].startTime&&n<t)n=s+1;else return s}return r[n].startTime-e<e-r[i].startTime?n:i}function jm(r,e,t){const n=[],i=Xm(r,e);if(i>-1)for(let s=i,o=r.length;s<o;s++){const a=r[s];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function Is(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(r[t])}return e}var zt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const zm=.25;function ga(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Au(r,e,t,n,i){let s=new r(e,t,"");try{s.value=n,i&&(s.type=i)}catch{s=new r(e,t,JSON.stringify(i?ht({type:i},n):n))}return s}const Cs=(()=>{const r=ga();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function pa(r,e){return r.getTime()/1e3-e}function Zm(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class eE{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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(yn(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return au(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:i}}}=this;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=ga();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===zt.emsg&&!n||!i)continue;const A=kc(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>Cs&&(u=Cs),u-c<=0&&(u=c+zm);for(let d=0;d<A.length;d++){const f=A[d];if(!Fc(f)){this.updateId3CueEnds(c,l);const g=Au(o,c,u,f,l);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const o=i[s];o.type===t&&o.startTime<e&&o.endTime===Cs&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(s&&(a||l)){let A;i==="audio"?A=c=>c.type===zt.audioId3&&l:i==="video"?A=c=>c.type===zt.emsg&&a:A=c=>c.type===zt.audioId3&&l||c.type===zt.emsg&&a,fa(s,t,n,A)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:n,id3Track:i}=this,{dateRanges:s}=t,o=Object.keys(s);if(i){const c=Object.keys(n).filter(u=>!o.includes(u));for(let u=c.length;u--;){const h=c[u];Object.keys(n[h].cues).forEach(d=>{i.removeCue(n[h].cues[d])}),delete n[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!he(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=a.programDateTime/1e3-a.start,A=ga();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=pa(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,C=Cs;const Q=h.endDate;if(Q)C=pa(Q,l),p=!0;else if(h.endOnNext&&!p){const v=o.reduce((x,R)=>{if(R!==h.id){const k=s[R];if(k.class===h.class&&k.startDate>h.startDate&&(!x||h.startDate<x.startDate))return k}return x},null);v&&(C=pa(v.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let v=0;v<b.length;v++){const x=b[v];if(!nm(x))continue;const R=g[x];if(R)p&&!f.durationKnown&&(R.endTime=C);else if(A){let k=h.attr[x];im(x)&&(k=Zm(k));const $=Au(A,d,C,{key:x,data:k},zt.dateRange);$&&($.id=u,this.id3Track.addCue($),g[x]=$)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class tE{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:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let A=a&&n||t;(l.liveSyncDuration||l.liveSyncDurationCount||A===0)&&(A=s!==void 0?s:o*i);const c=i;return A+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(e===null||t===null||n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,o=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,s),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 n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(I.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 n;t.details===V.BUFFER_STALLED_ERROR&&(this.stallCount++,(n=this.levelDetails)!=null&&n.live&&U.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 n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=n-o,l=Math.min(this.maxLatency,o+t.targetduration);if(a<l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}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 ma=["NONE","TYPE-0","TYPE-1",null];function rE(r){return ma.indexOf(r)>-1}const vs=["SDR","PQ","HLG"];function nE(r){return!!r&&vs.indexOf(r)>-1}var ys={No:"",Yes:"YES",v2:"v2"};function cu(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?ys.v2:ys.Yes:ys.No}class uu{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){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 Bn{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 hu(this._audioGroups,e)}hasSubtitleGroup(e){return hu(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 hu(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function Ea(r,e){const t=e.startPTS;if(he(t)){let n=0,i;e.sn>r.sn?(n=t-r.start,i=r):(n=r.start-t,i=e),i.duration!==n&&(i.duration=n)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.start=r.start+(r.minEndPTS-r.start):e.start=r.start+r.duration:e.start=Math.max(r.start-e.duration,0)}function du(r,e,t,n,i,s){n-t<=0&&(U.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let a=t,l=n;const A=e.startPTS,c=e.endPTS;if(he(A)){const p=Math.abs(A-t);he(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,A),t=Math.min(t,A),i=Math.min(i,e.startDTS),l=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=n-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=l,e.endDTS=s;const h=e.sn;if(!r||h<r.startSN||h>r.endSN)return 0;let d;const f=h-r.startSN,g=r.fragments;for(g[f]=e,d=f;d>0;d--)Ea(g[d],g[d-1]);for(d=f;d<g.length-1;d++)Ea(g[d],g[d+1]);return r.fragmentHint&&Ea(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function iE(r,e){let t=null;const n=r.fragments;for(let l=n.length-1;l>=0;l--){const A=n[l].initSegment;if(A){t=A;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let i=0,s;if(aE(r,e,(l,A)=>{l.relurl&&(i=l.cc-A.cc),he(l.startPTS)&&he(l.endPTS)&&(A.start=A.startPTS=l.startPTS,A.startDTS=l.startDTS,A.maxStartPTS=l.maxStartPTS,A.endPTS=l.endPTS,A.endDTS=l.endDTS,A.minEndPTS=l.minEndPTS,A.duration=l.endPTS-l.startPTS,A.duration&&(s=A),e.PTSKnown=e.alignedSliding=!0),A.elementaryStreams=l.elementaryStreams,A.loader=l.loader,A.stats=l.stats,l.initSegment&&(A.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(A=>{var c;A&&(!A.initSegment||A.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(A.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=sE(r.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(i){U.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<o.length;l++)o[l].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),oE(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?du(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):fu(r,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const l=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=l),e.driftEndTime=a,e.driftEnd=l}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime}function sE(r,e,t){const n=it({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new xc(e[i].attr,n[i]);s.isValid?n[i]=s:U.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),n}function oE(r,e,t){if(r&&e){let n=0;for(let i=0,s=r.length;i<=s;i++){const o=r[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function aE(r,e,t){const n=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,s=(r.fragmentHint?1:0)+(n?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,o=e.startSN-r.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let A=i;A<=s;A++){const c=l[o+A];let u=a[A];n&&!u&&A<n&&(u=e.fragments[A]=c),c&&u&&t(c,u)}}function fu(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||Ia(e,n[t].start)}function Ia(r,e){if(e){const t=r.fragments;for(let n=r.skippedSegments;n<t.length;n++)t[n].start+=e;r.fragmentHint&&(r.fragmentHint.start+=e)}}function lE(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const n=r.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function AE(r,e,t){if(!(r!=null&&r.details))return null;const n=r.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e)?i:e<n.startSN&&t&&t.sn===e?t:null}function gu(r,e,t){var n;return r!=null&&r.details?pu((n=r.details)==null?void 0:n.partList,e,t):null}function pu(r,e,t){if(r)for(let n=r.length;n--;){const i=r[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function mu(r){r.forEach((e,t)=>{const{details:n}=e;n!=null&&n.fragments&&n.fragments.forEach(i=>{i.level=t})})}function Bs(r){switch(r.details){case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_TIMEOUT:case V.LEVEL_LOAD_TIMEOUT:case V.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Eu(r,e){const t=Bs(e);return r.default[`${t?"timeout":"error"}Retry`]}function Ca(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function Iu(r){return ht(ht({},r),{errorRetry:null,timeoutRetry:null})}function Ts(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(cE(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function cE(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const Cu={search:function(r,e){let t=0,n=r.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=r[i];const o=e(s);if(o>0)t=i+1;else if(o<0)n=i-1;else return s}return null}};function uE(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!he(e))return null;const n=r[0].programDateTime;if(e<(n||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let s=0;s<r.length;++s){const o=r[s];if(dE(e,t,o))return o}return null}function Qs(r,e,t=0,n=0,i=.005){let s=null;if(r){s=e[r.sn-e[0].sn+1]||null;const a=r.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!r||r.level===s.level)&&va(t,n,s)===0||hE(s,r,Math.min(i,n))))return s;const o=Cu.search(e,va.bind(null,t,n));return o&&(o!==r||!s)?o:s}function hE(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return r.start<=n}return!1}function va(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=r?1:t.start-n>r&&t.start?-1:0}function dE(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function fE(r,e){return Cu.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var Bt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class gE{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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.ERROR,this.onError,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.ERROR,this.onError,this),e.off(I.ERROR,this.onErrorOut,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.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)===Ee.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n,i;if(t.fatal)return;const s=this.hls,o=t.context;switch(t.details){case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case V.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Bt.SendAlternateToPenaltyBox;return}case V.LEVEL_EMPTY_ERROR:case V.LEVEL_PARSING_ERROR:{var a,l;const A=t.parent===Ee.MAIN?t.level:s.loadLevel;t.details===V.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(l=a.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,A):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,A))}return;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.SUBTITLE_LOAD_ERROR:case V.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const A=s.levels[s.loadLevel];if(A&&(o.type===Oe.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Oe.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=Bt.SendAlternateToPenaltyBox,t.errorAction.flags=Zt.MoveAllAlternatesMatchingHost;return}}return;case V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const A=s.levels[s.loadLevel],c=A==null?void 0:A.attrs["HDCP-LEVEL"];c?t.errorAction={action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case V.BUFFER_ADD_CODEC_ERROR:case V.REMUX_ALLOC_ERROR:case V.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:s.loadLevel);return;case V.INTERNAL_EXCEPTION:case V.BUFFER_APPENDING_ERROR:case V.BUFFER_FULL_ERROR:case V.LEVEL_SWITCH_ERROR:case V.BUFFER_STALLED_ERROR:case V.BUFFER_SEEK_OVER_HOLE:case V.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}t.type===Be.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 n=this.hls,i=Eu(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Ts(i,s,Bs(e),e.response))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:i,retryCount:s};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=s),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:o}=t.config,a=Eu(e.details.startsWith("key")?o:s,e),l=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(i&&(e.details!==V.FRAG_GAP&&i.fragmentError++,Ts(a,l,Bs(e),e.response)))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:a,retryCount:l};const A=this.getLevelSwitchAction(e,n);return a&&(A.retryConfig=a,A.retryCount=l),A}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,o;const A=e.details;i.loadError++,A===V.BUFFER_APPEND_ERROR&&i.fragmentError++;let c=-1;const{levels:u,loadLevel:h,minAutoLevel:d,maxAutoLevel:f}=n;n.autoLevelEnabled||(n.loadLevel=-1);const g=(s=e.frag)==null?void 0:s.type,C=(g===Ee.AUDIO&&A===V.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(A===V.BUFFER_ADD_CODEC_ERROR||A===V.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:R})=>i.audioCodec!==R),b=e.sourceBufferName==="video"&&(A===V.BUFFER_ADD_CODEC_ERROR||A===V.BUFFER_APPEND_ERROR)&&u.some(({codecSet:R,audioCodec:k})=>i.codecSet!==R&&i.audioCodec===k),{type:v,groupId:x}=(o=e.context)!=null?o:{};for(let R=u.length;R--;){const k=(R+h)%u.length;if(k!==h&&k>=d&&k<=f&&u[k].loadError===0){var a,l;const $=u[k];if(A===V.FRAG_GAP&&g===Ee.MAIN&&e.frag){const K=u[k].details;if(K){const O=Qs(e.frag,K.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(v===Oe.AUDIO_TRACK&&$.hasAudioGroup(x)||v===Oe.SUBTITLE_TRACK&&$.hasSubtitleGroup(x))continue;if(g===Ee.AUDIO&&(a=i.audioGroups)!=null&&a.some(K=>$.hasAudioGroup(K))||g===Ee.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(K=>$.hasSubtitleGroup(K))||C&&i.audioCodec===$.audioCodec||!C&&i.audioCodec!==$.audioCodec||b&&i.codecSet===$.codecSet)continue}c=k;break}}if(c>-1&&n.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Bt.SendAlternateToPenaltyBox,flags:Zt.None,nextAutoLevel:c}}return{action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case Bt.DoNothing:break;case Bt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==V.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,n=e.errorAction;if(!n)return;const{flags:i,hdcpLevel:s,nextAutoLevel:o}=n;switch(i){case Zt.None:this.switchLevel(e,o);break;case Zt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=ma[ma.indexOf(s)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.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 ya{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=U.log.bind(U,`${t}:`),this.warn=U.warn.bind(U,`${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,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(A){U.warn(`Could not construct new URL for Rendition Report: ${A}`),l=a.URI||""}if(l===e){s=o;break}else l===e.substring(0,l.length)&&(s=o)}if(s!==-1){const o=i[s],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=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);l>=0&&c>t.partTarget&&(l+=1)}const A=n&&cu(n);return new uu(a,l>=0?l:void 0,A)}}}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,n){const{details:i,stats:s}=t,o=self.performance.now(),a=s.loading.first?Math.max(0,o-s.loading.first):0;if(i.advancedDateTime=Date.now()-a,i.live||n!=null&&n.live){if(i.reloaded(n),n&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),n&&i.fragments.length>0&&iE(n,i),!this.canLoad||!i.live)return;let l,A,c;if(i.canBlockReload&&i.endSN&&i.advanced){const p=this.hls.config.lowLatencyMode,C=i.lastPartSn,Q=i.endSN,b=i.lastPartIndex,v=b!==-1,x=C===Q,R=p?0:b;v?(A=x?Q+1:C,c=x?R:b+1):A=Q+1;const k=i.age,$=k+i.ageHeader;let K=Math.min($-i.partTarget,i.targetduration*1.5);if(K>0){if(n&&K>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${K} with playlist age: ${i.age}`),K=0;else{const O=Math.floor(K/i.targetduration);if(A+=O,c!==void 0){const W=Math.round(K%i.targetduration/i.partTarget);c+=W}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${k.toFixed(2)}s goal: ${K} skip sn ${O} to part ${c}`)}i.tuneInGoal=K}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c),p||!x){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,d=(i.edge-h)*1e3,f=lE(i,d);i.updated&&o>this.requestScheduled+f&&(this.requestScheduled=s.loading.start),A!==void 0&&i.canBlockReload?this.requestScheduled=s.loading.first+f-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+f<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=f);let g=this.requestScheduled-o;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),g)}else this.clearTimer()}getDeliveryDirectives(e,t,n,i){let s=cu(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=ys.No),new uu(n,i,s)}checkRetry(e){const t=e.details,n=Bs(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===Bt.RetryRequest||!i.resolved&&s===Bt.SendAlternateToPenaltyBox);if(l){var A;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(n&&(A=e.context)!=null&&A.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=Ca(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,i.resolved=!0}return l}}class Tn{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 pE{constructor(e,t,n,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Tn(e),this.fast_=new Tn(t),this.defaultTTFB_=i,this.ttfb_=new Tn(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new Tn(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Tn(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Tn(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const vu={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},yu={};function mE(r,e,t,n,i,s){const o=r.audioCodec?r.audioGroups:null,a=s==null?void 0:s.audioCodec,l=s==null?void 0:s.channels,A=l?parseInt(l):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((u,h)=>{if(h){const d=e.groups[h];if(!d)throw new Error(`Audio track group ${h} not found`);Object.keys(d.channels).forEach(f=>{u[f]=(u[f]||0)+d.channels[f]})}return u},{2:0})}catch{return!0}return r.videoCodec!==void 0&&(r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(n,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!c&&he(A)&&Object.keys(c).some(u=>parseInt(u)>A)}function EE(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(vu);const s={width:r.width,height:r.height,bitrate:Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)),framerate:r.frameRate||30},o=r.videoRange;o!=="SDR"&&(s.transferFunction=o.toLowerCase());const a=n.split(",").map(l=>({type:"media-source",video:ht(ht({},s),{},{contentType:gi(l,"video")})}));return i&&r.audioGroups&&r.audioGroups.forEach(l=>{var A;l&&((A=e.groups[l])==null||A.tracks.forEach(c=>{if(c.groupId===l){const u=c.channels||"",h=parseFloat(u);he(h)&&h>2&&a.push.apply(a,i.split(",").map(d=>({type:"media-source",audio:{contentType:gi(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=IE(l);return yu[A]||(yu[A]=t.decodingInfo(l))})).then(l=>({supported:!l.some(A=>!A.supported),configurations:a,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:a,decodingInfoResults:[],error:l}))}function IE(r){const{audio:e,video:t}=r,n=t||e;if(n){const i=n.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function CE(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function vE(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||vs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:CE(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function yE(r,e,t,n,i){const s=Object.keys(r),o=n==null?void 0:n.channels,a=n==null?void 0:n.audioCodec,l=o&&parseInt(o)===2;let A=!0,c=!1,u=1/0,h=1/0,d=1/0,f=0,g=[];const{preferHDR:p,allowedVideoRanges:C}=vE(e,i);for(let x=s.length;x--;){const R=r[s[x]];A=R.channels[2]>0,u=Math.min(u,R.minHeight),h=Math.min(h,R.minFramerate),d=Math.min(d,R.minBitrate);const k=C.filter($=>R.videoRanges[$]>0);k.length>0&&(c=!0,g=k)}u=he(u)?u:0,h=he(h)?h:0;const Q=Math.max(1080,u),b=Math.max(30,h);return d=he(d)?d:t,t=Math.max(d,t),c||(e=void 0,g=[]),{codecSet:s.reduce((x,R)=>{const k=r[R];if(R===x)return x;if(k.minBitrate>t)return Tr(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),x;if(!k.hasDefaultAudio)return Tr(R,"no renditions with default or auto-select sound found"),x;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Tr(R,`audio codec preference "${a}" not found`),x;if(o&&!l){if(!k.channels[o])return Tr(R,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),x}else if((!a||l)&&A&&k.channels[2]===0)return Tr(R,"no renditions with stereo sound found"),x;return k.minHeight>Q?(Tr(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),x):k.minFramerate>b?(Tr(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),x):g.some($=>k.videoRanges[$]>0)?k.maxScore<f?(Tr(R,`max score of ${k.maxScore} < selected max of ${f}`),x):x&&(ms(R)>=ms(x)||k.fragmentError>r[x].fragmentError)?x:(f=k.maxScore,R):(Tr(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),x)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Tr(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function BE(r){return r.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function TE(r,e,t,n){return r.slice(t,n+1).reduce((i,s)=>{if(!s.codecSet)return i;const o=s.audioGroups;let a=i[s.codecSet];a||(i[s.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,s.bitrate);const l=Math.min(s.height,s.width);return a.minHeight=Math.min(a.minHeight,l),a.minFramerate=Math.min(a.minFramerate,s.frameRate),a.maxScore=Math.max(a.maxScore,s.score),a.fragmentError+=s.fragmentError,a.videoRanges[s.videoRange]=(a.videoRanges[s.videoRange]||0)+1,o&&o.forEach(A=>{if(!A)return;const c=e.groups[A];c&&(a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(u=>{a.channels[u]=(a.channels[u]||0)+c.channels[u]}))}),i},{})}function cr(r,e,t){if("attrs"in r){const n=e.indexOf(r);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(Qn(r,i,t))return n}return-1}function Qn(r,e,t){const{groupId:n,name:i,lang:s,assocLang:o,characteristics:a,default:l}=r,A=r.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||e.lang===s)&&(s===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(A===void 0||e.forced===A)&&(a===void 0||QE(a,e.characteristics))&&(t===void 0||t(r,e))}function QE(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function bn(r,e){const{audioCodec:t,channels:n}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function bE(r,e,t,n,i){const s=e[n],a=e.reduce((h,d,f)=>{const g=d.uri;return(h[g]||(h[g]=[])).push(f),h},{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=s.videoRange,A=s.frameRate,c=s.codecSet.substring(0,4),u=Bu(e,n,h=>{if(h.videoRange!==l||h.frameRate!==A||h.codecSet.substring(0,4)!==c)return!1;const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1});return u>-1?u:Bu(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1})}function Bu(r,e,t){for(let n=e;n>-1;n--)if(t(r[n]))return n;for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return-1}class xE{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:n,hls:i}=this,{autoLevelEnabled:s,media:o}=i;if(!t||!o)return;const a=performance.now(),l=n?n.stats:t.stats,A=n?n.duration:t.duration,c=a-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||o.paused||!o.playbackRate||!o.readyState)return;const h=i.mainForwardBufferInfo;if(h===null)return;const d=this.bwEstimator.getEstimateTTFB(),f=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(A/(f*2))))return;const g=h.len/f,p=l.loading.first?l.loading.first-l.loading.start:-1,C=l.loaded&&p>-1,Q=this.getBwEstimate(),b=i.levels,v=b[t.level],x=l.total||Math.max(l.loaded,Math.round(A*v.averageBitrate/8));let R=C?c-p:c;R<1&&C&&(R=Math.min(c,l.loaded*8/Q));const k=C?l.loaded*1e3/R:0,$=k?(x-l.loaded)/k:x*8/Q+d/1e3;if($<=g)return;const K=k?k*8:Q;let O=Number.POSITIVE_INFINITY,W;for(W=t.level-1;W>u;W--){const te=b[W].maxBitrate;if(O=this.getTimeToLoadFrag(d/1e3,K,A*te,!b[W].details),O<g)break}if(O>=$||O>A*10)return;i.nextLoadLevel=i.nextAutoLevel=W,C?this.bwEstimator.sample(c-Math.min(d,p),l.loaded):this.bwEstimator.sampleTTFB(c);const ie=b[W].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ie&&this.resetEstimator(ie),this.clearTimer(),U.warn(`[abr] Fragment ${t.sn}${n?" part "+n.index:""} of level ${t.level} is loading too slowly;
2464
2464
  Time to underbuffer: ${g.toFixed(3)} s
2465
- Estimated load time for current fragment: ${H.toFixed(3)} s
2465
+ Estimated load time for current fragment: ${$.toFixed(3)} s
2466
2466
  Estimated load time for down switch fragment: ${O.toFixed(3)} s
2467
2467
  TTFB estimate: ${p|0} ms
2468
2468
  Current BW estimate: ${he(Q)?Q|0:"Unknown"} bps
2469
2469
  New BW estimate: ${this.getBwEstimate()|0} bps
2470
- Switching to level ${W} @ ${ie|0} bps`),i.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(U.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 DI(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(I.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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i: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 K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=s?s.stats:n.stats,l=o-a.loading.start,A=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&A>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,A),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,o=i?this.lastLevelLoadSec:0;return s+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.start;he(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(I.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const o=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return U.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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,s)&&o[e].loadError<=o[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this,{maxAutoLevel:i,config:s,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),A=this.getStarvationDelay();let c=s.abrBandWidthFactor,u=s.abrBandWidthUpFactor;if(A){const p=this.findBestLevel(l,o,i,A,0,c,u);if(p>=0)return p}let h=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!A){const p=this.bitrateTestDelay;p&&(h=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-p,U.info(`[abr] bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),c=u=1)}const d=this.findBestLevel(l,o,i,A,h,c,u);if(U.info(`[abr] ${A?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=n.levels[o],g=n.levels[n.loadLevel];return(f==null?void 0:f.bitrate)<(g==null?void 0:g.bitrate)?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,o,a){var l;const A=i+s,c=this.lastLoadedFragLevel,u=c===-1?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:p,config:y}=this.hls;if(f.length===1)return 0;const Q=f[u],b=!!(Q!=null&&(l=Q.details)!=null&&l.live),v=p===-1||c===-1;let w,R="SDR",k=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:H,videoPreference:V}=y,O=this.audioTracksByGroup||(this.audioTracksByGroup=PI(g));if(v){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=OI(f,O,t,n)),P=MI(D,R,e,H,V),{codecSet:j,videoRanges:_,minFramerate:S,minBitrate:F,preferHDR:J}=P;w=j,R=J?_[_.length-1]:_[0],k=S,e=Math.max(e,F),U.log(`[abr] picked start tier ${JSON.stringify(P)}`)}else w=Q==null?void 0:Q.codecSet,R=Q==null?void 0:Q.videoRange;const W=d?d.duration:h?h.duration:0,ie=this.bwEstimator.getEstimateTTFB()/1e3,te=[];for(let D=n;D>=t;D--){var le;const P=f[D],j=D>u;if(!P)continue;if(y.useMediaCapabilities&&!P.supportedResult&&!P.supportedPromise){const ce=navigator.mediaCapabilities;typeof(ce==null?void 0:ce.decodingInfo)=="function"&&_I(P,O,R,k,e,H)?(P.supportedPromise=LI(P,O,ce),P.supportedPromise.then(pe=>{if(!this.hls)return;P.supportedResult=pe;const ge=this.hls.levels,Se=ge.indexOf(P);pe.error?U.warn(`[abr] MediaCapabilities decodingInfo error: "${pe.error}" for level ${Se} ${JSON.stringify(pe)}`):pe.supported||(U.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Se} ${JSON.stringify(pe)}`),Se>-1&&ge.length>1&&(U.log(`[abr] Removing unsupported level ${Se}`),this.hls.removeLevel(Se)))})):P.supportedResult=nh}if(w&&P.codecSet!==w||R&&P.videoRange!==R||j&&k>P.frameRate||!j&&k>0&&k<P.frameRate||P.supportedResult&&!((le=P.supportedResult.decodingInfoResults)!=null&&le[0].smooth)){te.push(D);continue}const _=P.details,S=(d?_==null?void 0:_.partTarget:_==null?void 0:_.averagetargetduration)||W;let F;j?F=a*e:F=o*e;const J=W&&i>=W*2&&s===0?f[D].averageBitrate:f[D].maxBitrate,Y=this.getTimeToLoadFrag(ie,F,J*S,_===void 0);if(F>=J&&(D===c||P.loadError===0&&P.fragmentError===0)&&(Y<=ie||!he(Y)||b&&!this.bitrateTestDelay||Y<A)){const ce=this.forcedAutoLevel;return D!==p&&(ce===-1||ce!==p)&&(te.length&&U.trace(`[abr] Skipped level(s) ${te.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${f[te[0]].codecs}" ${f[te[0]].videoRange}; not compatible with "${Q.codecs}" ${R}`),U.info(`[abr] switch candidate:${u}->${D} adjustedbw(${Math.round(F)})-bitrate=${Math.round(F-J)} ttfb:${ie.toFixed(1)} avgDuration:${S.toFixed(1)} maxFetchDuration:${A.toFixed(1)} fetchDuration:${Y.toFixed(1)} firstSelection:${v} codecSet:${w} videoRange:${R} hls.loadLevel:${p}`)),v&&(this.firstSelection=D),D}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,i=Math.min(Math.max(e,n),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class $I{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 dt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class YI{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(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;const o=s.end;if(s.start<=e&&o!==null&&e<=o)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:n}=this,i=Object.keys(n);for(let s=i.length;s--;){const o=n[i[s]];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,n,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||s>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===n&&this.removeFragment(a.body);return}const l=a.range[e];l&&l.time.some(A=>{const c=!this.isTimeBuffered(A.startPTS,A.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:n,part:i}=e;if(!t||n.sn==="initSegment")return;const s=bn(n),o=this.fragments[s];if(!o||o.buffered&&n.gap)return;const a=!n.relurl;Object.keys(t).forEach(l=>{const A=n.elementaryStreams[l];if(!A)return;const c=t[l],u=a||A.partial===!0;o.range[l]=this.getBufferedTimes(n,i,u,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=n.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),ks(o)||this.removeParts(n.sn-1,n.type)):this.removeFragment(o.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=n.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=bn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},o=e.start,a=e.end,l=e.minEndPTS||a,A=e.maxStartPTS||o;for(let c=0;c<i.length;c++){const u=i.start(c)-this.bufferPadding,h=i.end(c)+this.bufferPadding;if(A>=u&&l<=h){s.time.push({startPTS:Math.max(o,i.start(c)),endPTS:Math.min(a,i.end(c))});break}else if(o<h&&a>u){const d=Math.max(o,i.start(c)),f=Math.min(a,i.end(c));f>d&&(s.partial=!0,s.time.push({startPTS:d,endPTS:f}))}else if(a<=u)break}return s}getPartialFragment(e){let t=null,n,i,s,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(A=>{const c=l[A];c&&ks(c)&&(i=c.body.start-a,s=c.body.end+a,e>=i&&e<=s&&(n=Math.min(e-i,s-e),o<=n&&(t=c.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ks(t))}getState(e){const t=bn(e),n=this.fragments[t];return n?n.buffered?ks(n)?dt.PARTIAL:dt.OK:dt.APPENDING:dt.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let o=0;o<n.length;o++){if(i=n.start(o)-this.bufferPadding,s=n.end(o)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:n,part:i}=t;if(n.sn==="initSegment"||n.bitrateTest)return;const s=i?null:t,o=bn(n);this.fragments[o]={body:n,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(i)}this.timeRanges=s,Object.keys(s).forEach(a=>{const l=s[a];this.detectEvictedFragments(a,l,o,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=bn(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==n||i&&!l.gap||l.start<t&&l.end>e&&(a.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=bn(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=n.filter(s=>s.fragment.sn!==i)}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 ks(r){var e,t,n;return r.buffered&&(r.body.gap||((e=r.range.video)==null?void 0:e.partial)||((t=r.range.audio)==null?void 0:t.partial)||((n=r.range.audiovideo)==null?void 0:n.partial))}function bn(r){return`${r.type}_${r.level}_${r.sn}`}const VI={length:0,start:()=>0,end:()=>0};class Ke{static isBuffered(e,t){try{if(e){const n=Ke.getBuffered(e);for(let i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,n){try{if(e){const i=Ke.getBuffered(e),s=[];let o;for(o=0;o<i.length;o++)s.push({start:i.start(o),end:i.end(o)});return this.bufferedInfo(s,t,n)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.sort(function(A,c){const u=A.start-c.start;return u||c.end-A.end});let i=[];if(n)for(let A=0;A<e.length;A++){const c=i.length;if(c){const u=i[c-1].end;e[A].start-u<n?e[A].end>u&&(i[c-1].end=e[A].end):i.push(e[A])}else i.push(e[A])}else i=e;let s=0,o,a=t,l=t;for(let A=0;A<i.length;A++){const c=i[A].start,u=i[A].end;if(t+n>=c&&t<u)a=c,l=u,s=l-t;else if(t+n<c){o=c;break}}return{len:s,start:a||0,end:l||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return U.log("failed to get media.buffered",t),VI}}}class Oa{constructor(e,t,n,i=0,s=-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=Ns(),this.buffering={audio:Ns(),video:Ns(),audiovideo:Ns()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function Ns(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Ms(r,e){for(let n=0,i=r.length;n<i;n++){var t;if(((t=r[n])==null?void 0:t.cc)===e)return r[n]}return null}function KI(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function JI(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=Ms(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function oh(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function ah(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)oh(t[n],r);e.fragmentHint&&oh(e.fragmentHint,r),e.alignedSliding=!0}function WI(r,e,t){e&&(qI(r,t,e),!t.alignedSliding&&e&&Ps(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&ju(e,t))}function qI(r,e,t){if(KI(r,t,e)){const n=JI(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),ah(n.start,e))}}function Ps(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const o=Math.min(e.endCC,r.endCC);e.startCC<o&&r.startCC<o&&(i=Ms(n,o),s=Ms(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=Ms(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=s.programDateTime;if(!a||!l)return;const A=(l-a)/1e3-(s.start-i.start);ah(A,r)}const lh=Math.pow(2,17);class jI{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 n=e.url;if(!n)return Promise.reject(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){l(ch(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=Ah(e),u=th(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:lh};e.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A);let y=d.data;g.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,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ht({url:n,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))},onProgress:(d,f,g,p)=>{t&&t({frag:e,part:null,payload:g,networkDetails:p})}})})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(ch(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=Ah(e,t),u=th(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:lh};t.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};n(y),a(y)},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ht({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),A=Math.min(Math.round(n.loaded/s),l),u=(l-A)*Math.round(n.loaded/A);n.total=n.loaded+u}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.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 Ah(r,e=null){const t=e||r,n={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(he(i)&&he(s)){var o;let a=i,l=s;if(r.sn==="initSegment"&&((o=r.decryptdata)==null?void 0:o.method)==="AES-128"){const A=s-i;A%16&&(l=s+(16-A%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function ch(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),n={type:Be.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(n.part=e),(e||r).stats.aborted=!0,new Qr(n)}class Qr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class XI{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 zI{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 ZI(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?en(r,0,e-t):r}class eC{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],o=n[2],a=n[3],l=this.invSubMix,A=l[0],c=l[1],u=l[2],h=l[3],d=new Uint32Array(256);let f=0,g=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=g^g<<1^g<<2^g<<3^g<<4;y=y>>>8^y&255^99,e[f]=y,t[y]=f;const Q=d[f],b=d[Q],v=d[b];let w=d[y]*257^y*16843008;i[f]=w<<24|w>>>8,s[f]=w<<16|w>>>16,o[f]=w<<8|w>>>24,a[f]=w,w=v*16843009^b*65537^Q*257^f*16843008,A[y]=w<<24|w>>>8,c[y]=w<<16|w>>>16,u[y]=w<<8|w>>>24,h[y]=w,f?(f=Q^d[d[d[v^Q]]],g^=d[d[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const o=this.ksRows=(s+6+1)*4;let a,l;const A=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],g=d[1],p=d[2],y=d[3];let Q,b;for(a=0;a<o;a++){if(a<s){Q=A[a]=t[a];continue}b=Q,a%s===0?(b=b<<8|b>>>24,b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255],b^=h[a/s|0]<<24):s>6&&a%s===4&&(b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255]),A[a]=Q=(A[a-s]^b)>>>0}for(l=0;l<o;l++)a=o-l,l&3?b=A[a]:b=A[a-4],l<4||a<=4?c[l]=b:c[l]=f[u[b>>>24]]^g[u[b>>>16&255]]^p[u[b>>>8&255]]^y[u[b&255]],c[l]=c[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],A=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],f=h[1],g=h[2],p=h[3];const y=new Int32Array(e),Q=new Int32Array(y.length);let b,v,w,R,k,H,V,O,W,ie,te,le,D,P;const j=this.networkToHostOrderSwap;for(;t<y.length;){for(W=j(y[t]),ie=j(y[t+1]),te=j(y[t+2]),le=j(y[t+3]),k=W^s[0],H=le^s[1],V=te^s[2],O=ie^s[3],D=4,P=1;P<i;P++)b=l[k>>>24]^A[H>>16&255]^c[V>>8&255]^u[O&255]^s[D],v=l[H>>>24]^A[V>>16&255]^c[O>>8&255]^u[k&255]^s[D+1],w=l[V>>>24]^A[O>>16&255]^c[k>>8&255]^u[H&255]^s[D+2],R=l[O>>>24]^A[k>>16&255]^c[H>>8&255]^u[V&255]^s[D+3],k=b,H=v,V=w,O=R,D=D+4;b=o[k>>>24]<<24^o[H>>16&255]<<16^o[V>>8&255]<<8^o[O&255]^s[D],v=o[H>>>24]<<24^o[V>>16&255]<<16^o[O>>8&255]<<8^o[k&255]^s[D+1],w=o[V>>>24]<<24^o[O>>16&255]<<16^o[k>>8&255]<<8^o[H&255]^s[D+2],R=o[O>>>24]<<24^o[k>>16&255]<<16^o[H>>8&255]<<8^o[V&255]^s[D+3],Q[t]=j(b^d),Q[t+1]=j(R^f),Q[t+2]=j(w^g),Q[t+3]=j(v^p),d=W,f=ie,g=te,p=le,t=t+4}return Q.buffer}}const tC=16;class Ua{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 n=self.crypto;n&&(this.subtle=n.subtle||n.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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?ZI(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n){return this.useSoftware?new Promise((i,s)=>{this.softwareDecrypt(new Uint8Array(e),t,n);const o=this.flush();o?i(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n)}softwareDecrypt(e,t,n){const{currentIV:i,currentResult:s,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=$t(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;i&&(n=i);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new eC),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=en(a,-16).buffer,A||null}webCryptoDecrypt(e,t,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n));this.key=t,this.fastAesKey=new zI(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new XI(this.subtle,new Uint8Array(n)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(U.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n)))}onWebCryptoError(e,t,n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%tC;return n!==e.length&&(t=en(e,0,n),this.remainderData=en(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const rC={toString:function(r){let e="";const t=r.length;for(let n=0;n<t;n++)e+=`[${r.start(n).toFixed(3)}-${r.end(n).toFixed(3)}]`;return e}},re={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 Ga extends $I{constructor(e,t,n,i,s){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=re.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=s,this.logPrefix=i,this.log=U.log.bind(U,`${i}:`),this.warn=U.warn.bind(U,`${i}:`),this.hls=e,this.fragmentLoader=new jI(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ua(e.config),e.on(I.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=re.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const n=t.partList;if(n!=null&&n.length){const s=n[n.length-1];return Ke.isBuffered(this.media,s.start+s.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===re.STOPPED&&this.startLoad(i.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:n,mediaBuffer:i,state:s}=this,o=n?n.currentTime:0,a=Ke.bufferInfo(i||n,o,e.maxBufferHole);if(this.log(`media seeking to ${he(o)?o.toFixed(3):o}, state: ${s}`),this.state===re.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,A=t.start-l,c=t.start+t.duration+l;if(!a.len||c<a.start||A>a.end){const u=o>c;(o<A||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}n&&(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(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=re.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,n){this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${s.part?" p: "+s.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const o=this.state;if(this.fragContextChanged(e)){(o===re.FRAG_LOADING||!this.fragCurrent&&o===re.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=re.IDLE);return}"payload"in s&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(I.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===dt.APPENDING){const s=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,s),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===dt.PARTIAL&&n.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,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(I.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{if(!n||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{payload:s}=n,o=e.decryptdata;if(s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer).catch(l=>{throw i.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const A=self.performance.now();return i.trigger(I.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:a,tdecrypt:A}}),n.payload=l,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state=re.IDLE,e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.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 n,i,s,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===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((n=e.startPTS)!=null?n:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${a?rC.toString(Ke.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==Ee.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=re.IDLE;return}}const A=(l=this.levels)==null?void 0:l[e.level];A!=null&&A.fragmentError&&(this.log(`Resetting level fragment error count of ${A.fragmentError} on frag buffered`),A.fragmentError=0)}this.state=re.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((s=this.fragCurrent)==null?void 0:s.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:n,part:i,partsLoaded:s}=e,o=!s||s.length===0||s.some(l=>!l),a=new Oa(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;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&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=re.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(I.KEY_LOADED,c),this.state===re.KEY_LOADING&&(this.state=re.IDLE),c}),this.hls.trigger(I.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),n=Math.max(e.start,n||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&i){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);const u=this.getNextPart(c,e,n);if(u>-1){const h=c[u];this.log(`Loading part sn: ${e.sn} p: ${h.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${u}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=re.FRAG_LOADING;let d;return a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,h,t,i)).catch(f=>this.handleFragLoadError(f)):d=this.doFragPartsLoad(e,h,t,i).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(I.FRAG_LOADING,{frag:e,part:h,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,n))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(n.toFixed(3))}`),he(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=re.FRAG_LOADING;const l=this.config.progressive;let A;return l&&a?A=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,i)).catch(c=>this.handleFragLoadError(c)):A=Promise.all([this.fragmentLoader.load(e,l?i:void 0),a]).then(([c])=>(!l&&c&&i&&i(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(I.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):A}doFragPartsLoad(e,t,n,i){return new Promise((s,o)=>{var a;const l=[],A=(a=n.details)==null?void 0:a.partList,c=u=>{this.fragmentLoader.loadPart(e,u,i).then(h=>{l[u.index]=h;const d=h.part;this.hls.trigger(I.FRAG_LOADED,h);const f=Xu(n,e.sn,u.index+1)||zu(A,e.sn,u.index+1);if(f)c(f);else return s({frag:e,part:d,partsLoaded:l})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(I.ERROR,t)}else this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==re.PARSING){!this.fragCurrent&&this.state!==re.STOPPED&&this.state!==re.ERROR&&(this.state=re.IDLE);return}const{frag:n,part:i,level:s}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o),this.updateLevelTiming(n,i,s,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of level ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=o>-1?Xu(a,s,o):null,A=l?l.fragment:TI(a,s,n);return A?(n&&n!==A&&(A.stats=n.stats),{frag:A,part:l,level:a}):null}bufferFragmentData(e,t,n,i,s){var o;if(!e||this.state!==re.PARSING)return;const{data1:a,data2:l}=e;let A=a;if(a&&l&&(A=$t(a,l)),!((o=A)!=null&&o.length))return;const c={type:e.type,frag:t,part:n,chunkMeta:i,parent:t.type,data:A};if(this.hls.trigger(I.BUFFER_APPENDING,c),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ke.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Ke.bufferInfo(t,n,0),s=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const n=this.getLoadPosition();return he(n)?this.getFwdBufferInfoAtPos(e,n,t):null}getFwdBufferInfoAtPos(e,t,n){const{config:{maxBufferHole:i}}=this,s=Ke.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&s.nextStart<o.end)return Ke.bufferInfo(e,t,Math.max(s.nextStart,i))}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,n=e||t.maxBufferLength,i=t.maxMaxBufferLength/2;return i>=n?(t.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const n=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,o=n[0].start;let a;if(t.live){const l=s.initialLiveManifestSize;if(i<l)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,n),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=n[0]);if(!a){const l=s.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===dt.OK||n===dt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&n.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i);if(l!==null&&n.len+l.len>=s)return this.log(`buffer full after gaps in "${i}" 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,n){let i=-1,s=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const A=e[a];if(o=o&&!A.independent,i>-1&&n<A.start)break;const c=A.loaded;c?i=-1:(s||A.independent||o)&&A.fragment===t&&(i=a),s=c}return i}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e,t){const n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=bI(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const o=t[s-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=SI(t,n.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:A}=i,c=n.partList,u=!!(i.lowLatencyMode&&c!=null&&c.length&&l);u&&l&&!this.bitrateTest&&(o=o.concat(l),a=l.sn);let h;if(e<t){const d=e>t-A?0:A;h=Fs(s,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-n.startSN,f=this.fragmentTracker.getState(h);if((f===dt.OK||f===dt.PARTIAL&&h.gap)&&(s=h),s&&h.sn===s.sn&&(!u||c[0].fragment.sn>h.sn)&&s&&h.level===s.level){const p=o[d+1];h.sn<a&&this.fragmentTracker.getState(p)!==dt.OK?h=p:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=n.currentTime,o=e.fragments[0].start,a=e.edge,l=s>=o-t.maxFragLookUpTolerance&&s<=a;if(i!==null&&n.duration>i&&(s<i||!l)){const A=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&n.readyState<4||s<a-A)&&(this.loadedmetadata||(this.nextLoadPosition=i),n.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),n.currentTime=i))}}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragments[0].start,o=!t,a=e.alignedSliding&&he(s);if(o||!a&&!s){const{fragPrevious:l}=this;WI(l,n,e);const A=e.fragments[0].start;return this.log(`Live playlist sliding: ${A.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),A}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;if(n<t&&(n=-1),n===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&he(s)?(n=t+s,s<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Start time offset ${s} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${n}`),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n}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!==re.FRAG_LOADING_WAITING_RETRY)&&(this.state=re.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var i;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const s=t.details===K.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction,{action:a,retryCount:l=0,retryConfig:A}=o||{};if(o&&a===Bt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Na(A,l);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${l+1}/${A.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=re.FRAG_LOADING_WAITING_RETRY}else if(A&&o)if(this.resetFragmentErrors(e),l<A.maxNumRetry)!s&&a!==Bt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===Bt.SendAlternateToPenaltyBox?this.state=re.WAITING_LEVEL:this.state=re.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===re.PARSING||this.state===re.PARSED){const t=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,t),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len);const s=!i;return s&&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(),s}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==re.STOPPED&&(this.state=re.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Ke.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===re.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=re.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,n,i){var s;const o=n.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,A)=>{const c=e.elementaryStreams[A];if(c){const u=c.endPTS-c.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${A} duration reliably (${u})`),l||!1;const h=i?0:qu(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:o,level:n,drift:h,type:A,frag:e,start:c.startPTS,end:c.endPTS}),!0}return l},!1)&&((s=this.transmuxer)==null?void 0:s.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(n.fragmentError===0&&(n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=re.PARSED,this.hls.trigger(I.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 uh{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=nC(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function nC(r,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++){const s=r[i];t.set(s,n),n+=s.length}return t}function iC(){return typeof __HLS_WORKER_BUNDLE__=="function"}function sC(){const r=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(r);return{worker:new self.Worker(e),objectURL:e}}function oC(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function ur(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Ha{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,n,i){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,n){}demux(e,t){this.cachedData&&(e=$t(this.cachedData,e),this.cachedData=null);let n=gi(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?ya(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=aC(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY});i<A;){if(this.canParse(e,i)){const c=this.appendFrame(o,e,i);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i+=c.length,s=i):i=A}else SE(e,i)?(n=gi(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=en(e,s);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:ur(),id3Track:a,textTrack:ur()}}demuxSampleAes(e,t,n){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:ur(),id3Track:this._id3Track,textTrack:ur()}}destroy(){}}const aC=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function lC(r,e,t,n){let i,s,o,a;const l=navigator.userAgent.toLowerCase(),A=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>c.length-1){const h=new Error(`invalid ADTS sampling index:${u}`);r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,U.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,a=new Array(4),s=u-3):(i=2,a=new Array(2),s=u):l.indexOf("android")!==-1?(i=2,a=new Array(2),s=u):(i=5,a=new Array(4),n&&(n.indexOf("mp4a.40.29")!==-1||n.indexOf("mp4a.40.5")!==-1)||!n&&u>=6?s=u-3:((n&&n.indexOf("mp4a.40.2")!==-1&&(u>=6&&o===1||/vivaldi/i.test(l))||!n&&o===1)&&(i=2,a=new Array(2)),s=u)),a[0]=i<<3,a[0]|=(u&14)>>1,a[1]|=(u&1)<<7,a[1]|=o<<3,i===5&&(a[1]|=(s&14)>>1,a[2]=(s&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[u],channelCount:o,codec:"mp4a.40."+i,manifestCodec:A}}function hh(r,e){return r[e]===255&&(r[e+1]&246)===240}function dh(r,e){return r[e+1]&1?7:9}function $a(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function AC(r,e){return e+5<r.length}function Os(r,e){return e+1<r.length&&hh(r,e)}function cC(r,e){return AC(r,e)&&hh(r,e)&&$a(r,e)<=r.length-e}function uC(r,e){if(Os(r,e)){const t=dh(r,e);if(e+t>=r.length)return!1;const n=$a(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Os(r,i)}return!1}function fh(r,e,t,n,i){if(!r.samplerate){const s=lC(e,t,n,i);if(!s)return;r.config=s.config,r.samplerate=s.samplerate,r.channelCount=s.channelCount,r.codec=s.codec,r.manifestCodec=s.manifestCodec,U.log(`parsed codec:${r.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function gh(r){return 9216e4/r}function hC(r,e){const t=dh(r,e);if(e+t<=r.length){const n=$a(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function ph(r,e,t,n,i){const s=gh(r.samplerate),o=n+i*s,a=hC(e,t);let l;if(a){const{frameLength:u,headerLength:h}=a,d=h+u,f=Math.max(0,t+d-e.length);f?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const g={unit:l,pts:o};return f||r.samples.push(g),{sample:g,length:d,missing:f}}const A=e.length-t;return l=new Uint8Array(A),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:A,missing:-1}}let Us=null;const dC=[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],fC=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],gC=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],pC=[0,1,1,4];function mh(r,e,t,n,i){if(t+24>e.length)return;const s=Eh(e,t);if(s&&t+s.frameLength<=e.length){const o=s.samplesPerFrame*9e4/s.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+s.frameLength),pts:a,dts:a};return r.config=[],r.channelCount=s.channelCount,r.samplerate=s.sampleRate,r.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function Eh(r,e){const t=r[e+1]>>3&3,n=r[e+1]>>1&3,i=r[e+2]>>4&15,s=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const o=r[e+2]>>1&1,a=r[e+3]>>6,l=t===3?3-n:n===3?3:4,A=dC[l*14+i-1]*1e3,u=fC[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=gC[t][n],f=pC[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Us===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Us=b?parseInt(b[1]):0}return!!Us&&Us<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function Ya(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Ih(r,e){return e+1<r.length&&Ya(r,e)}function mC(r,e){return Ya(r,e)&&4<=r.length-e}function Ch(r,e){if(e+1<r.length&&Ya(r,e)){const n=Eh(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Ih(r,s)}return!1}class EC extends Ha{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=gi(e,0);let n=(t==null?void 0:t.length)||0;if(Ch(e,n))return!1;for(let i=e.length;n<i;n++)if(uC(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return cC(e,t)}appendFrame(e,t,n){fh(e,this.observer,t,n,e.manifestCodec);const i=ph(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const IC=/\/emsg[-/]ID3/i;class CC{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,n,i){const s=this.videoTrack=ur("video",1),o=this.audioTrack=ur("audio",1),a=this.txtTrack=ur("text",1);if(this.id3Track=ur("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=yu(e);if(l.video){const{id:A,timescale:c,codec:u}=l.video;s.id=A,s.timescale=a.timescale=c,s.codec=u}if(l.audio){const{id:A,timescale:c,codec:u}=l.audio;o.id=A,o.timescale=c,o.codec=u}a.id=Eu.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return PE(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=$t(this.remainderData,e));const a=KE(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Tu(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Tu(e,t),{videoTrack:t,audioTrack:ur(),id3Track:i,textTrack:ur()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=qE(s);if(IC.test(o.schemeIdUri)){const a=he(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const A=o.payload;n.samples.push({data:A,len:A.byteLength,dts:a,pts:a,type:zt.emsg,duration:l})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const vh=(r,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=r[e];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,i[0]=(o[0]&s[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class vC extends Ha{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=yh(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=gi(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&ya(t)!==void 0&&vh(e,n)<16}}function yh(r,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],l=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][l*3+s]*2;if(t+c>e.length)return-1;const u=e[t+6]>>5;let h=0;u===2?h+=2:(u&1&&u!==1&&(h+=2),u&4&&(h+=2));const d=(e[t+6]<<8|e[t+7])>>12-h&1,g=[2,1,2,3,3,4,4,5][u]+d,p=e[t+5]>>3,y=e[t+5]&7,Q=new Uint8Array([s<<6|p<<1|y>>2,(y&3)<<6|u<<3|d<<2|l>>4,l<<4&224]),b=1536/a*9e4,v=n+i*b,w=e.subarray(t,t+c);return r.config=Q,r.channelCount=g,r.samplerate=a,r.samples.push({unit:w,pts:v}),c}class yC{constructor(){this.VideoSample=null}createVideoSample(e,t,n,i){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&U.log(e.pts+"/"+e.dts+":"+e.debug)}}class Bh{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,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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 n=this.word>>>32-t;if(e>32&&U.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?n<<t|this.readBits(t):n}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,n=8,i;for(let s=0;s<e;s++)n!==0&&(i=this.readEG(),n=(t+i+256)%256),t=n===0?t:n}readSPS(){let e=0,t=0,n=0,i=0,s,o,a;const l=this.readUByte.bind(this),A=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);l();const p=l();if(A(5),h(3),l(),f(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const R=c();if(R===3&&h(1),f(),f(),h(1),u())for(o=R!==3?8:12,a=0;a<o;a++)u()&&(a<6?g(16):g(64))}f();const y=c();if(y===0)c();else if(y===1)for(h(1),d(),d(),s=c(),a=0;a<s;a++)d();f(),h(1);const Q=c(),b=c(),v=A(1);v===0&&h(1),h(1),u()&&(e=c(),t=c(),n=c(),i=c());let w=[1,1];if(u()&&u())switch(l()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((Q+1)*16-e*2-t*2),height:(2-v)*(b+1)*16-(v?2:4)*(n+i),pixelRatio:w}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class BC extends yC{parseAVCPES(e,t,n,i,s){const o=this.parseAVCNALu(e,n.data);let a=this.VideoSample,l,A=!1;n.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"")),o.forEach(c=>{var u;switch(c.type){case 1:{let g=!1;l=!0;const p=c.data;if(A&&p.length>4){const y=new Bh(p).readSliceType();(y===2||y===4||y===7||y===9)&&(g=!0)}if(g){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.frame=!0,a.key=g;break}case 5:l=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.key=!0,a.frame=!0;break;case 6:{l=!0,Qu(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,y=new Bh(g).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||((d=e.pixelRatio)==null?void 0:d[0])!==y.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[g],e.duration=s;const Q=g.subarray(1,4);let b="avc1.";for(let v=0;v<3;v++){let w=Q[v].toString(16);w.length<2&&(w="0"+w),b+=w}e.codec=b}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"");break;case 12:l=!0;break;default:l=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&l&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const n=t.byteLength;let i=e.naluState||0;const s=i,o=[];let a=0,l,A,c,u=-1,h=0;for(i===-1&&(u=0,h=t[0]&31,i=0,a=1);a<n;){if(l=t[a++],!i){i=l?0:1;continue}if(i===1){i=l?0:2;continue}if(!l)i=3;else if(l===1){if(A=a-i-1,u>=0){const d={data:t.subarray(u,A),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(s&&a<=4-s&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-s)),A>0&&(d.data=$t(d.data,t.subarray(0,A)),d.state=0))}a<n?(c=t[a]&31,u=a,h=c,i=0):i=-1}else i=0}if(u>=0&&i>=0){const d={data:t.subarray(u,n),type:h,state:i};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=$t(d.data,t))}return e.naluState=i,o}}class TC{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Ua(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const o=bu(s.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const o=s[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}const ft=188;class Pr{constructor(e,t,n){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=n,this.videoParser=new BC}static probe(e){const t=Pr.syncOffset(e);return t>0&&U.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let n=Math.min(ft*5,t-ft)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=ft)if(e[l]===71&&(t-l===ft||e[l+ft]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+ft*99,e.length-ft)+1)),s||(s=Va(e,l)===0),s&&a>1&&(o===0&&a>2||l+ft>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Eu[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Pr.createTrack("video"),this._audioTrack=Pr.createTrack("audio",i),this._id3Track=Pr.createTrack("id3"),this._txtTrack=Pr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,A=this._txtTrack;let c=o.pid,u=o.pesData,h=a.pid,d=l.pid,f=a.pesData,g=l.pesData,p=null,y=this.pmtParsed,Q=this._pmtId,b=e.length;if(this.remainderData&&(e=$t(this.remainderData,e),b=e.length,this.remainderData=null),b<ft&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const v=Math.max(0,Pr.syncOffset(e));b-=(b-v)%ft,b<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let w=0;for(let k=v;k<b;k+=ft)if(e[k]===71){const H=!!(e[k+1]&64),V=Va(e,k),O=(e[k+3]&48)>>4;let W;if(O>1){if(W=k+5+e[k+4],W===k+ft)continue}else W=k+4;switch(V){case c:H&&(u&&(s=xn(u))&&this.videoParser.parseAVCPES(o,A,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(W,k+ft)),u.size+=k+ft-W);break;case h:if(H){if(f&&(s=xn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(W,k+ft)),f.size+=k+ft-W);break;case d:H&&(g&&(s=xn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(W,k+ft)),g.size+=k+ft-W);break;case 0:H&&(W+=e[W]+1),Q=this._pmtId=QC(e,W);break;case Q:{H&&(W+=e[W]+1);const ie=bC(e,W,this.typeSupported,n,this.observer);c=ie.videoPid,c>0&&(o.pid=c,o.segmentCodec=ie.segmentVideoCodec),h=ie.audioPid,h>0&&(a.pid=h,a.segmentCodec=ie.segmentAudioCodec),d=ie.id3Pid,d>0&&(l.pid=d),p!==null&&!y&&(U.warn(`MPEG-TS PMT found at ${k} after unknown PID '${p}'. Backtracking to sync byte @${v} to parse all TS packets.`),p=null,k=v-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=V;break}}else w++;w>0&&Gs(this.observer,new Error(`Found ${w} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=f,l.pesData=g;const R={audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};return i&&this.extractRemainingSamples(R),R}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:s}=e,o=n.pesData,a=t.pesData,l=i.pesData;let A;if(o&&(A=xn(o))?(this.videoParser.parseAVCPES(n,s,A,!0,this._duration),n.pesData=null):n.pesData=o,a&&(A=xn(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,A);break;case"mp3":this.parseMPEGPES(t,A);break;case"ac3":this.parseAC3PES(t,A);break}t.pesData=null}else a!=null&&a.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(A=xn(l))?(this.parseID3PES(i,A),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new TC(this.observer,this.config,t);return this.decrypt(i,s)}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const u=i.missing,h=i.sample.unit.byteLength;if(u===-1)s=$t(i.sample.unit,s);else{const d=h-u;i.sample.unit.set(s.subarray(0,u),d),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=s.length;o<a-1&&!Os(s,o);o++);if(o!==n){let u;const h=o<a-1;if(h?u=`AAC PES did not start with ADTS header,offset:${o}`:u="No ADTS header found in AAC PES",Gs(this.observer,new Error(u),h),!h)return}fh(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=gh(e.samplerate);l=i.sample.pts+u}else{U.warn("[tsdemuxer]: AAC PES unknown PTS");return}let A=0,c;for(;o<a;)if(c=ph(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Os(s,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,o=0;const a=t.pts;if(a===void 0){U.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<i;)if(Ih(n,o)){const l=mh(e,n,o,a,s);if(l)o+=l.length,s++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){U.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let o=0,a=0,l;for(;a<s&&(l=yh(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){U.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=it({},t,{type:this._videoTrack?zt.emsg:zt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Va(r,e){return((r[e+1]&31)<<8)+r[e+2]}function QC(r,e){return(r[e+10]&31)<<8|r[e+11]}function bC(r,e,t,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],a=e+3+o-4,l=(r[e+10]&15)<<8|r[e+11];for(e+=12+l;e<a;){const A=Va(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){Ka("ADTS AAC");break}case 15:s.audioPid===-1&&(s.audioPid=A);break;case 21:s.id3Pid===-1&&(s.id3Pid=A);break;case 219:if(!n){Ka("H.264");break}case 27:s.videoPid===-1&&(s.videoPid=A,s.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?U.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="mp3");break;case 193:if(!n){Ka("AC-3");break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="ac3"):U.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&c>0){let u=e+5,h=c;for(;h>2;){switch(r[u]){case 106:t.ac3!==!0?U.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=A,s.segmentAudioCodec="ac3");break}const f=r[u+1]+2;u+=f,h-=f}}break;case 194:case 135:return Gs(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Gs(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function Gs(r,e,t){U.warn(`parsing error: ${e.message}`),r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Ka(r){U.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function xn(r){let e=0,t,n,i,s,o;const a=r.data;if(!r||r.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=$t(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(n=(t[4]<<8)+t[5],n&&n>r.size-6)return null;const A=t[7];A&192&&(s=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,A&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,s-o>54e5&&(U.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),i=t[8];let c=i+9;if(r.size<=c)return null;r.size-=c;const u=new Uint8Array(r.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let f=t.byteLength;if(c)if(c>f){c-=f;continue}else t=t.subarray(c),f-=c,c=0;u.set(t,e),e+=f}return n&&(n-=i+3),{data:u,pts:s,dts:o,len:n}}return null}class xC extends Ha{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=gi(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&ya(t)!==void 0&&vh(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Ch(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return mC(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return mh(e,t,n,this.basePTS,this.frameIndex)}}class Th{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 Or=Math.pow(2,32)-1;class G{static init(){G.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 G.types)G.types.hasOwnProperty(e)&&(G.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]),n=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]);G.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);G.STTS=G.STSC=G.STCO=s,G.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),G.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),G.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),G.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]),l=new Uint8Array([0,0,0,1]);G.FTYP=G.box(G.types.ftyp,o,l,o,a),G.DINF=G.box(G.types.dinf,G.box(G.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<s;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return G.box(G.types.hdlr,G.HDLR_TYPES[e])}static mdat(e){return G.box(G.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Or+1)),i=Math.floor(t%(Or+1));return G.box(G.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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return G.box(G.types.mdia,G.mdhd(e.timescale,e.duration),G.hdlr(e.type),G.minf(e))}static mfhd(e){return G.box(G.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"?G.box(G.types.minf,G.box(G.types.smhd,G.SMHD),G.DINF,G.stbl(e)):G.box(G.types.minf,G.box(G.types.vmhd,G.VMHD),G.DINF,G.stbl(e))}static moof(e,t,n){return G.box(G.types.moof,G.mfhd(e),G.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trak(e[t]);return G.box.apply(null,[G.types.moov,G.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(G.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trex(e[t]);return G.box.apply(null,[G.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Or+1)),i=Math.floor(t%(Or+1)),s=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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&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 G.box(G.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return G.box(G.types.sdtp,n)}static stbl(e){return G.box(G.types.stbl,G.stsd(e),G.box(G.types.stts,G.STTS),G.box(G.types.stsc,G.STSC),G.box(G.types.stsz,G.STSZ),G.box(G.types.stco,G.STCO))}static avc1(e){let t=[],n=[],i,s,o;for(i=0;i<e.sps.length;i++)s=e.sps[i],o=s.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],o=s.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(s));const a=G.box(G.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,A=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return G.box(G.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,A>>8&255,A&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,G.box(G.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),G.box(G.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,u>>24,u>>16&255,u>>8&255,u&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 G.box(G.types.mp4a,G.audioStsd(e),G.box(G.types.esds,G.esds(e)))}static mp3(e){return G.box(G.types[".mp3"],G.audioStsd(e))}static ac3(e){return G.box(G.types["ac-3"],G.audioStsd(e),G.box(G.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?G.box(G.types.stsd,G.STSD,G.mp3(e)):e.segmentCodec==="ac3"?G.box(G.types.stsd,G.STSD,G.ac3(e)):G.box(G.types.stsd,G.STSD,G.mp4a(e)):G.box(G.types.stsd,G.STSD,G.avc1(e))}static tkhd(e){const t=e.id,n=e.duration*e.timescale,i=e.width,s=e.height,o=Math.floor(n/(Or+1)),a=Math.floor(n%(Or+1));return G.box(G.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,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=G.sdtp(e),i=e.id,s=Math.floor(t/(Or+1)),o=Math.floor(t%(Or+1));return G.box(G.types.traf,G.box(G.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),G.box(G.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),G.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,G.box(G.types.trak,G.tkhd(e),G.mdia(e))}static trex(e){const t=e.id;return G.box(G.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 n=e.samples||[],i=n.length,s=12+16*i,o=new Uint8Array(s);let a,l,A,c,u,h;for(t+=8+s,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],A=l.duration,c=l.size,u=l.flags,h=l.cts,o.set([A>>>24&255,A>>>16&255,A>>>8&255,A&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*a);return G.box(G.types.trun,o)}static initSegment(e){G.types||G.init();const t=G.moov(e);return $t(G.FTYP,t)}}G.types=void 0,G.HDLR_TYPES=void 0,G.STTS=void 0,G.STSC=void 0,G.STCO=void 0,G.STSZ=void 0,G.VMHD=void 0,G.SMHD=void 0,G.STSD=void 0,G.FTYP=void 0,G.DINF=void 0;const Qh=9e4;function Ja(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function wC(r,e,t=1,n=!1){return Ja(r,e,1/t,n)}function Ei(r,e=!1){return Ja(r,1e3,1/Qh,e)}function SC(r,e=1){return Ja(r,Qh,1/e)}const RC=10*1e3,bh=1024,DC=1152,_C=1536;let wn=null,Wa=null;class Hs{constructor(e,t,n,i=""){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=n,this.ISGenerated=!1,wn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wn=o?parseInt(o[1]):0}if(Wa===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Wa=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e.reduce((i,s)=>{const o=s.pts-i;return o<-4294967296?(t=!0,Yt(i,s.pts)):o>0?i:s.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),n}remux(e,t,n,i,s,o,a,l){let A,c,u,h,d,f,g=s,p=s;const y=e.pid>-1,Q=t.pid>-1,b=t.samples.length,v=e.samples.length>0,w=a&&b>0||b>1;if((!y||v)&&(!Q||w)||this.ISGenerated||a){if(this.ISGenerated){var k,H,V,O;const le=this.videoTrackConfig;le&&(t.width!==le.width||t.height!==le.height||((k=t.pixelRatio)==null?void 0:k[0])!==((H=le.pixelRatio)==null?void 0:H[0])||((V=t.pixelRatio)==null?void 0:V[1])!==((O=le.pixelRatio)==null?void 0:O[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,s,o);const W=this.isVideoContiguous;let ie=-1,te;if(w&&(ie=LC(t.samples),!W&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,ie>0){U.warn(`[mp4-remuxer]: Dropped ${ie} out of ${b} video samples due to a missing keyframe`);const le=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ie),t.dropped+=ie,p+=(t.samples[0].pts-le)/t.inputTimeScale,te=p}else ie===-1&&(U.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),f=!1);if(this.ISGenerated){if(v&&w){const le=this.getVideoStartPts(t.samples),P=(Yt(e.samples[0].pts,le)-le)/t.inputTimeScale;g+=Math.max(0,P),p+=Math.max(0,-P)}if(v){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,s,o)),c=this.remuxAudio(e,g,this.isAudioContiguous,o,Q||w||l===Ee.AUDIO?p:void 0),w){const le=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,s,o)),A=this.remuxVideo(t,p,W,le)}}else w&&(A=this.remuxVideo(t,p,W,0));A&&(A.firstKeyFrame=ie,A.independent=ie!==-1,A.firstKeyFramePTS=te)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=xh(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=wh(i,s,this._initPTS))),{audio:c,video:A,initSegment:u,independent:f,text:h,id3:d}}generateIS(e,t,n,i){const s=e.samples,o=t.samples,a=this.typeSupported,l={},A=this._initPTS;let c=!A||i,u="audio/mp4",h,d,f;if(c&&(h=d=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(u="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):G.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.inputTimeScale,!A||f!==A.timescale?h=d=s[0].pts-Math.round(f*n):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:G.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.inputTimeScale,!A||f!==A.timescale){const g=this.getVideoStartPts(o),p=Math.round(f*n);d=Math.min(d,Yt(o[0].dts,g)-p),h=Math.min(h,g-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:h,timescale:f},this._initDTS={baseTime:d,timescale:f}):h=f=void 0,{tracks:l,initPTS:h,timescale:f}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,o=e.samples,a=[],l=o.length,A=this._initPTS;let c=this.nextAvcDts,u=8,h=this.videoSampleDuration,d,f,g=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!n||c===null){const S=t*s,F=o[0].pts-Yt(o[0].dts,o[0].pts);wn&&c!==null&&Math.abs(S-F-c)<15e3?n=!0:c=S-F}const Q=A.baseTime*s/A.timescale;for(let S=0;S<l;S++){const F=o[S];F.pts=Yt(F.pts-Q,c),F.dts=Yt(F.dts-Q,c),F.dts<o[S>0?S-1:S].dts&&(y=!0)}y&&o.sort(function(S,F){const J=S.dts-F.dts,Y=S.pts-F.pts;return J||Y}),d=o[0].dts,f=o[o.length-1].dts;const b=f-d,v=b?Math.round(b/(l-1)):h||e.inputTimeScale/30;if(n){const S=d-c,F=S>v,J=S<-1;if((F||J)&&(F?U.warn(`AVC: ${Ei(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${Ei(-S,!0)} ms (${S}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!J||c>=o[0].pts||wn)){d=c;const Y=o[0].pts-S;if(F)o[0].dts=d,o[0].pts=Y;else for(let ne=0;ne<o.length&&!(o[ne].dts>Y);ne++)o[ne].dts-=S,o[ne].pts-=S;U.log(`Video: Initial PTS/DTS adjusted: ${Ei(Y,!0)}/${Ei(d,!0)}, delta: ${Ei(S,!0)} ms`)}}d=Math.max(0,d);let w=0,R=0,k=d;for(let S=0;S<l;S++){const F=o[S],J=F.units,Y=J.length;let ne=0;for(let ce=0;ce<Y;ce++)ne+=J[ce].data.length;R+=ne,w+=Y,F.length=ne,F.dts<k?(F.dts=k,k+=v/4|0||1):k=F.dts,g=Math.min(F.pts,g),p=Math.max(F.pts,p)}f=o[l-1].dts;const H=R+4*w+8;let V;try{V=new Uint8Array(H)}catch(S){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:S,bytes:H,reason:`fail allocating video mdat ${H}`});return}const O=new DataView(V.buffer);O.setUint32(0,H),V.set(G.types.mdat,4);let W=!1,ie=Number.POSITIVE_INFINITY,te=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let S=0;S<l;S++){const F=o[S],J=F.units;let Y=0;for(let pe=0,ge=J.length;pe<ge;pe++){const Se=J[pe],Le=Se.data,Ge=Se.data.byteLength;O.setUint32(u,Ge),u+=4,V.set(Le,u),u+=Ge,Y+=4+Ge}let ne;if(S<l-1)h=o[S+1].dts-F.dts,ne=o[S+1].pts-F.pts;else{const pe=this.config,ge=S>0?F.dts-o[S-1].dts:v;if(ne=S>0?F.pts-o[S-1].pts:v,pe.stretchShortVideoTrack&&this.nextAudioPts!==null){const Se=Math.floor(pe.maxBufferHole*s),Le=(i?g+i*s:this.nextAudioPts)-F.pts;Le>Se?(h=Le-ge,h<0?h=ge:W=!0,U.log(`[mp4-remuxer]: It is approximately ${Le/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ge}else h=ge}const ce=Math.round(F.pts-F.dts);ie=Math.min(ie,h),le=Math.max(le,h),te=Math.min(te,ne),D=Math.max(D,ne),a.push(new Sh(F.key,h,Y,ce))}if(a.length){if(wn){if(wn<70){const S=a[0].flags;S.dependsOn=2,S.isNonSync=0}}else if(Wa&&D-te<le-ie&&v/le<.025&&a[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let S=d;for(let F=0,J=a.length;F<J;F++){const Y=S+a[F].duration,ne=S+a[F].cts;if(F<J-1){const ce=Y+a[F+1].cts;a[F].duration=ce-ne}else a[F].duration=F?a[F-1].duration:v;a[F].cts=0,S=Y}}}h=W||!h?v:h,this.nextAvcDts=c=f+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const _={data1:G.moof(e.sequenceNumber++,d,it({},e,{samples:a})),data2:V,startPTS:g/s,endPTS:(p+h)/s,startDTS:d/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,_}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return DC;case"ac3":return _C;default:return bh}}remuxAudio(e,t,n,i,s){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,A=this.getSamplesPerFrame(e),c=A*l,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],f=s!==void 0;let g=e.samples,p=h?0:8,y=this.nextAudioPts||-1;const Q=t*o,b=u.baseTime*o/u.timescale;if(this.isAudioContiguous=n=n||g.length&&y>0&&(i&&Math.abs(Q-y)<9e3||Math.abs(Yt(g[0].pts-b,Q)-y)<20*c),g.forEach(function(P){P.pts=Yt(P.pts-b,Q)}),!n||y<0){if(g=g.filter(P=>P.pts>=0),!g.length)return;s===0?y=0:i&&!f?y=Math.max(0,Q):y=g[0].pts}if(e.segmentCodec==="aac"){const P=this.config.maxAudioFramesDrift;for(let j=0,_=y;j<g.length;j++){const S=g[j],F=S.pts,J=F-_,Y=Math.abs(1e3*J/o);if(J<=-P*c&&f)j===0&&(U.warn(`Audio frame @ ${(F/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*J/o)} ms.`),this.nextAudioPts=y=_=F);else if(J>=P*c&&Y<RC&&f){let ne=Math.round(J/c);_=F-ne*c,_<0&&(ne--,_+=c),j===0&&(this.nextAudioPts=y=_),U.warn(`[mp4-remuxer]: Injecting ${ne} audio frame @ ${(_/o).toFixed(3)}s due to ${Math.round(1e3*J/o)} ms gap.`);for(let ce=0;ce<ne;ce++){const pe=Math.max(_,0);let ge=Th.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ge||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=S.unit.subarray()),g.splice(j,0,{unit:ge,pts:pe}),_+=c,j++}}S.pts=_,_+=c}}let v=null,w=null,R,k=0,H=g.length;for(;H--;)k+=g[H].unit.byteLength;for(let P=0,j=g.length;P<j;P++){const _=g[P],S=_.unit;let F=_.pts;if(w!==null){const Y=d[P-1];Y.duration=Math.round((F-w)/l)}else if(n&&e.segmentCodec==="aac"&&(F=y),v=F,k>0){k+=p;try{R=new Uint8Array(k)}catch(Y){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:Y,bytes:k,reason:`fail allocating audio mdat ${k}`});return}h||(new DataView(R.buffer).setUint32(0,k),R.set(G.types.mdat,4))}else return;R.set(S,p);const J=S.byteLength;p+=J,d.push(new Sh(!0,A,J,0)),w=F}const V=d.length;if(!V)return;const O=d[d.length-1];this.nextAudioPts=y=w+l*O.duration;const W=h?new Uint8Array(0):G.moof(e.sequenceNumber++,v/l,it({},e,{samples:d}));e.samples=[];const ie=v/o,te=y/o,D={data1:W,data2:R,startPTS:ie,endPTS:te,startDTS:ie,endDTS:te,type:"audio",hasAudio:!0,hasVideo:!1,nb:V};return this.isAudioContiguous=!0,D}remuxEmptyAudio(e,t,n,i){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,a=s/o,l=this.nextAudioPts,A=this._initDTS,c=A.baseTime*9e4/A.timescale,u=(l!==null?l:i.startDTS*s)+c,h=i.endDTS*s+c,d=a*bh,f=Math.ceil((h-u)/d),g=Th.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),!g){U.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<f;y++){const Q=u+y*d;p.push({unit:g,pts:Q,dts:Q})}return e.samples=p,this.remuxAudio(e,t,n,!1)}}function Yt(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function LC(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function xh(r,e,t,n){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const l=r.samples[a];l.pts=Yt(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=Yt(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function wh(r,e,t){const n=r.samples.length;if(!n)return;const i=r.inputTimeScale;for(let o=0;o<n;o++){const a=r.samples[o];a.pts=Yt(a.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((o,a)=>o.pts-a.pts);const s=r.samples;return r.samples=[],{samples:s}}class Sh{constructor(e,t,n,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class FC{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,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(GE(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=yu(e);i.audio&&(t=Rh(i.audio,He.AUDIO)),i.video&&(n=Rh(i.video,He.VIDEO));const s={};i.audio&&i.video?s.audiovideo={container:"video/mp4",codec:t+","+n,initSegment:e,id:"main"}:i.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?s.video={container:"video/mp4",codec:n,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,n,i,s,o){var a,l;let{initPTS:A,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};he(c)||(c=this.lastEndTime=s||0);const h=t.samples;if(!(h!=null&&h.length))return u;const d={initPTS:void 0,timescale:1};let f=this.initData;if((a=f)!=null&&a.length||(this.generateInitSegment(h),f=this.initData),!((l=f)!=null&&l.length))return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=$E(h,f),p=HE(f,h),y=p===null?s:p;(kC(A,y,s,g)||d.timescale!==A.timescale&&o)&&(d.initPTS=y-s,A&&A.timescale===1&&U.warn(`Adjusting initPTS by ${d.initPTS-A.baseTime}`),this.initPTS=A={baseTime:d.initPTS,timescale:1});const Q=e?y-A.baseTime/A.timescale:c,b=Q+g;VE(f,h,A.baseTime/A.timescale),g>0?this.lastEndTime=b:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const v=!!f.audio,w=!!f.video;let R="";v&&(R+="audio"),w&&(R+="video");const k={data1:h,startPTS:Q,startDTS:Q,endPTS:b,endDTS:b,type:R,hasAudio:v,hasVideo:w,nb:1,dropped:0};return u.audio=k.type==="audio"?k:void 0,u.video=k.type!=="audio"?k:void 0,u.initSegment=d,u.id3=xh(n,s,A,A),i.samples.length&&(u.text=wh(i,s,A)),u}}function kC(r,e,t,n){if(r===null)return!0;const i=Math.max(n,1),s=e-r.baseTime/r.timescale;return Math.abs(s-t)>i}function Rh(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===He.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return xs(t,!1);const n="mp4a.40.5";return U.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${n}"`),n}return U.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let br;try{br=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),br=Cn==null?void 0:Cn.Date.now}const $s=[{demux:CC,remux:FC},{demux:Pr,remux:Hs},{demux:EC,remux:Hs},{demux:xC,remux:Hs}];$s.splice(2,0,{demux:vC,remux:Hs});class Dh{constructor(e,t,n,i,s){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=n,this.vendor=i,this.id=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=br();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:A,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=i||a,{audioCodec:g,videoCodec:p,defaultInitPts:y,duration:Q,initSegmentData:b}=l,v=NC(o,t);if(v&&v.method==="AES-128"){const H=this.getDecrypter();if(H.isSync()){let V=H.softwareDecrypt(o,v.key.buffer,v.iv.buffer);if(n.part>-1&&(V=H.flush()),!V)return s.executeEnd=br(),qa(n);o=new Uint8Array(V)}else return this.decryptionPromise=H.webCryptoDecrypt(o,v.key.buffer,v.iv.buffer).then(V=>{const O=this.push(V,null,n);return this.decryptionPromise=null,O}),this.decryptionPromise}const w=this.needsProbing(c,u);if(w){const H=this.configureTransmuxer(o);if(H)return U.warn(`[transmuxer] ${H.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:H,reason:H.message}),s.executeEnd=br(),qa(n)}(c||u||f||w)&&this.resetInitSegment(b,g,p,Q,t),(c||f||w)&&this.resetInitialTimestamp(y),A||this.resetContiguity();const R=this.transmux(o,v,d,h,n),k=this.currentTransmuxState;return k.contiguous=!0,k.discontinuity=!1,k.trackSwitch=!1,s.executeEnd=br(),R}flush(e){const t=e.transmuxing;t.executeStart=br();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return s.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const u=n.flush();u&&o.push(this.push(u,null,e))}const{demuxer:l,remuxer:A}=this;if(!l||!A)return t.executeEnd=br(),[qa(e)];const c=l.flush(a);return Ys(c)?c.then(u=>(this.flushRemux(o,u,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:A}=this.currentTransmuxState;U.log(`[transmuxer.ts]: Flushed fragment ${n.sn}${n.part>-1?" p: "+n.part:""} of level ${n.level}`);const c=this.remuxer.remux(i,s,o,a,A,l,!0,this.id);e.push({remuxResult:c,chunkMeta:n}),n.transmuxing.executeEnd=br()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,s):o=this.transmuxUnencrypted(e,n,i,s),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i,vendor:s}=this;let o;for(let h=0,d=$s.length;h<d;h++){var a;if((a=$s[h].demux)!=null&&a.probe(e)){o=$s[h];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,A=this.remuxer,c=o.remux,u=o.demux;(!A||!(A instanceof c))&&(this.remuxer=new c(n,t,i,s)),(!l||!(l instanceof u))&&(this.demuxer=new u(n,t,i),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Ua(this.config)),e}}function NC(r,e){let t=null;return r.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const qa=r=>({remuxResult:{},chunkMeta:r});function Ys(r){return"then"in r&&r.then instanceof Function}class MC{constructor(e,t,n,i,s){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=n,this.duration=i,this.defaultInitPts=s||null}}class PC{constructor(e,t,n,i,s,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=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=o}}var _h={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,A,c){this.fn=l,this.context=A,this.once=c||!1}function s(l,A,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||l,h),f=t?t+A:A;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],d]:l._events[f].push(d):(l._events[f]=d,l._eventsCount++),l}function o(l,A){--l._eventsCount===0?l._events=new n:delete l._events[A]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var A=[],c,u;if(this._eventsCount===0)return A;for(u in c=this._events)e.call(c,u)&&A.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(c)):A},a.prototype.listeners=function(A){var c=t?t+A:A,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,f=new Array(d);h<d;h++)f[h]=u[h].fn;return f},a.prototype.listenerCount=function(A){var c=t?t+A:A,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(A,c,u,h,d,f){var g=t?t+A:A;if(!this._events[g])return!1;var p=this._events[g],y=arguments.length,Q,b;if(p.fn){switch(p.once&&this.removeListener(A,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,u),!0;case 4:return p.fn.call(p.context,c,u,h),!0;case 5:return p.fn.call(p.context,c,u,h,d),!0;case 6:return p.fn.call(p.context,c,u,h,d,f),!0}for(b=1,Q=new Array(y-1);b<y;b++)Q[b-1]=arguments[b];p.fn.apply(p.context,Q)}else{var v=p.length,w;for(b=0;b<v;b++)switch(p[b].once&&this.removeListener(A,p[b].fn,void 0,!0),y){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,u);break;case 4:p[b].fn.call(p[b].context,c,u,h);break;default:if(!Q)for(w=1,Q=new Array(y-1);w<y;w++)Q[w-1]=arguments[w];p[b].fn.apply(p[b].context,Q)}}return!0},a.prototype.on=function(A,c,u){return s(this,A,c,u,!1)},a.prototype.once=function(A,c,u){return s(this,A,c,u,!0)},a.prototype.removeListener=function(A,c,u,h){var d=t?t+A:A;if(!this._events[d])return this;if(!c)return o(this,d),this;var f=this._events[d];if(f.fn)f.fn===c&&(!h||f.once)&&(!u||f.context===u)&&o(this,d);else{for(var g=0,p=[],y=f.length;g<y;g++)(f[g].fn!==c||h&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(A){var c;return A?(c=t?t+A:A,this._events[c]&&o(this,c)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(_h);var OC=_h.exports,ja=lE(OC);class Lh{constructor(e,t,n,i){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 s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(A,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,A===I.ERROR&&(this.error=c.error),this.hls.trigger(A,c)};this.observer=new ja,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=tn(s.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={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"&&(s.workerPath||iC())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=oC(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=sC()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=u=>{const h=new Error(`${u.message} (${u.filename}:${u.lineno})`);s.enableWorker=!1,U.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},c.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(s)})}catch(c){U.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new Dh(this.observer,l,s,"",t)}return}this.transmuxer=new Dh(this.observer,l,s,"",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,n,i,s,o,a,l,A,c){var u,h;A.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=o?o.start:s.start,g=s.decryptdata,p=this.frag,y=!(p&&s.cc===p.cc),Q=!(p&&A.level===p.level),b=p?A.sn-p.sn:-1,v=this.part?A.part-this.part.index:-1,w=b===0&&A.id>1&&A.id===(p==null?void 0:p.stats.chunkCount),R=!Q&&(b===1||b===0&&(v===1||w&&v<=0)),k=self.performance.now();(Q||b||s.stats.parsing.start===0)&&(s.stats.parsing.start=k),o&&(v||!R)&&(o.stats.parsing.start=k);const H=!(p&&((u=s.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),V=new PC(y,R,l,Q,f,H);if(!R||y||H){U.log(`[transmuxer-interface, ${s.type}]: Starting new transmux session for sn: ${A.sn} p: ${A.part} level: ${A.level} id: ${A.id}
2471
- discontinuity: ${y}
2470
+ Switching to level ${W} @ ${ie|0} bps`),i.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(U.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 pE(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(I.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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i: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 V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case V.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=s?s.stats:n.stats,l=o-a.loading.start,A=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&A>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,A),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,o=i?this.lastLevelLoadSec:0;return s+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.start;he(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(I.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const o=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return U.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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,s)&&o[e].loadError<=o[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this,{maxAutoLevel:i,config:s,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),A=this.getStarvationDelay();let c=s.abrBandWidthFactor,u=s.abrBandWidthUpFactor;if(A){const p=this.findBestLevel(l,o,i,A,0,c,u);if(p>=0)return p}let h=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!A){const p=this.bitrateTestDelay;p&&(h=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-p,U.info(`[abr] bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),c=u=1)}const d=this.findBestLevel(l,o,i,A,h,c,u);if(U.info(`[abr] ${A?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=n.levels[o],g=n.levels[n.loadLevel];return(f==null?void 0:f.bitrate)<(g==null?void 0:g.bitrate)?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,o,a){var l;const A=i+s,c=this.lastLoadedFragLevel,u=c===-1?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:p,config:C}=this.hls;if(f.length===1)return 0;const Q=f[u],b=!!(Q!=null&&(l=Q.details)!=null&&l.live),v=p===-1||c===-1;let x,R="SDR",k=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:$,videoPreference:K}=C,O=this.audioTracksByGroup||(this.audioTracksByGroup=BE(g));if(v){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=TE(f,O,t,n)),P=yE(D,R,e,$,K),{codecSet:X,videoRanges:_,minFramerate:S,minBitrate:F,preferHDR:J}=P;x=X,R=J?_[_.length-1]:_[0],k=S,e=Math.max(e,F),U.log(`[abr] picked start tier ${JSON.stringify(P)}`)}else x=Q==null?void 0:Q.codecSet,R=Q==null?void 0:Q.videoRange;const W=d?d.duration:h?h.duration:0,ie=this.bwEstimator.getEstimateTTFB()/1e3,te=[];for(let D=n;D>=t;D--){var le;const P=f[D],X=D>u;if(!P)continue;if(C.useMediaCapabilities&&!P.supportedResult&&!P.supportedPromise){const ce=navigator.mediaCapabilities;typeof(ce==null?void 0:ce.decodingInfo)=="function"&&mE(P,O,R,k,e,$)?(P.supportedPromise=EE(P,O,ce),P.supportedPromise.then(pe=>{if(!this.hls)return;P.supportedResult=pe;const ge=this.hls.levels,Se=ge.indexOf(P);pe.error?U.warn(`[abr] MediaCapabilities decodingInfo error: "${pe.error}" for level ${Se} ${JSON.stringify(pe)}`):pe.supported||(U.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Se} ${JSON.stringify(pe)}`),Se>-1&&ge.length>1&&(U.log(`[abr] Removing unsupported level ${Se}`),this.hls.removeLevel(Se)))})):P.supportedResult=vu}if(x&&P.codecSet!==x||R&&P.videoRange!==R||X&&k>P.frameRate||!X&&k>0&&k<P.frameRate||P.supportedResult&&!((le=P.supportedResult.decodingInfoResults)!=null&&le[0].smooth)){te.push(D);continue}const _=P.details,S=(d?_==null?void 0:_.partTarget:_==null?void 0:_.averagetargetduration)||W;let F;X?F=a*e:F=o*e;const J=W&&i>=W*2&&s===0?f[D].averageBitrate:f[D].maxBitrate,Y=this.getTimeToLoadFrag(ie,F,J*S,_===void 0);if(F>=J&&(D===c||P.loadError===0&&P.fragmentError===0)&&(Y<=ie||!he(Y)||b&&!this.bitrateTestDelay||Y<A)){const ce=this.forcedAutoLevel;return D!==p&&(ce===-1||ce!==p)&&(te.length&&U.trace(`[abr] Skipped level(s) ${te.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${f[te[0]].codecs}" ${f[te[0]].videoRange}; not compatible with "${Q.codecs}" ${R}`),U.info(`[abr] switch candidate:${u}->${D} adjustedbw(${Math.round(F)})-bitrate=${Math.round(F-J)} ttfb:${ie.toFixed(1)} avgDuration:${S.toFixed(1)} maxFetchDuration:${A.toFixed(1)} fetchDuration:${Y.toFixed(1)} firstSelection:${v} codecSet:${x} videoRange:${R} hls.loadLevel:${p}`)),v&&(this.firstSelection=D),D}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,i=Math.min(Math.max(e,n),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class wE{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 dt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class SE{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(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;const o=s.end;if(s.start<=e&&o!==null&&e<=o)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:n}=this,i=Object.keys(n);for(let s=i.length;s--;){const o=n[i[s]];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,n,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||s>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===n&&this.removeFragment(a.body);return}const l=a.range[e];l&&l.time.some(A=>{const c=!this.isTimeBuffered(A.startPTS,A.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:n,part:i}=e;if(!t||n.sn==="initSegment")return;const s=xn(n),o=this.fragments[s];if(!o||o.buffered&&n.gap)return;const a=!n.relurl;Object.keys(t).forEach(l=>{const A=n.elementaryStreams[l];if(!A)return;const c=t[l],u=a||A.partial===!0;o.range[l]=this.getBufferedTimes(n,i,u,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=n.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),bs(o)||this.removeParts(n.sn-1,n.type)):this.removeFragment(o.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=n.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=xn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},o=e.start,a=e.end,l=e.minEndPTS||a,A=e.maxStartPTS||o;for(let c=0;c<i.length;c++){const u=i.start(c)-this.bufferPadding,h=i.end(c)+this.bufferPadding;if(A>=u&&l<=h){s.time.push({startPTS:Math.max(o,i.start(c)),endPTS:Math.min(a,i.end(c))});break}else if(o<h&&a>u){const d=Math.max(o,i.start(c)),f=Math.min(a,i.end(c));f>d&&(s.partial=!0,s.time.push({startPTS:d,endPTS:f}))}else if(a<=u)break}return s}getPartialFragment(e){let t=null,n,i,s,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(A=>{const c=l[A];c&&bs(c)&&(i=c.body.start-a,s=c.body.end+a,e>=i&&e<=s&&(n=Math.min(e-i,s-e),o<=n&&(t=c.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||bs(t))}getState(e){const t=xn(e),n=this.fragments[t];return n?n.buffered?bs(n)?dt.PARTIAL:dt.OK:dt.APPENDING:dt.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let o=0;o<n.length;o++){if(i=n.start(o)-this.bufferPadding,s=n.end(o)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:n,part:i}=t;if(n.sn==="initSegment"||n.bitrateTest)return;const s=i?null:t,o=xn(n);this.fragments[o]={body:n,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(i)}this.timeRanges=s,Object.keys(s).forEach(a=>{const l=s[a];this.detectEvictedFragments(a,l,o,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=xn(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==n||i&&!l.gap||l.start<t&&l.end>e&&(a.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=xn(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=n.filter(s=>s.fragment.sn!==i)}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 bs(r){var e,t,n;return r.buffered&&(r.body.gap||((e=r.range.video)==null?void 0:e.partial)||((t=r.range.audio)==null?void 0:t.partial)||((n=r.range.audiovideo)==null?void 0:n.partial))}function xn(r){return`${r.type}_${r.level}_${r.sn}`}const RE={length:0,start:()=>0,end:()=>0};class Je{static isBuffered(e,t){try{if(e){const n=Je.getBuffered(e);for(let i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,n){try{if(e){const i=Je.getBuffered(e),s=[];let o;for(o=0;o<i.length;o++)s.push({start:i.start(o),end:i.end(o)});return this.bufferedInfo(s,t,n)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.sort(function(A,c){const u=A.start-c.start;return u||c.end-A.end});let i=[];if(n)for(let A=0;A<e.length;A++){const c=i.length;if(c){const u=i[c-1].end;e[A].start-u<n?e[A].end>u&&(i[c-1].end=e[A].end):i.push(e[A])}else i.push(e[A])}else i=e;let s=0,o,a=t,l=t;for(let A=0;A<i.length;A++){const c=i[A].start,u=i[A].end;if(t+n>=c&&t<u)a=c,l=u,s=l-t;else if(t+n<c){o=c;break}}return{len:s,start:a||0,end:l||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return U.log("failed to get media.buffered",t),RE}}}class Ba{constructor(e,t,n,i=0,s=-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=xs(),this.buffering={audio:xs(),video:xs(),audiovideo:xs()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function xs(){return{start:0,executeStart:0,executeEnd:0,end:0}}function ws(r,e){for(let n=0,i=r.length;n<i;n++){var t;if(((t=r[n])==null?void 0:t.cc)===e)return r[n]}return null}function DE(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function _E(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=ws(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function Tu(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function Qu(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)Tu(t[n],r);e.fragmentHint&&Tu(e.fragmentHint,r),e.alignedSliding=!0}function LE(r,e,t){e&&(FE(r,t,e),!t.alignedSliding&&e&&Ss(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&fu(e,t))}function FE(r,e,t){if(DE(r,t,e)){const n=_E(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Qu(n.start,e))}}function Ss(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const o=Math.min(e.endCC,r.endCC);e.startCC<o&&r.startCC<o&&(i=ws(n,o),s=ws(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=ws(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=s.programDateTime;if(!a||!l)return;const A=(l-a)/1e3-(s.start-i.start);Qu(A,r)}const bu=Math.pow(2,17);class kE{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 n=e.url;if(!n)return Promise.reject(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){l(wu(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=xu(e),u=Iu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:bu};e.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A);let C=d.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(C.slice(0,16)),C=C.slice(16)),a({frag:e,part:null,payload:C,networkDetails:p})},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ht({url:n,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))},onProgress:(d,f,g,p)=>{t&&t({frag:e,part:null,payload:g,networkDetails:p})}})})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(wu(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=xu(e,t),u=Iu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:bu};t.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A),this.updateStatsFromPart(e,t);const C={frag:e,part:t,payload:d.data,networkDetails:p};n(C),a(C)},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ht({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),A=Math.min(Math.round(n.loaded/s),l),u=(l-A)*Math.round(n.loaded/A);n.total=n.loaded+u}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.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 xu(r,e=null){const t=e||r,n={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(he(i)&&he(s)){var o;let a=i,l=s;if(r.sn==="initSegment"&&((o=r.decryptdata)==null?void 0:o.method)==="AES-128"){const A=s-i;A%16&&(l=s+(16-A%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function wu(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),n={type:Be.MEDIA_ERROR,details:V.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(n.part=e),(e||r).stats.aborted=!0,new Qr(n)}class Qr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class NE{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 ME{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 PE(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?en(r,0,e-t):r}class OE{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],o=n[2],a=n[3],l=this.invSubMix,A=l[0],c=l[1],u=l[2],h=l[3],d=new Uint32Array(256);let f=0,g=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 C=g^g<<1^g<<2^g<<3^g<<4;C=C>>>8^C&255^99,e[f]=C,t[C]=f;const Q=d[f],b=d[Q],v=d[b];let x=d[C]*257^C*16843008;i[f]=x<<24|x>>>8,s[f]=x<<16|x>>>16,o[f]=x<<8|x>>>24,a[f]=x,x=v*16843009^b*65537^Q*257^f*16843008,A[C]=x<<24|x>>>8,c[C]=x<<16|x>>>16,u[C]=x<<8|x>>>24,h[C]=x,f?(f=Q^d[d[d[v^Q]]],g^=d[d[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const o=this.ksRows=(s+6+1)*4;let a,l;const A=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],g=d[1],p=d[2],C=d[3];let Q,b;for(a=0;a<o;a++){if(a<s){Q=A[a]=t[a];continue}b=Q,a%s===0?(b=b<<8|b>>>24,b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255],b^=h[a/s|0]<<24):s>6&&a%s===4&&(b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255]),A[a]=Q=(A[a-s]^b)>>>0}for(l=0;l<o;l++)a=o-l,l&3?b=A[a]:b=A[a-4],l<4||a<=4?c[l]=b:c[l]=f[u[b>>>24]]^g[u[b>>>16&255]]^p[u[b>>>8&255]]^C[u[b&255]],c[l]=c[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],A=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],f=h[1],g=h[2],p=h[3];const C=new Int32Array(e),Q=new Int32Array(C.length);let b,v,x,R,k,$,K,O,W,ie,te,le,D,P;const X=this.networkToHostOrderSwap;for(;t<C.length;){for(W=X(C[t]),ie=X(C[t+1]),te=X(C[t+2]),le=X(C[t+3]),k=W^s[0],$=le^s[1],K=te^s[2],O=ie^s[3],D=4,P=1;P<i;P++)b=l[k>>>24]^A[$>>16&255]^c[K>>8&255]^u[O&255]^s[D],v=l[$>>>24]^A[K>>16&255]^c[O>>8&255]^u[k&255]^s[D+1],x=l[K>>>24]^A[O>>16&255]^c[k>>8&255]^u[$&255]^s[D+2],R=l[O>>>24]^A[k>>16&255]^c[$>>8&255]^u[K&255]^s[D+3],k=b,$=v,K=x,O=R,D=D+4;b=o[k>>>24]<<24^o[$>>16&255]<<16^o[K>>8&255]<<8^o[O&255]^s[D],v=o[$>>>24]<<24^o[K>>16&255]<<16^o[O>>8&255]<<8^o[k&255]^s[D+1],x=o[K>>>24]<<24^o[O>>16&255]<<16^o[k>>8&255]<<8^o[$&255]^s[D+2],R=o[O>>>24]<<24^o[k>>16&255]<<16^o[$>>8&255]<<8^o[K&255]^s[D+3],Q[t]=X(b^d),Q[t+1]=X(R^f),Q[t+2]=X(x^g),Q[t+3]=X(v^p),d=W,f=ie,g=te,p=le,t=t+4}return Q.buffer}}const UE=16;class Ta{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 n=self.crypto;n&&(this.subtle=n.subtle||n.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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?PE(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n){return this.useSoftware?new Promise((i,s)=>{this.softwareDecrypt(new Uint8Array(e),t,n);const o=this.flush();o?i(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n)}softwareDecrypt(e,t,n){const{currentIV:i,currentResult:s,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=$t(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;i&&(n=i);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new OE),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=en(a,-16).buffer,A||null}webCryptoDecrypt(e,t,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n));this.key=t,this.fastAesKey=new ME(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new NE(this.subtle,new Uint8Array(n)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(U.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n)))}onWebCryptoError(e,t,n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%UE;return n!==e.length&&(t=en(e,0,n),this.remainderData=en(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const GE={toString:function(r){let e="";const t=r.length;for(let n=0;n<t;n++)e+=`[${r.start(n).toFixed(3)}-${r.end(n).toFixed(3)}]`;return e}},re={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 Qa extends wE{constructor(e,t,n,i,s){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=re.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=s,this.logPrefix=i,this.log=U.log.bind(U,`${i}:`),this.warn=U.warn.bind(U,`${i}:`),this.hls=e,this.fragmentLoader=new kE(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ta(e.config),e.on(I.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=re.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const n=t.partList;if(n!=null&&n.length){const s=n[n.length-1];return Je.isBuffered(this.media,s.start+s.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===re.STOPPED&&this.startLoad(i.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:n,mediaBuffer:i,state:s}=this,o=n?n.currentTime:0,a=Je.bufferInfo(i||n,o,e.maxBufferHole);if(this.log(`media seeking to ${he(o)?o.toFixed(3):o}, state: ${s}`),this.state===re.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,A=t.start-l,c=t.start+t.duration+l;if(!a.len||c<a.start||A>a.end){const u=o>c;(o<A||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}n&&(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(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=re.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,n){this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${s.part?" p: "+s.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const o=this.state;if(this.fragContextChanged(e)){(o===re.FRAG_LOADING||!this.fragCurrent&&o===re.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=re.IDLE);return}"payload"in s&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(I.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===dt.APPENDING){const s=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,s),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===dt.PARTIAL&&n.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,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(I.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{if(!n||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{payload:s}=n,o=e.decryptdata;if(s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer).catch(l=>{throw i.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const A=self.performance.now();return i.trigger(I.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:a,tdecrypt:A}}),n.payload=l,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state=re.IDLE,e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.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 n,i,s,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===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((n=e.startPTS)!=null?n:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${a?GE.toString(Je.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==Ee.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=re.IDLE;return}}const A=(l=this.levels)==null?void 0:l[e.level];A!=null&&A.fragmentError&&(this.log(`Resetting level fragment error count of ${A.fragmentError} on frag buffered`),A.fragmentError=0)}this.state=re.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((s=this.fragCurrent)==null?void 0:s.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:n,part:i,partsLoaded:s}=e,o=!s||s.length===0||s.some(l=>!l),a=new Ba(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;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&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=re.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(I.KEY_LOADED,c),this.state===re.KEY_LOADING&&(this.state=re.IDLE),c}),this.hls.trigger(I.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),n=Math.max(e.start,n||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&i){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);const u=this.getNextPart(c,e,n);if(u>-1){const h=c[u];this.log(`Loading part sn: ${e.sn} p: ${h.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${u}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=re.FRAG_LOADING;let d;return a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,h,t,i)).catch(f=>this.handleFragLoadError(f)):d=this.doFragPartsLoad(e,h,t,i).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(I.FRAG_LOADING,{frag:e,part:h,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,n))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(n.toFixed(3))}`),he(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=re.FRAG_LOADING;const l=this.config.progressive;let A;return l&&a?A=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,i)).catch(c=>this.handleFragLoadError(c)):A=Promise.all([this.fragmentLoader.load(e,l?i:void 0),a]).then(([c])=>(!l&&c&&i&&i(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(I.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):A}doFragPartsLoad(e,t,n,i){return new Promise((s,o)=>{var a;const l=[],A=(a=n.details)==null?void 0:a.partList,c=u=>{this.fragmentLoader.loadPart(e,u,i).then(h=>{l[u.index]=h;const d=h.part;this.hls.trigger(I.FRAG_LOADED,h);const f=gu(n,e.sn,u.index+1)||pu(A,e.sn,u.index+1);if(f)c(f);else return s({frag:e,part:d,partsLoaded:l})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===V.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(I.ERROR,t)}else this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==re.PARSING){!this.fragCurrent&&this.state!==re.STOPPED&&this.state!==re.ERROR&&(this.state=re.IDLE);return}const{frag:n,part:i,level:s}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o),this.updateLevelTiming(n,i,s,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of level ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=o>-1?gu(a,s,o):null,A=l?l.fragment:AE(a,s,n);return A?(n&&n!==A&&(A.stats=n.stats),{frag:A,part:l,level:a}):null}bufferFragmentData(e,t,n,i,s){var o;if(!e||this.state!==re.PARSING)return;const{data1:a,data2:l}=e;let A=a;if(a&&l&&(A=$t(a,l)),!((o=A)!=null&&o.length))return;const c={type:e.type,frag:t,part:n,chunkMeta:i,parent:t.type,data:A};if(this.hls.trigger(I.BUFFER_APPENDING,c),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Je.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Je.bufferInfo(t,n,0),s=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const n=this.getLoadPosition();return he(n)?this.getFwdBufferInfoAtPos(e,n,t):null}getFwdBufferInfoAtPos(e,t,n){const{config:{maxBufferHole:i}}=this,s=Je.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&s.nextStart<o.end)return Je.bufferInfo(e,t,Math.max(s.nextStart,i))}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,i=Math.max(Math.min(e-t,n.maxBufferLength),t),s=Math.max(e-t*3,n.maxMaxBufferLength/2,i);return s>=i?(n.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const n=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,o=n[0].start;let a;if(t.live){const l=s.initialLiveManifestSize;if(i<l)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,n),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=n[0]);if(!a){const l=s.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===dt.OK||n===dt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&n.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i);if(l!==null&&n.len+l.len>=s)return this.log(`buffer full after gaps in "${i}" 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,n){let i=-1,s=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const A=e[a];if(o=o&&!A.independent,i>-1&&n<A.start)break;const c=A.loaded;c?i=-1:(s||A.independent||o)&&A.fragment===t&&(i=a),s=c}return i}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e,t){const n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=uE(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const o=t[s-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=fE(t,n.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:A}=i,c=n.partList,u=!!(i.lowLatencyMode&&c!=null&&c.length&&l);u&&l&&!this.bitrateTest&&(o=o.concat(l),a=l.sn);let h;if(e<t){const d=e>t-A?0:A;h=Qs(s,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-n.startSN,f=this.fragmentTracker.getState(h);if((f===dt.OK||f===dt.PARTIAL&&h.gap)&&(s=h),s&&h.sn===s.sn&&(!u||c[0].fragment.sn>h.sn)&&s&&h.level===s.level){const p=o[d+1];h.sn<a&&this.fragmentTracker.getState(p)!==dt.OK?h=p:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=n.currentTime,o=e.fragments[0].start,a=e.edge,l=s>=o-t.maxFragLookUpTolerance&&s<=a;if(i!==null&&n.duration>i&&(s<i||!l)){const A=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&n.readyState<4||s<a-A)&&(this.loadedmetadata||(this.nextLoadPosition=i),n.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),n.currentTime=i))}}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragments[0].start,o=!t,a=e.alignedSliding&&he(s);if(o||!a&&!s){const{fragPrevious:l}=this;LE(l,n,e);const A=e.fragments[0].start;return this.log(`Live playlist sliding: ${A.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),A}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;if(n<t&&(n=-1),n===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&he(s)?(n=t+s,s<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Start time offset ${s} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${n}`),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n}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!==re.FRAG_LOADING_WAITING_RETRY)&&(this.state=re.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var i;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const s=t.details===V.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction,{action:a,retryCount:l=0,retryConfig:A}=o||{};if(o&&a===Bt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Ca(A,l);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${l+1}/${A.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=re.FRAG_LOADING_WAITING_RETRY}else if(A&&o)if(this.resetFragmentErrors(e),l<A.maxNumRetry)!s&&a!==Bt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===Bt.SendAlternateToPenaltyBox?this.state=re.WAITING_LEVEL:this.state=re.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===re.PARSING||this.state===re.PARSED){const t=e.frag,n=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=i&&i.len>.5;s&&this.reduceMaxBufferLength(i.len,(t==null?void 0:t.duration)||10);const o=!s;return o&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==re.STOPPED&&(this.state=re.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Je.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===re.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=re.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,n,i){var s;const o=n.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,A)=>{const c=e.elementaryStreams[A];if(c){const u=c.endPTS-c.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${A} duration reliably (${u})`),l||!1;const h=i?0:du(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:o,level:n,drift:h,type:A,frag:e,start:c.startPTS,end:c.endPTS}),!0}return l},!1)&&((s=this.transmuxer)==null?void 0:s.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(n.fragmentError===0&&(n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=re.PARSED,this.hls.trigger(I.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 Su{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=HE(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function HE(r,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++){const s=r[i];t.set(s,n),n+=s.length}return t}function $E(){return typeof __HLS_WORKER_BUNDLE__=="function"}function YE(){const r=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(r);return{worker:new self.Worker(e),objectURL:e}}function VE(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function ur(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ba{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,n,i){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,n){}demux(e,t){this.cachedData&&(e=$t(this.cachedData,e),this.cachedData=null);let n=di(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?oa(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=KE(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY});i<A;){if(this.canParse(e,i)){const c=this.appendFrame(o,e,i);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i+=c.length,s=i):i=A}else dm(e,i)?(n=di(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=en(e,s);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:ur(),id3Track:a,textTrack:ur()}}demuxSampleAes(e,t,n){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:ur(),id3Track:this._id3Track,textTrack:ur()}}destroy(){}}const KE=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function JE(r,e,t,n){let i,s,o,a;const l=navigator.userAgent.toLowerCase(),A=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>c.length-1){const h=new Error(`invalid ADTS sampling index:${u}`);r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,U.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,a=new Array(4),s=u-3):(i=2,a=new Array(2),s=u):l.indexOf("android")!==-1?(i=2,a=new Array(2),s=u):(i=5,a=new Array(4),n&&(n.indexOf("mp4a.40.29")!==-1||n.indexOf("mp4a.40.5")!==-1)||!n&&u>=6?s=u-3:((n&&n.indexOf("mp4a.40.2")!==-1&&(u>=6&&o===1||/vivaldi/i.test(l))||!n&&o===1)&&(i=2,a=new Array(2)),s=u)),a[0]=i<<3,a[0]|=(u&14)>>1,a[1]|=(u&1)<<7,a[1]|=o<<3,i===5&&(a[1]|=(s&14)>>1,a[2]=(s&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[u],channelCount:o,codec:"mp4a.40."+i,manifestCodec:A}}function Ru(r,e){return r[e]===255&&(r[e+1]&246)===240}function Du(r,e){return r[e+1]&1?7:9}function xa(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function WE(r,e){return e+5<r.length}function Rs(r,e){return e+1<r.length&&Ru(r,e)}function qE(r,e){return WE(r,e)&&Ru(r,e)&&xa(r,e)<=r.length-e}function XE(r,e){if(Rs(r,e)){const t=Du(r,e);if(e+t>=r.length)return!1;const n=xa(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Rs(r,i)}return!1}function _u(r,e,t,n,i){if(!r.samplerate){const s=JE(e,t,n,i);if(!s)return;r.config=s.config,r.samplerate=s.samplerate,r.channelCount=s.channelCount,r.codec=s.codec,r.manifestCodec=s.manifestCodec,U.log(`parsed codec:${r.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function Lu(r){return 9216e4/r}function jE(r,e){const t=Du(r,e);if(e+t<=r.length){const n=xa(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Fu(r,e,t,n,i){const s=Lu(r.samplerate),o=n+i*s,a=jE(e,t);let l;if(a){const{frameLength:u,headerLength:h}=a,d=h+u,f=Math.max(0,t+d-e.length);f?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const g={unit:l,pts:o};return f||r.samples.push(g),{sample:g,length:d,missing:f}}const A=e.length-t;return l=new Uint8Array(A),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:A,missing:-1}}let Ds=null;const zE=[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],ZE=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],eI=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],tI=[0,1,1,4];function ku(r,e,t,n,i){if(t+24>e.length)return;const s=Nu(e,t);if(s&&t+s.frameLength<=e.length){const o=s.samplesPerFrame*9e4/s.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+s.frameLength),pts:a,dts:a};return r.config=[],r.channelCount=s.channelCount,r.samplerate=s.sampleRate,r.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function Nu(r,e){const t=r[e+1]>>3&3,n=r[e+1]>>1&3,i=r[e+2]>>4&15,s=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const o=r[e+2]>>1&1,a=r[e+3]>>6,l=t===3?3-n:n===3?3:4,A=zE[l*14+i-1]*1e3,u=ZE[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=eI[t][n],f=tI[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Ds===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ds=b?parseInt(b[1]):0}return!!Ds&&Ds<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function wa(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Mu(r,e){return e+1<r.length&&wa(r,e)}function rI(r,e){return wa(r,e)&&4<=r.length-e}function Pu(r,e){if(e+1<r.length&&wa(r,e)){const n=Nu(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Mu(r,s)}return!1}class nI extends ba{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=di(e,0);let n=(t==null?void 0:t.length)||0;if(Pu(e,n))return!1;for(let i=e.length;n<i;n++)if(XE(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return qE(e,t)}appendFrame(e,t,n){_u(e,this.observer,t,n,e.manifestCodec);const i=Fu(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const iI=/\/emsg[-/]ID3/i;class sI{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,n,i){const s=this.videoTrack=ur("video",1),o=this.audioTrack=ur("audio",1),a=this.txtTrack=ur("text",1);if(this.id3Track=ur("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Uc(e);if(l.video){const{id:A,timescale:c,codec:u}=l.video;s.id=A,s.timescale=a.timescale=c,s.codec=u}if(l.audio){const{id:A,timescale:c,codec:u}=l.audio;o.id=A,o.timescale=c,o.codec=u}a.id=Nc.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return ym(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=$t(this.remainderData,e));const a=Rm(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Hc(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Hc(e,t),{videoTrack:t,audioTrack:ur(),id3Track:i,textTrack:ur()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=Lm(s);if(iI.test(o.schemeIdUri)){const a=he(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const A=o.payload;n.samples.push({data:A,len:A.byteLength,dts:a,pts:a,type:zt.emsg,duration:l})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Ou=(r,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=r[e];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,i[0]=(o[0]&s[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class oI extends ba{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=Uu(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=di(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&oa(t)!==void 0&&Ou(e,n)<16}}function Uu(r,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],l=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][l*3+s]*2;if(t+c>e.length)return-1;const u=e[t+6]>>5;let h=0;u===2?h+=2:(u&1&&u!==1&&(h+=2),u&4&&(h+=2));const d=(e[t+6]<<8|e[t+7])>>12-h&1,g=[2,1,2,3,3,4,4,5][u]+d,p=e[t+5]>>3,C=e[t+5]&7,Q=new Uint8Array([s<<6|p<<1|C>>2,(C&3)<<6|u<<3|d<<2|l>>4,l<<4&224]),b=1536/a*9e4,v=n+i*b,x=e.subarray(t,t+c);return r.config=Q,r.channelCount=g,r.samplerate=a,r.samples.push({unit:x,pts:v}),c}class aI{constructor(){this.VideoSample=null}createVideoSample(e,t,n,i){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&U.log(e.pts+"/"+e.dts+":"+e.debug)}}class Gu{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,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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 n=this.word>>>32-t;if(e>32&&U.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?n<<t|this.readBits(t):n}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,n=8,i;for(let s=0;s<e;s++)n!==0&&(i=this.readEG(),n=(t+i+256)%256),t=n===0?t:n}readSPS(){let e=0,t=0,n=0,i=0,s,o,a;const l=this.readUByte.bind(this),A=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);l();const p=l();if(A(5),h(3),l(),f(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const R=c();if(R===3&&h(1),f(),f(),h(1),u())for(o=R!==3?8:12,a=0;a<o;a++)u()&&(a<6?g(16):g(64))}f();const C=c();if(C===0)c();else if(C===1)for(h(1),d(),d(),s=c(),a=0;a<s;a++)d();f(),h(1);const Q=c(),b=c(),v=A(1);v===0&&h(1),h(1),u()&&(e=c(),t=c(),n=c(),i=c());let x=[1,1];if(u()&&u())switch(l()){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((Q+1)*16-e*2-t*2),height:(2-v)*(b+1)*16-(v?2:4)*(n+i),pixelRatio:x}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class lI extends aI{parseAVCPES(e,t,n,i,s){const o=this.parseAVCNALu(e,n.data);let a=this.VideoSample,l,A=!1;n.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"")),o.forEach(c=>{var u;switch(c.type){case 1:{let g=!1;l=!0;const p=c.data;if(A&&p.length>4){const C=new Gu(p).readSliceType();(C===2||C===4||C===7||C===9)&&(g=!0)}if(g){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.frame=!0,a.key=g;break}case 5:l=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.key=!0,a.frame=!0;break;case 6:{l=!0,$c(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,C=new Gu(g).readSPS();if(!e.sps||e.width!==C.width||e.height!==C.height||((d=e.pixelRatio)==null?void 0:d[0])!==C.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==C.pixelRatio[1]){e.width=C.width,e.height=C.height,e.pixelRatio=C.pixelRatio,e.sps=[g],e.duration=s;const Q=g.subarray(1,4);let b="avc1.";for(let v=0;v<3;v++){let x=Q[v].toString(16);x.length<2&&(x="0"+x),b+=x}e.codec=b}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"");break;case 12:l=!0;break;default:l=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&l&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const n=t.byteLength;let i=e.naluState||0;const s=i,o=[];let a=0,l,A,c,u=-1,h=0;for(i===-1&&(u=0,h=t[0]&31,i=0,a=1);a<n;){if(l=t[a++],!i){i=l?0:1;continue}if(i===1){i=l?0:2;continue}if(!l)i=3;else if(l===1){if(A=a-i-1,u>=0){const d={data:t.subarray(u,A),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(s&&a<=4-s&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-s)),A>0&&(d.data=$t(d.data,t.subarray(0,A)),d.state=0))}a<n?(c=t[a]&31,u=a,h=c,i=0):i=-1}else i=0}if(u>=0&&i>=0){const d={data:t.subarray(u,n),type:h,state:i};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=$t(d.data,t))}return e.naluState=i,o}}class AI{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Ta(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const o=Yc(s.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const o=s[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}const ft=188;class Pr{constructor(e,t,n){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=n,this.videoParser=new lI}static probe(e){const t=Pr.syncOffset(e);return t>0&&U.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let n=Math.min(ft*5,t-ft)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=ft)if(e[l]===71&&(t-l===ft||e[l+ft]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+ft*99,e.length-ft)+1)),s||(s=Sa(e,l)===0),s&&a>1&&(o===0&&a>2||l+ft>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Nc[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Pr.createTrack("video"),this._audioTrack=Pr.createTrack("audio",i),this._id3Track=Pr.createTrack("id3"),this._txtTrack=Pr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,A=this._txtTrack;let c=o.pid,u=o.pesData,h=a.pid,d=l.pid,f=a.pesData,g=l.pesData,p=null,C=this.pmtParsed,Q=this._pmtId,b=e.length;if(this.remainderData&&(e=$t(this.remainderData,e),b=e.length,this.remainderData=null),b<ft&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const v=Math.max(0,Pr.syncOffset(e));b-=(b-v)%ft,b<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let x=0;for(let k=v;k<b;k+=ft)if(e[k]===71){const $=!!(e[k+1]&64),K=Sa(e,k),O=(e[k+3]&48)>>4;let W;if(O>1){if(W=k+5+e[k+4],W===k+ft)continue}else W=k+4;switch(K){case c:$&&(u&&(s=wn(u))&&this.videoParser.parseAVCPES(o,A,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(W,k+ft)),u.size+=k+ft-W);break;case h:if($){if(f&&(s=wn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(W,k+ft)),f.size+=k+ft-W);break;case d:$&&(g&&(s=wn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(W,k+ft)),g.size+=k+ft-W);break;case 0:$&&(W+=e[W]+1),Q=this._pmtId=cI(e,W);break;case Q:{$&&(W+=e[W]+1);const ie=uI(e,W,this.typeSupported,n,this.observer);c=ie.videoPid,c>0&&(o.pid=c,o.segmentCodec=ie.segmentVideoCodec),h=ie.audioPid,h>0&&(a.pid=h,a.segmentCodec=ie.segmentAudioCodec),d=ie.id3Pid,d>0&&(l.pid=d),p!==null&&!C&&(U.warn(`MPEG-TS PMT found at ${k} after unknown PID '${p}'. Backtracking to sync byte @${v} to parse all TS packets.`),p=null,k=v-188),C=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=K;break}}else x++;x>0&&_s(this.observer,new Error(`Found ${x} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=f,l.pesData=g;const R={audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};return i&&this.extractRemainingSamples(R),R}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:i,textTrack:s}=e,o=n.pesData,a=t.pesData,l=i.pesData;let A;if(o&&(A=wn(o))?(this.videoParser.parseAVCPES(n,s,A,!0,this._duration),n.pesData=null):n.pesData=o,a&&(A=wn(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,A);break;case"mp3":this.parseMPEGPES(t,A);break;case"ac3":this.parseAC3PES(t,A);break}t.pesData=null}else a!=null&&a.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(A=wn(l))?(this.parseID3PES(i,A),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new AI(this.observer,this.config,t);return this.decrypt(i,s)}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const u=i.missing,h=i.sample.unit.byteLength;if(u===-1)s=$t(i.sample.unit,s);else{const d=h-u;i.sample.unit.set(s.subarray(0,u),d),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=s.length;o<a-1&&!Rs(s,o);o++);if(o!==n){let u;const h=o<a-1;if(h?u=`AAC PES did not start with ADTS header,offset:${o}`:u="No ADTS header found in AAC PES",_s(this.observer,new Error(u),h),!h)return}_u(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=Lu(e.samplerate);l=i.sample.pts+u}else{U.warn("[tsdemuxer]: AAC PES unknown PTS");return}let A=0,c;for(;o<a;)if(c=Fu(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Rs(s,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,o=0;const a=t.pts;if(a===void 0){U.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<i;)if(Mu(n,o)){const l=ku(e,n,o,a,s);if(l)o+=l.length,s++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){U.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let o=0,a=0,l;for(;a<s&&(l=Uu(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){U.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=it({},t,{type:this._videoTrack?zt.emsg:zt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Sa(r,e){return((r[e+1]&31)<<8)+r[e+2]}function cI(r,e){return(r[e+10]&31)<<8|r[e+11]}function uI(r,e,t,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],a=e+3+o-4,l=(r[e+10]&15)<<8|r[e+11];for(e+=12+l;e<a;){const A=Sa(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){Ra("ADTS AAC");break}case 15:s.audioPid===-1&&(s.audioPid=A);break;case 21:s.id3Pid===-1&&(s.id3Pid=A);break;case 219:if(!n){Ra("H.264");break}case 27:s.videoPid===-1&&(s.videoPid=A,s.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?U.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="mp3");break;case 193:if(!n){Ra("AC-3");break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="ac3"):U.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&c>0){let u=e+5,h=c;for(;h>2;){switch(r[u]){case 106:t.ac3!==!0?U.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=A,s.segmentAudioCodec="ac3");break}const f=r[u+1]+2;u+=f,h-=f}}break;case 194:case 135:return _s(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return _s(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function _s(r,e,t){U.warn(`parsing error: ${e.message}`),r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function Ra(r){U.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function wn(r){let e=0,t,n,i,s,o;const a=r.data;if(!r||r.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=$t(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(n=(t[4]<<8)+t[5],n&&n>r.size-6)return null;const A=t[7];A&192&&(s=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,A&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,s-o>54e5&&(U.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),i=t[8];let c=i+9;if(r.size<=c)return null;r.size-=c;const u=new Uint8Array(r.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let f=t.byteLength;if(c)if(c>f){c-=f;continue}else t=t.subarray(c),f-=c,c=0;u.set(t,e),e+=f}return n&&(n-=i+3),{data:u,pts:s,dts:o,len:n}}return null}class hI extends ba{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=di(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&oa(t)!==void 0&&Ou(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Pu(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return rI(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return ku(e,t,n,this.basePTS,this.frameIndex)}}class Hu{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 Or=Math.pow(2,32)-1;class G{static init(){G.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 G.types)G.types.hasOwnProperty(e)&&(G.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]),n=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]);G.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);G.STTS=G.STSC=G.STCO=s,G.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),G.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),G.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),G.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]),l=new Uint8Array([0,0,0,1]);G.FTYP=G.box(G.types.ftyp,o,l,o,a),G.DINF=G.box(G.types.dinf,G.box(G.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<s;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return G.box(G.types.hdlr,G.HDLR_TYPES[e])}static mdat(e){return G.box(G.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Or+1)),i=Math.floor(t%(Or+1));return G.box(G.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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return G.box(G.types.mdia,G.mdhd(e.timescale,e.duration),G.hdlr(e.type),G.minf(e))}static mfhd(e){return G.box(G.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"?G.box(G.types.minf,G.box(G.types.smhd,G.SMHD),G.DINF,G.stbl(e)):G.box(G.types.minf,G.box(G.types.vmhd,G.VMHD),G.DINF,G.stbl(e))}static moof(e,t,n){return G.box(G.types.moof,G.mfhd(e),G.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trak(e[t]);return G.box.apply(null,[G.types.moov,G.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(G.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trex(e[t]);return G.box.apply(null,[G.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Or+1)),i=Math.floor(t%(Or+1)),s=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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&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 G.box(G.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return G.box(G.types.sdtp,n)}static stbl(e){return G.box(G.types.stbl,G.stsd(e),G.box(G.types.stts,G.STTS),G.box(G.types.stsc,G.STSC),G.box(G.types.stsz,G.STSZ),G.box(G.types.stco,G.STCO))}static avc1(e){let t=[],n=[],i,s,o;for(i=0;i<e.sps.length;i++)s=e.sps[i],o=s.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],o=s.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(s));const a=G.box(G.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,A=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return G.box(G.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,A>>8&255,A&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,G.box(G.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),G.box(G.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,u>>24,u>>16&255,u>>8&255,u&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 G.box(G.types.mp4a,G.audioStsd(e),G.box(G.types.esds,G.esds(e)))}static mp3(e){return G.box(G.types[".mp3"],G.audioStsd(e))}static ac3(e){return G.box(G.types["ac-3"],G.audioStsd(e),G.box(G.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?G.box(G.types.stsd,G.STSD,G.mp3(e)):e.segmentCodec==="ac3"?G.box(G.types.stsd,G.STSD,G.ac3(e)):G.box(G.types.stsd,G.STSD,G.mp4a(e)):G.box(G.types.stsd,G.STSD,G.avc1(e))}static tkhd(e){const t=e.id,n=e.duration*e.timescale,i=e.width,s=e.height,o=Math.floor(n/(Or+1)),a=Math.floor(n%(Or+1));return G.box(G.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,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=G.sdtp(e),i=e.id,s=Math.floor(t/(Or+1)),o=Math.floor(t%(Or+1));return G.box(G.types.traf,G.box(G.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),G.box(G.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),G.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,G.box(G.types.trak,G.tkhd(e),G.mdia(e))}static trex(e){const t=e.id;return G.box(G.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 n=e.samples||[],i=n.length,s=12+16*i,o=new Uint8Array(s);let a,l,A,c,u,h;for(t+=8+s,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],A=l.duration,c=l.size,u=l.flags,h=l.cts,o.set([A>>>24&255,A>>>16&255,A>>>8&255,A&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*a);return G.box(G.types.trun,o)}static initSegment(e){G.types||G.init();const t=G.moov(e);return $t(G.FTYP,t)}}G.types=void 0,G.HDLR_TYPES=void 0,G.STTS=void 0,G.STSC=void 0,G.STCO=void 0,G.STSZ=void 0,G.VMHD=void 0,G.SMHD=void 0,G.STSD=void 0,G.FTYP=void 0,G.DINF=void 0;const $u=9e4;function Da(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function dI(r,e,t=1,n=!1){return Da(r,e,1/t,n)}function pi(r,e=!1){return Da(r,1e3,1/$u,e)}function fI(r,e=1){return Da(r,$u,1/e)}const gI=10*1e3,Yu=1024,pI=1152,mI=1536;let Sn=null,_a=null;class Ls{constructor(e,t,n,i=""){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=n,this.ISGenerated=!1,Sn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sn=o?parseInt(o[1]):0}if(_a===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);_a=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e.reduce((i,s)=>{const o=s.pts-i;return o<-4294967296?(t=!0,Yt(i,s.pts)):o>0?i:s.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),n}remux(e,t,n,i,s,o,a,l){let A,c,u,h,d,f,g=s,p=s;const C=e.pid>-1,Q=t.pid>-1,b=t.samples.length,v=e.samples.length>0,x=a&&b>0||b>1;if((!C||v)&&(!Q||x)||this.ISGenerated||a){if(this.ISGenerated){var k,$,K,O;const le=this.videoTrackConfig;le&&(t.width!==le.width||t.height!==le.height||((k=t.pixelRatio)==null?void 0:k[0])!==(($=le.pixelRatio)==null?void 0:$[0])||((K=t.pixelRatio)==null?void 0:K[1])!==((O=le.pixelRatio)==null?void 0:O[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,s,o);const W=this.isVideoContiguous;let ie=-1,te;if(x&&(ie=EI(t.samples),!W&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,ie>0){U.warn(`[mp4-remuxer]: Dropped ${ie} out of ${b} video samples due to a missing keyframe`);const le=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ie),t.dropped+=ie,p+=(t.samples[0].pts-le)/t.inputTimeScale,te=p}else ie===-1&&(U.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),f=!1);if(this.ISGenerated){if(v&&x){const le=this.getVideoStartPts(t.samples),P=(Yt(e.samples[0].pts,le)-le)/t.inputTimeScale;g+=Math.max(0,P),p+=Math.max(0,-P)}if(v){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,s,o)),c=this.remuxAudio(e,g,this.isAudioContiguous,o,Q||x||l===Ee.AUDIO?p:void 0),x){const le=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,s,o)),A=this.remuxVideo(t,p,W,le)}}else x&&(A=this.remuxVideo(t,p,W,0));A&&(A.firstKeyFrame=ie,A.independent=ie!==-1,A.firstKeyFramePTS=te)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=Vu(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=Ku(i,s,this._initPTS))),{audio:c,video:A,initSegment:u,independent:f,text:h,id3:d}}generateIS(e,t,n,i){const s=e.samples,o=t.samples,a=this.typeSupported,l={},A=this._initPTS;let c=!A||i,u="audio/mp4",h,d,f;if(c&&(h=d=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(u="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):G.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.inputTimeScale,!A||f!==A.timescale?h=d=s[0].pts-Math.round(f*n):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:G.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.inputTimeScale,!A||f!==A.timescale){const g=this.getVideoStartPts(o),p=Math.round(f*n);d=Math.min(d,Yt(o[0].dts,g)-p),h=Math.min(h,g-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:h,timescale:f},this._initDTS={baseTime:d,timescale:f}):h=f=void 0,{tracks:l,initPTS:h,timescale:f}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,o=e.samples,a=[],l=o.length,A=this._initPTS;let c=this.nextAvcDts,u=8,h=this.videoSampleDuration,d,f,g=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,C=!1;if(!n||c===null){const S=t*s,F=o[0].pts-Yt(o[0].dts,o[0].pts);Sn&&c!==null&&Math.abs(S-F-c)<15e3?n=!0:c=S-F}const Q=A.baseTime*s/A.timescale;for(let S=0;S<l;S++){const F=o[S];F.pts=Yt(F.pts-Q,c),F.dts=Yt(F.dts-Q,c),F.dts<o[S>0?S-1:S].dts&&(C=!0)}C&&o.sort(function(S,F){const J=S.dts-F.dts,Y=S.pts-F.pts;return J||Y}),d=o[0].dts,f=o[o.length-1].dts;const b=f-d,v=b?Math.round(b/(l-1)):h||e.inputTimeScale/30;if(n){const S=d-c,F=S>v,J=S<-1;if((F||J)&&(F?U.warn(`AVC: ${pi(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${pi(-S,!0)} ms (${S}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!J||c>=o[0].pts||Sn)){d=c;const Y=o[0].pts-S;if(F)o[0].dts=d,o[0].pts=Y;else for(let ne=0;ne<o.length&&!(o[ne].dts>Y);ne++)o[ne].dts-=S,o[ne].pts-=S;U.log(`Video: Initial PTS/DTS adjusted: ${pi(Y,!0)}/${pi(d,!0)}, delta: ${pi(S,!0)} ms`)}}d=Math.max(0,d);let x=0,R=0,k=d;for(let S=0;S<l;S++){const F=o[S],J=F.units,Y=J.length;let ne=0;for(let ce=0;ce<Y;ce++)ne+=J[ce].data.length;R+=ne,x+=Y,F.length=ne,F.dts<k?(F.dts=k,k+=v/4|0||1):k=F.dts,g=Math.min(F.pts,g),p=Math.max(F.pts,p)}f=o[l-1].dts;const $=R+4*x+8;let K;try{K=new Uint8Array($)}catch(S){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:S,bytes:$,reason:`fail allocating video mdat ${$}`});return}const O=new DataView(K.buffer);O.setUint32(0,$),K.set(G.types.mdat,4);let W=!1,ie=Number.POSITIVE_INFINITY,te=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let S=0;S<l;S++){const F=o[S],J=F.units;let Y=0;for(let pe=0,ge=J.length;pe<ge;pe++){const Se=J[pe],Le=Se.data,Ge=Se.data.byteLength;O.setUint32(u,Ge),u+=4,K.set(Le,u),u+=Ge,Y+=4+Ge}let ne;if(S<l-1)h=o[S+1].dts-F.dts,ne=o[S+1].pts-F.pts;else{const pe=this.config,ge=S>0?F.dts-o[S-1].dts:v;if(ne=S>0?F.pts-o[S-1].pts:v,pe.stretchShortVideoTrack&&this.nextAudioPts!==null){const Se=Math.floor(pe.maxBufferHole*s),Le=(i?g+i*s:this.nextAudioPts)-F.pts;Le>Se?(h=Le-ge,h<0?h=ge:W=!0,U.log(`[mp4-remuxer]: It is approximately ${Le/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ge}else h=ge}const ce=Math.round(F.pts-F.dts);ie=Math.min(ie,h),le=Math.max(le,h),te=Math.min(te,ne),D=Math.max(D,ne),a.push(new Ju(F.key,h,Y,ce))}if(a.length){if(Sn){if(Sn<70){const S=a[0].flags;S.dependsOn=2,S.isNonSync=0}}else if(_a&&D-te<le-ie&&v/le<.025&&a[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let S=d;for(let F=0,J=a.length;F<J;F++){const Y=S+a[F].duration,ne=S+a[F].cts;if(F<J-1){const ce=Y+a[F+1].cts;a[F].duration=ce-ne}else a[F].duration=F?a[F-1].duration:v;a[F].cts=0,S=Y}}}h=W||!h?v:h,this.nextAvcDts=c=f+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const _={data1:G.moof(e.sequenceNumber++,d,it({},e,{samples:a})),data2:K,startPTS:g/s,endPTS:(p+h)/s,startDTS:d/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,_}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return pI;case"ac3":return mI;default:return Yu}}remuxAudio(e,t,n,i,s){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,A=this.getSamplesPerFrame(e),c=A*l,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],f=s!==void 0;let g=e.samples,p=h?0:8,C=this.nextAudioPts||-1;const Q=t*o,b=u.baseTime*o/u.timescale;if(this.isAudioContiguous=n=n||g.length&&C>0&&(i&&Math.abs(Q-C)<9e3||Math.abs(Yt(g[0].pts-b,Q)-C)<20*c),g.forEach(function(P){P.pts=Yt(P.pts-b,Q)}),!n||C<0){if(g=g.filter(P=>P.pts>=0),!g.length)return;s===0?C=0:i&&!f?C=Math.max(0,Q):C=g[0].pts}if(e.segmentCodec==="aac"){const P=this.config.maxAudioFramesDrift;for(let X=0,_=C;X<g.length;X++){const S=g[X],F=S.pts,J=F-_,Y=Math.abs(1e3*J/o);if(J<=-P*c&&f)X===0&&(U.warn(`Audio frame @ ${(F/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*J/o)} ms.`),this.nextAudioPts=C=_=F);else if(J>=P*c&&Y<gI&&f){let ne=Math.round(J/c);_=F-ne*c,_<0&&(ne--,_+=c),X===0&&(this.nextAudioPts=C=_),U.warn(`[mp4-remuxer]: Injecting ${ne} audio frame @ ${(_/o).toFixed(3)}s due to ${Math.round(1e3*J/o)} ms gap.`);for(let ce=0;ce<ne;ce++){const pe=Math.max(_,0);let ge=Hu.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ge||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=S.unit.subarray()),g.splice(X,0,{unit:ge,pts:pe}),_+=c,X++}}S.pts=_,_+=c}}let v=null,x=null,R,k=0,$=g.length;for(;$--;)k+=g[$].unit.byteLength;for(let P=0,X=g.length;P<X;P++){const _=g[P],S=_.unit;let F=_.pts;if(x!==null){const Y=d[P-1];Y.duration=Math.round((F-x)/l)}else if(n&&e.segmentCodec==="aac"&&(F=C),v=F,k>0){k+=p;try{R=new Uint8Array(k)}catch(Y){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:Y,bytes:k,reason:`fail allocating audio mdat ${k}`});return}h||(new DataView(R.buffer).setUint32(0,k),R.set(G.types.mdat,4))}else return;R.set(S,p);const J=S.byteLength;p+=J,d.push(new Ju(!0,A,J,0)),x=F}const K=d.length;if(!K)return;const O=d[d.length-1];this.nextAudioPts=C=x+l*O.duration;const W=h?new Uint8Array(0):G.moof(e.sequenceNumber++,v/l,it({},e,{samples:d}));e.samples=[];const ie=v/o,te=C/o,D={data1:W,data2:R,startPTS:ie,endPTS:te,startDTS:ie,endDTS:te,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,D}remuxEmptyAudio(e,t,n,i){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,a=s/o,l=this.nextAudioPts,A=this._initDTS,c=A.baseTime*9e4/A.timescale,u=(l!==null?l:i.startDTS*s)+c,h=i.endDTS*s+c,d=a*Yu,f=Math.ceil((h-u)/d),g=Hu.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),!g){U.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let C=0;C<f;C++){const Q=u+C*d;p.push({unit:g,pts:Q,dts:Q})}return e.samples=p,this.remuxAudio(e,t,n,!1)}}function Yt(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function EI(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function Vu(r,e,t,n){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const l=r.samples[a];l.pts=Yt(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=Yt(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function Ku(r,e,t){const n=r.samples.length;if(!n)return;const i=r.inputTimeScale;for(let o=0;o<n;o++){const a=r.samples[o];a.pts=Yt(a.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((o,a)=>o.pts-a.pts);const s=r.samples;return r.samples=[],{samples:s}}class Ju{constructor(e,t,n,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class II{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,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(Qm(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=Uc(e);i.audio&&(t=Wu(i.audio,He.AUDIO)),i.video&&(n=Wu(i.video,He.VIDEO));const s={};i.audio&&i.video?s.audiovideo={container:"video/mp4",codec:t+","+n,initSegment:e,id:"main"}:i.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?s.video={container:"video/mp4",codec:n,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,n,i,s,o){var a,l;let{initPTS:A,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};he(c)||(c=this.lastEndTime=s||0);const h=t.samples;if(!(h!=null&&h.length))return u;const d={initPTS:void 0,timescale:1};let f=this.initData;if((a=f)!=null&&a.length||(this.generateInitSegment(h),f=this.initData),!((l=f)!=null&&l.length))return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=xm(h,f),p=bm(f,h),C=p===null?s:p;(CI(A,C,s,g)||d.timescale!==A.timescale&&o)&&(d.initPTS=C-s,A&&A.timescale===1&&U.warn(`Adjusting initPTS by ${d.initPTS-A.baseTime}`),this.initPTS=A={baseTime:d.initPTS,timescale:1});const Q=e?C-A.baseTime/A.timescale:c,b=Q+g;Sm(f,h,A.baseTime/A.timescale),g>0?this.lastEndTime=b:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const v=!!f.audio,x=!!f.video;let R="";v&&(R+="audio"),x&&(R+="video");const k={data1:h,startPTS:Q,startDTS:Q,endPTS:b,endDTS:b,type:R,hasAudio:v,hasVideo:x,nb:1,dropped:0};return u.audio=k.type==="audio"?k:void 0,u.video=k.type!=="audio"?k:void 0,u.initSegment=d,u.id3=Vu(n,s,A,A),i.samples.length&&(u.text=Ku(i,s,A)),u}}function CI(r,e,t,n){if(r===null)return!0;const i=Math.max(n,1),s=e-r.baseTime/r.timescale;return Math.abs(s-t)>i}function Wu(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===He.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Es(t,!1);const n="mp4a.40.5";return U.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${n}"`),n}return U.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let br;try{br=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),br=vn==null?void 0:vn.Date.now}const Fs=[{demux:sI,remux:II},{demux:Pr,remux:Ls},{demux:nI,remux:Ls},{demux:hI,remux:Ls}];Fs.splice(2,0,{demux:oI,remux:Ls});class qu{constructor(e,t,n,i,s){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=n,this.vendor=i,this.id=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=br();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:A,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=i||a,{audioCodec:g,videoCodec:p,defaultInitPts:C,duration:Q,initSegmentData:b}=l,v=vI(o,t);if(v&&v.method==="AES-128"){const $=this.getDecrypter();if($.isSync()){let K=$.softwareDecrypt(o,v.key.buffer,v.iv.buffer);if(n.part>-1&&(K=$.flush()),!K)return s.executeEnd=br(),La(n);o=new Uint8Array(K)}else return this.decryptionPromise=$.webCryptoDecrypt(o,v.key.buffer,v.iv.buffer).then(K=>{const O=this.push(K,null,n);return this.decryptionPromise=null,O}),this.decryptionPromise}const x=this.needsProbing(c,u);if(x){const $=this.configureTransmuxer(o);if($)return U.warn(`[transmuxer] ${$.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:$,reason:$.message}),s.executeEnd=br(),La(n)}(c||u||f||x)&&this.resetInitSegment(b,g,p,Q,t),(c||f||x)&&this.resetInitialTimestamp(C),A||this.resetContiguity();const R=this.transmux(o,v,d,h,n),k=this.currentTransmuxState;return k.contiguous=!0,k.discontinuity=!1,k.trackSwitch=!1,s.executeEnd=br(),R}flush(e){const t=e.transmuxing;t.executeStart=br();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return s.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const u=n.flush();u&&o.push(this.push(u,null,e))}const{demuxer:l,remuxer:A}=this;if(!l||!A)return t.executeEnd=br(),[La(e)];const c=l.flush(a);return ks(c)?c.then(u=>(this.flushRemux(o,u,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:A}=this.currentTransmuxState;U.log(`[transmuxer.ts]: Flushed fragment ${n.sn}${n.part>-1?" p: "+n.part:""} of level ${n.level}`);const c=this.remuxer.remux(i,s,o,a,A,l,!0,this.id);e.push({remuxResult:c,chunkMeta:n}),n.transmuxing.executeEnd=br()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,s):o=this.transmuxUnencrypted(e,n,i,s),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i,vendor:s}=this;let o;for(let h=0,d=Fs.length;h<d;h++){var a;if((a=Fs[h].demux)!=null&&a.probe(e)){o=Fs[h];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,A=this.remuxer,c=o.remux,u=o.demux;(!A||!(A instanceof c))&&(this.remuxer=new c(n,t,i,s)),(!l||!(l instanceof u))&&(this.demuxer=new u(n,t,i),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Ta(this.config)),e}}function vI(r,e){let t=null;return r.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const La=r=>({remuxResult:{},chunkMeta:r});function ks(r){return"then"in r&&r.then instanceof Function}class yI{constructor(e,t,n,i,s){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=n,this.duration=i,this.defaultInitPts=s||null}}class BI{constructor(e,t,n,i,s,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=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=o}}var Xu={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,A,c){this.fn=l,this.context=A,this.once=c||!1}function s(l,A,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||l,h),f=t?t+A:A;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],d]:l._events[f].push(d):(l._events[f]=d,l._eventsCount++),l}function o(l,A){--l._eventsCount===0?l._events=new n:delete l._events[A]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var A=[],c,u;if(this._eventsCount===0)return A;for(u in c=this._events)e.call(c,u)&&A.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(c)):A},a.prototype.listeners=function(A){var c=t?t+A:A,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,f=new Array(d);h<d;h++)f[h]=u[h].fn;return f},a.prototype.listenerCount=function(A){var c=t?t+A:A,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(A,c,u,h,d,f){var g=t?t+A:A;if(!this._events[g])return!1;var p=this._events[g],C=arguments.length,Q,b;if(p.fn){switch(p.once&&this.removeListener(A,p.fn,void 0,!0),C){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,u),!0;case 4:return p.fn.call(p.context,c,u,h),!0;case 5:return p.fn.call(p.context,c,u,h,d),!0;case 6:return p.fn.call(p.context,c,u,h,d,f),!0}for(b=1,Q=new Array(C-1);b<C;b++)Q[b-1]=arguments[b];p.fn.apply(p.context,Q)}else{var v=p.length,x;for(b=0;b<v;b++)switch(p[b].once&&this.removeListener(A,p[b].fn,void 0,!0),C){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,u);break;case 4:p[b].fn.call(p[b].context,c,u,h);break;default:if(!Q)for(x=1,Q=new Array(C-1);x<C;x++)Q[x-1]=arguments[x];p[b].fn.apply(p[b].context,Q)}}return!0},a.prototype.on=function(A,c,u){return s(this,A,c,u,!1)},a.prototype.once=function(A,c,u){return s(this,A,c,u,!0)},a.prototype.removeListener=function(A,c,u,h){var d=t?t+A:A;if(!this._events[d])return this;if(!c)return o(this,d),this;var f=this._events[d];if(f.fn)f.fn===c&&(!h||f.once)&&(!u||f.context===u)&&o(this,d);else{for(var g=0,p=[],C=f.length;g<C;g++)(f[g].fn!==c||h&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(A){var c;return A?(c=t?t+A:A,this._events[c]&&o(this,c)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(Xu);var TI=Xu.exports,Fa=Jp(TI);class ju{constructor(e,t,n,i){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 s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(A,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,A===I.ERROR&&(this.error=c.error),this.hls.trigger(A,c)};this.observer=new Fa,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=tn(s.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={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"&&(s.workerPath||$E())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=VE(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=YE()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=u=>{const h=new Error(`${u.message} (${u.filename}:${u.lineno})`);s.enableWorker=!1,U.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},c.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(s)})}catch(c){U.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new qu(this.observer,l,s,"",t)}return}this.transmuxer=new qu(this.observer,l,s,"",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,n,i,s,o,a,l,A,c){var u,h;A.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=o?o.start:s.start,g=s.decryptdata,p=this.frag,C=!(p&&s.cc===p.cc),Q=!(p&&A.level===p.level),b=p?A.sn-p.sn:-1,v=this.part?A.part-this.part.index:-1,x=b===0&&A.id>1&&A.id===(p==null?void 0:p.stats.chunkCount),R=!Q&&(b===1||b===0&&(v===1||x&&v<=0)),k=self.performance.now();(Q||b||s.stats.parsing.start===0)&&(s.stats.parsing.start=k),o&&(v||!R)&&(o.stats.parsing.start=k);const $=!(p&&((u=s.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),K=new BI(C,R,l,Q,f,$);if(!R||C||$){U.log(`[transmuxer-interface, ${s.type}]: Starting new transmux session for sn: ${A.sn} p: ${A.part} level: ${A.level} id: ${A.id}
2471
+ discontinuity: ${C}
2472
2472
  trackSwitch: ${Q}
2473
2473
  contiguous: ${R}
2474
2474
  accurateTimeOffset: ${l}
2475
2475
  timeOffset: ${f}
2476
- initSegmentChange: ${H}`);const O=new MC(n,i,t,a,c);this.configureTransmuxer(O)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:A,state:V},e instanceof ArrayBuffer?[e]:[]);else if(d){const O=d.push(e,g,A,V);Ys(O)?(d.async=!0,O.then(W=>{this.handleTransmuxComplete(W)}).catch(W=>{this.transmuxerError(W,A,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(O))}}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 n=t.flush(e);Ys(n)||t.async?(Ys(n)||(n=Promise.resolve(n)),n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){U.warn(`worker message received with no ${t?"event name":"data"}`);return}const n=this.hls;if(this.hls)switch(t.event){case"init":{var i;const s=(i=this.workerContext)==null?void 0:i.objectURL;s&&self.URL.revokeObjectURL(s);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":U[t.data.logType]&&U[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.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 Fh(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Sn(r[t].attrs,e[t].attrs))return!1;return!0}function Sn(r,e,t){const n=r["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function Xa(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const kh=100;class UC extends Ga{constructor(e,t,n){super(e,t,n,"[audio-stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){if(n==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:s},this.log(`InitPTS for cc: ${o} found from main: ${i}`),this.videoTrackCC=o,this.state===re.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=re.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(kh),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=re.IDLE):(this.loadedmetadata=!1,this.state=re.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case re.IDLE:this.doTickIdle();break;case re.WAITING_TRACK:{var e;const{levels:n,trackId:i}=this,s=n==null||(e=n[i])==null?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=re.WAITING_INIT_PTS}break}case re.FRAG_LOADING_WAITING_RETRY:{var t;const n=performance.now(),i=this.retryDate;if(!i||n>=i||(t=this.media)!=null&&t.seeking){const{levels:s,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((s==null?void 0:s[o])||null),this.state=re.IDLE}break}case re.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:i,part:s,cache:o,complete:a}=n;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=re.FRAG_LOADING;const l=o.flush(),A={frag:i,part:s,payload:l,networkDetails:null};this._handleFragmentLoadProgress(A),a&&super._handleFragmentLoadComplete(A)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),A=Ke.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Ma(A.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${A.end} is needed`),this.clearWaitingFragment())}}else this.state=re.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=re.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:n,trackId:i}=this,s=e.config;if(!n&&(this.startFragRequested||!s.startFragPrefetch)||!(t!=null&&t[i]))return;const o=t[i],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=re.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,He.AUDIO,Ee.AUDIO));const A=this.getFwdBufferInfo(l,Ee.AUDIO);if(A===null)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(A,a)){e.trigger(I.BUFFER_EOS,{type:"audio"}),this.state=re.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=A.len,f=this.getMaxBufferLength(h==null?void 0:h.len),g=a.fragments,p=g[0].start;let y=this.flushing?this.getLoadPosition():A.end;if(u&&n){const w=this.getLoadPosition();c&&!Sn(u.attrs,c.attrs)&&(y=w),a.PTSKnown&&w<p&&(A.end>p||A.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=p+.05)}if(d>=f&&!u&&y<g[g.length-1].start)return;let Q=this.getNextFragment(y,a),b=!1;if(Q&&this.isLoopLoading(Q,y)&&(b=!!Q.gap,Q=this.getNextFragmentLoopLoading(Q,a,A,Ee.MAIN,f)),!Q){this.bufferFlushed=!0;return}const v=h&&Q.start>h.end+a.targetduration;if(v||!(h!=null&&h.len)&&A.len){const w=this.getAppendedFrag(Q.start,Ee.MAIN);if(w===null||(b||(b=!!w.gap||!!v&&h.len===0),v&&!b||b&&A.nextStart&&A.nextStart<w.end))return}this.loadFragment(Q,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(n=>new yn(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?this.setInterval(kh):this.resetTransmuxer(),n?(this.switchingTrack=t,this.state=re.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=re.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(I.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var n;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:s,id:o}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const a=i[o];let l=0;if(s.live||(n=a.details)!=null&&n.live){this.checkLiveUpdate(s);const c=this.mainDetails;if(s.deltaUpdateFailed||!c)return;if(!a.details&&s.hasProgramDateTime&&c.hasProgramDateTime)Ps(s,c),l=s.fragments[0].start;else{var A;l=this.alignPlaylists(s,a.details,(A=this.levelLastLoaded)==null?void 0:A.details)}}a.details=s,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!s.live)&&this.setStartPosition(this.mainDetails||s,l),this.state===re.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=re.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const A=l[a];if(!A){this.warn("Audio track is undefined on fragment load progress");return}const c=A.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const u=o.defaultAudioCodec||A.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Lh(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=(t=n.initSegment)==null?void 0:t.data;if(d!==void 0){const p=i?i.index:-1,y=p!==-1,Q=new Oa(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,y);h.push(s,f,u,"",n,i,c.totalduration,!1,Q,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:g}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new uh,complete:!1};g.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=re.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==Ee.AUDIO){if(!this.loadedmetadata&&n.type===Ee.MAIN){const s=this.videoBuffer||this.media;s&&Ke.getBuffered(s).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(n.sn!=="initSegment"){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,ht({},s)))}this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===Oe.AUDIO_TRACK&&(this.state=re.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==He.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==He.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===re.ENDED&&(this.state=re.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,Ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{details:u}=c,{audio:h,text:d,id3:f,initSegment:g}=s;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const p=l.initSegment||l;this._bufferInitSegment(c,g.tracks,p,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:n,tracks:g.tracks})}if(h){const{startPTS:p,endPTS:y,startDTS:Q,endDTS:b}=h;A&&(A.elementaryStreams[He.AUDIO]={startPTS:p,endPTS:y,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo(He.AUDIO,p,y,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=it({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=it({id:n,frag:l,details:u},d);i.trigger(I.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;t.video&&delete t.video;const s=t.audio;if(!s)return;s.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${o}/${s.codec}]`),o&&o.split(",").length===1&&(s.levelCodec=o),this.hls.trigger(I.BUFFER_CODECS,t);const a=s.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(I.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===dt.NOT_LOADED||i===dt.PARTIAL){var s;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.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=re.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&Ps(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:n}=this,i=n==null?void 0:n.attrs,s=e.attrs;t&&i&&(i.CHANNELS!==s.CHANNELS||n.name!==e.name||n.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(I.AUDIO_TRACK_SWITCHED,ht({},e))}}class GC extends Pa{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!n||n.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,d)=>{h.id=d});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const l=this.hls.config.audioPreference;if(!s&&l){const h=cr(l,a,Qn);if(h>-1)s=a[h];else{const d=cr(l,this.tracks);s=this.tracks[d]}}let A=this.findTrackId(s);A===-1&&s&&(A=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(A!==-1&&u===-1)this.setAudioTrack(A);else if(a.length&&u===-1){var o;const h=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(h.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(s)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Tn(e,i,Qn))return i;const s=cr(e,this.tracksInGroup,Qn);if(s>-1){const o=this.tracksInGroup[s];return this.setAudioTrack(s),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=GI(e,t.levels,n,o,Qn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=cr(e,n);if(o>-1)return n[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 n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,ht({},i)),s))return;const o=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Tn(e,i,Qn)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l}=e;for(let A=0;A<t.length;A++){const c=t[A];if(Tn({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},c,Qn))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE"]))return A}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${n} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}}const Nh=500;class HC extends Ga{constructor(e,t,n){super(e,t,n,"[subtitle-stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=re.IDLE,this.setInterval(Nh),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:n,success:i}=t;if(this.fragPrevious=n,this.state=re.IDLE,!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o;const a=n.start;for(let A=0;A<s.length;A++)if(a>=s[A].start&&a<=s[A].end){o=s[A];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},s.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null)}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=s){o.shift();continue}else if(o[a].start<s)o[a].start=s;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(n,s,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var n;(n=this.media)!=null&&n.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===Ee.SUBTITLE&&(t.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==re.STOPPED&&(this.state=re.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Fh(this.levels,t)){this.levels=t.map(n=>new yn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new yn(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(Nh)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:o,id:a}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=s[a];if(a>=s.length||!l)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 A=0;if(o.live||(n=l.details)!=null&&n.live){const u=this.mainDetails;if(o.deltaUpdateFailed||!u)return;const h=u.fragments[0];if(!l.details)o.hasProgramDateTime&&u.hasProgramDateTime?(Ps(o,u),A=o.fragments[0].start):h&&(A=h.start,ka(o,A));else{var c;A=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details),A===0&&h&&(A=h.start,ka(o,A))}}l.details=o,this.levelLastLoaded=l,a===i&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,A),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===re.IDLE&&(Fs(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch(a=>{throw s.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();s.trigger(I.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=re.IDLE})}}doTick(){if(!this.media){this.state=re.IDLE;return}if(this.state===re.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details)return;const{config:i}=this,s=this.getLoadPosition(),o=Ke.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:a,len:l}=o,A=this.getFwdBufferInfo(this.media,Ee.MAIN),c=n.details,u=this.getMaxBufferLength(A==null?void 0:A.len)+c.levelTargetDuration;if(l>u)return;const h=c.fragments,d=h.length,f=c.edge;let g=null;const p=this.fragPrevious;if(a<f){const y=i.maxFragLookUpTolerance,Q=a>f-y?0:y;g=Fs(p,h,Math.max(h[0].start,a),Q),!g&&p&&p.start<h[0].start&&(g=h[0])}else g=h[d-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const y=g.sn-c.startSN,Q=h[y-1];Q&&Q.cc===g.cc&&this.fragmentTracker.getState(Q)===dt.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===dt.NOT_LOADED&&this.loadFragment(g,n,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,n){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,n))}get mediaBufferTimeRanges(){return new $C(this.tracksBuffered[this.currentTrackId]||[])}}class $C{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}class YC extends Pa{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 n=ws(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.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),ws(this.media.textTracks).forEach(t=>{vn(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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!n||n.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,u)=>{c.id=u});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!s&&a){this.selectDefaultTrack=!1;const c=cr(a,o);if(c>-1)s=o[c];else{const u=cr(a,this.tracks);s=this.tracks[u]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const A={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,A),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(s)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||Tn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(Xa(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.currentTrack;if(n&&Tn(e,n))return n;const i=cr(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=cr(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${n}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=ws(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>Xa(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!he(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:A,url:c}=i;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:A,url:c});const u=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(u)}}class VC{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,n){const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const n=new Promise(s=>{t=s}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),n}executeNext(e){const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(i){U.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),n.onError(i);const s=this.buffers[e];s!=null&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Mh=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class KC{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=n=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:n,mediaSource:i}=this;this.log("Media source opened"),n&&(n.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:n,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&U.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=tI(tn(e.config.preferManagedMediaSource)),this.log=U.log.bind(U,t),this.warn=U.warn.bind(U,t),this.error=U.error.bind(U,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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.BUFFER_EOS,this.onBufferEos,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.FRAG_PARSED,this.onFragParsed,this),e.on(I.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_EOS,this.onBufferEos,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.FRAG_PARSED,this.onFragParsed,this),e.off(I.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new VC(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 n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const n=this.media=t.media,i=tn(this.appendSource);if(n&&i){var s;const o=this.mediaSource=new i;this.log(`created media source: ${(s=o.constructor)==null?void 0:s.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{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,Ph(n),JC(n,a),n.load()}catch{n.src=a}else n.src=a;n.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:n}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.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),n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(e.removeAttribute("src"),this.appendSource&&Ph(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(I.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 n;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const n=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(o=>{if(n){const l=this.tracks[o];if(l&&typeof l.buffer.changeType=="function"){var a;const{id:A,codec:c,levelCodec:u,container:h,metadata:d}=t[o],f=_u(l.codec,l.levelCodec),g=f==null?void 0:f.replace(Mh,"$1");let p=_u(c,u);const y=(a=p)==null?void 0:a.replace(Mh,"$1");if(p&&g!==y){o.slice(0,5)==="audio"&&(p=xs(p,this.appendSource));const Q=`${h};codecs=${p}`;this.appendChangeType(o,Q),this.log(`switching codec ${f} to ${p}`),this.tracks[o]={buffer:l.buffer,codec:c,container:h,levelCodec:u,metadata:d,id:A}}}}else this.pendingTracks[o]=t[o]}),n)return;const s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(`${s} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=s),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:n}=this,i={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),n.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};n.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:n,operationQueue:i,tracks:s}=this,{data:o,type:a,frag:l,part:A,chunkMeta:c}=t,u=c.buffering[a],h=self.performance.now();u.start=h;const d=l.stats.buffering,f=A?A.stats.buffering:null;d.start===0&&(d.start=h),f&&f.start===0&&(f.start=h);const g=s.audio;let p=!1;a==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=l.start,Q={execute:()=>{if(u.executeStart=self.performance.now(),p){const b=this.sourceBuffer[a];if(b){const v=y-b.timestampOffset;Math.abs(v)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${y} (delta: ${v}) sn: ${l.sn})`),b.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();u.executeEnd=u.end=b,d.first===0&&(d.first=b),f&&f.first===0&&(f.first=b);const{sourceBuffer:v}=this,w={};for(const R in v)w[R]=Ke.getBuffered(v[R]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:a,frag:l,part:A,chunkMeta:c,parent:l.type,timeRanges:w})},onError:b=>{const v={type:Be.MEDIA_ERROR,parent:l.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:l,part:A,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)v.details=K.BUFFER_FULL_ERROR;else{const w=++this.appendErrors[a];v.details=K.BUFFER_APPEND_ERROR,this.warn(`Failed ${w}/${n.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),w>=n.config.appendErrorMaxRetry&&(v.fatal=!0)}n.trigger(I.ERROR,v)}};i.append(Q,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:n}=this,i=s=>({execute:this.removeExecutor.bind(this,s,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:s})},onError:o=>{this.warn(`Failed to remove from ${s} SourceBuffer`,o)}});t.type?n.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(s=>{n.append(i(s),s)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],o=i?i.elementaryStreams:n.elementaryStreams;o[He.AUDIOVIDEO]?s.push("audiovideo"):(o[He.AUDIO]&&s.push("audio"),o[He.VIDEO]&&s.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const A=i?i.stats:n.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:n,part:i,stats:A,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,s)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,s)=>{const o=this.sourceBuffer[s];return o&&(!t.type||t.type===s)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${s} sourceBuffer now EOS`))),i&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(s=>{const o=this.sourceBuffer[s];o&&(o.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.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:n}=this;if(!n||t===null||!this.getSourceBufferTypes().length)return;const s=e.config,o=n.currentTime,a=t.levelTargetDuration,l=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(he(l)&&l>0){const A=Math.max(l,a),c=Math.floor(o/a)*a-A;this.flushBackBuffer(o,a,c)}if(he(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const A=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),c=Math.max(A,a),u=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,u)}}flushBackBuffer(e,t,n){const{details:i,sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const l=s[a];if(l){const A=Ke.getBuffered(l);if(A.length>0&&n>A.start(0)){if(this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:n}),i!=null&&i.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l.ended&&A.end(A.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:a})}}})}flushFrontBuffer(e,t,n){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(o=>{const a=i[o];if(a){const l=Ke.getBuffered(a),A=l.length;if(A<2)return;const c=l.start(A-1),u=l.end(A-1);if(n>c||e>=c&&e<=u)return;if(a.ended&&e-u<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.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:n,mediaSource:i}=this,s=e.fragments[0].start+e.totalduration,o=n.duration,a=he(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(s>a&&s>o||!he(o))&&(this.log(`Updating Media Source duration to ${s.toFixed(3)}`),i.duration=s)}updateSeekableRange(e){const t=this.mediaSource,n=e.fragments;if(n.length&&e.live&&t!=null&&t.setLiveSeekableRange){const s=Math.max(0,n[0].start),o=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${o}.`),t.setLiveSeekableRange(s,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:n}=this,i=Object.keys(n).length;if(i&&(!e||i===2||"audiovideo"in n)){this.createSourceBuffers(n),this.pendingTracks={};const s=this.getSourceBufferTypes();if(s.length)this.hls.trigger(I.BUFFER_CREATED,{tracks:this.tracks}),s.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:n}=this;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){var i;const o=e[s];if(!o)throw Error(`source buffer exists for track ${s}, however track does not`);let a=((i=o.levelCodec)==null?void 0:i.indexOf(","))===-1?o.levelCodec:o.codec;a&&s.slice(0,5)==="audio"&&(a=xs(a,this.appendSource));const l=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${l})`);try{const A=t[s]=n.addSourceBuffer(l),c=s;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(c,"bufferedchange",(u,h)=>{const d=h.removedRanges;d!=null&&d.length&&this.hls.trigger(I.BUFFER_FLUSHED,{type:s})}),this.tracks[s]={buffer:A,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:s,mimeType:l})}}}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:n}=this;n.current(e).onComplete(),n.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.operationQueue.current(e);s&&s.onError(i)}removeExecutor(e,t,n){const{media:i,mediaSource:s,operationQueue:o,sourceBuffer:a}=this,l=a[e];if(!i||!s||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const A=he(i.duration)?i.duration:1/0,c=he(s.duration)?s.duration:1/0,u=Math.max(0,t),h=Math.min(n,A,c);h>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.sourceBuffer[t];if(!n){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}n.ended=!1,n.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:n}=this,i=t.map(s=>n.appendBlocker(s));Promise.all(i).then(()=>{e(),t.forEach(s=>{const o=this.sourceBuffer[s];o!=null&&o.updating||n.shiftAndExecuteNext(s)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,n){const i=this.sourceBuffer[e];if(!i)return;const s=n.bind(this,e);this.listeners[e].push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(n=>{t.removeEventListener(n.event,n.listener)})}}function Ph(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function JC(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const WC={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},Oh=r=>String.fromCharCode(WC[r]||r),er=15,xr=100,qC={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},jC={17:2,18:4,21:6,22:8,23:10,19:13,20:15},XC={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},zC={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ZC=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ev{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;U.log(`${this.time} [${e}] ${n}`)}}}const rn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Uh{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}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 tv{constructor(){this.uchar=" ",this.penState=new Uh}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 rv{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Uh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xr;t++)this.chars.push(new tv);this.logger=e}equals(e){for(let t=0;t<xr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xr;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>xr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=Oh(e);if(this.pos>=xr){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<xr;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 n=0;n<xr;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class za{constructor(e){this.rows=[],this.currRow=er-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<er;t++)this.rows.push(new rv(e));this.logger=e}reset(){for(let e=0;e<er;e++)this.rows[e].clear();this.currRow=er-1}equals(e){let t=!0;for(let n=0;n<er;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<er;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<er;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<er;a++)this.rows[a].clear();const s=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[s].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let A=0;A<this.nrRollUpRows;A++)this.rows[t-this.nrRollUpRows+A+1].copy(o.rows[s+A])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,o=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}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 n="",i=-1;for(let s=0;s<er;s++){const o=this.rows[s].getTextString();o&&(i=s+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
2477
- `)),n}getTextAndFormat(){return this.rows}}class Gh{constructor(e,t,n){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 za(n),this.nonDisplayedMemory=new za(n),this.lastOutputScreen=new za(n),this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[er-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}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 Hh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=iv(),this.logger=void 0;const i=this.logger=new ev;this.channels=[null,new Gh(e,t,i),new Gh(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let o=!1,a=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+rn([t[n],t[n+1]])+"] -> ("+rn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(nv(i,s,l)){Vs(null,null,l),this.logger.log(3,()=>"Repeated command ("+rn([i,s])+") is dropped");continue}Vs(i,s,this.cmdHistory),o=this.parseCmd(i,s),o||(o=this.parseMidrow(i,s)),o||(o=this.parsePAC(i,s)),o||(o=this.parseBackgroundAttributes(i,s))}else Vs(null,null,l);if(!o&&(a=this.parseChars(i,s),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 "+rn([i,s])+" orig: "+rn([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,o=this.channels[s];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=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+rn([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?qC[e]:XC[e]:n=o===1?jC[e]:zC[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let o;s===17?o=t+80:s===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+Oh(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+rn(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const o={};e===16||e===24?(s=Math.floor((t-32)/2),o.background=ZC[s],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()}Vs(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function Vs(r,e,t){t.a=r,t.b=e}function nv(r,e,t){return t.a===r&&t.b===e}function iv(){return{a:null,b:null}}class Ks{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Za=function(){if(Cn!=null&&Cn.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const A=l.toLowerCase();return~a.indexOf(A)?A:!1}function n(a){return t(r,a)}function i(a){return t(e,a)}function s(a,...l){let A=1;for(;A<arguments.length;A++){const c=arguments[A];for(const u in c)a[u]=c[u]}return a}function o(a,l,A){const c=this,u={enumerable:!0};c.hasBeenReset=!1;let h="",d=!1,f=a,g=l,p=A,y=null,Q="",b=!0,v="auto",w="start",R=50,k="middle",H=50,V="middle";Object.defineProperty(c,"id",s({},u,{get:function(){return h},set:function(O){h=""+O}})),Object.defineProperty(c,"pauseOnExit",s({},u,{get:function(){return d},set:function(O){d=!!O}})),Object.defineProperty(c,"startTime",s({},u,{get:function(){return f},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");f=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},u,{get:function(){return g},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");g=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},u,{get:function(){return p},set:function(O){p=""+O,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},u,{get:function(){return y},set:function(O){y=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},u,{get:function(){return Q},set:function(O){const W=n(O);if(W===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},u,{get:function(){return b},set:function(O){b=!!O,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},u,{get:function(){return v},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");v=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},u,{get:function(){return w},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");w=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},u,{get:function(){return R},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");R=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},u,{get:function(){return k},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");k=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},u,{get:function(){return H},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");H=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},u,{get:function(){return V},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");V=W,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class sv{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function $h(r){function e(n,i,s,o){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(o||0)}const t=r.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 ov{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function Yh(r,e,t,n){const i=n?r.split(n):[r];for(const s in i){if(typeof i[s]!="string")continue;const o=i[s].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const el=new Za(0,0,""),Js=el.align==="middle"?"middle":"center";function av(r,e,t){const n=r;function i(){const a=$h(r);if(a===null)throw new Error("Malformed timestamp: "+n);return r=r.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,l){const A=new ov;Yh(a,function(h,d){let f;switch(h){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===d){A.set(h,t[g].region);break}break;case"vertical":A.alt(h,d,["rl","lr"]);break;case"line":f=d.split(","),A.integer(h,f[0]),A.percent(h,f[0])&&A.set("snapToLines",!1),A.alt(h,f[0],["auto"]),f.length===2&&A.alt("lineAlign",f[1],["start",Js,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Js,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Js,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&el.line===-1&&(c=-1),l.line=c,l.lineAlign=A.get("lineAlign","start"),l.snapToLines=A.get("snapToLines",!0),l.size=A.get("size",100),l.align=A.get("align",Js);let u=A.get("position","auto");u==="auto"&&el.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function o(){r=r.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);r=r.slice(3),o(),e.endTime=i(),o(),s(r,e)}function Vh(r){return r.replace(/<br(?: \/)?>/gi,`
2478
- `)}class lv{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new sv,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 n(){let s=t.buffer,o=0;for(s=Vh(s);o<s.length&&s[o]!=="\r"&&s[o]!==`
2476
+ initSegmentChange: ${$}`);const O=new yI(n,i,t,a,c);this.configureTransmuxer(O)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:A,state:K},e instanceof ArrayBuffer?[e]:[]);else if(d){const O=d.push(e,g,A,K);ks(O)?(d.async=!0,O.then(W=>{this.handleTransmuxComplete(W)}).catch(W=>{this.transmuxerError(W,A,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(O))}}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 n=t.flush(e);ks(n)||t.async?(ks(n)||(n=Promise.resolve(n)),n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){U.warn(`worker message received with no ${t?"event name":"data"}`);return}const n=this.hls;if(this.hls)switch(t.event){case"init":{var i;const s=(i=this.workerContext)==null?void 0:i.objectURL;s&&self.URL.revokeObjectURL(s);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":U[t.data.logType]&&U[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.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 zu(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Rn(r[t].attrs,e[t].attrs))return!1;return!0}function Rn(r,e,t){const n=r["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function ka(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const Zu=100;class QI extends Qa{constructor(e,t,n){super(e,t,n,"[audio-stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){if(n==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:s},this.log(`InitPTS for cc: ${o} found from main: ${i}`),this.videoTrackCC=o,this.state===re.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=re.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Zu),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=re.IDLE):(this.loadedmetadata=!1,this.state=re.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case re.IDLE:this.doTickIdle();break;case re.WAITING_TRACK:{var e;const{levels:n,trackId:i}=this,s=n==null||(e=n[i])==null?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=re.WAITING_INIT_PTS}break}case re.FRAG_LOADING_WAITING_RETRY:{var t;const n=performance.now(),i=this.retryDate;if(!i||n>=i||(t=this.media)!=null&&t.seeking){const{levels:s,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((s==null?void 0:s[o])||null),this.state=re.IDLE}break}case re.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:i,part:s,cache:o,complete:a}=n;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=re.FRAG_LOADING;const l=o.flush(),A={frag:i,part:s,payload:l,networkDetails:null};this._handleFragmentLoadProgress(A),a&&super._handleFragmentLoadComplete(A)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),A=Je.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);va(A.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${A.end} is needed`),this.clearWaitingFragment())}}else this.state=re.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=re.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:n,trackId:i}=this,s=e.config;if(!n&&(this.startFragRequested||!s.startFragPrefetch)||!(t!=null&&t[i]))return;const o=t[i],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=re.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,He.AUDIO,Ee.AUDIO));const A=this.getFwdBufferInfo(l,Ee.AUDIO);if(A===null)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(A,a)){e.trigger(I.BUFFER_EOS,{type:"audio"}),this.state=re.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=A.len,f=this.getMaxBufferLength(h==null?void 0:h.len),g=a.fragments,p=g[0].start;let C=this.flushing?this.getLoadPosition():A.end;if(u&&n){const x=this.getLoadPosition();c&&!Rn(u.attrs,c.attrs)&&(C=x),a.PTSKnown&&x<p&&(A.end>p||A.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=p+.05)}if(d>=f&&!u&&C<g[g.length-1].start)return;let Q=this.getNextFragment(C,a),b=!1;if(Q&&this.isLoopLoading(Q,C)&&(b=!!Q.gap,Q=this.getNextFragmentLoopLoading(Q,a,A,Ee.MAIN,f)),!Q){this.bufferFlushed=!0;return}const v=h&&Q.start>h.end+a.targetduration;if(v||!(h!=null&&h.len)&&A.len){const x=this.getAppendedFrag(Q.start,Ee.MAIN);if(x===null||(b||(b=!!x.gap||!!v&&h.len===0),v&&!b||b&&A.nextStart&&A.nextStart<x.end))return}this.loadFragment(Q,o,C)}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(n=>new Bn(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?this.setInterval(Zu):this.resetTransmuxer(),n?(this.switchingTrack=t,this.state=re.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=re.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(I.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var n;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:s,id:o}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const a=i[o];let l=0;if(s.live||(n=a.details)!=null&&n.live){this.checkLiveUpdate(s);const c=this.mainDetails;if(s.deltaUpdateFailed||!c)return;if(!a.details&&s.hasProgramDateTime&&c.hasProgramDateTime)Ss(s,c),l=s.fragments[0].start;else{var A;l=this.alignPlaylists(s,a.details,(A=this.levelLastLoaded)==null?void 0:A.details)}}a.details=s,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!s.live)&&this.setStartPosition(this.mainDetails||s,l),this.state===re.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=re.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const A=l[a];if(!A){this.warn("Audio track is undefined on fragment load progress");return}const c=A.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const u=o.defaultAudioCodec||A.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new ju(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=(t=n.initSegment)==null?void 0:t.data;if(d!==void 0){const p=i?i.index:-1,C=p!==-1,Q=new Ba(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,C);h.push(s,f,u,"",n,i,c.totalduration,!1,Q,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:g}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new Su,complete:!1};g.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=re.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==Ee.AUDIO){if(!this.loadedmetadata&&n.type===Ee.MAIN){const s=this.videoBuffer||this.media;s&&Je.getBuffered(s).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(n.sn!=="initSegment"){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,ht({},s)))}this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===Oe.AUDIO_TRACK&&(this.state=re.IDLE);break;case V.BUFFER_APPEND_ERROR:case V.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===V.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==He.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==He.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===re.ENDED&&(this.state=re.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,Ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{details:u}=c,{audio:h,text:d,id3:f,initSegment:g}=s;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const p=l.initSegment||l;this._bufferInitSegment(c,g.tracks,p,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:n,tracks:g.tracks})}if(h){const{startPTS:p,endPTS:C,startDTS:Q,endDTS:b}=h;A&&(A.elementaryStreams[He.AUDIO]={startPTS:p,endPTS:C,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo(He.AUDIO,p,C,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=it({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=it({id:n,frag:l,details:u},d);i.trigger(I.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;t.video&&delete t.video;const s=t.audio;if(!s)return;s.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${o}/${s.codec}]`),o&&o.split(",").length===1&&(s.levelCodec=o),this.hls.trigger(I.BUFFER_CODECS,t);const a=s.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(I.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===dt.NOT_LOADED||i===dt.PARTIAL){var s;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.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=re.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&Ss(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:n}=this,i=n==null?void 0:n.attrs,s=e.attrs;t&&i&&(i.CHANNELS!==s.CHANNELS||n.name!==e.name||n.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(I.AUDIO_TRACK_SWITCHED,ht({},e))}}class bI extends ya{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!n||n.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,d)=>{h.id=d});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const l=this.hls.config.audioPreference;if(!s&&l){const h=cr(l,a,bn);if(h>-1)s=a[h];else{const d=cr(l,this.tracks);s=this.tracks[d]}}let A=this.findTrackId(s);A===-1&&s&&(A=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(A!==-1&&u===-1)this.setAudioTrack(A);else if(a.length&&u===-1){var o;const h=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(h.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(s)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Qn(e,i,bn))return i;const s=cr(e,this.tracksInGroup,bn);if(s>-1){const o=this.tracksInGroup[s];return this.setAudioTrack(s),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=bE(e,t.levels,n,o,bn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=cr(e,n);if(o>-1)return n[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 n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,ht({},i)),s))return;const o=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Qn(e,i,bn)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l}=e;for(let A=0;A<t.length;A++){const c=t[A];if(Qn({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},c,bn))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Rn(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Rn(e.attrs,c.attrs,["LANGUAGE"]))return A}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${n} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}}const eh=500;class xI extends Qa{constructor(e,t,n){super(e,t,n,"[subtitle-stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=re.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:n,success:i}=t;if(this.fragPrevious=n,this.state=re.IDLE,!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o;const a=n.start;for(let A=0;A<s.length;A++)if(a>=s[A].start&&a<=s[A].end){o=s[A];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},s.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null)}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=s){o.shift();continue}else if(o[a].start<s)o[a].start=s;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(n,s,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var n;(n=this.media)!=null&&n.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===Ee.SUBTITLE&&(t.details===V.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==re.STOPPED&&(this.state=re.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&zu(this.levels,t)){this.levels=t.map(n=>new Bn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new Bn(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(eh)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:o,id:a}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=s[a];if(a>=s.length||!l)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 A=0;if(o.live||(n=l.details)!=null&&n.live){const u=this.mainDetails;if(o.deltaUpdateFailed||!u)return;const h=u.fragments[0];if(!l.details)o.hasProgramDateTime&&u.hasProgramDateTime?(Ss(o,u),A=o.fragments[0].start):h&&(A=h.start,Ia(o,A));else{var c;A=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details),A===0&&h&&(A=h.start,Ia(o,A))}}l.details=o,this.levelLastLoaded=l,a===i&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,A),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===re.IDLE&&(Qs(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch(a=>{throw s.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();s.trigger(I.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=re.IDLE})}}doTick(){if(!this.media){this.state=re.IDLE;return}if(this.state===re.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details)return;const{config:i}=this,s=this.getLoadPosition(),o=Je.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:a,len:l}=o,A=this.getFwdBufferInfo(this.media,Ee.MAIN),c=n.details,u=this.getMaxBufferLength(A==null?void 0:A.len)+c.levelTargetDuration;if(l>u)return;const h=c.fragments,d=h.length,f=c.edge;let g=null;const p=this.fragPrevious;if(a<f){const C=i.maxFragLookUpTolerance,Q=a>f-C?0:C;g=Qs(p,h,Math.max(h[0].start,a),Q),!g&&p&&p.start<h[0].start&&(g=h[0])}else g=h[d-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const C=g.sn-c.startSN,Q=h[C-1];Q&&Q.cc===g.cc&&this.fragmentTracker.getState(Q)===dt.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===dt.NOT_LOADED&&this.loadFragment(g,n,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,n){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,n))}get mediaBufferTimeRanges(){return new wI(this.tracksBuffered[this.currentTrackId]||[])}}class wI{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}class SI extends ya{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 n=Is(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.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),Is(this.media.textTracks).forEach(t=>{yn(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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!n||n.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,u)=>{c.id=u});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!s&&a){this.selectDefaultTrack=!1;const c=cr(a,o);if(c>-1)s=o[c];else{const u=cr(a,this.tracks);s=this.tracks[u]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const A={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,A),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(s)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||Qn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Rn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Rn(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(ka(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.currentTrack;if(n&&Qn(e,n))return n;const i=cr(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=cr(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${n}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Is(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>ka(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!he(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:A,url:c}=i;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:A,url:c});const u=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(u)}}class RI{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,n){const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const n=new Promise(s=>{t=s}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),n}executeNext(e){const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(i){U.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),n.onError(i);const s=this.buffers[e];s!=null&&s.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 DI{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=n=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:n,mediaSource:i}=this;this.log("Media source opened"),n&&(n.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:n,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&U.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Um(tn(e.config.preferManagedMediaSource)),this.log=U.log.bind(U,t),this.warn=U.warn.bind(U,t),this.error=U.error.bind(U,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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.BUFFER_EOS,this.onBufferEos,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.FRAG_PARSED,this.onFragParsed,this),e.on(I.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_EOS,this.onBufferEos,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.FRAG_PARSED,this.onFragParsed,this),e.off(I.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new RI(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 n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const n=this.media=t.media,i=tn(this.appendSource);if(n&&i){var s;const o=this.mediaSource=new i;this.log(`created media source: ${(s=o.constructor)==null?void 0:s.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{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,rh(n),_I(n,a),n.load()}catch{n.src=a}else n.src=a;n.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:n}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.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),n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(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(I.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 n;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const n=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(o=>{if(n){const l=this.tracks[o];if(l&&typeof l.buffer.changeType=="function"){var a;const{id:A,codec:c,levelCodec:u,container:h,metadata:d}=t[o],f=Xc(l.codec,l.levelCodec),g=f==null?void 0:f.replace(th,"$1");let p=Xc(c,u);const C=(a=p)==null?void 0:a.replace(th,"$1");if(p&&g!==C){o.slice(0,5)==="audio"&&(p=Es(p,this.appendSource));const Q=`${h};codecs=${p}`;this.appendChangeType(o,Q),this.log(`switching codec ${f} to ${p}`),this.tracks[o]={buffer:l.buffer,codec:c,container:h,levelCodec:u,metadata:d,id:A}}}}else this.pendingTracks[o]=t[o]}),n)return;const s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(`${s} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=s),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:n}=this,i={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),n.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};n.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:n,operationQueue:i,tracks:s}=this,{data:o,type:a,frag:l,part:A,chunkMeta:c}=t,u=c.buffering[a],h=self.performance.now();u.start=h;const d=l.stats.buffering,f=A?A.stats.buffering:null;d.start===0&&(d.start=h),f&&f.start===0&&(f.start=h);const g=s.audio;let p=!1;a==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const C=l.start,Q={execute:()=>{if(u.executeStart=self.performance.now(),p){const b=this.sourceBuffer[a];if(b){const v=C-b.timestampOffset;Math.abs(v)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${C} (delta: ${v}) sn: ${l.sn})`),b.timestampOffset=C)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();u.executeEnd=u.end=b,d.first===0&&(d.first=b),f&&f.first===0&&(f.first=b);const{sourceBuffer:v}=this,x={};for(const R in v)x[R]=Je.getBuffered(v[R]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:a,frag:l,part:A,chunkMeta:c,parent:l.type,timeRanges:x})},onError:b=>{const v={type:Be.MEDIA_ERROR,parent:l.type,details:V.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:l,part:A,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)v.details=V.BUFFER_FULL_ERROR;else{const x=++this.appendErrors[a];v.details=V.BUFFER_APPEND_ERROR,this.warn(`Failed ${x}/${n.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),x>=n.config.appendErrorMaxRetry&&(v.fatal=!0)}n.trigger(I.ERROR,v)}};i.append(Q,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:n}=this,i=s=>({execute:this.removeExecutor.bind(this,s,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:s})},onError:o=>{this.warn(`Failed to remove from ${s} SourceBuffer`,o)}});t.type?n.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(s=>{n.append(i(s),s)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],o=i?i.elementaryStreams:n.elementaryStreams;o[He.AUDIOVIDEO]?s.push("audiovideo"):(o[He.AUDIO]&&s.push("audio"),o[He.VIDEO]&&s.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const A=i?i.stats:n.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:n,part:i,stats:A,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,s)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,s)=>{const o=this.sourceBuffer[s];return o&&(!t.type||t.type===s)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${s} sourceBuffer now EOS`))),i&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(s=>{const o=this.sourceBuffer[s];o&&(o.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.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:n}=this;if(!n||t===null||!this.getSourceBufferTypes().length)return;const s=e.config,o=n.currentTime,a=t.levelTargetDuration,l=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(he(l)&&l>0){const A=Math.max(l,a),c=Math.floor(o/a)*a-A;this.flushBackBuffer(o,a,c)}if(he(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const A=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),c=Math.max(A,a),u=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,u)}}flushBackBuffer(e,t,n){const{details:i,sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const l=s[a];if(l){const A=Je.getBuffered(l);if(A.length>0&&n>A.start(0)){if(this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:n}),i!=null&&i.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l.ended&&A.end(A.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:a})}}})}flushFrontBuffer(e,t,n){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(o=>{const a=i[o];if(a){const l=Je.getBuffered(a),A=l.length;if(A<2)return;const c=l.start(A-1),u=l.end(A-1);if(n>c||e>=c&&e<=u)return;if(a.ended&&e-u<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.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:n,mediaSource:i}=this,s=e.fragments[0].start+e.totalduration,o=n.duration,a=he(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(s>a&&s>o||!he(o))&&(this.log(`Updating Media Source duration to ${s.toFixed(3)}`),i.duration=s)}updateSeekableRange(e){const t=this.mediaSource,n=e.fragments;if(n.length&&e.live&&t!=null&&t.setLiveSeekableRange){const s=Math.max(0,n[0].start),o=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${o}.`),t.setLiveSeekableRange(s,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:n}=this,i=Object.keys(n).length;if(i&&(!e||i===2||"audiovideo"in n)){this.createSourceBuffers(n),this.pendingTracks={};const s=this.getSourceBufferTypes();if(s.length)this.hls.trigger(I.BUFFER_CREATED,{tracks:this.tracks}),s.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:n}=this;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){var i;const o=e[s];if(!o)throw Error(`source buffer exists for track ${s}, however track does not`);let a=((i=o.levelCodec)==null?void 0:i.indexOf(","))===-1?o.levelCodec:o.codec;a&&s.slice(0,5)==="audio"&&(a=Es(a,this.appendSource));const l=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${l})`);try{const A=t[s]=n.addSourceBuffer(l),c=s;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(c,"bufferedchange",(u,h)=>{const d=h.removedRanges;d!=null&&d.length&&this.hls.trigger(I.BUFFER_FLUSHED,{type:s})}),this.tracks[s]={buffer:A,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:s,mimeType:l})}}}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.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:n}=this;n.current(e).onComplete(),n.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.operationQueue.current(e);s&&s.onError(i)}removeExecutor(e,t,n){const{media:i,mediaSource:s,operationQueue:o,sourceBuffer:a}=this,l=a[e];if(!i||!s||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const A=he(i.duration)?i.duration:1/0,c=he(s.duration)?s.duration:1/0,u=Math.max(0,t),h=Math.min(n,A,c);h>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.sourceBuffer[t];if(!n){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}n.ended=!1,n.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:n}=this,i=t.map(s=>n.appendBlocker(s));Promise.all(i).then(()=>{e(),t.forEach(s=>{const o=this.sourceBuffer[s];o!=null&&o.updating||n.shiftAndExecuteNext(s)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,n){const i=this.sourceBuffer[e];if(!i)return;const s=n.bind(this,e);this.listeners[e].push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(n=>{t.removeEventListener(n.event,n.listener)})}}function rh(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function _I(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const LI={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=r=>String.fromCharCode(LI[r]||r),er=15,xr=100,FI={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},kI={17:2,18:4,21:6,22:8,23:10,19:13,20:15},NI={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},MI={25:2,26:4,29:6,30:8,31:10,27:13,28:15},PI=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class OI{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;U.log(`${this.time} [${e}] ${n}`)}}}const rn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class ih{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}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 UI{constructor(){this.uchar=" ",this.penState=new ih}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 GI{constructor(e){this.chars=[],this.pos=0,this.currPenState=new ih,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xr;t++)this.chars.push(new UI);this.logger=e}equals(e){for(let t=0;t<xr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xr;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>xr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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>=xr){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<xr;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 n=0;n<xr;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Na{constructor(e){this.rows=[],this.currRow=er-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<er;t++)this.rows.push(new GI(e));this.logger=e}reset(){for(let e=0;e<er;e++)this.rows[e].clear();this.currRow=er-1}equals(e){let t=!0;for(let n=0;n<er;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<er;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<er;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<er;a++)this.rows[a].clear();const s=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[s].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let A=0;A<this.nrRollUpRows;A++)this.rows[t-this.nrRollUpRows+A+1].copy(o.rows[s+A])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,o=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}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 n="",i=-1;for(let s=0;s<er;s++){const o=this.rows[s].getTextString();o&&(i=s+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
2477
+ `)),n}getTextAndFormat(){return this.rows}}class sh{constructor(e,t,n){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 Na(n),this.nonDisplayedMemory=new Na(n),this.lastOutputScreen=new Na(n),this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[er-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}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 oh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=$I(),this.logger=void 0;const i=this.logger=new OI;this.channels=[null,new sh(e,t,i),new sh(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let o=!1,a=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+rn([t[n],t[n+1]])+"] -> ("+rn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(HI(i,s,l)){Ns(null,null,l),this.logger.log(3,()=>"Repeated command ("+rn([i,s])+") is dropped");continue}Ns(i,s,this.cmdHistory),o=this.parseCmd(i,s),o||(o=this.parseMidrow(i,s)),o||(o=this.parsePAC(i,s)),o||(o=this.parseBackgroundAttributes(i,s))}else Ns(null,null,l);if(!o&&(a=this.parseChars(i,s),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 "+rn([i,s])+" orig: "+rn([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,o=this.channels[s];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=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+rn([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?FI[e]:NI[e]:n=o===1?kI[e]:MI[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let o;s===17?o=t+80:s===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+nh(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+rn(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const o={};e===16||e===24?(s=Math.floor((t-32)/2),o.background=PI[s],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()}Ns(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function Ns(r,e,t){t.a=r,t.b=e}function HI(r,e,t){return t.a===r&&t.b===e}function $I(){return{a:null,b:null}}class Ms{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Ma=function(){if(vn!=null&&vn.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const A=l.toLowerCase();return~a.indexOf(A)?A:!1}function n(a){return t(r,a)}function i(a){return t(e,a)}function s(a,...l){let A=1;for(;A<arguments.length;A++){const c=arguments[A];for(const u in c)a[u]=c[u]}return a}function o(a,l,A){const c=this,u={enumerable:!0};c.hasBeenReset=!1;let h="",d=!1,f=a,g=l,p=A,C=null,Q="",b=!0,v="auto",x="start",R=50,k="middle",$=50,K="middle";Object.defineProperty(c,"id",s({},u,{get:function(){return h},set:function(O){h=""+O}})),Object.defineProperty(c,"pauseOnExit",s({},u,{get:function(){return d},set:function(O){d=!!O}})),Object.defineProperty(c,"startTime",s({},u,{get:function(){return f},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");f=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},u,{get:function(){return g},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");g=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},u,{get:function(){return p},set:function(O){p=""+O,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},u,{get:function(){return C},set:function(O){C=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},u,{get:function(){return Q},set:function(O){const W=n(O);if(W===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},u,{get:function(){return b},set:function(O){b=!!O,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},u,{get:function(){return v},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");v=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},u,{get:function(){return x},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");x=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},u,{get:function(){return R},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");R=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},u,{get:function(){return k},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");k=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},u,{get:function(){return $},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");$=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},u,{get:function(){return K},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");K=W,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class YI{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ah(r){function e(n,i,s,o){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(o||0)}const t=r.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 VI{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function lh(r,e,t,n){const i=n?r.split(n):[r];for(const s in i){if(typeof i[s]!="string")continue;const o=i[s].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const Pa=new Ma(0,0,""),Ps=Pa.align==="middle"?"middle":"center";function KI(r,e,t){const n=r;function i(){const a=ah(r);if(a===null)throw new Error("Malformed timestamp: "+n);return r=r.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,l){const A=new VI;lh(a,function(h,d){let f;switch(h){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===d){A.set(h,t[g].region);break}break;case"vertical":A.alt(h,d,["rl","lr"]);break;case"line":f=d.split(","),A.integer(h,f[0]),A.percent(h,f[0])&&A.set("snapToLines",!1),A.alt(h,f[0],["auto"]),f.length===2&&A.alt("lineAlign",f[1],["start",Ps,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Ps,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Ps,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&Pa.line===-1&&(c=-1),l.line=c,l.lineAlign=A.get("lineAlign","start"),l.snapToLines=A.get("snapToLines",!0),l.size=A.get("size",100),l.align=A.get("align",Ps);let u=A.get("position","auto");u==="auto"&&Pa.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function o(){r=r.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);r=r.slice(3),o(),e.endTime=i(),o(),s(r,e)}function Ah(r){return r.replace(/<br(?: \/)?>/gi,`
2478
+ `)}class JI{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new YI,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 n(){let s=t.buffer,o=0;for(s=Ah(s);o<s.length&&s[o]!=="\r"&&s[o]!==`
2479
2479
  `;)++o;const a=s.slice(0,o);return s[o]==="\r"&&++o,s[o]===`
2480
- `&&++o,t.buffer=s.slice(o),a}function i(s){Yh(s,function(o,a){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();const a=s.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:s=n(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Za(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{av(s,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=s.indexOf("-->")!==-1;if(!s||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+=`
2480
+ `&&++o,t.buffer=s.slice(o),a}function i(s){lh(s,function(o,a){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();const a=s.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:s=n(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Ma(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{KI(s,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=s.indexOf("-->")!==-1;if(!s||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+=`
2481
2481
  `),t.cue.text+=s}continue;case"BADCUE":s||(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+=`
2482
2482
 
2483
- `,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 Av=/\r\n|\n\r|\n|\r/g,tl=function(e,t,n=0){return e.slice(n,n+t.length)===t},cv=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!he(t)||!he(n)||!he(i)||!he(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*s,t},rl=function(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()};function nl(r,e,t){return rl(r.toString())+rl(e.toString())+rl(t)}const uv=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(o=s)!=null&&o.new;){var o;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function hv(r,e,t,n,i,s,o){const a=new lv,l=or(new Uint8Array(r)).trim().replace(Av,`
2483
+ `,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 WI=/\r\n|\n\r|\n|\r/g,Oa=function(e,t,n=0){return e.slice(n,n+t.length)===t},qI=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!he(t)||!he(n)||!he(i)||!he(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*s,t},Ua=function(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()};function Ga(r,e,t){return Ua(r.toString())+Ua(e.toString())+Ua(t)}const XI=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(o=s)!=null&&o.new;){var o;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function jI(r,e,t,n,i,s,o){const a=new JI,l=or(new Uint8Array(r)).trim().replace(WI,`
2484
2484
  `).split(`
2485
- `),A=[],c=e?SC(e.baseTime,e.timescale):0;let u="00:00.000",h=0,d=0,f,g=!0;a.oncue=function(p){const y=t[n];let Q=t.ccOffset;const b=(h-c)/9e4;if(y!=null&&y.new&&(d!==void 0?Q=t.ccOffset=y.start:uv(t,n,b)),b){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}Q=b-t.presentationOffset}const v=p.endTime-p.startTime,w=Yt((p.startTime+Q-d)*9e4,i*9e4)/9e4;p.startTime=Math.max(w,0),p.endTime=Math.max(w+v,0);const R=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(R)),p.id||(p.id=nl(p.startTime,p.endTime,R)),p.endTime>0&&A.push(p)},a.onparsingerror=function(p){f=p},a.onflush=function(){if(f){o(f);return}s(A)},l.forEach(p=>{if(g)if(tl(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(y=>{tl(y,"LOCAL:")?u=y.slice(6):tl(y,"MPEGTS:")&&(h=parseInt(y.slice(7)))});try{d=cv(u)/1e3}catch(y){f=y}return}else p===""&&(g=!1);a.parse(p+`
2486
- `)}),a.flush()}const il="stpp.ttml.im1t",Kh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Jh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,dv={left:"start",center:"center",right:"end",start:"start",end:"end"};function Wh(r,e,t,n){const i=xe(new Uint8Array(r),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(a=>or(a)),o=wC(e.baseTime,1,e.timescale);try{s.forEach(a=>t(fv(a,o)))}catch(a){n(a)}}function fv(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(s).reduce((u,h)=>(u[h]=i.getAttribute(`ttp:${h}`)||s[h],u),{}),a=i.getAttribute("xml:space")!=="preserve",l=qh(sl(i,"styling","style")),A=qh(sl(i,"layout","region")),c=sl(i,"body","[begin]");return[].map.call(c,u=>{const h=jh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=al(u.getAttribute("begin"),o),f=al(u.getAttribute("dur"),o);let g=al(u.getAttribute("end"),o);if(d===null)throw Xh(u);if(g===null){if(f===null)throw Xh(u);g=d+f}const p=new Za(d-e,g-e,h);p.id=nl(p.startTime,p.endTime,p.text);const y=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=gv(y,Q,l),{textAlign:v}=b;if(v){const w=dv[v];w&&(p.lineAlign=w),p.align=v}return it(p,b),p}).filter(u=>u!==null)}function sl(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function qh(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function jh(r,e){return[].slice.call(r.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
2487
- `:(s=n.childNodes)!=null&&s.length?jh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function gv(r,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),s.reduce((a,l)=>{const A=ol(e,n,l)||ol(r,n,l)||ol(i,n,l);return A&&(a[l]=A),a},{})}function ol(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function Xh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function al(r,e){if(!r)return null;let t=$h(r);return t===null&&(Kh.test(r)?t=pv(r,e):Jh.test(r)&&(t=mv(r,e))),t}function pv(r,e){const t=Kh.exec(r),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function mv(r,e){const t=Jh.exec(r),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class Ev{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=ed(),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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(I.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 Ks(this,"textTrack1"),t=new Ks(this,"textTrack2"),n=new Ks(this,"textTrack3"),i=new Ks(this,"textTrack4");this.cea608Parser1=new Hh(1,e,t),this.cea608Parser2=new Hh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=Iv(l[0],l[1],t,n);if(A>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,A/(n-t)>.5))return}if(o||s.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){const{unparsedVttFrags:o}=this;n==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:s}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(I.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(Zh(s,{name:e,lang:t,attrs:{}}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:o}=t[e],a=this.getExistingTrack(s,o);if(a)n[e]=a,vn(n[e]),$u(n[e],i);else{const l=this.createTextTrack("captions",s,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{vn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ed(),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 n=0;n<t.length;n++)vn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===il);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Fh(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?ws(o.textTracks):null;if(this.tracks.forEach((l,A)=>{let c;if(a){let u=null;for(let h=0;h<a.length;h++)if(a[h]&&Zh(a[h],l)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)vn(c);else{const u=zh(l);c=this.createTextTrack(u,l.name,l.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const l=a.filter(A=>A!==null).map(A=>A.label);l.length&&U.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,o=this.captionsProperties[s];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}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===Ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:A}=t.frag,c=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&o&&(A!==a+1||A===a&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=l,this.lastSn=A,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===Ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,o="stats"in t;if(s==null||!s.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===il?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Wh(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{U.log(`Failed to parse IMSC1: ${i}`),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:o}=this,a=s.length-1;if(!s[n.cc]&&a===-1){o.push(e);return}const l=this.hls,A=(t=n.initSegment)!=null&&t.data?$t(n.initSegment.data,new Uint8Array(i)):i;hv(A,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,c=>{this._appendCues(c,n.level),l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},c=>{const u=c.message==="Missing initPTS for VTT MPEGTS";u?o.push(e):this._fallbackToIMSC1(n,i),U.log(`Failed to parse VTT cue: ${c}`),!(u&&a>n.cc)&&l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:c})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Wh(t,this.initPTS[e.cc],()=>{n.textCodec=il,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>Yu(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(I.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===Ee.SUBTITLE&&this.onFragLoaded(I.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:n,cea608Parser2:i}=this;if(!this.enabled||!n||!i)return;const{frag:s,samples:o}=t;if(!(s.type===Ee.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let a=0;a<o.length;a++){const l=o[a].bytes;if(l){const A=this.extractCea608Data(l);n.addData(o[a].pts,A[0]),i.addData(o[a].pts,A[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!s||s==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>Ra(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>Ra(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(l))}}return t}}function zh(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function Zh(r,e){return!!r&&r.kind===zh(e)&&Xa(e,r)}function Iv(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function ed(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class ll{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(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&he(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&U.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,ll.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let s=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){s=a;break}}return s}}class Cv{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(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/s,A=this.hls;if(A.trigger(I.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>A.config.fpsDroppedMonitoringThreshold*a){let c=A.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(A.autoLevelCapping===-1||A.autoLevelCapping>=c)&&(c=c-1,A.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:A.currentLevel}),A.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,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 Ws="[eme]";class Rn{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=Rn.CDMCleanupPromise?[Rn.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,Ws),this.log=U.log.bind(U,Ws),this.warn=U.warn.bind(U,Ws),this.error=U.error.bind(U,Ws),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(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===Je.WIDEVINE&&n)return n;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),s=t.map(o=>o.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((o,a)=>{const l=A=>{const c=A.shift();this.getMediaKeysPromise(c,i,s).then(u=>o({keySystem:c,mediaKeys:u})).catch(u=>{A.length?l(A):u instanceof Vt?a(u):a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return fu===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){const i=xE(e,t,n,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let o=s==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),o=this.requestMediaKeySystemAccess(e,i);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const A=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),A.then(u=>u?this.setMediaKeysServerCertificate(c,e,u):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${ar.hexDump(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,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 ar.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${ar.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
2488
- } (data length: ${t&&t.byteLength})`),i.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,n)=>{const i=Ca(this.config),s=e.map(uu).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=du(o);a?t(a):n(new Error(`Unable to find format for key-system "${o}"`))}).catch(n)})}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let s=this.keyIdToKeySessionPromise[n];return s||(s=this.keyIdToKeySessionPromise[n]=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 ${i}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),s.catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vt?this.hls.trigger(I.ERROR,e.data):this.hls.trigger(I.ERROR,{type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=uu(e.keyFormat),s=i?[i]:Ca(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=Ca(this.config)),e.length===0)throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.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:n}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),n===null)return;let i,s;if(t==="sinf"&&this.config.drmSystems[Je.FAIRPLAY]){const c=ct(new Uint8Array(n));try{const u=Ea(JSON.parse(c).sinf),h=Bu(new Uint8Array(u));if(!h)return;i=h.subarray(8,24),s=Je.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=zE(n);if(c===null)return;c.version===0&&c.systemId===hu.WIDEVINE&&c.data&&(i=c.data.subarray(8,24)),s=bE(c.systemId)}if(!s||!i)return;const o=ar.hexDump(i),{keyIdToKeySessionPromise:a,mediaKeySessions:l}=this;let A=a[o];for(let c=0;c<l.length;c++){const u=l[c],h=u.decryptdata;if(h.pssh||!h.keyId)continue;const d=ar.hexDump(h.keyId);if(o===d||h.uri.replace(/-/g,"").indexOf(o)!==-1){A=a[d],delete a[d],h.pssh=new Uint8Array(n),h.keyId=i,A=a[o]=A.then(()=>this.generateRequestWithPreferredKeySession(u,t,n,"encrypted-event-key-match"));break}}A||(A=a[o]=this.getKeySystemSelectionPromise([s]).then(({keySystem:c,mediaKeys:u})=>{var h;this.throwIfDestroyed();const d=new pi("ISO-23001-7",o,(h=du(c))!=null?h:"");return d.pssh=new Uint8Array(n),d.keyId=i,this.attemptSetMediaKeys(c,u).then(()=>{this.throwIfDestroyed();const f=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:u});return this.generateRequestWithPreferredKeySession(f,t,n,"encrypted-event-no-match")})})),A.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s,o;const a=(s=this.config.drmSystems)==null||(o=s[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const f=a.call(this.hls,t,n,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,n=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var l;if(this.warn(f.message),(l=this.hls)!=null&&l.config.debug)throw f}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const A=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${A} (init data type: ${t} length: ${n?n.byteLength:null})`);const c=new ja,u=e._onmessage=f=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=f;this.log(`"${p}" message event for session "${g.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(Q=>{this.handleError(Q),c.emit("error",Q)}):p==="license-release"?e.keySystem===Je.FAIRPLAY&&(this.updateKeySession(e,Ia("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},h=e._onkeystatuseschange=f=>{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 ${A}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise((f,g)=>{c.on("error",g),c.on("keyStatus",p=>{p.startsWith("usable")?f():p==="output-restricted"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${A}`)}).catch(f=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>d).catch(f=>{throw c.removeAllListeners(),this.removeSession(e),f}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ar.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${ar.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:s},A=t.certLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{o(h.data)},onError:(h,d,f,g)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:ht({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(h,d,f)=>{a(new Error("aborted"))}};i.load(l,c,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),i(e)}).catch(o=>{s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let c;for(let u=0,h=s.length;u<h;u++){var o,a;c=s[u];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,f=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&f&&e.setRequestHeader(d,f)}}const l=i.querySelector("Challenge"),A=l==null?void 0:l.textContent;if(!A)throw new Error("Cannot find <Challenge> in key message");return Ia(atob(A))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{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 s(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const A=this.config.licenseResponseCallback;if(A)try{l=A.call(this.hls,a,o,e)}catch(c){this.error(c)}i(l)}else{const l=n.errorRetry,A=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A||a.status>=400&&a.status<500)s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.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=A-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:A})=>{e.keySystem==Je.PLAYREADY&&(A=this.unpackPlayReadyKeyMessage(l,A)),l.send(A)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,n.addEventListener("encrypted",this.onMediaEncrypted),n.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={},pi.clearKeyUriToKeyIdMap();const n=t.length;Rn.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=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),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(s=>{this.log(`Could not remove session: ${s}`)}).then(()=>t.close()).catch(s=>{this.log(`Could not close session: ${s}`)})}}}Rn.CDMCleanupPromise=void 0;class Vt 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 Qt;(function(r){r.MANIFEST="m",r.AUDIO="a",r.VIDEO="v",r.MUXED="av",r.INIT="i",r.CAPTION="c",r.TIMED_TEXT="tt",r.KEY="k",r.OTHER="o"})(Qt||(Qt={}));var Al;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Al||(Al={}));var nn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(nn||(nn={}));const vv={[nn.OBJECT]:["br","d","ot","tb"],[nn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[nn.SESSION]:["cid","pr","sf","sid","st","v"],[nn.STATUS]:["bs","rtp"]};class Dn{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(n=>n instanceof Dn?n:new Dn(n))),this.value=e,this.params=t}}class td{constructor(e){this.description=void 0,this.description=e}}const yv="Dict";function Bv(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function Tv(r,e,t,n){return new Error(`failed to ${r} "${Bv(e)}" as ${t}`,{cause:n})}const rd="Bare Item",Qv="Boolean",bv="Byte Sequence",xv="Decimal",wv="Integer";function Sv(r){return r<-999999999999999||999999999999999<r}const Rv=/[\x00-\x1f\x7f]+/,Dv="Token",_v="Key";function hr(r,e,t){return Tv("serialize",r,e,t)}function Lv(r){if(typeof r!="boolean")throw hr(r,Qv);return r?"?1":"?0"}function Fv(r){return btoa(String.fromCharCode(...r))}function kv(r){if(ArrayBuffer.isView(r)===!1)throw hr(r,bv);return`:${Fv(r)}:`}function nd(r){if(Sv(r))throw hr(r,wv);return r.toString()}function Nv(r){return`@${nd(r.getTime()/1e3)}`}function id(r,e){if(r<0)return-id(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}function Mv(r){const e=id(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw hr(r,xv);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Pv="String";function Ov(r){if(Rv.test(r))throw hr(r,Pv);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uv(r){return r.description||r.toString().slice(7,-1)}function sd(r){const e=Uv(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw hr(e,Dv);return e}function cl(r){switch(typeof r){case"number":if(!he(r))throw hr(r,rd);return Number.isInteger(r)?nd(r):Mv(r);case"string":return Ov(r);case"symbol":return sd(r);case"boolean":return Lv(r);case"object":if(r instanceof Date)return Nv(r);if(r instanceof Uint8Array)return kv(r);if(r instanceof td)return sd(r);default:throw hr(r,rd)}}function ul(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw hr(r,_v);return r}function hl(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${ul(e)}`:`;${ul(e)}=${cl(t)}`).join("")}function od(r){return r instanceof Dn?`${cl(r.value)}${hl(r.params)}`:cl(r)}function Gv(r){return`(${r.value.map(od).join(" ")})${hl(r.params)}`}function Hv(r,e={whitespace:!0}){if(typeof r!="object")throw hr(r,yv);const t=r instanceof Map?r.entries():Object.entries(r),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof Dn||(s=new Dn(s));let o=ul(i);return s.value===!0?o+=hl(s.params):(o+="=",Array.isArray(s.value)?o+=Gv(s):o+=od(s)),o}).join(`,${n}`)}function $v(r,e){return Hv(r,e)}const Yv=r=>r==="ot"||r==="sf"||r==="st",Vv=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function Kv(r,e){const t=new URL(r),n=new URL(e);if(t.origin!==n.origin)return r;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}function Jv(){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,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}const qs=r=>Math.round(r),Wv=(r,e)=>(e!=null&&e.baseUrl&&(r=Kv(r,e.baseUrl)),encodeURIComponent(r)),js=r=>qs(r/100)*100,qv={br:qs,d:qs,bl:js,dl:js,mtp:js,nor:Wv,rtp:js,tb:qs};function jv(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=it({},qv,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return n.forEach(o=>{if(s!=null&&s(o))return;let a=r[o];const l=i[o];l&&(a=l(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||Vv(a)&&(Yv(o)&&typeof a=="string"&&(a=new td(a)),t[o]=a))}),t}function ad(r,e={}){return r?$v(jv(r,e),it({whitespace:!1},e)):""}function Xv(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(vv).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((s,o)=>{var a,l;const[A,c]=o,u=((a=n.find(h=>h[1].includes(A)))==null?void 0:a[0])||nn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=ad(a,e),s),{})}function zv(r,e,t){return it(r,Xv(e,t))}const Zv="CMCD";function ey(r,e={}){if(!r)return"";const t=ad(r,e);return`${Zv}=${encodeURIComponent(t)}`}const ld=/CMCD=[^&#]+/;function ty(r,e,t){const n=ey(e,t);if(!n)return r;if(ld.test(r))return r.replace(ld,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class ry{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=i=>{try{this.apply(i,{ot:Qt.MANIFEST,su:!this.initialized})}catch(s){U.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const s=i.frag,o=this.hls.levels[s.level],a=this.getObjectType(s),l={d:s.duration*1e3,ot:a};(a===Qt.VIDEO||a===Qt.AUDIO||a==Qt.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(a)/1e3,l.bl=this.getBufferLength(a)),this.apply(i,l)}catch(s){U.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||Jv(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHED,this.onMediaDetached,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHED,this.onMediaDetached,this),e.off(I.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 n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Al.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){it(t,this.createData());const n=t.ot===Qt.INIT||t.ot===Qt.VIDEO||t.ot===Qt.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((s,o)=>(i.includes(o)&&(s[o]=t[o]),s),{})),this.useHeaders?(e.headers||(e.headers={}),zv(e.headers,t)):e.url=ty(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Qt.TIMED_TEXT;if(e.sn==="initSegment")return Qt.INIT;if(t==="audio")return Qt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Qt.VIDEO:Qt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Qt.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,o=s>-1?s+1:i.levels.length;n=i.levels.slice(0,o)}for(const s of n)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,n=e===Qt.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Ke.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}}const ny=3e5;class iy{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=U.log.bind(U,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===Bt.SendAlternateToPenaltyBox&&n.flags===Zt.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:A}=t.context;a&&i?o=this.getPathwayForGroupId(a,A,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!s&&i&&(s=i.reduce((a,l)=>(a.indexOf(l.pathwayId)===-1&&a.push(l.pathwayId),a),[])),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==o),n.resolved||U.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}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 n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>ny&&delete n[s]});for(let s=0;s<e.length;s++){const o=e[s];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,Zu(t),this.hls.trigger(I.LEVELS_UPDATED,{levels:t});const A=this.hls.levels[a];l&&A&&this.levels&&(A.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&A.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${A.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===Oe.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Oe.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=s;if(t.some(c=>c.pathwayId===o))return;const A=this.getLevelsForPathway(a).map(c=>{const u=new je(c.attrs);u["PATHWAY-ID"]=o;const h=u.AUDIO&&`${u.AUDIO}_clone_${o}`,d=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;h&&(n[u.AUDIO]=h,u.AUDIO=h),d&&(i[u.SUBTITLES]=d,u.SUBTITLES=d);const f=cd(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new yn({attrs:u,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:f,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)g.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)g.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return g});t.push(...A),Ad(this.audioTracks,n,l,o),Ad(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+c)}const s={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},A={onSuccess:(c,u,h,d)=>{this.log(`Loaded steering manifest: "${i}"`);const f=c.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=f;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const Q={steeringManifest:f,url:i.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,Q),y&&this.updatePathwayPriority(y)},onError:(c,u,h,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${u.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let f=this.timeToLoad*1e3;if(c.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const p=g.getResponseHeader("Retry-After");p&&(f=parseFloat(p)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f)},onTimeout:(c,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,A)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Ad(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=it({},o);return a.details=void 0,a.attrs=new je(a.attrs),a.url=a.attrs.URI=cd(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});r.push(...s)})}function cd(r,e,t,n){const{HOST:i,PARAMS:s,[t]:o}=n;let a;e&&(a=o==null?void 0:o[e],a&&(r=a));const l=new self.URL(r);return i&&!a&&(l.host=i),s&&Object.keys(s).sort().forEach(A=>{A&&l.searchParams.set(A,s[A])}),l.href}const sy=/^age:\s*[\d.]+\s*$/im;class ud{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 Cs,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{this.callbacks.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[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),n.timeout=s&&he(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===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)){n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=a?t.response:t.responseText,A=t.responseType==="arraybuffer"?l.byteLength:l.length;if(n.loaded=n.total=A,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(n,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:o};this.callbacks.onSuccess(u,n,e,t)}else{const l=s.loadPolicy.errorRetry,A=n.retry,c={url:e.url,data:void 0,code:o};Ls(l,A,!1,c)?this.retry(l):(U.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,n))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ls(e,t,!0))this.retry(e);else{var n;U.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Na(e,n.retry),n.retry++,U.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&sy.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 oy(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const ay=/(\d+)-(\d+)\/(\d+)/;class hd{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||uy,this.controller=new self.AbortController,this.stats=new Cs}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=ly(e,this.controller.signal),o=n.onProgress,a=e.responseType==="arraybuffer",l=a?"byteLength":"length",{maxTimeToFirstByteMs:A,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=A&&he(A)?A:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},c-(h-i.loading.start)),!u.ok){const{status:d,statusText:f}=u;throw new hy(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=cy(u.headers)||i.total,o&&he(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,o):a?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const d=u[l];d&&(i.loaded=i.total=d);const f={url:h.url,data:u,code:h.status};o&&!he(t.highWaterMark)&&o(i,e,u,h),n.onSuccess(f,i,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=u&&u.code||0,d=u?u.message:null;n.onError({code:h,text:d},e,u?u.details:null,i)})}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,n,i=0,s){const o=new uh,a=e.body.getReader(),l=()=>a.read().then(A=>{if(A.done)return o.dataLength&&s(t,n,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=A.value,u=c.length;return t.loaded+=u,u<i||o.dataLength?(o.push(c),o.dataLength>=i&&s(t,n,o.flush(),e)):s(t,n,c,e),l()}).catch(()=>Promise.reject());return l()}}function ly(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(it({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function Ay(r){const e=ay.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function cy(r){const e=r.get("Content-Range");if(e){const n=Ay(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function uy(r,e){return new self.Request(r.url,e)}class hy extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const dy=/\s/,fy={newCue(r,e,t,n){const i=[];let s,o,a,l,A;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(s=n.rows[h],a=!0,l=0,A="",!s.isEmpty()){var u;for(let g=0;g<s.chars.length;g++)dy.test(s.chars[g].uchar)&&a?l++:(A+=s.chars[g].uchar,a=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=Vh(A.trim()),f=nl(e,t,d);r!=null&&(u=r.cues)!=null&&u.getCueById(f)||(o=new c(e,t,d),o.id=f,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(o))}return r&&i.length&&(i.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),i.forEach(h=>Yu(r,h))),i}},gy={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},dd=ht(ht({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:ud,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:HI,bufferController:KC,capLevelController:ll,errorController:RI,fpsController:Cv,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:fu,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:gy},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},py()),{},{subtitleStreamController:HC,subtitleTrackController:YC,timelineController:Ev,audioStreamController:UC,audioTrackController:GC,emeController:Rn,cmcdController:ry,contentSteeringController:iy});function py(){return{cueHandler:fy,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 my(r,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=dl(r),n=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(s=>{const o=`${s==="level"?"playlist":s}LoadPolicy`,a=e[o]===void 0,l=[];i.forEach(A=>{const c=`${s}Loading${A}`,u=e[c];if(u!==void 0&&a){l.push(c);const h=t[o].default;switch(e[o]={default:h},A){case"TimeOut":h.maxLoadTimeMs=u,h.maxTimeToFirstByteMs=u;break;case"MaxRetry":h.errorRetry.maxNumRetry=u,h.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":h.errorRetry.retryDelayMs=u,h.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=u,h.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&U.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ht(ht({},t),e)}function dl(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(dl):Object.keys(r).reduce((e,t)=>(e[t]=dl(r[t]),e),{}):r}function Ey(r){const e=r.loader;e!==hd&&e!==ud?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):oy()&&(r.loader=hd,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let fl;class Iy extends Pa{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.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 n=this.hls.config.preferManagedMediaSource,i=[],s={},o={};let a=!1,l=!1,A=!1;t.levels.forEach(c=>{var u,h;const d=c.attrs;let{audioCodec:f,videoCodec:g}=c;((u=f)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(fl||(fl=/chrome|firefox/i.test(navigator.userAgent)),fl&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=xs(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=sI(g));const{width:p,height:y,unknownCodecs:Q}=c;if(a||(a=!!(p&&y)),l||(l=!!g),A||(A=!!f),Q!=null&&Q.length||f&&!xa(f,"audio",n)||g&&!xa(g,"video",n))return;const{CODECS:b,"FRAME-RATE":v,"HDCP-LEVEL":w,"PATHWAY-ID":R,RESOLUTION:k,"VIDEO-RANGE":H}=d,O=`${`${R||"."}-`}${c.bitrate}-${k}-${v}-${b}-${H}-${w}`;if(s[O])if(s[O].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const W=o[O]+=1;c.attrs["PATHWAY-ID"]=new Array(W+1).join(".");const ie=new yn(c);s[O]=ie,i.push(ie)}else s[O].addGroupId("audio",d.AUDIO),s[O].addGroupId("text",d.SUBTITLES);else{const W=new yn(c);s[O]=W,o[O]=1,i.push(W)}}),this.filterAndSortMediaOptions(i,t,a,l,A)}filterAndSortMediaOptions(e,t,n,i,s){let o=[],a=[],l=e;if((n||i)&&s&&(l=l.filter(({videoCodec:f,videoRange:g,width:p,height:y})=>(!!f||!!(p&&y))&&EI(g))),l.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 f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;o=t.audioTracks.filter(g=>!g.audioCodec||xa(g.audioCodec,"audio",f)),fd(o)}t.subtitles&&(a=t.subtitles,fd(a));const A=l.slice(0);l.sort((f,g)=>{if(f.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&f.height!==g.height)return f.height-g.height;if(f.frameRate!==g.frameRate)return f.frameRate-g.frameRate;if(f.videoRange!==g.videoRange)return Rs.indexOf(f.videoRange)-Rs.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=Du(f.videoCodec),y=Du(g.videoCodec);if(p!==y)return y-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=bs(f.codecSet),y=bs(g.codecSet);if(p!==y)return y-p}return f.averageBitrate!==g.averageBitrate?f.averageBitrate-g.averageBitrate:0});let c=A[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==A.length)){for(let f=0;f<A.length;f++)if(A[f].pathwayId===l[0].pathwayId){c=A[f];break}}this._levels=l;for(let f=0;f<l.length;f++)if(l[f]===c){var u;this._firstLevel=f;const g=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const y=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);y>p&&p===dd.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const h=s&&!i,d={levels:l,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:!h&&o.some(f=>!!f.url)};this.hls.trigger(I.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"),u=e<0;if(this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&o.details&&i&&s===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 ${n}${s?" with Pathway "+s:""}`);const l={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(I.LEVEL_SWITCHING,l);const A=o.details;if(!A||A.live){const c=this.switchParams(o.uri,i==null?void 0:i.details,A);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===Oe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,o=this._levels[i];if(!o){var a;this.warn(`Invalid level index ${i}`),(a=t.deliveryDirectives)!=null&&a.skip&&(s.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(i,t,o.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let i=n.uri;if(e)try{i=e.addDirectives(i)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const s=n.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${s?" Pathway "+s:""} ${i}`),this.clearTimer(),this.hls.trigger(I.LEVEL_LOADING,{url:i,level:t,pathwayId:n.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 n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));Zu(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(I.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function fd(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class Cy{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.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=K.KEY_LOAD_ERROR,n,i,s){return new Qr({type:Be.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:n,cc:i}=e;for(let s=0;s<t.length;s++){const o=t[s];if(i<=o.cc&&(n==="initSegment"||o.sn==="initSegment"||n<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 n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const A=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,K.KEY_LOAD_ERROR,A))}const o=s.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((n=a)!=null&&n.decryptdata.key)return s.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((i=a)!=null&&i.keyLoadPromise){var l;switch((l=a.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(A=>(s.key=A.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.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,K.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);if(i)return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},A=n.keyLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{const{frag:p,keyInfo:y,url:Q}=f;if(!p.decryptdata||y!==this.keyUriToKeyInfo[Q])return a(this.createKeyLoadError(p,K.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));y.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(h,d,f,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),f,ht({url:l.url,data:void 0},h)))},onTimeout:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};s.load(l,c,u)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[i],s&&s.destroy()}}function gd(){return self.SourceBuffer||self.WebKitSourceBuffer}function pd(){if(!tn())return!1;const e=gd();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function vy(){if(!pd())return!1;const r=tn();return typeof(r==null?void 0:r.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(mi(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(mi(e,"audio"))))}function yy(){var r;const e=gd();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const By=250,Xs=2,Ty=.1,Qy=.05;class by{constructor(e,t,n,i){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=n,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:n,media:i,stalled:s}=this;if(i===null)return;const{currentTime:o,seeking:a}=i,l=this.seeking&&!a,A=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),s!==null){if(this.stallReported){const p=self.performance.now()-s;U.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(A||l){this.stalled=null;return}if(i.paused&&!a||i.ended||i.playbackRate===0||!Ke.getBuffered(i).length){this.nudgeRetry=0;return}const c=Ke.bufferInfo(i,o,0),u=c.nextStart||0;if(a){const p=c.len>Xs,y=!u||t&&t.start<=o||u-o>Xs&&!this.fragmentTracker.getPartialFragment(o);if(p||y)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(c.len>0)&&!u)return;const y=Math.max(u,c.start||0)-o,Q=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,v=(Q==null||(h=Q.details)==null?void 0:h.live)?Q.details.targetduration*2:Xs,w=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=v||w)){i.paused||this._trySkipBufferHole(w);return}}const d=self.performance.now();if(s===null){this.stalled=d;return}const f=d-s;if(!a&&f>=By&&(this._reportStall(c),!this.media))return;const g=Ke.bufferInfo(i,o,n.maxBufferHole);this._tryFixBufferStall(g,f)}_tryFixBufferStall(e,t){const{config:n,fragmentTracker:i,media:s}=this;if(s===null)return;const o=s.currentTime,a=i.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-o<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:n,stallReported:i}=this;if(!i&&n){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);U.warn(s.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:n,media:i}=this;if(i===null)return 0;const s=i.currentTime,o=Ke.bufferInfo(i,s,0),a=s<o.start?o.start:o.nextStart;if(a){const l=o.len<=t.maxBufferHole,A=o.len>0&&o.len<1&&i.readyState<3,c=a-s;if(c>0&&(l||A)){if(c>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(s===0){const f=h.getAppendedFrag(0,Ee.MAIN);f&&a<f.end&&(d=!0)}if(!d){const f=e||h.getAppendedFrag(s,Ee.MAIN);if(f){let g=!1,p=f.end;for(;p<a;){const y=h.getPartialFragment(p);if(y)p+=y.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(a+Qy,s+Ty);if(U.warn(`skipping hole, adjusting currentTime from ${s} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${u}`);n.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:n,nudgeRetry:i}=this;if(n===null)return;const s=n.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const o=s+(i+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${s} to ${o}`);U.warn(a.message),n.currentTime=o,t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${s} after ${e.nudgeMaxRetry} nudges`);U.error(o.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const xy=100;class wy extends Ga{constructor(e,t,n){super(e,t,n,"[stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(I.ERROR,this.onError,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(I.ERROR,this.onError,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(xy),this.level=-1,!this.startFragRequested){let i=n.startLevel;i===-1&&(n.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=n.firstAutoLevel),n.nextLoadLevel=i,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=re.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=re.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case re.WAITING_LEVEL:{const{levels:t,level:n}=this,i=t==null?void 0:t[n],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=re.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=re.IDLE;break}break}case re.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:i,level:s}=this,o=i==null?void 0:i[s];this.resetStartWhenNotLoaded(o||null),this.state=re.IDLE}}break}this.state===re.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=e.nextLoadLevel;if(!(n!=null&&n[s]))return;const o=n[s],a=this.getMainFwdBufferInfo();if(a===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(a,l)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(I.BUFFER_EOS,g),this.state=re.ENDED;return}e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const A=o.details;if(!A||this.state===re.WAITING_LEVEL||A.live&&this.levelLastLoaded!==o){this.level=s,this.state=re.WAITING_LEVEL;return}const c=a.len,u=this.getMaxBufferLength(o.maxBitrate);if(c>=u)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,A);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==dt.OK){var f;const p=((f=this.backtrackFragment)!=null?f:d).sn-A.startSN,y=A.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,h)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?He.AUDIO:He.VIDEO,y=(p===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,p,Ee.MAIN)}d=this.getNextFragmentLoopLoading(d,A,a,Ee.MAIN,u)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===dt.NOT_LOADED||i===dt.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,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ee.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 n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<s.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],A=this.fragLastKbps;A&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*A)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,A=a.duration,c=Math.max(o.end,l+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,A*(this.couldBacktrack?.5:.125)),A*(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 re.KEY_LOADING:case re.FRAG_LOADING:case re.FRAG_LOADING_WAITING_RETRY:case re.PARSING:case re.PARSED:this.state=re.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 n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new by(this.config,n,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;he(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const n=this.getMainFwdBufferInfo();if(n===null||n.len===0){this.warn(`Main forward buffer length on "seeked" event ${n?n.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.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 n=!1,i=!1;t.levels.forEach(s=>{const o=s.audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,i=i||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=n&&i&&!yy(),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:n}=this;if(!n||this.state!==re.IDLE)return;const i=n[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=re.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i}=this,s=t.level,o=t.details,a=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const l=i[s],A=this.fragCurrent;A&&(this.state===re.FRAG_LOADING||this.state===re.FRAG_LOADING_WAITING_RETRY)&&A.level!==t.level&&A.loader&&this.abortCurrentFrag();let c=0;if(o.live||(n=l.details)!=null&&n.live){var u;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=o,this.levelLastLoaded=l,this.hls.trigger(I.LEVEL_UPDATED,{details:o,level:s}),this.state===re.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=re.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const a=o[n.level],l=a.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const A=a.videoCodec,c=l.PTSKnown||!l.live,u=(t=n.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Lh(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new Oa(n.level,n.sn,n.stats.chunkCount,s.byteLength,f,g),y=this.initPTS[n.cc];d.push(s,u,h,A,n,i,l.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const n=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 s=this.hls;n&&(s.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),s.trigger(I.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=t.id,i=!!this.hls.audioTracks[n].url;if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,o=!1;for(const a in n){const l=n[a];if(l.id==="main"){if(s=a,i=l,a==="video"){const A=n[a];A&&(this.videoBuffer=A.buffer)}}else o=!0}o&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n&&n.type!==Ee.MAIN)return;if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===re.PARSED&&(this.state=re.IDLE);return}const s=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===Oe.LEVEL&&(this.state=re.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ke.getBuffered(e).length){const n=this.state!==re.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,n)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=re.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==He.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,t,Ee.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 n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=Ke.getBuffered(e),o=(i.length?i.start(0):0)-n;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),n+=o,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_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(n=>{const{hls:i}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=re.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=e.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(I.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const n="main",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{video:u,text:h,id3:d,initSegment:f}=s,{details:g}=c,p=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,f){if(f!=null&&f.tracks){const b=l.initSegment||l;this._bufferInitSegment(c,f.tracks,b,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:n,tracks:f.tracks})}const y=f.initPTS,Q=f.timescale;he(y)&&(this.initPTS[l.cc]={baseTime:y,timescale:Q},i.trigger(I.INIT_PTS_FOUND,{frag:l,id:n,initPTS:y,timescale:Q}))}if(u&&g&&l.sn!=="initSegment"){const y=g.fragments[l.sn-1-g.startSN],Q=l.sn===g.startSN,b=!y||l.cc>y.cc;if(s.independent!==!1){const{startPTS:v,endPTS:w,startDTS:R,endDTS:k}=u;if(A)A.elementaryStreams[u.type]={startPTS:v,endPTS:w,startDTS:R,endDTS:k};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const H=this.getMainFwdBufferInfo(),V=(H?H.end:this.getLoadPosition())+this.config.maxBufferHole,O=u.firstKeyFramePTS?u.firstKeyFramePTS:v;if(!Q&&V<O-this.config.maxBufferHole&&!b){this.backtrack(l);return}else b&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,w,l.start,k,!0)}else Q&&v>Xs&&(l.gap=!0);l.setElementaryStreamInfo(u.type,v,w,R,k),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,A,o,Q||b)}else if(Q||b)l.gap=!0;else{this.backtrack(l);return}}if(p){const{startPTS:y,endPTS:Q,startDTS:b,endDTS:v}=p;A&&(A.elementaryStreams[He.AUDIO]={startPTS:y,endPTS:Q,startDTS:b,endDTS:v}),l.setElementaryStreamInfo(He.AUDIO,y,Q,b,v),this.bufferFragmentData(p,l,A,o)}if(g&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:n,frag:l,details:g,samples:d.samples};i.trigger(I.FRAG_PARSING_METADATA,y)}if(g&&h){const y={id:n,frag:l,details:g,samples:h.samples};i.trigger(I.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:s,video:o,audiovideo:a}=t;if(s){let l=e.audioCodec;const A=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const c=s.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&A.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&A.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),s.levelCodec=l,s.id="main",this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${s.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(I.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const c=t[l].initSegment;c!=null&&c.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:l,data:c,frag:n,part:null,chunkMeta:i,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ee.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=re.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Ke.isBuffered(e,n)?t=this.getAppendedFrag(n):Ke.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(I.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(I.LEVEL_SWITCHED,{level:s}))}}}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,n=this.currentFrag;if(n&&he(t)&&he(n.programDateTime)){const i=n.programDateTime+(t-n.start)*1e3;return new Date(i)}}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 wr{static get version(){return"1.5.11"}static isMSESupported(){return pd()}static isSupported(){return vy()}static getMediaSource(){return tn()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return K}static get DefaultConfig(){return wr.defaultConfig?wr.defaultConfig:dd}static set DefaultConfig(e){wr.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 ja,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,pE(e.debug||!1,"Hls instance");const t=this.config=my(wr.DefaultConfig,e);this.userConfig=e,t.progressive&&Ey(t);const{abrController:n,bufferController:i,capLevelController:s,errorController:o,fpsController:a}=t,l=new o(this),A=this.abrController=new n(this),c=this.bufferController=new i(this),u=this.capLevelController=new s(this),h=new a(this),d=new cI(this),f=new gI(this),g=t.contentSteeringController,p=g?new g(this):null,y=this.levelController=new Iy(this,p),Q=new YI(this),b=new Cy(this.config),v=this.streamController=new wy(this,Q,b);u.setStreamController(v),h.setStreamController(v);const w=[d,y,v];p&&w.splice(1,0,p),this.networkControllers=w;const R=[A,c,u,h,f,Q];this.audioTrackController=this.createController(t.audioTrackController,w);const k=t.audioStreamController;k&&w.push(new k(this,Q,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,w);const H=t.subtitleStreamController;H&&w.push(new H(this,Q,b)),this.createController(t.timelineController,R),b.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(pI,R),this.coreComponents=R,w.push(l);const V=l.onErrorOut;typeof V=="function"&&this.on(I.ERROR,V,l)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(U.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===I.ERROR;this.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){U.log("destroy"),this.trigger(I.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){U.log("attachMedia"),this._media=e,this.trigger(I.MEDIA_ATTACHING,{media:e})}detachMedia(){U.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,n=this.url,i=this.url=ga.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,U.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(I.MANIFEST_LOADING,{url:e})}startLoad(e=-1){U.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){U.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(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){U.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){U.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){U.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){U.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){U.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){U.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&&(U.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){mI(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 n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const o=e[s].attrs["HDCP-LEVEL"];if(o&&o<=n)return s}return i}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}}wr.defaultConfig=void 0;function Sy(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Ry(r){return r}function Dy(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||Ry,s={};function o(a,l,A){A=A||1,Object.keys(a).forEach(function(c){const u=a[c],h=e.safe&&Array.isArray(u),d=Object.prototype.toString.call(u),f=Sy(u),g=d==="[object Object]"||d==="[object Array]",p=l?l+t+i(c):i(c);if(!h&&!f&&g&&Object.keys(u).length&&(!e.maxDepth||A<n))return o(u,p,A+1);s[p]=u})}return o(r),s}var md=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function _y(r,e){return!!(r===e||md(r)&&md(e))}function Ly(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!_y(r[t],e[t]))return!1;return!0}function Fy(r,e){e===void 0&&(e=Ly);var t=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(t&&t.lastThis===this&&e(i,t.lastArgs))return t.lastResult;var o=r.apply(this,i);return t={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){t=null},n}/**
2485
+ `),A=[],c=e?fI(e.baseTime,e.timescale):0;let u="00:00.000",h=0,d=0,f,g=!0;a.oncue=function(p){const C=t[n];let Q=t.ccOffset;const b=(h-c)/9e4;if(C!=null&&C.new&&(d!==void 0?Q=t.ccOffset=C.start:XI(t,n,b)),b){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}Q=b-t.presentationOffset}const v=p.endTime-p.startTime,x=Yt((p.startTime+Q-d)*9e4,i*9e4)/9e4;p.startTime=Math.max(x,0),p.endTime=Math.max(x+v,0);const R=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(R)),p.id||(p.id=Ga(p.startTime,p.endTime,R)),p.endTime>0&&A.push(p)},a.onparsingerror=function(p){f=p},a.onflush=function(){if(f){o(f);return}s(A)},l.forEach(p=>{if(g)if(Oa(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(C=>{Oa(C,"LOCAL:")?u=C.slice(6):Oa(C,"MPEGTS:")&&(h=parseInt(C.slice(7)))});try{d=qI(u)/1e3}catch(C){f=C}return}else p===""&&(g=!1);a.parse(p+`
2486
+ `)}),a.flush()}const Ha="stpp.ttml.im1t",ch=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,uh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,zI={left:"start",center:"center",right:"end",start:"start",end:"end"};function hh(r,e,t,n){const i=xe(new Uint8Array(r),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(a=>or(a)),o=dI(e.baseTime,1,e.timescale);try{s.forEach(a=>t(ZI(a,o)))}catch(a){n(a)}}function ZI(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(s).reduce((u,h)=>(u[h]=i.getAttribute(`ttp:${h}`)||s[h],u),{}),a=i.getAttribute("xml:space")!=="preserve",l=dh($a(i,"styling","style")),A=dh($a(i,"layout","region")),c=$a(i,"body","[begin]");return[].map.call(c,u=>{const h=fh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=Va(u.getAttribute("begin"),o),f=Va(u.getAttribute("dur"),o);let g=Va(u.getAttribute("end"),o);if(d===null)throw gh(u);if(g===null){if(f===null)throw gh(u);g=d+f}const p=new Ma(d-e,g-e,h);p.id=Ga(p.startTime,p.endTime,p.text);const C=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=eC(C,Q,l),{textAlign:v}=b;if(v){const x=zI[v];x&&(p.lineAlign=x),p.align=v}return it(p,b),p}).filter(u=>u!==null)}function $a(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function dh(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function fh(r,e){return[].slice.call(r.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
2487
+ `:(s=n.childNodes)!=null&&s.length?fh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function eC(r,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),s.reduce((a,l)=>{const A=Ya(e,n,l)||Ya(r,n,l)||Ya(i,n,l);return A&&(a[l]=A),a},{})}function Ya(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function gh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function Va(r,e){if(!r)return null;let t=ah(r);return t===null&&(ch.test(r)?t=tC(r,e):uh.test(r)&&(t=rC(r,e))),t}function tC(r,e){const t=ch.exec(r),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function rC(r,e){const t=uh.exec(r),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class nC{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=Eh(),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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(I.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 Ms(this,"textTrack1"),t=new Ms(this,"textTrack2"),n=new Ms(this,"textTrack3"),i=new Ms(this,"textTrack4");this.cea608Parser1=new oh(1,e,t),this.cea608Parser2=new oh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=iC(l[0],l[1],t,n);if(A>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,A/(n-t)>.5))return}if(o||s.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){const{unparsedVttFrags:o}=this;n==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:s}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(I.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(mh(s,{name:e,lang:t,attrs:{}}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:o}=t[e],a=this.getExistingTrack(s,o);if(a)n[e]=a,yn(n[e]),au(n[e],i);else{const l=this.createTextTrack("captions",s,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{yn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Eh(),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 n=0;n<t.length;n++)yn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Ha);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(zu(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Is(o.textTracks):null;if(this.tracks.forEach((l,A)=>{let c;if(a){let u=null;for(let h=0;h<a.length;h++)if(a[h]&&mh(a[h],l)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)yn(c);else{const u=ph(l);c=this.createTextTrack(u,l.name,l.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const l=a.filter(A=>A!==null).map(A=>A.label);l.length&&U.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,o=this.captionsProperties[s];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}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===Ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:A}=t.frag,c=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&o&&(A!==a+1||A===a&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=l,this.lastSn=A,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===Ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,o="stats"in t;if(s==null||!s.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===Ha?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;hh(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{U.log(`Failed to parse IMSC1: ${i}`),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:o}=this,a=s.length-1;if(!s[n.cc]&&a===-1){o.push(e);return}const l=this.hls,A=(t=n.initSegment)!=null&&t.data?$t(n.initSegment.data,new Uint8Array(i)):i;jI(A,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,c=>{this._appendCues(c,n.level),l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},c=>{const u=c.message==="Missing initPTS for VTT MPEGTS";u?o.push(e):this._fallbackToIMSC1(n,i),U.log(`Failed to parse VTT cue: ${c}`),!(u&&a>n.cc)&&l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:c})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||hh(t,this.initPTS[e.cc],()=>{n.textCodec=Ha,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>lu(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(I.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===Ee.SUBTITLE&&this.onFragLoaded(I.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:n,cea608Parser2:i}=this;if(!this.enabled||!n||!i)return;const{frag:s,samples:o}=t;if(!(s.type===Ee.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let a=0;a<o.length;a++){const l=o[a].bytes;if(l){const A=this.extractCea608Data(l);n.addData(o[a].pts,A[0]),i.addData(o[a].pts,A[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!s||s==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>fa(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>fa(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(l))}}return t}}function ph(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function mh(r,e){return!!r&&r.kind===ph(e)&&ka(e,r)}function iC(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function Eh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ka{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(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&he(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&U.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,Ka.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let s=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){s=a;break}}return s}}class sC{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(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/s,A=this.hls;if(A.trigger(I.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>A.config.fpsDroppedMonitoringThreshold*a){let c=A.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(A.autoLevelCapping===-1||A.autoLevelCapping>=c)&&(c=c-1,A.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:A.currentLevel}),A.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,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 Os="[eme]";class Dn{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=Dn.CDMCleanupPromise?[Dn.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,Os),this.log=U.log.bind(U,Os),this.warn=U.warn.bind(U,Os),this.error=U.error.bind(U,Os),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(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===Ke.WIDEVINE&&n)return n;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),s=t.map(o=>o.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((o,a)=>{const l=A=>{const c=A.shift();this.getMediaKeysPromise(c,i,s).then(u=>o({keySystem:c,mediaKeys:u})).catch(u=>{A.length?l(A):u instanceof Vt?a(u):a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return _c===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){const i=um(e,t,n,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let o=s==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),o=this.requestMediaKeySystemAccess(e,i);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const A=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),A.then(u=>u?this.setMediaKeysServerCertificate(c,e,u):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${ar.hexDump(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,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 ar.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${ar.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
2488
+ } (data length: ${t&&t.byteLength})`),i.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,n)=>{const i=ia(this.config),s=e.map(Sc).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=Dc(o);a?t(a):n(new Error(`Unable to find format for key-system "${o}"`))}).catch(n)})}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let s=this.keyIdToKeySessionPromise[n];return s||(s=this.keyIdToKeySessionPromise[n]=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 ${i}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),s.catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vt?this.hls.trigger(I.ERROR,e.data):this.hls.trigger(I.ERROR,{type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=Sc(e.keyFormat),s=i?[i]:ia(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ia(this.config)),e.length===0)throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.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:n}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),n===null)return;let s,o;if(t==="sinf"&&this.config.drmSystems[Ke.FAIRPLAY]){const u=ct(new Uint8Array(n));try{const h=ra(JSON.parse(u).sinf),d=Gc(new Uint8Array(h));if(!d)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=d.subarray(8,24),o=Ke.FAIRPLAY}catch(h){this.warn(`${i} Failed to parse sinf: ${h}`);return}}else{const u=Nm(n),h=u.filter(d=>d.systemId===hi.WIDEVINE)[0];if(!h){u.length===0||u.some(d=>!d.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(d=>Rc(d.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(o=Rc(h.systemId),h.version===0&&h.data){const d=h.data.length-22;s=h.data.subarray(d,d+16)}}if(!o||!s)return;const a=ar.hexDump(s),{keyIdToKeySessionPromise:l,mediaKeySessions:A}=this;let c=l[a];for(let u=0;u<A.length;u++){const h=A[u],d=h.decryptdata;if(!d.keyId)continue;const f=ar.hexDump(d.keyId);if(a===f||d.uri.replace(/-/g,"").indexOf(a)!==-1){if(c=l[f],d.pssh)break;delete l[f],d.pssh=new Uint8Array(n),d.keyId=s,c=l[a]=c.then(()=>this.generateRequestWithPreferredKeySession(h,t,n,"encrypted-event-key-match"));break}}c||(c=l[a]=this.getKeySystemSelectionPromise([o]).then(({keySystem:u,mediaKeys:h})=>{var d;this.throwIfDestroyed();const f=new fi("ISO-23001-7",a,(d=Dc(u))!=null?d:"");return f.pssh=new Uint8Array(n),f.keyId=s,this.attemptSetMediaKeys(u,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:f,keySystem:u,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,n,"encrypted-event-no-match")})})),c.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s,o;const a=(s=this.config.drmSystems)==null||(o=s[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const f=a.call(this.hls,t,n,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,n=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var l;if(this.warn(f.message),(l=this.hls)!=null&&l.config.debug)throw f}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const A=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${A} (init data type: ${t} length: ${n?n.byteLength:null})`);const c=new Fa,u=e._onmessage=f=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:C}=f;this.log(`"${p}" message event for session "${g.sessionId}" message size: ${C.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,C).catch(Q=>{this.handleError(Q),c.emit("error",Q)}):p==="license-release"?e.keySystem===Ke.FAIRPLAY&&(this.updateKeySession(e,na("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},h=e._onkeystatuseschange=f=>{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 ${A}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise((f,g)=>{c.on("error",g),c.on("keyStatus",p=>{p.startsWith("usable")?f():p==="output-restricted"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${A}`)}).catch(f=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>d).catch(f=>{throw c.removeAllListeners(),this.removeSession(e),f}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ar.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${ar.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:s},A=t.certLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{o(h.data)},onError:(h,d,f,g)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:ht({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(h,d,f)=>{a(new Error("aborted"))}};i.load(l,c,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),i(e)}).catch(o=>{s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let c;for(let u=0,h=s.length;u<h;u++){var o,a;c=s[u];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,f=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&f&&e.setRequestHeader(d,f)}}const l=i.querySelector("Challenge"),A=l==null?void 0:l.textContent;if(!A)throw new Error("Cannot find <Challenge> in key message");return na(atob(A))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{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 s(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const A=this.config.licenseResponseCallback;if(A)try{l=A.call(this.hls,a,o,e)}catch(c){this.error(c)}i(l)}else{const l=n.errorRetry,A=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A||a.status>=400&&a.status<500)s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.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=A-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:A})=>{e.keySystem==Ke.PLAYREADY&&(A=this.unpackPlayReadyKeyMessage(l,A)),l.send(A)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,n.addEventListener("encrypted",this.onMediaEncrypted),n.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={},fi.clearKeyUriToKeyIdMap();const n=t.length;Dn.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=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),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(s=>{this.log(`Could not remove session: ${s}`)}).then(()=>t.close()).catch(s=>{this.log(`Could not close session: ${s}`)})}}}Dn.CDMCleanupPromise=void 0;class Vt 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 Qt;(function(r){r.MANIFEST="m",r.AUDIO="a",r.VIDEO="v",r.MUXED="av",r.INIT="i",r.CAPTION="c",r.TIMED_TEXT="tt",r.KEY="k",r.OTHER="o"})(Qt||(Qt={}));var Ja;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Ja||(Ja={}));var nn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(nn||(nn={}));const oC={[nn.OBJECT]:["br","d","ot","tb"],[nn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[nn.SESSION]:["cid","pr","sf","sid","st","v"],[nn.STATUS]:["bs","rtp"]};class _n{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(n=>n instanceof _n?n:new _n(n))),this.value=e,this.params=t}}class Ih{constructor(e){this.description=void 0,this.description=e}}const aC="Dict";function lC(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function AC(r,e,t,n){return new Error(`failed to ${r} "${lC(e)}" as ${t}`,{cause:n})}const Ch="Bare Item",cC="Boolean",uC="Byte Sequence",hC="Decimal",dC="Integer";function fC(r){return r<-999999999999999||999999999999999<r}const gC=/[\x00-\x1f\x7f]+/,pC="Token",mC="Key";function hr(r,e,t){return AC("serialize",r,e,t)}function EC(r){if(typeof r!="boolean")throw hr(r,cC);return r?"?1":"?0"}function IC(r){return btoa(String.fromCharCode(...r))}function CC(r){if(ArrayBuffer.isView(r)===!1)throw hr(r,uC);return`:${IC(r)}:`}function vh(r){if(fC(r))throw hr(r,dC);return r.toString()}function vC(r){return`@${vh(r.getTime()/1e3)}`}function yh(r,e){if(r<0)return-yh(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}function yC(r){const e=yh(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw hr(r,hC);const t=e.toString();return t.includes(".")?t:`${t}.0`}const BC="String";function TC(r){if(gC.test(r))throw hr(r,BC);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function QC(r){return r.description||r.toString().slice(7,-1)}function Bh(r){const e=QC(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw hr(e,pC);return e}function Wa(r){switch(typeof r){case"number":if(!he(r))throw hr(r,Ch);return Number.isInteger(r)?vh(r):yC(r);case"string":return TC(r);case"symbol":return Bh(r);case"boolean":return EC(r);case"object":if(r instanceof Date)return vC(r);if(r instanceof Uint8Array)return CC(r);if(r instanceof Ih)return Bh(r);default:throw hr(r,Ch)}}function qa(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw hr(r,mC);return r}function Xa(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${qa(e)}`:`;${qa(e)}=${Wa(t)}`).join("")}function Th(r){return r instanceof _n?`${Wa(r.value)}${Xa(r.params)}`:Wa(r)}function bC(r){return`(${r.value.map(Th).join(" ")})${Xa(r.params)}`}function xC(r,e={whitespace:!0}){if(typeof r!="object")throw hr(r,aC);const t=r instanceof Map?r.entries():Object.entries(r),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof _n||(s=new _n(s));let o=qa(i);return s.value===!0?o+=Xa(s.params):(o+="=",Array.isArray(s.value)?o+=bC(s):o+=Th(s)),o}).join(`,${n}`)}function wC(r,e){return xC(r,e)}const SC=r=>r==="ot"||r==="sf"||r==="st",RC=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function DC(r,e){const t=new URL(r),n=new URL(e);if(t.origin!==n.origin)return r;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}function _C(){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,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}const Us=r=>Math.round(r),LC=(r,e)=>(e!=null&&e.baseUrl&&(r=DC(r,e.baseUrl)),encodeURIComponent(r)),Gs=r=>Us(r/100)*100,FC={br:Us,d:Us,bl:Gs,dl:Gs,mtp:Gs,nor:LC,rtp:Gs,tb:Us};function kC(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=it({},FC,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return n.forEach(o=>{if(s!=null&&s(o))return;let a=r[o];const l=i[o];l&&(a=l(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||RC(a)&&(SC(o)&&typeof a=="string"&&(a=new Ih(a)),t[o]=a))}),t}function Qh(r,e={}){return r?wC(kC(r,e),it({whitespace:!1},e)):""}function NC(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(oC).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((s,o)=>{var a,l;const[A,c]=o,u=((a=n.find(h=>h[1].includes(A)))==null?void 0:a[0])||nn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=Qh(a,e),s),{})}function MC(r,e,t){return it(r,NC(e,t))}const PC="CMCD";function OC(r,e={}){if(!r)return"";const t=Qh(r,e);return`${PC}=${encodeURIComponent(t)}`}const bh=/CMCD=[^&#]+/;function UC(r,e,t){const n=OC(e,t);if(!n)return r;if(bh.test(r))return r.replace(bh,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class GC{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=i=>{try{this.apply(i,{ot:Qt.MANIFEST,su:!this.initialized})}catch(s){U.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const s=i.frag,o=this.hls.levels[s.level],a=this.getObjectType(s),l={d:s.duration*1e3,ot:a};(a===Qt.VIDEO||a===Qt.AUDIO||a==Qt.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(a)/1e3,l.bl=this.getBufferLength(a)),this.apply(i,l)}catch(s){U.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||_C(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHED,this.onMediaDetached,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHED,this.onMediaDetached,this),e.off(I.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 n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Ja.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){it(t,this.createData());const n=t.ot===Qt.INIT||t.ot===Qt.VIDEO||t.ot===Qt.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((s,o)=>(i.includes(o)&&(s[o]=t[o]),s),{})),this.useHeaders?(e.headers||(e.headers={}),MC(e.headers,t)):e.url=UC(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Qt.TIMED_TEXT;if(e.sn==="initSegment")return Qt.INIT;if(t==="audio")return Qt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Qt.VIDEO:Qt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Qt.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,o=s>-1?s+1:i.levels.length;n=i.levels.slice(0,o)}for(const s of n)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,n=e===Qt.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Je.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}}const HC=3e5;class $C{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=U.log.bind(U,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===Bt.SendAlternateToPenaltyBox&&n.flags===Zt.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:A}=t.context;a&&i?o=this.getPathwayForGroupId(a,A,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!s&&i&&(s=i.reduce((a,l)=>(a.indexOf(l.pathwayId)===-1&&a.push(l.pathwayId),a),[])),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==o),n.resolved||U.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>HC&&delete n[s]});for(let s=0;s<e.length;s++){const o=e[s];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,mu(t),this.hls.trigger(I.LEVELS_UPDATED,{levels:t});const A=this.hls.levels[a];l&&A&&this.levels&&(A.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&A.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${A.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===Oe.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Oe.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=s;if(t.some(c=>c.pathwayId===o))return;const A=this.getLevelsForPathway(a).map(c=>{const u=new je(c.attrs);u["PATHWAY-ID"]=o;const h=u.AUDIO&&`${u.AUDIO}_clone_${o}`,d=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;h&&(n[u.AUDIO]=h,u.AUDIO=h),d&&(i[u.SUBTITLES]=d,u.SUBTITLES=d);const f=wh(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new Bn({attrs:u,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:f,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)g.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)g.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return g});t.push(...A),xh(this.audioTracks,n,l,o),xh(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+c)}const s={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},A={onSuccess:(c,u,h,d)=>{this.log(`Loaded steering manifest: "${i}"`);const f=c.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":C}=f;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const Q={steeringManifest:f,url:i.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,Q),C&&this.updatePathwayPriority(C)},onError:(c,u,h,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${u.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let f=this.timeToLoad*1e3;if(c.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const p=g.getResponseHeader("Retry-After");p&&(f=parseFloat(p)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f)},onTimeout:(c,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,A)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function xh(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=it({},o);return a.details=void 0,a.attrs=new je(a.attrs),a.url=a.attrs.URI=wh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});r.push(...s)})}function wh(r,e,t,n){const{HOST:i,PARAMS:s,[t]:o}=n;let a;e&&(a=o==null?void 0:o[e],a&&(r=a));const l=new self.URL(r);return i&&!a&&(l.host=i),s&&Object.keys(s).sort().forEach(A=>{A&&l.searchParams.set(A,s[A])}),l.href}const YC=/^age:\s*[\d.]+\s*$/im;class Sh{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 us,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{this.callbacks.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[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),n.timeout=s&&he(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===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)){n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=a?t.response:t.responseText,A=t.responseType==="arraybuffer"?l.byteLength:l.length;if(n.loaded=n.total=A,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(n,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:o};this.callbacks.onSuccess(u,n,e,t)}else{const l=s.loadPolicy.errorRetry,A=n.retry,c={url:e.url,data:void 0,code:o};Ts(l,A,!1,c)?this.retry(l):(U.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,n))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Ts(e,t,!0))this.retry(e);else{var n;U.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Ca(e,n.retry),n.retry++,U.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&YC.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 VC(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const KC=/(\d+)-(\d+)\/(\d+)/;class Rh{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||XC,this.controller=new self.AbortController,this.stats=new us}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=JC(e,this.controller.signal),o=n.onProgress,a=e.responseType==="arraybuffer",l=a?"byteLength":"length",{maxTimeToFirstByteMs:A,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=A&&he(A)?A:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},c-(h-i.loading.start)),!u.ok){const{status:d,statusText:f}=u;throw new jC(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=qC(u.headers)||i.total,o&&he(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,o):a?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const d=u[l];d&&(i.loaded=i.total=d);const f={url:h.url,data:u,code:h.status};o&&!he(t.highWaterMark)&&o(i,e,u,h),n.onSuccess(f,i,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=u&&u.code||0,d=u?u.message:null;n.onError({code:h,text:d},e,u?u.details:null,i)})}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,n,i=0,s){const o=new Su,a=e.body.getReader(),l=()=>a.read().then(A=>{if(A.done)return o.dataLength&&s(t,n,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=A.value,u=c.length;return t.loaded+=u,u<i||o.dataLength?(o.push(c),o.dataLength>=i&&s(t,n,o.flush(),e)):s(t,n,c,e),l()}).catch(()=>Promise.reject());return l()}}function JC(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(it({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function WC(r){const e=KC.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function qC(r){const e=r.get("Content-Range");if(e){const n=WC(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function XC(r,e){return new self.Request(r.url,e)}class jC extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const zC=/\s/,ZC={newCue(r,e,t,n){const i=[];let s,o,a,l,A;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(s=n.rows[h],a=!0,l=0,A="",!s.isEmpty()){var u;for(let g=0;g<s.chars.length;g++)zC.test(s.chars[g].uchar)&&a?l++:(A+=s.chars[g].uchar,a=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=Ah(A.trim()),f=Ga(e,t,d);r!=null&&(u=r.cues)!=null&&u.getCueById(f)||(o=new c(e,t,d),o.id=f,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(o))}return r&&i.length&&(i.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),i.forEach(h=>lu(r,h))),i}},ev={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Dh=ht(ht({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:Sh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:xE,bufferController:DI,capLevelController:Ka,errorController:gE,fpsController:sC,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:_c,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:ev},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},tv()),{},{subtitleStreamController:xI,subtitleTrackController:SI,timelineController:nC,audioStreamController:QI,audioTrackController:bI,emeController:Dn,cmcdController:GC,contentSteeringController:$C});function tv(){return{cueHandler:ZC,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 rv(r,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=ja(r),n=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(s=>{const o=`${s==="level"?"playlist":s}LoadPolicy`,a=e[o]===void 0,l=[];i.forEach(A=>{const c=`${s}Loading${A}`,u=e[c];if(u!==void 0&&a){l.push(c);const h=t[o].default;switch(e[o]={default:h},A){case"TimeOut":h.maxLoadTimeMs=u,h.maxTimeToFirstByteMs=u;break;case"MaxRetry":h.errorRetry.maxNumRetry=u,h.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":h.errorRetry.retryDelayMs=u,h.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=u,h.timeoutRetry.maxRetryDelayMs=u;break}}}),l.length&&U.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ht(ht({},t),e)}function ja(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(ja):Object.keys(r).reduce((e,t)=>(e[t]=ja(r[t]),e),{}):r}function nv(r){const e=r.loader;e!==Rh&&e!==Sh?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):VC()&&(r.loader=Rh,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let za;class iv extends ya{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.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 n=this.hls.config.preferManagedMediaSource,i=[],s={},o={};let a=!1,l=!1,A=!1;t.levels.forEach(c=>{var u,h;const d=c.attrs;let{audioCodec:f,videoCodec:g}=c;((u=f)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(za||(za=/chrome|firefox/i.test(navigator.userAgent)),za&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=Es(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=Ym(g));const{width:p,height:C,unknownCodecs:Q}=c;if(a||(a=!!(p&&C)),l||(l=!!g),A||(A=!!f),Q!=null&&Q.length||f&&!ua(f,"audio",n)||g&&!ua(g,"video",n))return;const{CODECS:b,"FRAME-RATE":v,"HDCP-LEVEL":x,"PATHWAY-ID":R,RESOLUTION:k,"VIDEO-RANGE":$}=d,O=`${`${R||"."}-`}${c.bitrate}-${k}-${v}-${b}-${$}-${x}`;if(s[O])if(s[O].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const W=o[O]+=1;c.attrs["PATHWAY-ID"]=new Array(W+1).join(".");const ie=new Bn(c);s[O]=ie,i.push(ie)}else s[O].addGroupId("audio",d.AUDIO),s[O].addGroupId("text",d.SUBTITLES);else{const W=new Bn(c);s[O]=W,o[O]=1,i.push(W)}}),this.filterAndSortMediaOptions(i,t,a,l,A)}filterAndSortMediaOptions(e,t,n,i,s){let o=[],a=[],l=e;if((n||i)&&s&&(l=l.filter(({videoCodec:f,videoRange:g,width:p,height:C})=>(!!f||!!(p&&C))&&nE(g))),l.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 f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;o=t.audioTracks.filter(g=>!g.audioCodec||ua(g.audioCodec,"audio",f)),_h(o)}t.subtitles&&(a=t.subtitles,_h(a));const A=l.slice(0);l.sort((f,g)=>{if(f.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&f.height!==g.height)return f.height-g.height;if(f.frameRate!==g.frameRate)return f.frameRate-g.frameRate;if(f.videoRange!==g.videoRange)return vs.indexOf(f.videoRange)-vs.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=qc(f.videoCodec),C=qc(g.videoCodec);if(p!==C)return C-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=ms(f.codecSet),C=ms(g.codecSet);if(p!==C)return C-p}return f.averageBitrate!==g.averageBitrate?f.averageBitrate-g.averageBitrate:0});let c=A[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==A.length)){for(let f=0;f<A.length;f++)if(A[f].pathwayId===l[0].pathwayId){c=A[f];break}}this._levels=l;for(let f=0;f<l.length;f++)if(l[f]===c){var u;this._firstLevel=f;const g=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const C=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);C>p&&p===Dh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=C)}break}const h=s&&!i,d={levels:l,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:!h&&o.some(f=>!!f.url)};this.hls.trigger(I.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"),u=e<0;if(this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&o.details&&i&&s===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 ${n}${s?" with Pathway "+s:""}`);const l={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(I.LEVEL_SWITCHING,l);const A=o.details;if(!A||A.live){const c=this.switchParams(o.uri,i==null?void 0:i.details,A);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===Oe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,o=this._levels[i];if(!o){var a;this.warn(`Invalid level index ${i}`),(a=t.deliveryDirectives)!=null&&a.skip&&(s.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(i,t,o.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let i=n.uri;if(e)try{i=e.addDirectives(i)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const s=n.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${s?" Pathway "+s:""} ${i}`),this.clearTimer(),this.hls.trigger(I.LEVEL_LOADING,{url:i,level:t,pathwayId:n.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 n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));mu(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(I.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function _h(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class sv{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.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=V.KEY_LOAD_ERROR,n,i,s){return new Qr({type:Be.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:n,cc:i}=e;for(let s=0;s<t.length;s++){const o=t[s];if(i<=o.cc&&(n==="initSegment"||o.sn==="initSegment"||n<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 n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const A=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,V.KEY_LOAD_ERROR,A))}const o=s.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((n=a)!=null&&n.decryptdata.key)return s.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((i=a)!=null&&i.keyLoadPromise){var l;switch((l=a.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(A=>(s.key=A.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.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,V.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);if(i)return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},A=n.keyLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{const{frag:p,keyInfo:C,url:Q}=f;if(!p.decryptdata||C!==this.keyUriToKeyInfo[Q])return a(this.createKeyLoadError(p,V.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));C.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,C.loader=null,o({frag:p,keyInfo:C})},onError:(h,d,f,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),f,ht({url:l.url,data:void 0},h)))},onTimeout:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};s.load(l,c,u)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[i],s&&s.destroy()}}function Lh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Fh(){if(!tn())return!1;const e=Lh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function ov(){if(!Fh())return!1;const r=tn();return typeof(r==null?void 0:r.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(gi(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(gi(e,"audio"))))}function av(){var r;const e=Lh();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const lv=250,Hs=2,Av=.1,cv=.05;class uv{constructor(e,t,n,i){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=n,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:n,media:i,stalled:s}=this;if(i===null)return;const{currentTime:o,seeking:a}=i,l=this.seeking&&!a,A=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),s!==null){if(this.stallReported){const p=self.performance.now()-s;U.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(A||l){this.stalled=null;return}if(i.paused&&!a||i.ended||i.playbackRate===0||!Je.getBuffered(i).length){this.nudgeRetry=0;return}const c=Je.bufferInfo(i,o,0),u=c.nextStart||0;if(a){const p=c.len>Hs,C=!u||t&&t.start<=o||u-o>Hs&&!this.fragmentTracker.getPartialFragment(o);if(p||C)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(c.len>0)&&!u)return;const C=Math.max(u,c.start||0)-o,Q=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,v=(Q==null||(h=Q.details)==null?void 0:h.live)?Q.details.targetduration*2:Hs,x=this.fragmentTracker.getPartialFragment(o);if(C>0&&(C<=v||x)){i.paused||this._trySkipBufferHole(x);return}}const d=self.performance.now();if(s===null){this.stalled=d;return}const f=d-s;if(!a&&f>=lv&&(this._reportStall(c),!this.media))return;const g=Je.bufferInfo(i,o,n.maxBufferHole);this._tryFixBufferStall(g,f)}_tryFixBufferStall(e,t){const{config:n,fragmentTracker:i,media:s}=this;if(s===null)return;const o=s.currentTime,a=i.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-o<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:n,stallReported:i}=this;if(!i&&n){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);U.warn(s.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:n,media:i}=this;if(i===null)return 0;const s=i.currentTime,o=Je.bufferInfo(i,s,0),a=s<o.start?o.start:o.nextStart;if(a){const l=o.len<=t.maxBufferHole,A=o.len>0&&o.len<1&&i.readyState<3,c=a-s;if(c>0&&(l||A)){if(c>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(s===0){const f=h.getAppendedFrag(0,Ee.MAIN);f&&a<f.end&&(d=!0)}if(!d){const f=e||h.getAppendedFrag(s,Ee.MAIN);if(f){let g=!1,p=f.end;for(;p<a;){const C=h.getPartialFragment(p);if(C)p+=C.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(a+cv,s+Av);if(U.warn(`skipping hole, adjusting currentTime from ${s} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${u}`);n.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:n,nudgeRetry:i}=this;if(n===null)return;const s=n.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const o=s+(i+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${s} to ${o}`);U.warn(a.message),n.currentTime=o,t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${s} after ${e.nudgeMaxRetry} nudges`);U.error(o.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const hv=100;class dv extends Qa{constructor(e,t,n){super(e,t,n,"[stream-controller]",Ee.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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(I.ERROR,this.onError,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(I.ERROR,this.onError,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(hv),this.level=-1,!this.startFragRequested){let i=n.startLevel;i===-1&&(n.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=n.firstAutoLevel),n.nextLoadLevel=i,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=re.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=re.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case re.WAITING_LEVEL:{const{levels:t,level:n}=this,i=t==null?void 0:t[n],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=re.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=re.IDLE;break}break}case re.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:i,level:s}=this,o=i==null?void 0:i[s];this.resetStartWhenNotLoaded(o||null),this.state=re.IDLE}}break}this.state===re.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=e.nextLoadLevel;if(!(n!=null&&n[s]))return;const o=n[s],a=this.getMainFwdBufferInfo();if(a===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(a,l)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(I.BUFFER_EOS,g),this.state=re.ENDED;return}e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const A=o.details;if(!A||this.state===re.WAITING_LEVEL||A.live&&this.levelLastLoaded!==o){this.level=s,this.state=re.WAITING_LEVEL;return}const c=a.len,u=this.getMaxBufferLength(o.maxBitrate);if(c>=u)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,A);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==dt.OK){var f;const p=((f=this.backtrackFragment)!=null?f:d).sn-A.startSN,C=A.fragments[p-1];C&&d.cc===C.cc&&(d=C,this.fragmentTracker.removeFragment(C))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?He.AUDIO:He.VIDEO,C=(p===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;C&&this.afterBufferFlushed(C,p,Ee.MAIN)}d=this.getNextFragmentLoopLoading(d,A,a,Ee.MAIN,u)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===dt.NOT_LOADED||i===dt.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,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ee.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 n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<s.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],A=this.fragLastKbps;A&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*A)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,A=a.duration,c=Math.max(o.end,l+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,A*(this.couldBacktrack?.5:.125)),A*(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 re.KEY_LOADING:case re.FRAG_LOADING:case re.FRAG_LOADING_WAITING_RETRY:case re.PARSING:case re.PARSED:this.state=re.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 n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new uv(this.config,n,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;he(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const n=this.getMainFwdBufferInfo();if(n===null||n.len===0){this.warn(`Main forward buffer length on "seeked" event ${n?n.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.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 n=!1,i=!1;t.levels.forEach(s=>{const o=s.audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,i=i||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=n&&i&&!av(),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:n}=this;if(!n||this.state!==re.IDLE)return;const i=n[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=re.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i}=this,s=t.level,o=t.details,a=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const l=i[s],A=this.fragCurrent;A&&(this.state===re.FRAG_LOADING||this.state===re.FRAG_LOADING_WAITING_RETRY)&&A.level!==t.level&&A.loader&&this.abortCurrentFrag();let c=0;if(o.live||(n=l.details)!=null&&n.live){var u;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=o,this.levelLastLoaded=l,this.hls.trigger(I.LEVEL_UPDATED,{details:o,level:s}),this.state===re.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=re.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const a=o[n.level],l=a.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const A=a.videoCodec,c=l.PTSKnown||!l.live,u=(t=n.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new ju(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new Ba(n.level,n.sn,n.stats.chunkCount,s.byteLength,f,g),C=this.initPTS[n.cc];d.push(s,u,h,A,n,i,l.totalduration,c,p,C)}onAudioTrackSwitching(e,t){const n=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 s=this.hls;n&&(s.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),s.trigger(I.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=t.id,i=!!this.hls.audioTracks[n].url;if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,o=!1;for(const a in n){const l=n[a];if(l.id==="main"){if(s=a,i=l,a==="video"){const A=n[a];A&&(this.videoBuffer=A.buffer)}}else o=!0}o&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n&&n.type!==Ee.MAIN)return;if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===re.PARSED&&(this.state=re.IDLE);return}const s=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===Oe.LEVEL&&(this.state=re.IDLE);break;case V.BUFFER_APPEND_ERROR:case V.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===V.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Je.getBuffered(e).length){const n=this.state!==re.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,n)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=re.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==He.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,t,Ee.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 n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=Je.getBuffered(e),o=(i.length?i.start(0):0)-n;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),n+=o,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_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(n=>{const{hls:i}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=re.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=e.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(I.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const n="main",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{video:u,text:h,id3:d,initSegment:f}=s,{details:g}=c,p=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,f){if(f!=null&&f.tracks){const b=l.initSegment||l;this._bufferInitSegment(c,f.tracks,b,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:n,tracks:f.tracks})}const C=f.initPTS,Q=f.timescale;he(C)&&(this.initPTS[l.cc]={baseTime:C,timescale:Q},i.trigger(I.INIT_PTS_FOUND,{frag:l,id:n,initPTS:C,timescale:Q}))}if(u&&g&&l.sn!=="initSegment"){const C=g.fragments[l.sn-1-g.startSN],Q=l.sn===g.startSN,b=!C||l.cc>C.cc;if(s.independent!==!1){const{startPTS:v,endPTS:x,startDTS:R,endDTS:k}=u;if(A)A.elementaryStreams[u.type]={startPTS:v,endPTS:x,startDTS:R,endDTS:k};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const $=this.getMainFwdBufferInfo(),K=($?$.end:this.getLoadPosition())+this.config.maxBufferHole,O=u.firstKeyFramePTS?u.firstKeyFramePTS:v;if(!Q&&K<O-this.config.maxBufferHole&&!b){this.backtrack(l);return}else b&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,x,l.start,k,!0)}else Q&&v>Hs&&(l.gap=!0);l.setElementaryStreamInfo(u.type,v,x,R,k),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,A,o,Q||b)}else if(Q||b)l.gap=!0;else{this.backtrack(l);return}}if(p){const{startPTS:C,endPTS:Q,startDTS:b,endDTS:v}=p;A&&(A.elementaryStreams[He.AUDIO]={startPTS:C,endPTS:Q,startDTS:b,endDTS:v}),l.setElementaryStreamInfo(He.AUDIO,C,Q,b,v),this.bufferFragmentData(p,l,A,o)}if(g&&d!=null&&(t=d.samples)!=null&&t.length){const C={id:n,frag:l,details:g,samples:d.samples};i.trigger(I.FRAG_PARSING_METADATA,C)}if(g&&h){const C={id:n,frag:l,details:g,samples:h.samples};i.trigger(I.FRAG_PARSING_USERDATA,C)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:s,video:o,audiovideo:a}=t;if(s){let l=e.audioCodec;const A=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const c=s.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&A.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&A.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),s.levelCodec=l,s.id="main",this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${s.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(I.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const c=t[l].initSegment;c!=null&&c.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:l,data:c,frag:n,part:null,chunkMeta:i,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ee.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=re.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Je.isBuffered(e,n)?t=this.getAppendedFrag(n):Je.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(I.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(I.LEVEL_SWITCHED,{level:s}))}}}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,n=this.currentFrag;if(n&&he(t)&&he(n.programDateTime)){const i=n.programDateTime+(t-n.start)*1e3;return new Date(i)}}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 wr{static get version(){return"1.5.17"}static isMSESupported(){return Fh()}static isSupported(){return ov()}static getMediaSource(){return tn()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return V}static get DefaultConfig(){return wr.defaultConfig?wr.defaultConfig:Dh}static set DefaultConfig(e){wr.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 Fa,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,tm(e.debug||!1,"Hls instance");const t=this.config=rv(wr.DefaultConfig,e);this.userConfig=e,t.progressive&&nv(t);const{abrController:n,bufferController:i,capLevelController:s,errorController:o,fpsController:a}=t,l=new o(this),A=this.abrController=new n(this),c=this.bufferController=new i(this),u=this.capLevelController=new s(this),h=new a(this),d=new qm(this),f=new eE(this),g=t.contentSteeringController,p=g?new g(this):null,C=this.levelController=new iv(this,p),Q=new SE(this),b=new sv(this.config),v=this.streamController=new dv(this,Q,b);u.setStreamController(v),h.setStreamController(v);const x=[d,C,v];p&&x.splice(1,0,p),this.networkControllers=x;const R=[A,c,u,h,f,Q];this.audioTrackController=this.createController(t.audioTrackController,x);const k=t.audioStreamController;k&&x.push(new k(this,Q,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,x);const $=t.subtitleStreamController;$&&x.push(new $(this,Q,b)),this.createController(t.timelineController,R),b.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(tE,R),this.coreComponents=R,x.push(l);const K=l.onErrorOut;typeof K=="function"&&this.on(I.ERROR,K,l)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(U.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===I.ERROR;this.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){U.log("destroy"),this.trigger(I.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){U.log("attachMedia"),this._media=e,this.trigger(I.MEDIA_ATTACHING,{media:e})}detachMedia(){U.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,n=this.url,i=this.url=Zo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,U.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(I.MANIFEST_LOADING,{url:e})}startLoad(e=-1){U.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){U.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(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){U.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){U.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){U.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){U.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){U.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){U.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&&(U.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){rE(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 n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const o=e[s].attrs["HDCP-LEVEL"];if(o&&o<=n)return s}return i}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}}wr.defaultConfig=void 0;function fv(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function gv(r){return r}function pv(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||gv,s={};function o(a,l,A){A=A||1,Object.keys(a).forEach(function(c){const u=a[c],h=e.safe&&Array.isArray(u),d=Object.prototype.toString.call(u),f=fv(u),g=d==="[object Object]"||d==="[object Array]",p=l?l+t+i(c):i(c);if(!h&&!f&&g&&Object.keys(u).length&&(!e.maxDepth||A<n))return o(u,p,A+1);s[p]=u})}return o(r),s}var kh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function mv(r,e){return!!(r===e||kh(r)&&kh(e))}function Ev(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!mv(r[t],e[t]))return!1;return!0}function Iv(r,e){e===void 0&&(e=Ev);var t=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(t&&t.lastThis===this&&e(i,t.lastArgs))return t.lastResult;var o=r.apply(this,i);return t={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){t=null},n}/**
2489
2489
  * @license
2490
2490
  * Copyright 2017 Google LLC
2491
2491
  * SPDX-License-Identifier: BSD-3-Clause
2492
- */const Ed=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Id=pn(class extends Zn{constructor(r){if(super(r),r.type!==gn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=$f(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=Wr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Wr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Wr(i[u],s[f]),zn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Wr(i[h],s[d]),zn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Ed(o,d,f),c=Ed(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const y=zn(r,i[u]);Wr(y,s[d]),l[d]=y}else l[d]=Wr(p,s[d]),zn(r,i[u],p),i[g]=null;d++}else Bo(i[h]),h--;else Bo(i[u]),u++;for(;d<=f;){const g=zn(r,l[f+1]);Wr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&Bo(g)}return this.ut=o,Hf(r,l),jt}});var Ft="top",Kt="bottom",Jt="right",kt="left",gl="auto",Ii=[Ft,Kt,Jt,kt],_n="start",Ci="end",ky="clippingParents",Cd="viewport",vi="popper",Ny="reference",vd=Ii.reduce(function(r,e){return r.concat([e+"-"+_n,e+"-"+Ci])},[]),yd=[].concat(Ii,[gl]).reduce(function(r,e){return r.concat([e,e+"-"+_n,e+"-"+Ci])},[]),My="beforeRead",Py="read",Oy="afterRead",Uy="beforeMain",Gy="main",Hy="afterMain",$y="beforeWrite",Yy="write",Vy="afterWrite",Ky=[My,Py,Oy,Uy,Gy,Hy,$y,Yy,Vy];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function sn(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function pl(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function Jy(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Wy(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Bd={name:"applyStyles",enabled:!0,phase:"write",fn:Jy,effect:Wy,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var on=Math.max,zs=Math.min,Ln=Math.round;function ml(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Td(){return!/^((?!chrome|android).)*safari/i.test(ml())}function Fn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&Ln(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ln(n.height)/r.offsetHeight||1);var o=sn(r)?Pt(r):window,a=o.visualViewport,l=!Td()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function El(r){var e=Fn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function Qd(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&pl(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function qy(r){return["table","td","th"].indexOf(dr(r))>=0}function Ur(r){return((sn(r)?r.ownerDocument:r.document)||window.document).documentElement}function Zs(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(pl(r)?r.host:null)||Ur(r)}function bd(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function jy(r){var e=/firefox/i.test(ml()),t=/Trident/i.test(ml());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=Zs(r);for(pl(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function yi(r){for(var e=Pt(r),t=bd(r);t&&qy(t)&&Sr(t).position==="static";)t=bd(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||jy(r)||e}function Il(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Bi(r,e,t){return on(r,zs(e,t))}function Xy(r,e,t){var n=Bi(r,e,t);return n>t?t:n}function xd(){return{top:0,right:0,bottom:0,left:0}}function wd(r){return Object.assign({},xd(),r)}function Sd(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var zy=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,wd(typeof e!="number"?e:Sd(e,Ii))};function Zy(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=Il(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=zy(i.padding,t),h=El(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],y=yi(s),Q=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,b=g/2-p/2,v=u[d],w=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=Bi(v,R,w),H=l;t.modifiersData[n]=(e={},e[H]=k,e.centerOffset=k-R,e)}}function eB(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Qd(e.elements.popper,i)&&(e.elements.arrow=i))}const tB={name:"arrow",enabled:!0,phase:"main",fn:Zy,effect:eB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function kn(r){return r.split("-")[1]}var rB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function nB(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:Ln(t*i)/i||0,y:Ln(n*i)/i||0}}function Rd(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var y=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,v=Ft,w=window;if(A){var R=yi(t),k="clientHeight",H="clientWidth";if(R===Pt(t)&&(R=Ur(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",H="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===Ci){v=Kt;var V=u&&R===w&&w.visualViewport?w.visualViewport.height:R[k];g-=V-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===Ci){b=Jt;var O=u&&R===w&&w.visualViewport?w.visualViewport.width:R[H];d-=O-n.width,d*=l?1:-1}}var W=Object.assign({position:a},A&&rB),ie=c===!0?nB({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var te;return Object.assign({},W,(te={},te[v]=Q?"0":"",te[b]=y?"0":"",te.transform=(w.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",te))}return Object.assign({},W,(e={},e[v]=Q?g+"px":"",e[b]=y?d+"px":"",e.transform="",e))}function iB(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:kn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Rd(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Rd(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const sB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:iB,data:{}};var eo={passive:!0};function oB(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,eo)}),a&&l.addEventListener("resize",t.update,eo),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,eo)}),a&&l.removeEventListener("resize",t.update,eo)}}const aB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:oB,data:{}};var lB={left:"right",right:"left",bottom:"top",top:"bottom"};function to(r){return r.replace(/left|right|bottom|top/g,function(e){return lB[e]})}var AB={start:"end",end:"start"};function Dd(r){return r.replace(/start|end/g,function(e){return AB[e]})}function Cl(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function vl(r){return Fn(Ur(r)).left+Cl(r).scrollLeft}function cB(r,e){var t=Pt(r),n=Ur(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Td();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+vl(r),y:l}}function uB(r){var e,t=Ur(r),n=Cl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=on(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=on(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+vl(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=on(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function yl(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function _d(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&yl(r)?r:_d(Zs(r))}function Ti(r,e){var t;e===void 0&&(e=[]);var n=_d(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],yl(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(Ti(Zs(o)))}function Bl(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function hB(r,e){var t=Fn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function Ld(r,e,t){return e===Cd?Bl(cB(r,t)):sn(e)?hB(e,t):Bl(uB(Ur(r)))}function dB(r){var e=Ti(Zs(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?yi(r):r;return sn(n)?e.filter(function(i){return sn(i)&&Qd(i,n)&&dr(i)!=="body"}):[]}function fB(r,e,t,n){var i=e==="clippingParents"?dB(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=Ld(r,A,n);return l.top=on(c.top,l.top),l.right=zs(c.right,l.right),l.bottom=zs(c.bottom,l.bottom),l.left=on(c.left,l.left),l},Ld(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Fd(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?kn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?Il(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case _n:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Ci:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Qi(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?ky:a,A=t.rootBoundary,c=A===void 0?Cd:A,u=t.elementContext,h=u===void 0?vi:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,y=wd(typeof p!="number"?p:Sd(p,Ii)),Q=h===vi?Ny:vi,b=r.rects.popper,v=r.elements[f?Q:h],w=fB(sn(v)?v:v.contextElement||Ur(r.elements.popper),l,c,o),R=Fn(r.elements.reference),k=Fd({reference:R,element:b,strategy:"absolute",placement:i}),H=Bl(Object.assign({},b,k)),V=h===vi?H:R,O={top:w.top-V.top+y.top,bottom:V.bottom-w.bottom+y.bottom,left:w.left-V.left+y.left,right:V.right-w.right+y.right},W=r.modifiersData.offset;if(h===vi&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Jt,Kt].indexOf(te)>=0?1:-1,D=[Ft,Kt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function gB(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?yd:l,c=kn(n),u=c?a?vd:vd.filter(function(f){return kn(f)===c}):Ii,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Qi(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function pB(r){if(fr(r)===gl)return[];var e=to(r);return[Dd(r),e,Dd(e)]}function mB(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,y=fr(p),Q=y===p,b=l||(Q||!f?[to(p)]:pB(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===gl?gB(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),w=e.rects.reference,R=e.rects.popper,k=new Map,H=!0,V=v[0],O=0;O<v.length;O++){var W=v[O],ie=fr(W),te=kn(W)===_n,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",P=Qi(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),j=le?te?Jt:kt:te?Kt:Ft;w[D]>R[D]&&(j=to(j));var _=to(j),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[j]<=0,P[_]<=0),S.every(function(ce){return ce})){V=W,H=!1;break}k.set(W,S)}if(H)for(var F=f?3:1,J=function(pe){var ge=v.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return V=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==V&&(e.modifiersData[n]._skip=!0,e.placement=V,e.reset=!0)}}const EB={name:"flip",enabled:!0,phase:"main",fn:mB,requiresIfExists:["offset"],data:{_skip:!1}};function kd(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function Nd(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function IB(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Qi(e,{elementContext:"reference"}),a=Qi(e,{altBoundary:!0}),l=kd(o,n),A=kd(a,i,s),c=Nd(l),u=Nd(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const CB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:IB};function vB(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function yB(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=yd.reduce(function(c,u){return c[u]=vB(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const BB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:yB};function TB(r){var e=r.state,t=r.name;e.modifiersData[t]=Fd({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const QB={name:"popperOffsets",enabled:!0,phase:"read",fn:TB,data:{}};function bB(r){return r==="x"?"y":"x"}function xB(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Qi(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),y=fr(e.placement),Q=kn(e.placement),b=!Q,v=Il(y),w=bB(v),R=e.modifiersData.popperOffsets,k=e.rects.reference,H=e.rects.popper,V=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var te,le=v==="y"?Ft:kt,D=v==="y"?Kt:Jt,P=v==="y"?"height":"width",j=R[v],_=j+p[le],S=j-p[D],F=d?-H[P]/2:0,J=Q===_n?k[P]:H[P],Y=Q===_n?-H[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?El(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:xd(),ge=pe[le],Se=pe[D],Le=Bi(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:J-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&yi(e.elements.arrow),Me=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,We=j+Ge-we-Me,Te=j+fe-we,T=Bi(d?zs(_,We):_,j,d?on(S,Te):S);R[v]=T,ie[v]=T-j}if(a){var m,E=v==="x"?Ft:kt,x=v==="x"?Kt:Jt,M=R[w],z=w==="y"?"height":"width",X=M+p[E],Ie=M-p[x],be=[Ft,kt].indexOf(y)!==-1,De=(m=W==null?void 0:W[w])!=null?m:0,ke=be?X:M-k[z]-H[z]-De+O.altAxis,_e=be?M+k[z]+H[z]-De-O.altAxis:Ie,Mt=d&&be?Xy(ke,M,_e):Bi(d?ke:X,M,d?_e:Ie);R[w]=Mt,ie[w]=Mt-M}e.modifiersData[n]=ie}}const wB={name:"preventOverflow",enabled:!0,phase:"main",fn:xB,requiresIfExists:["offset"]};function SB(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function RB(r){return r===Pt(r)||!Wt(r)?Cl(r):SB(r)}function DB(r){var e=r.getBoundingClientRect(),t=Ln(e.width)/r.offsetWidth||1,n=Ln(e.height)/r.offsetHeight||1;return t!==1||n!==1}function _B(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&DB(e),s=Ur(e),o=Fn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||yl(s))&&(a=RB(e)),Wt(e)?(l=Fn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=vl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function LB(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function FB(r){var e=LB(r);return Ky.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function kB(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function NB(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var Md={placement:"bottom",modifiers:[],strategy:"absolute"};function Pd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function MB(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?Md:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Md,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(y){var Q=typeof y=="function"?y(c.options):y;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:sn(a)?Ti(a):a.contextElement?Ti(a.contextElement):[],popper:Ti(l)};var b=FB(NB([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(v){return v.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var y=c.elements,Q=y.reference,b=y.popper;if(Pd(Q,b)){c.rects={reference:_B(Q,yi(b),c.options.strategy==="fixed"),popper:El(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var v=0;v<c.orderedModifiers.length;v++){if(c.reset===!0){c.reset=!1,v=-1;continue}var w=c.orderedModifiers[v],R=w.fn,k=w.options,H=k===void 0?{}:k,V=w.name;typeof R=="function"&&(c=R({state:c,options:H,name:V,instance:d})||c)}}}},update:kB(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!Pd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var y=p.name,Q=p.options,b=Q===void 0?{}:Q,v=p.effect;if(typeof v=="function"){var w=v({state:c,name:y,instance:d,options:b}),R=function(){};u.push(w||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var PB=[aB,QB,sB,Bd,BB,EB,wB,tB,CB],OB=MB({defaultModifiers:PB}),UB="tippy-box",Od="tippy-content",GB="tippy-backdrop",Ud="tippy-arrow",Gd="tippy-svg-arrow",an={passive:!0,capture:!0},Hd=function(){return document.body};function Tl(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function Ql(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function $d(r,e){return typeof r=="function"?r.apply(void 0,e):r}function Yd(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function HB(r){return r.split(/\s+/).filter(Boolean)}function Nn(r){return[].concat(r)}function Vd(r,e){r.indexOf(e)===-1&&r.push(e)}function $B(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function YB(r){return r.split("-")[0]}function ro(r){return[].slice.call(r)}function Kd(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function bi(){return document.createElement("div")}function no(r){return["Element","Fragment"].some(function(e){return Ql(r,e)})}function VB(r){return Ql(r,"NodeList")}function KB(r){return Ql(r,"MouseEvent")}function JB(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function WB(r){return no(r)?[r]:VB(r)?ro(r):Array.isArray(r)?r:ro(document.querySelectorAll(r))}function bl(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Jd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function qB(r){var e,t=Nn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function jB(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=YB(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,y=s.left-t+d>l,Q=t-s.right-f>l;return g||p||y||Q})}function xl(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function Wd(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},qd=0;function XB(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",jd))}function jd(){var r=performance.now();r-qd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",jd)),qd=r}function zB(){var r=document.activeElement;if(JB(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function ZB(){document.addEventListener("touchstart",XB,an),window.addEventListener("blur",zB)}var e1=typeof window<"u"&&typeof document<"u",t1=e1?!!window.msCrypto:!1,r1={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},n1={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:Hd,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},r1,n1),i1=Object.keys(tr),s1=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function Xd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function o1(r,e){var t=e?Object.keys(Xd(Object.assign({},tr,{plugins:e}))):i1,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function zd(r,e){var t=Object.assign({},e,{content:$d(e.content,[r])},e.ignoreAttributes?{}:o1(r,e.plugins));return t.aria=Object.assign({},tr.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 a1=function(){return"innerHTML"};function wl(r,e){r[a1()]=e}function Zd(r){var e=bi();return r===!0?e.className=Ud:(e.className=Gd,no(r)?e.appendChild(r):wl(e,r)),e}function ef(r,e){no(e.content)?(wl(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?wl(r,e.content):r.textContent=e.content)}function Sl(r){var e=r.firstElementChild,t=ro(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(Od)}),arrow:t.find(function(n){return n.classList.contains(Ud)||n.classList.contains(Gd)}),backdrop:t.find(function(n){return n.classList.contains(GB)})}}function tf(r){var e=bi(),t=bi();t.className=UB,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=bi();n.className=Od,n.setAttribute("data-state","hidden"),ef(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=Sl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&ef(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(Zd(o.arrow))):l.appendChild(Zd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}tf.$$tippy=!0;var l1=1,io=[],Rl=[];function A1(r,e){var t=zd(r,Object.assign({},tr,Xd(Kd(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=Yd(We,t.interactiveDebounce),g,p=l1++,y=null,Q=$B(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:bi(),popperInstance:y,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return v;var w=t.render(v),R=w.popper,k=w.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+v.id,v.popper=R,r._tippy=v,R._tippy=v;var H=Q.map(function(q){return q.fn(v)}),V=r.hasAttribute("aria-expanded");return Qe(),F(),j(),_("onCreate",[v]),t.showOnCreate&&X(),R.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),v;function O(){var q=v.props.touch;return Array.isArray(q)?q:[q,0]}function W(){return O()[0]==="hold"}function ie(){var q;return!!((q=v.props.render)!=null&&q.$$tippy)}function te(){return g||r}function le(){var q=te().parentNode;return q?qB(q):document}function D(){return Sl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:Tl(v.props.delay,q?0:1,tr.delay)}function j(q){q===void 0&&(q=!1),R.style.pointerEvents=v.props.interactive&&!q?"":"none",R.style.zIndex=""+v.props.zIndex}function _(q,de,Ce){if(Ce===void 0&&(Ce=!0),H.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),Ce){var Pe;(Pe=v.props)[q].apply(Pe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Pe=Nn(v.props.triggerTarget||r);Pe.forEach(function(Fe){var qe=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,qe?qe+" "+Ce:Ce);else{var xt=qe&&qe.replace(Ce,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(V||!v.props.aria.expanded)){var q=Nn(v.props.triggerTarget||r);q.forEach(function(de){v.props.interactive?de.setAttribute("aria-expanded",v.state.isVisible&&de===te()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),io=io.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&Wd(R,de))){if(Nn(v.props.triggerTarget||r).some(function(Ce){return Wd(Ce,de)})){if(gr.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[v,q]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,an),q.addEventListener("touchstart",ce,an),q.addEventListener("touchmove",ne,an)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,an),q.removeEventListener("touchstart",ce,an),q.removeEventListener("touchmove",ne,an)}function Se(q,de){Ge(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var Ce=D().box;function Pe(Fe){Fe.target===Ce&&(xl(Ce,"remove",Pe),de())}if(q===0)return de();xl(Ce,"remove",u),xl(Ce,"add",Pe),u=Pe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Pe=Nn(v.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,Ce),d.push({node:Fe,eventType:q,handler:de,options:Ce})})}function Qe(){W()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),HB(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(t1?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(Ce,Pe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&KB(q)&&io.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?Ce=!0:X(q),q.type==="click"&&(o=!Ce),Ce&&!Pe&&Ie(q)}}function We(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Pe=z().concat(R).map(function(Fe){var qe,xt=Fe._tippy,wt=(qe=xt.popperInstance)==null?void 0:qe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);jB(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||v.props.trigger.indexOf("click")>=0&&o;if(!de){if(v.props.interactive){v.hideWithInteractivity(q);return}Ie(q)}}function T(q){v.props.trigger.indexOf("focusin")<0&&q.target!==te()||v.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){x();var q=v.props,de=q.popperOptions,Ce=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,qe=q.moveTransition,xt=ie()?Sl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,Gn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Hn){var $r=Hn.state;if(ie()){var Li=D(),Fi=Li.box;["placement","reference-hidden","escaped"].forEach(function($n){$n==="placement"?Fi.setAttribute("data-placement",$r.placement):$r.attributes.popper["data-popper-"+$n]?Fi.setAttribute("data-"+$n,""):Fi.removeAttribute("data-"+$n)}),$r.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!qe}},Gn];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),v.popperInstance=OB(wt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:St}))}function x(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===Hd||q==="parent"?de=Ce.parentNode:de=$d(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return ro(R.querySelectorAll("[data-tippy-root]"))}function X(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Pe=Ce[0],Fe=Ce[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){v.show()},de):v.show()}function Ie(q){if(v.clearDelayTimeouts(),_("onUntrigger",[v,q]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){v.state.isVisible&&v.hide()},de):s=requestAnimationFrame(function(){v.hide()})}}function be(){v.state.isEnabled=!0}function De(){v.hide(),v.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!v.state.isDestroyed){_("onBeforeUpdate",[v,q]),Me();var de=v.props,Ce=zd(r,Object.assign({},de,Kd(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=Yd(We,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?Nn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),j(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Mt(q){v.setProps({content:q})}function ut(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=gr.isTouch&&!v.props.touch,Fe=Tl(v.props.duration,0,tr.duration);if(!(q||de||Ce||Pe)&&!te().hasAttribute("disabled")&&(_("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,ie()&&(R.style.visibility="visible"),j(),pe(),v.state.isMounted||(R.style.transition="none"),ie()){var qe=D(),xt=qe.box,wt=qe.content;bl([xt,wt],0)}h=function(){var St;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var hn=D(),Hn=hn.box,$r=hn.content;bl([Hn,$r],Fe),Jd([Hn,$r],"visible")}S(),F(),Vd(Rl,v),(St=v.popperInstance)==null||St.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ut(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=Tl(v.props.duration,1,tr.duration);if(!(q||de||Ce)&&(_("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),j(!0),ie()){var Fe=D(),qe=Fe.box,xt=Fe.content;v.props.animation&&(bl([qe,xt],Pe),Jd([qe,xt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Pe,v.unmount):v.unmount()}}function Er(q){le().addEventListener("mousemove",f),Vd(io,f),f(q)}function Ir(){v.state.isVisible&&v.hide(),v.state.isMounted&&(x(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),Rl=Rl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Tt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Me(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function ln(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);ZB();var n=Object.assign({},e,{plugins:t}),i=WB(r),s=i.reduce(function(o,a){var l=a&&A1(a,n);return l&&o.push(l),o},[]);return no(r)?s[0]:s}ln.defaultProps=tr,ln.setDefaultProps=s1,ln.currentInput=gr,Object.assign({},Bd,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),ln.setDefaultProps({render:tf});class so extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const c1=5;function u1(r,e){const t=r.map(({id:i})=>i).join("|"),n=e.map(({id:i})=>i).join("|");return t===n}class h1{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){u1(e,this._activeScenes)||(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,n,i;const s=Math.min(this.host.duration,Math.max(0,e));this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A})=>s>=A-c1&&s<A)),[]))??[],this.loadScenes(),this.syncVideoState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return Ct(this._canvas)}controls(){return Ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,n,i;const{start:s,duration:o,video:a}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a!=null&&a.key&&this.host.videos[a==null?void 0:a.key]){const A=this.host.videos[a==null?void 0:a.key],{key:c,hls:u,node:h,start:d,duration:f}=A,g=this.host.videoState[c];h&&g&&(h.currentTime>=d+f||h.ended||l&&(u?(t=u.startLoadOnce)==null||t.call(u,d):g.initialised||(n=h.startLoadOnce)==null||n.call(h)))}else if(l){const A=`${s}-${o}`,c=this.host._sceneController.videoState[A];this.host.duration&&!((i=c==null?void 0:c.buffered)!=null&&i.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[A]:{...c,buffered:[{start:Math.max(0,s/this.host.duration*100),end:Math.min((s+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.drawScenes)==null||n.forEach(i=>{var s,o,a;if((s=i.video)!=null&&s.key&&this.host.videos[(o=i.video)==null?void 0:o.key]){const l=this.host.videos[(a=i.video)==null?void 0:a.key],{key:A,node:c}=l,u=this.host.videoState[A],h=this.activeScenes.includes(i);if(c&&u)if(h&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(c.paused&&u.initialised)try{return c.play()}catch(d){throw new so("Video play error",d,!0)}}else c.paused||c.pause()}})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function rf(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function d1(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function f1(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function g1(r,e){return new Promise(async t=>{const{id:n,key:i,duration:s,startOffset:o,endOffset:a}=e,l=document.createElement("video");l.playsInline=!0,l.muted=!0,l.loop=!1,l.src=r;let A=!1;if(l.startLoadOnce=()=>{A||(l.preload="auto",l.load(),A=!0)},s){l.preload="none";const c=(o??0)*s,u=(1-(a??0))*s;t({id:n,key:i,hls:null,config:e,node:l,start:c,duration:u-c})}else{l.preload="metadata";const c=async()=>{const u=await rf(l),h=(o??0)*u,d=(1-(a??0))*u;t({id:n,key:i,hls:null,config:e,node:l,start:h,duration:d-h}),l.removeEventListener("loadedmetadata",c)};l.addEventListener("loadedmetadata",c)}})}function p1(r,e){return new Promise(t=>{const{id:n,key:i,startOffset:s,endOffset:o}=e,a=document.createElement("video");a.playsInline=!0,a.muted=!0,a.loop=!1;let l=!1;const A=new wr({autoStartLoad:!0,xhrSetup:c=>{const{open:u}=c,h=r.split("?")[1];c.open=function(d,f,g){f.toString().includes("?")||(f+="?"+h),!(!l&&f.toString().includes(".ts"))&&u.apply(this,[d,f,g])}}});A.on(wr.Events.LEVEL_LOADED,async()=>{l||A==null||A.stopLoad();const c=await rf(a),u=(s??0)*c,h=(1-(o??0))*c;t({id:n,key:i,hls:A,config:e,node:a,start:u,duration:h-u})}),A.loadSource(r),A.attachMedia(a),A.startLoadOnce=(c=-1,u)=>{if(A&&!l){const h=A==null?void 0:A.levels.findIndex(d=>Math.min(d.height,d.width)===u);l=!0,A.startLevel=A.firstLevel,A.startLoad(c),A.currentLevel=h!==-1?h:A.firstLevel}}})}function m1(r){const{src:e,playlist:t}=r;return t&&!d1()&&wr.isSupported()?p1(t,r):g1(e,r)}let E1=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._videos={},this._videoState={},this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._videoFactory=ii(async t=>{const{id:n,key:i}=t,s=await m1(t);s.node.volume=this.host.volume,s.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((l,A)=>{const c=A,u=o[c]({id:n,key:i,node:s.node});return l[c]=u,s.node.addEventListener(A,u),l},{});return{video:s,listeners:a,source:()=>s.node}},{cacheKey:([{id:t,key:n,src:i,playlist:s}])=>JSON.stringify({id:t,key:n,src:i==null?void 0:i.split("?")[0],playlist:s==null?void 0:s.split("?")[0]})}),this._createVideoFactory=async t=>{const{video:n,listeners:i,source:s}=await this._videoFactory(t);return this.videos={...this.videos,[t.key]:{...n,listeners:i}},this.videoState={...this.videoState,[t.key]:{initialised:!n,waiting:!!n,...this.videoState[t.key]}},s},this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised||(this.videoState={...this.videoState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setVideosCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.map(o=>{var a;return(a=o.video)==null?void 0:a.id}).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new so(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.videos)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_setupTask(){new $i(this.host,async([e,t])=>{var n;const i=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:s})=>t===s))&&(this.host._language=(n=this.host._languages[0])==null?void 0:n.value),e){try{const s={...e,tracks:await Promise.all(e.tracks.map(async o=>Promise.all(o.map(async a=>{const l=async A=>{if(A.renderer.type==="video"){const c=await this._createVideoFactory(A.options);A.options.video=c}if(A.children)for await(const c of A.children)await l(c)};return a.type==="scene"&&await l(a.recipe),a}))))};this.composition=await tu({config:s})}catch(s){throw new so("Fatal composition error",s,!0)}this.duration=this.composition.duration,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(s){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:s,message:s.message}))}finally{i.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:n,video:i}=t;if(i!=null&&i.key&&this.videos[i==null?void 0:i.key]){const s=this.videos[i==null?void 0:i.key],o=e-n;s.node.currentTime=Math.max(s.start,Math.min(s.start+s.duration,o+s.start))}}setVideosCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.videoScenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function I1(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function C1(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Dl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],v1={id:"captions",event:"captions:click",label:"Closed Captions"},y1={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},nf={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}]},B1={id:"playbackRate",label:"Playback playbackRate",subItems:nf};class T1 extends gA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==gn.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)),jt}}const _l=pn(T1),Q1=Fy(()=>{const r=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","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=Xc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},b1={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},sf=Dy(b1,{delimiter:"-"}),x1=Object.keys(sf).map(r=>Yn(`:host { --${r}: ${sf[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){Q1().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],x1,lt`
2492
+ */const Nh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Mh=pn(class extends ei{constructor(r){if(super(r),r.type!==gn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=af(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=Wr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Wr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Wr(i[u],s[f]),Zn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Wr(i[h],s[d]),Zn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Nh(o,d,f),c=Nh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const C=Zn(r,i[u]);Wr(C,s[d]),l[d]=C}else l[d]=Wr(p,s[d]),Zn(r,i[u],p),i[g]=null;d++}else fo(i[h]),h--;else fo(i[u]),u++;for(;d<=f;){const g=Zn(r,l[f+1]);Wr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&fo(g)}return this.ut=o,of(r,l),Xt}});var Ft="top",Kt="bottom",Jt="right",kt="left",Za="auto",mi=[Ft,Kt,Jt,kt],Ln="start",Ei="end",Cv="clippingParents",Ph="viewport",Ii="popper",vv="reference",Oh=mi.reduce(function(r,e){return r.concat([e+"-"+Ln,e+"-"+Ei])},[]),Uh=[].concat(mi,[Za]).reduce(function(r,e){return r.concat([e,e+"-"+Ln,e+"-"+Ei])},[]),yv="beforeRead",Bv="read",Tv="afterRead",Qv="beforeMain",bv="main",xv="afterMain",wv="beforeWrite",Sv="write",Rv="afterWrite",Dv=[yv,Bv,Tv,Qv,bv,xv,wv,Sv,Rv];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function sn(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function el(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function _v(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Lv(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Gh={name:"applyStyles",enabled:!0,phase:"write",fn:_v,effect:Lv,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var on=Math.max,$s=Math.min,Fn=Math.round;function tl(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Hh(){return!/^((?!chrome|android).)*safari/i.test(tl())}function kn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&Fn(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Fn(n.height)/r.offsetHeight||1);var o=sn(r)?Pt(r):window,a=o.visualViewport,l=!Hh()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function rl(r){var e=kn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function $h(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&el(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function Fv(r){return["table","td","th"].indexOf(dr(r))>=0}function Ur(r){return((sn(r)?r.ownerDocument:r.document)||window.document).documentElement}function Ys(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(el(r)?r.host:null)||Ur(r)}function Yh(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function kv(r){var e=/firefox/i.test(tl()),t=/Trident/i.test(tl());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=Ys(r);for(el(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ci(r){for(var e=Pt(r),t=Yh(r);t&&Fv(t)&&Sr(t).position==="static";)t=Yh(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||kv(r)||e}function nl(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function vi(r,e,t){return on(r,$s(e,t))}function Nv(r,e,t){var n=vi(r,e,t);return n>t?t:n}function Vh(){return{top:0,right:0,bottom:0,left:0}}function Kh(r){return Object.assign({},Vh(),r)}function Jh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var Mv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Kh(typeof e!="number"?e:Jh(e,mi))};function Pv(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=nl(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=Mv(i.padding,t),h=rl(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],C=Ci(s),Q=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,b=g/2-p/2,v=u[d],x=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=vi(v,R,x),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function Ov(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||$h(e.elements.popper,i)&&(e.elements.arrow=i))}const Uv={name:"arrow",enabled:!0,phase:"main",fn:Pv,effect:Ov,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Nn(r){return r.split("-")[1]}var Gv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Hv(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:Fn(t*i)/i||0,y:Fn(n*i)/i||0}}function Wh(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var C=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,v=Ft,x=window;if(A){var R=Ci(t),k="clientHeight",$="clientWidth";if(R===Pt(t)&&(R=Ur(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===Ei){v=Kt;var K=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=K-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===Ei){b=Jt;var O=u&&R===x&&x.visualViewport?x.visualViewport.width:R[$];d-=O-n.width,d*=l?1:-1}}var W=Object.assign({position:a},A&&Gv),ie=c===!0?Hv({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var te;return Object.assign({},W,(te={},te[v]=Q?"0":"",te[b]=C?"0":"",te.transform=(x.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",te))}return Object.assign({},W,(e={},e[v]=Q?g+"px":"",e[b]=C?d+"px":"",e.transform="",e))}function $v(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:Nn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Wh(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Wh(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Yv={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$v,data:{}};var Vs={passive:!0};function Vv(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Vs)}),a&&l.addEventListener("resize",t.update,Vs),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Vs)}),a&&l.removeEventListener("resize",t.update,Vs)}}const Kv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Vv,data:{}};var Jv={left:"right",right:"left",bottom:"top",top:"bottom"};function Ks(r){return r.replace(/left|right|bottom|top/g,function(e){return Jv[e]})}var Wv={start:"end",end:"start"};function qh(r){return r.replace(/start|end/g,function(e){return Wv[e]})}function il(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function sl(r){return kn(Ur(r)).left+il(r).scrollLeft}function qv(r,e){var t=Pt(r),n=Ur(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Hh();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+sl(r),y:l}}function Xv(r){var e,t=Ur(r),n=il(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=on(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=on(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+sl(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=on(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function ol(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function Xh(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&ol(r)?r:Xh(Ys(r))}function yi(r,e){var t;e===void 0&&(e=[]);var n=Xh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],ol(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(yi(Ys(o)))}function al(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function jv(r,e){var t=kn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function jh(r,e,t){return e===Ph?al(qv(r,t)):sn(e)?jv(e,t):al(Xv(Ur(r)))}function zv(r){var e=yi(Ys(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?Ci(r):r;return sn(n)?e.filter(function(i){return sn(i)&&$h(i,n)&&dr(i)!=="body"}):[]}function Zv(r,e,t,n){var i=e==="clippingParents"?zv(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=jh(r,A,n);return l.top=on(c.top,l.top),l.right=$s(c.right,l.right),l.bottom=$s(c.bottom,l.bottom),l.left=on(c.left,l.left),l},jh(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function zh(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?Nn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?nl(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Ln:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Ei:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Bi(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?Cv:a,A=t.rootBoundary,c=A===void 0?Ph:A,u=t.elementContext,h=u===void 0?Ii:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,C=Kh(typeof p!="number"?p:Jh(p,mi)),Q=h===Ii?vv:Ii,b=r.rects.popper,v=r.elements[f?Q:h],x=Zv(sn(v)?v:v.contextElement||Ur(r.elements.popper),l,c,o),R=kn(r.elements.reference),k=zh({reference:R,element:b,strategy:"absolute",placement:i}),$=al(Object.assign({},b,k)),K=h===Ii?$:R,O={top:x.top-K.top+C.top,bottom:K.bottom-x.bottom+C.bottom,left:x.left-K.left+C.left,right:K.right-x.right+C.right},W=r.modifiersData.offset;if(h===Ii&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Jt,Kt].indexOf(te)>=0?1:-1,D=[Ft,Kt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function ey(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Uh:l,c=Nn(n),u=c?a?Oh:Oh.filter(function(f){return Nn(f)===c}):mi,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Bi(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function ty(r){if(fr(r)===Za)return[];var e=Ks(r);return[qh(r),e,qh(e)]}function ry(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,C=fr(p),Q=C===p,b=l||(Q||!f?[Ks(p)]:ty(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===Za?ey(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),x=e.rects.reference,R=e.rects.popper,k=new Map,$=!0,K=v[0],O=0;O<v.length;O++){var W=v[O],ie=fr(W),te=Nn(W)===Ln,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",P=Bi(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?te?Jt:kt:te?Kt:Ft;x[D]>R[D]&&(X=Ks(X));var _=Ks(X),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[X]<=0,P[_]<=0),S.every(function(ce){return ce})){K=W,$=!1;break}k.set(W,S)}if($)for(var F=f?3:1,J=function(pe){var ge=v.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return K=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==K&&(e.modifiersData[n]._skip=!0,e.placement=K,e.reset=!0)}}const ny={name:"flip",enabled:!0,phase:"main",fn:ry,requiresIfExists:["offset"],data:{_skip:!1}};function Zh(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function ed(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function iy(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Bi(e,{elementContext:"reference"}),a=Bi(e,{altBoundary:!0}),l=Zh(o,n),A=Zh(a,i,s),c=ed(l),u=ed(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const sy={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:iy};function oy(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function ay(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Uh.reduce(function(c,u){return c[u]=oy(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const ly={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ay};function Ay(r){var e=r.state,t=r.name;e.modifiersData[t]=zh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const cy={name:"popperOffsets",enabled:!0,phase:"read",fn:Ay,data:{}};function uy(r){return r==="x"?"y":"x"}function hy(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Bi(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),C=fr(e.placement),Q=Nn(e.placement),b=!Q,v=nl(C),x=uy(v),R=e.modifiersData.popperOffsets,k=e.rects.reference,$=e.rects.popper,K=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof K=="number"?{mainAxis:K,altAxis:K}:Object.assign({mainAxis:0,altAxis:0},K),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var te,le=v==="y"?Ft:kt,D=v==="y"?Kt:Jt,P=v==="y"?"height":"width",X=R[v],_=X+p[le],S=X-p[D],F=d?-$[P]/2:0,J=Q===Ln?k[P]:$[P],Y=Q===Ln?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?rl(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Vh(),ge=pe[le],Se=pe[D],Le=vi(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:J-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&Ci(e.elements.arrow),Me=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,qe=X+Ge-we-Me,Te=X+fe-we,T=vi(d?$s(_,qe):_,X,d?on(S,Te):S);R[v]=T,ie[v]=T-X}if(a){var m,E=v==="x"?Ft:kt,w=v==="x"?Kt:Jt,M=R[x],z=x==="y"?"height":"width",j=M+p[E],Ie=M-p[w],be=[Ft,kt].indexOf(C)!==-1,De=(m=W==null?void 0:W[x])!=null?m:0,ke=be?j:M-k[z]-$[z]-De+O.altAxis,_e=be?M+k[z]+$[z]-De-O.altAxis:Ie,Mt=d&&be?Nv(ke,M,_e):vi(d?ke:j,M,d?_e:Ie);R[x]=Mt,ie[x]=Mt-M}e.modifiersData[n]=ie}}const dy={name:"preventOverflow",enabled:!0,phase:"main",fn:hy,requiresIfExists:["offset"]};function fy(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function gy(r){return r===Pt(r)||!Wt(r)?il(r):fy(r)}function py(r){var e=r.getBoundingClientRect(),t=Fn(e.width)/r.offsetWidth||1,n=Fn(e.height)/r.offsetHeight||1;return t!==1||n!==1}function my(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&py(e),s=Ur(e),o=kn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||ol(s))&&(a=gy(e)),Wt(e)?(l=kn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=sl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ey(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function Iy(r){var e=Ey(r);return Dv.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function Cy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function vy(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var td={placement:"bottom",modifiers:[],strategy:"absolute"};function rd(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function yy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?td:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},td,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(C){var Q=typeof C=="function"?C(c.options):C;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:sn(a)?yi(a):a.contextElement?yi(a.contextElement):[],popper:yi(l)};var b=Iy(vy([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(v){return v.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var C=c.elements,Q=C.reference,b=C.popper;if(rd(Q,b)){c.rects={reference:my(Q,Ci(b),c.options.strategy==="fixed"),popper:rl(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var v=0;v<c.orderedModifiers.length;v++){if(c.reset===!0){c.reset=!1,v=-1;continue}var x=c.orderedModifiers[v],R=x.fn,k=x.options,$=k===void 0?{}:k,K=x.name;typeof R=="function"&&(c=R({state:c,options:$,name:K,instance:d})||c)}}}},update:Cy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!rd(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var C=p.name,Q=p.options,b=Q===void 0?{}:Q,v=p.effect;if(typeof v=="function"){var x=v({state:c,name:C,instance:d,options:b}),R=function(){};u.push(x||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var By=[Kv,cy,Yv,Gh,ly,ny,dy,Uv,sy],Ty=yy({defaultModifiers:By}),Qy="tippy-box",nd="tippy-content",by="tippy-backdrop",id="tippy-arrow",sd="tippy-svg-arrow",an={passive:!0,capture:!0},od=function(){return document.body};function ll(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function Al(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function ad(r,e){return typeof r=="function"?r.apply(void 0,e):r}function ld(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function xy(r){return r.split(/\s+/).filter(Boolean)}function Mn(r){return[].concat(r)}function Ad(r,e){r.indexOf(e)===-1&&r.push(e)}function wy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function Sy(r){return r.split("-")[0]}function Js(r){return[].slice.call(r)}function cd(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function Ti(){return document.createElement("div")}function Ws(r){return["Element","Fragment"].some(function(e){return Al(r,e)})}function Ry(r){return Al(r,"NodeList")}function Dy(r){return Al(r,"MouseEvent")}function _y(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function Ly(r){return Ws(r)?[r]:Ry(r)?Js(r):Array.isArray(r)?r:Js(document.querySelectorAll(r))}function cl(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function ud(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Fy(r){var e,t=Mn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function ky(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=Sy(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,C=s.left-t+d>l,Q=t-s.right-f>l;return g||p||C||Q})}function ul(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function hd(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},dd=0;function Ny(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",fd))}function fd(){var r=performance.now();r-dd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",fd)),dd=r}function My(){var r=document.activeElement;if(_y(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function Py(){document.addEventListener("touchstart",Ny,an),window.addEventListener("blur",My)}var Oy=typeof window<"u"&&typeof document<"u",Uy=Oy?!!window.msCrypto:!1,Gy={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Hy={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:od,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},Gy,Hy),$y=Object.keys(tr),Yy=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function gd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Vy(r,e){var t=e?Object.keys(gd(Object.assign({},tr,{plugins:e}))):$y,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function pd(r,e){var t=Object.assign({},e,{content:ad(e.content,[r])},e.ignoreAttributes?{}:Vy(r,e.plugins));return t.aria=Object.assign({},tr.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 Ky=function(){return"innerHTML"};function hl(r,e){r[Ky()]=e}function md(r){var e=Ti();return r===!0?e.className=id:(e.className=sd,Ws(r)?e.appendChild(r):hl(e,r)),e}function Ed(r,e){Ws(e.content)?(hl(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?hl(r,e.content):r.textContent=e.content)}function dl(r){var e=r.firstElementChild,t=Js(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(nd)}),arrow:t.find(function(n){return n.classList.contains(id)||n.classList.contains(sd)}),backdrop:t.find(function(n){return n.classList.contains(by)})}}function Id(r){var e=Ti(),t=Ti();t.className=Qy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=Ti();n.className=nd,n.setAttribute("data-state","hidden"),Ed(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=dl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Ed(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(md(o.arrow))):l.appendChild(md(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}Id.$$tippy=!0;var Jy=1,qs=[],fl=[];function Wy(r,e){var t=pd(r,Object.assign({},tr,gd(cd(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=ld(qe,t.interactiveDebounce),g,p=Jy++,C=null,Q=wy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:Ti(),popperInstance:C,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return v;var x=t.render(v),R=x.popper,k=x.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+v.id,v.popper=R,r._tippy=v,R._tippy=v;var $=Q.map(function(q){return q.fn(v)}),K=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[v]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),v;function O(){var q=v.props.touch;return Array.isArray(q)?q:[q,0]}function W(){return O()[0]==="hold"}function ie(){var q;return!!((q=v.props.render)!=null&&q.$$tippy)}function te(){return g||r}function le(){var q=te().parentNode;return q?Fy(q):document}function D(){return dl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:ll(v.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=v.props.interactive&&!q?"":"none",R.style.zIndex=""+v.props.zIndex}function _(q,de,Ce){if(Ce===void 0&&(Ce=!0),$.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),Ce){var Pe;(Pe=v.props)[q].apply(Pe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Pe=Mn(v.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+Ce:Ce);else{var xt=Xe&&Xe.replace(Ce,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(K||!v.props.aria.expanded)){var q=Mn(v.props.triggerTarget||r);q.forEach(function(de){v.props.interactive?de.setAttribute("aria-expanded",v.state.isVisible&&de===te()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),qs=qs.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&hd(R,de))){if(Mn(v.props.triggerTarget||r).some(function(Ce){return hd(Ce,de)})){if(gr.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[v,q]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),a=!0,setTimeout(function(){a=!1}),v.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,an),q.addEventListener("touchstart",ce,an),q.addEventListener("touchmove",ne,an)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,an),q.removeEventListener("touchstart",ce,an),q.removeEventListener("touchmove",ne,an)}function Se(q,de){Ge(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var Ce=D().box;function Pe(Fe){Fe.target===Ce&&(ul(Ce,"remove",Pe),de())}if(q===0)return de();ul(Ce,"remove",u),ul(Ce,"add",Pe),u=Pe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Pe=Mn(v.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,Ce),d.push({node:Fe,eventType:q,handler:de,options:Ce})})}function Qe(){W()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),xy(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Uy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(Ce,Pe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&Dy(q)&&qs.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||o)&&v.props.hideOnClick!==!1&&v.state.isVisible?Ce=!0:j(q),q.type==="click"&&(o=!Ce),Ce&&!Pe&&Ie(q)}}function qe(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);ky(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||v.props.trigger.indexOf("click")>=0&&o;if(!de){if(v.props.interactive){v.hideWithInteractivity(q);return}Ie(q)}}function T(q){v.props.trigger.indexOf("focusin")<0&&q.target!==te()||v.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=v.props,de=q.popperOptions,Ce=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?dl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,Hn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function($n){var $r=$n.state;if(ie()){var Di=D(),_i=Di.box;["placement","reference-hidden","escaped"].forEach(function(Yn){Yn==="placement"?_i.setAttribute("data-placement",$r.placement):$r.attributes.popper["data-popper-"+Yn]?_i.setAttribute("data-"+Yn,""):_i.removeAttribute("data-"+Yn)}),$r.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},Hn];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),v.popperInstance=Ty(wt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:St}))}function w(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===od||q==="parent"?de=Ce.parentNode:de=ad(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return Js(R.querySelectorAll("[data-tippy-root]"))}function j(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Pe=Ce[0],Fe=Ce[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){v.show()},de):v.show()}function Ie(q){if(v.clearDelayTimeouts(),_("onUntrigger",[v,q]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){v.state.isVisible&&v.hide()},de):s=requestAnimationFrame(function(){v.hide()})}}function be(){v.state.isEnabled=!0}function De(){v.hide(),v.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!v.state.isDestroyed){_("onBeforeUpdate",[v,q]),Me();var de=v.props,Ce=pd(r,Object.assign({},de,cd(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=ld(qe,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?Mn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Mt(q){v.setProps({content:q})}function ut(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=gr.isTouch&&!v.props.touch,Fe=ll(v.props.duration,0,tr.duration);if(!(q||de||Ce||Pe)&&!te().hasAttribute("disabled")&&(_("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),v.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;cl([xt,wt],0)}h=function(){var St;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var hn=D(),$n=hn.box,$r=hn.content;cl([$n,$r],Fe),ud([$n,$r],"visible")}S(),F(),Ad(fl,v),(St=v.popperInstance)==null||St.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ut(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Pe=ll(v.props.duration,1,tr.duration);if(!(q||de||Ce)&&(_("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;v.props.animation&&(cl([Xe,xt],Pe),ud([Xe,xt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Pe,v.unmount):v.unmount()}}function Er(q){le().addEventListener("mousemove",f),Ad(qs,f),f(q)}function Ir(){v.state.isVisible&&v.hide(),v.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),fl=fl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Tt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Me(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function ln(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);Py();var n=Object.assign({},e,{plugins:t}),i=Ly(r),s=i.reduce(function(o,a){var l=a&&Wy(a,n);return l&&o.push(l),o},[]);return Ws(r)?s[0]:s}ln.defaultProps=tr,ln.setDefaultProps=Yy,ln.currentInput=gr,Object.assign({},Gh,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),ln.setDefaultProps({render:Id});function Rr(r){var e,t;const n=[];return(((e=r.renderer)==null?void 0:e.type)==="video"||((t=r.renderer)==null?void 0:t.type)==="audio")&&n.push({...r.config,...r.options}),n.push(...r.childNodes.flatMap(Rr).filter(Boolean)),n}class Xs extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const qy=5;function Xy(r,e){return r.length!==e.length||r.some((t,n)=>t!==e[n])}class jy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){Xy(e,this._activeScenes)&&(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,n,i;const s=Math.min(this.host.duration,Math.max(0,e));this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.scenes.filter(({start:A})=>s>=A-qy&&s<A)),[]))??[],this.loadScenes(),this.syncMediaState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return Ct(this._canvas)}controls(){return Ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Rr(e.layout.node).forEach(n=>{var i,s,o;const{start:a,duration:l}=e,A=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(this.host.media[n.key]){const c=this.host.media[n.key],{hls:u,node:h,start:d,duration:f}=c,g=this.host.mediaState[n.key];h&&g&&(h.currentTime>=d+f||h.ended||A&&(u?(i=u.startLoadOnce)==null||i.call(u,d):g.initialised||(s=h.startLoadOnce)==null||s.call(h)))}else if(A){const c=`${a}-${l}`,u=this.host._sceneController.mediaState[c];this.host.duration&&!((o=u==null?void 0:u.buffered)!=null&&o.length)&&(this.host._sceneController.mediaState={...this.host._sceneController.mediaState,[c]:{...u,buffered:[{start:Math.max(0,a/this.host.duration*100),end:Math.min((a+l)/this.host.duration*100,100)}]}})}})})}syncMediaState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.scenes)==null||n.forEach(i=>{Rr(i.layout.node).forEach(o=>{if(this.host.media[o.key]){const a=this.host.media[o.key],{node:l}=a,A=this.host.mediaState[o.key],c=this.activeScenes.includes(i);if(l&&A)if(c&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(l.paused&&A.initialised)try{return l.play()}catch(u){throw new Xs("Video play error",u,!0)}}else l.paused||l.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function Cd(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function zy(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Zy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function eB(r){return new Promise(async e=>{let t=null;const{type:n,key:i,src:s,duration:o,volume:a,startOffset:l,endOffset:A}=r;n==="video"?(t=document.createElement("video"),t.playsInline=!0):t=document.createElement("audio"),t.muted=!0,t.loop=!1,t.src=s;let c=!1;if(t.startLoadOnce=()=>{c||(t.preload="auto",t.load(),c=!0)},n==="video"&&o&&r.aspectRatio){t.preload="none";const u=(l??0)*o,h=(1-(A??0))*o;e({key:i,hls:null,node:t,volume:a??1,start:u,duration:h-u,aspectRatio:r.aspectRatio})}else{t.preload="metadata";const u=async()=>{const h=await Cd(t),d=(l??0)*h,f=(1-(A??0))*h;e({key:i,hls:null,node:t,volume:a??1,start:d,duration:f-d,aspectRatio:t instanceof HTMLVideoElement?t.videoWidth/t.videoHeight:null}),t.removeEventListener("loadedmetadata",u)};t.addEventListener("loadedmetadata",u)}})}function tB({key:r,playlist:e,volume:t,startOffset:n,endOffset:i}){return new Promise(s=>{const o=document.createElement("video");o instanceof HTMLVideoElement&&(o.playsInline=!0),o.muted=!0,o.loop=!1;let a=!1;const l=new wr({autoStartLoad:!0,xhrSetup:A=>{const{open:c}=A,u=e.split("?")[1];A.open=function(h,d,f){u&&!d.toString().includes("?")&&(d+="?"+u),!(!a&&d.toString().includes(".ts"))&&c.apply(this,[h,d,f])}}});l.on(wr.Events.LEVEL_LOADED,async()=>{a||l==null||l.stopLoad();const A=await Cd(o),c=(n??0)*A,u=(1-(i??0))*A;s({key:r,hls:l,node:o,volume:t??1,start:c,duration:u-c,aspectRatio:l.levels[0].width/l.levels[0].height})}),l.loadSource(e),l.attachMedia(o),l.startLoadOnce=(A=-1,c)=>{if(l&&!a){const u=l.levels.findIndex(h=>Math.min(h.height,h.width)===c);a=!0,l.startLevel=l.firstLevel,l.startLoad(A),l.currentLevel=u!==-1?u:l.firstLevel}}})}function rB(r){const{playlist:e}=r;return e&&!zy()&&wr.isSupported()?tB({...r,playlist:e}):eB(r)}const nB=qr(async function(e){const{weight:t,family:n}=e,{client:i,server:s}=n.weights.find(a=>a.weight===t)??{};return!i&&!s?null:new FontFace(e.family.name,`url(${i??s})`,{weight:t,style:"normal"}).load()},{cacheKey:([r])=>JSON.stringify(r)});let iB=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._medias={},this._mediaState={},this._compositionController=new AbortController,this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._createImageResolver=qr(async({config:t})=>t.src?new Promise((n,i)=>{const s=new Image;s.onload=()=>{n({image:s})},s.onerror=o=>{i(o)},s.src=t.src}):{image:null},{cacheKey:([{config:t}])=>JSON.stringify(t)}),this._mediaFactory=qr(async t=>{const{key:n,volume:i}=t,s=await rB(t);s.node.volume=this.host.volume*(i??1),s.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((l,A)=>{const c=A,u=o[c]({key:n,node:s.node});return l[c]=u,s.node.addEventListener(A,u),l},{});return{media:s,listeners:a,aspectRatio:s.aspectRatio,source:()=>s.node}},{cacheKey:([{key:t,src:n,playlist:i}])=>JSON.stringify({key:t,src:n==null?void 0:n.split("?")[0],playlist:i==null?void 0:i.split("?")[0]})}),this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised||(this.mediaState={...this.mediaState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setVideosCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.mediaState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.mediaState={...this.mediaState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.mediaState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>Rr(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new Xs(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupVideo=t=>{var n;const i=this.media[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.media)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),delete this.media[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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set media(e){e!==this._medias&&(this._medias=e,this.host.requestUpdate())}get media(){return this._medias}set mediaState(e){e!==this._mediaState&&(this._mediaState=e,this.host.requestUpdate())}get mediaState(){return this._mediaState}_setupTask(){new Gi(this.host,async([e,t,n])=>{var i;this._compositionController.abort(),this._compositionController=new AbortController;const s=this._compositionController,o=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:a})=>t===a))&&(this.host._language=(i=this.host._languages[0])==null?void 0:i.value),e){const{width:a,height:l}=Wo({aspectRatio:n,resolution:1080});try{const A=await Ic({config:e,resolvers:{text:async({options:c})=>{const u=await nB(c.font);return u&&document.fonts.add(u),{font:c.font}},image:this._createImageResolver,video:async({config:c,options:u})=>{const{media:h,source:d}=await this._mediaFactory({...c,...u});return{video:d,aspectRatio:h.aspectRatio}}},rootWidth:a,rootHeight:l});if(s.signal.aborted)return;this.composition=A}catch(A){throw new Xs("Fatal composition error",A,!0)}this.duration=this.composition.duration,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused);for await(const A of this.composition.tracks)for await(const c of A.scenes){const u=Rr(c.layout.node);for await(const h of u){const{media:d,listeners:f}=await this._mediaFactory(h);this.media={...this.media,[d.key]:{...d,listeners:f}},this.mediaState={...this.mediaState,[d.key]:{initialised:!d,waiting:!!d,...this.mediaState[d.key]}}}}}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(a){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{o.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language,aspectRatio:this.host.aspectRatio});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language,this.host.aspectRatio];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:n}=t;Rr(t.layout.node).forEach(s=>{if(this.media[s.key]){const o=this.media[s.key],a=e-n;o.node.currentTime=Math.max(o.start,Math.min(o.start+o.duration,a+o.start))}})}setVideosCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.media).forEach(e=>{this._cleanupVideo(e)}),this.media={}}};function sB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function oB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const gl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],aB={id:"captions",event:"captions:click",label:"Closed Captions"},lB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},vd={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}]},AB={id:"playbackRate",label:"Playback playbackRate",subItems:vd};class cB extends Zl{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==gn.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)),Xt}}const pl=pn(cB),uB=Iv(()=>{const r=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","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=lc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},hB={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},yd=pv(hB,{delimiter:"-"}),dB=Object.keys(yd).map(r=>Vn(`:host { --${r}: ${yd[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){uB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],dB,lt`
2493
2493
  :host {
2494
2494
  font-family: var(--fontFamilies-sans);
2495
2495
  font-size: var(--fontSizes-medium);
@@ -2570,7 +2570,7 @@ vec4 transition(vec2 uv) {
2570
2570
  scroll-behavior: auto !important;
2571
2571
  }
2572
2572
  }
2573
- `],e})(vr),w1=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),S1=(r,e)=>{const{kind:t,elements:n}=e;return{kind:t,elements:n,finisher(i){typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,i))}}},Rt=r=>e=>typeof e=="function"?w1(r,e):S1(r,e);class R1{constructor(e){this._memoKey=null,this._lastDeps=null,this._composition=null,this._videos={},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),delete this.videos[t])},this.host=e,this.host.addController(this)}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}_setupTask(){new $i(this.host,async([e,t])=>{try{if(!t||e)return;try{this.composition=await tu({config:t})}catch(n){throw new so("Video preview data template error",n)}}catch(n){this.composition=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:n,message:n.message}))}},()=>{const e=JSON.stringify({disabled:this.host.disabled,config:this.host.config});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.disabled,this.host.config];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}}function of(r,e,t){return Math.min(Math.max(e,r),t)}function xi(r,e){return e?e instanceof ShadowRoot?xi(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:xi(r,e.parentNode):null}function Ll(r,e={}){const t=Math.max(0,r||0),n=Math.floor(t/3600),i=Math.floor(t%3600/60),s=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=n?`${n}:${`${i}`.padStart(2,"0")}:${`${s}`.padStart(2,"0")}`:`${i}:${`${s}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var D1=Object.defineProperty,_1=Object.getOwnPropertyDescriptor,Mn=(r,e,t,n)=>{for(var i=n>1?void 0:n?_1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&D1(e,t,i),i};let Gr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`<button
2573
+ `],e})(vr),fB=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),gB=(r,e)=>{const{kind:t,elements:n}=e;return{kind:t,elements:n,finisher(i){typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,i))}}},Rt=r=>e=>typeof e=="function"?fB(r,e):gB(r,e);class pB{constructor(e){this._memoKey=null,this._lastDeps=null,this._composition=null,this._videos={},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),delete this.videos[t])},this.host=e,this.host.addController(this)}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}_setupTask(){new Gi(this.host,async([e,t])=>{try{if(!t||e)return;try{this.composition=await Ic({config:t,rootWidth:0,rootHeight:0})}catch(n){throw new Xs("Video preview data template error",n)}}catch(n){this.composition=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:n,message:n.message}))}},()=>{const e=JSON.stringify({disabled:this.host.disabled,config:this.host.config});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.disabled,this.host.config];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}}function Bd(r,e,t){return Math.min(Math.max(e,r),t)}function Qi(r,e){return e?e instanceof ShadowRoot?Qi(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:Qi(r,e.parentNode):null}function ml(r,e={}){const t=Math.max(0,r||0),n=Math.floor(t/3600),i=Math.floor(t%3600/60),s=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=n?`${n}:${`${i}`.padStart(2,"0")}:${`${s}`.padStart(2,"0")}`:`${i}:${`${s}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var mB=Object.defineProperty,EB=Object.getOwnPropertyDescriptor,Pn=(r,e,t,n)=>{for(var i=n>1?void 0:n?EB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&mB(e,t,i),i};let Gr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`<button
2574
2574
  class=${Ve({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"})}
2575
2575
  >
2576
2576
  <slot></slot>
@@ -2651,7 +2651,7 @@ vec4 transition(vec2 uv) {
2651
2651
  .weight-light:focus {
2652
2652
  --button-background: var(--vu-button-background-hover, #9d9d9d);
2653
2653
  }
2654
- `],Mn([ee({type:Boolean})],Gr.prototype,"active",2),Mn([ee({type:String})],Gr.prototype,"size",2),Mn([ee({type:String})],Gr.prototype,"rounded",2),Mn([ee({type:String})],Gr.prototype,"weight",2),Mn([ee({type:String})],Gr.prototype,"icon",2),Gr=Mn([Rt("vmp-button")],Gr);const af={"arrow-left":()=>ve`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
2654
+ `],Pn([ee({type:Boolean})],Gr.prototype,"active",2),Pn([ee({type:String})],Gr.prototype,"size",2),Pn([ee({type:String})],Gr.prototype,"rounded",2),Pn([ee({type:String})],Gr.prototype,"weight",2),Pn([ee({type:String})],Gr.prototype,"icon",2),Gr=Pn([Rt("vmp-button")],Gr);const Td={"arrow-left":()=>ve`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
2655
2655
  <path
2656
2656
  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"
2657
2657
  fill="currentColor"
@@ -2812,14 +2812,14 @@ vec4 transition(vec2 uv) {
2812
2812
  <path
2813
2813
  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"
2814
2814
  />
2815
- </svg>`};var L1=Object.defineProperty,F1=Object.getOwnPropertyDescriptor,lf=(r,e,t,n)=>{for(var i=n>1?void 0:n?F1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&L1(e,t,i),i};let oo=class extends $e{render(){return!this.icon||!Object.keys(af).includes(this.icon)?null:af[this.icon]()}};oo.styles=[$e.styles??[],lt`
2815
+ </svg>`};var IB=Object.defineProperty,CB=Object.getOwnPropertyDescriptor,Qd=(r,e,t,n)=>{for(var i=n>1?void 0:n?CB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&IB(e,t,i),i};let js=class extends $e{render(){return!this.icon||!Object.keys(Td).includes(this.icon)?null:Td[this.icon]()}};js.styles=[$e.styles??[],lt`
2816
2816
  :host {
2817
2817
  display: flex;
2818
2818
  align-items: center;
2819
2819
  justify-content: center;
2820
2820
  flex-shrink: 0;
2821
2821
  }
2822
- `],lf([ee({type:String})],oo.prototype,"icon",2),oo=lf([Rt("vmp-icon")],oo);var k1=Object.defineProperty,N1=Object.getOwnPropertyDescriptor,Pn=(r,e,t,n)=>{for(var i=n>1?void 0:n?N1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&k1(e,t,i),i};let Hr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`
2822
+ `],Qd([ee({type:String})],js.prototype,"icon",2),js=Qd([Rt("vmp-icon")],js);var vB=Object.defineProperty,yB=Object.getOwnPropertyDescriptor,On=(r,e,t,n)=>{for(var i=n>1?void 0:n?yB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&vB(e,t,i),i};let Hr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`
2823
2823
  <vmp-button
2824
2824
  ?active=${this.active}
2825
2825
  size=${At(this.size)}
@@ -2846,11 +2846,11 @@ vec4 transition(vec2 uv) {
2846
2846
  height: 32px;
2847
2847
  width: 32px;
2848
2848
  }
2849
- `],Pn([ee({type:Boolean})],Hr.prototype,"active",2),Pn([ee({type:String})],Hr.prototype,"size",2),Pn([ee({type:String})],Hr.prototype,"rounded",2),Pn([ee({type:String})],Hr.prototype,"weight",2),Pn([ee({type:String})],Hr.prototype,"icon",2),Hr=Pn([Rt("vmp-icon-button")],Hr);var M1=Object.defineProperty,P1=Object.getOwnPropertyDescriptor,mr=(r,e,t,n)=>{for(var i=n>1?void 0:n?P1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&M1(e,t,i),i};let An=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=fa,this._currentTime=0,this._sceneController=new R1(this),this._canvasRef=It(),this._previewRef=It(),this._previewTimeRef=It(),this._handleScrubberMouseEnter=({detail:{x:r,y:e,elementLeft:t,elementRight:n}})=>{var i,s;if((i=this._previewRef)!=null&&i.value){const o=this._previewRef.value.getBoundingClientRect(),a=(s=this._previewRef.value.getRootNode().host)==null?void 0:s.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${of(t-a.left,r-a.left-o.width/2,n-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:r,x:e,elementLeft:t,elementRight:n}})=>{var i,s,o,a,l,A,c,u,h,d,f,g,p;if(this._currentTime=r,(o=(s=(i=this._sceneController.composition)==null?void 0:i.tracks)==null?void 0:s[0])!=null&&o.scenes){const y=(c=(A=(l=(a=this._sceneController.composition)==null?void 0:a.tracks)==null?void 0:l[0])==null?void 0:A.videoScenes)==null?void 0:c.find(({start:Q,duration:b})=>r>=Q&&r<=Q+b);if(y&&((u=y.video)!=null&&u.key)&&this._sceneController.videos[y.video.key]){const Q=this._sceneController.videos[y.video.key];(d=(h=Q.node).startLoadOnce)==null||d.call(h),Q.node.currentTime=r-y.start}if(this._draw(),(f=this._previewRef)!=null&&f.value){const Q=this._previewRef.value.getBoundingClientRect(),b=(g=this._previewRef.value.getRootNode().host)==null?void 0:g.getBoundingClientRect();if(Q&&b){const v=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,w]=Array.from(v.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${of(t-b.left,e-b.left-Q.width/2,n-b.left-Q.width)}px, ${w[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",Ll(Math.max(0,Math.min(this._currentTime,(p=this._sceneController.composition)==null?void 0:p.duration))))}},this._handleScrubberMouseLeave=()=>{var r;(r=this._previewRef)!=null&&r.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:r}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const n=this._previewRef.value.getBoundingClientRect(),i=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(n&&i){const s=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(s.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${r-i.top-n.height-28}px, 0)`}}}}_draw(r=this._currentTime){this._sceneController.composition&&this._canvasRef.value&&this._sceneController.composition.draw({canvas:this._canvasRef.value,currentTime:Math.max(0,Math.min(r,this._sceneController.composition.duration))})}connectedCallback(){super.connectedCallback();const r=xi("vmp-media-player",this);r==null||r.addEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const r=xi("vmp-media-player",this);r==null||r.removeEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var r,e,t;const{height:n,width:i}=Kc({resolution:180,aspectRatio:this.aspectRatio}),s=((t=(e=(r=this._sceneController.composition)==null?void 0:r.tracks)==null?void 0:e[0])==null?void 0:t.scenes.length)??0;return!this.disabled&&s>1?ve`
2849
+ `],On([ee({type:Boolean})],Hr.prototype,"active",2),On([ee({type:String})],Hr.prototype,"size",2),On([ee({type:String})],Hr.prototype,"rounded",2),On([ee({type:String})],Hr.prototype,"weight",2),On([ee({type:String})],Hr.prototype,"icon",2),Hr=On([Rt("vmp-icon-button")],Hr);var BB=Object.defineProperty,TB=Object.getOwnPropertyDescriptor,mr=(r,e,t,n)=>{for(var i=n>1?void 0:n?TB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&BB(e,t,i),i};let An=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=zo,this._currentTime=0,this._sceneController=new pB(this),this._canvasRef=It(),this._previewRef=It(),this._previewTimeRef=It(),this._handleScrubberMouseEnter=({detail:{x:r,y:e,elementLeft:t,elementRight:n}})=>{var i,s;if((i=this._previewRef)!=null&&i.value){const o=this._previewRef.value.getBoundingClientRect(),a=(s=this._previewRef.value.getRootNode().host)==null?void 0:s.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Bd(t-a.left,r-a.left-o.width/2,n-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:r,x:e,elementLeft:t,elementRight:n}})=>{var i,s,o,a,l,A,c,u,h,d;if(this._currentTime=r,(o=(s=(i=this._sceneController.composition)==null?void 0:i.tracks)==null?void 0:s[0])!=null&&o.scenes){const f=(c=(A=(l=(a=this._sceneController.composition)==null?void 0:a.tracks)==null?void 0:l[0])==null?void 0:A.scenes)==null?void 0:c.find(({start:g,duration:p})=>r>=g&&r<=g+p);if(f&&Rr(f.layout.node).forEach(p=>{var C,Q;if(this._sceneController.videos[p.key]){const b=this._sceneController.videos[p.key];(Q=(C=b.node).startLoadOnce)==null||Q.call(C),b.node.currentTime=r-f.start}}),this._draw(),(u=this._previewRef)!=null&&u.value){const g=this._previewRef.value.getBoundingClientRect(),p=(h=this._previewRef.value.getRootNode().host)==null?void 0:h.getBoundingClientRect();if(g&&p){const C=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,Q]=Array.from(C.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Bd(t-p.left,e-p.left-g.width/2,n-p.left-g.width)}px, ${Q[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",ml(Math.max(0,Math.min(this._currentTime,(d=this._sceneController.composition)==null?void 0:d.duration))))}},this._handleScrubberMouseLeave=()=>{var r;(r=this._previewRef)!=null&&r.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:r}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const n=this._previewRef.value.getBoundingClientRect(),i=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(n&&i){const s=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(s.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${r-i.top-n.height-28}px, 0)`}}}}_draw(r=this._currentTime){this._sceneController.composition&&this._canvasRef.value&&this._sceneController.composition.draw({canvas:this._canvasRef.value,currentTime:Math.max(0,Math.min(r,this._sceneController.composition.duration))})}connectedCallback(){super.connectedCallback();const r=Qi("vmp-media-player",this);r==null||r.addEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const r=Qi("vmp-media-player",this);r==null||r.removeEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var r,e,t;const{height:n,width:i}=Wo({resolution:180,aspectRatio:this.aspectRatio}),s=((t=(e=(r=this._sceneController.composition)==null?void 0:r.tracks)==null?void 0:e[0])==null?void 0:t.scenes.length)??0;return!this.disabled&&s>1?ve`
2850
2850
  <div
2851
2851
  ${Ct(this._previewRef)}
2852
2852
  class="preview"
2853
- style=${di({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
2853
+ style=${ci({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
2854
2854
  >
2855
2855
  <canvas ${Ct(this._canvasRef)} class="preview-canvas" width=${i} height=${n}></canvas>
2856
2856
  <vmp-text ${Ct(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
@@ -2886,18 +2886,18 @@ vec4 transition(vec2 uv) {
2886
2886
  color: var(--colors-light-1000);
2887
2887
  font-variant-numeric: tabular-nums;
2888
2888
  }
2889
- `],mr([ee({type:Object})],An.prototype,"config",2),mr([ee({type:Boolean})],An.prototype,"disabled",2),mr([ee({type:Number})],An.prototype,"aspectRatio",2),mr([ee({attribute:!1})],An.prototype,"dataResolver",2),An=mr([Rt("vmp-video-preview-content")],An);let On=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=fa}render(){return ve`
2889
+ `],mr([ee({type:Object})],An.prototype,"config",2),mr([ee({type:Boolean})],An.prototype,"disabled",2),mr([ee({type:Number})],An.prototype,"aspectRatio",2),mr([ee({attribute:!1})],An.prototype,"dataResolver",2),An=mr([Rt("vmp-video-preview-content")],An);let Un=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=zo}render(){return ve`
2890
2890
  <vmp-video-preview-content
2891
2891
  ?disabled=${this.disabled}
2892
2892
  .config=${this.config}
2893
2893
  .aspectRatio=${this.aspectRatio}
2894
2894
  .dataResolver=${this.dataResolver}
2895
2895
  ></vmp-video-preview-content>
2896
- `}};mr([ee({type:Object})],On.prototype,"config",2),mr([ee({type:Boolean})],On.prototype,"disabled",2),mr([ee({type:Number})],On.prototype,"aspectRatio",2),mr([ee({attribute:!1})],On.prototype,"dataResolver",2),On=mr([Rt("vmp-video-preview")],On);class O1 extends Zn{constructor(e){if(super(e),e.type!==gn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),jt}}const Af=pn(O1);class U1{constructor(e){this.hiddenControls=[],this._measureRef=It(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var n,i,s;const o=this._measureRef.value,a=(s=(i=(n=t==null?void 0:t[0])==null?void 0:n.borderBoxSize)==null?void 0:i[0])==null?void 0:s.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(A=>{this._hideables[A].element.style.display=""}),Object.keys(this._showables).forEach(A=>{this._showables[A].element.style.display="none"});const l=[];for(;o.scrollWidth>o.offsetWidth;){const A=Object.keys(this._hideables).find(u=>this._hideables[u].hideIndex===l.length);if(!A)break;const c=this._hideables[A].element;c&&(c.style.display="none"),l.push(A),Object.keys(this._showables).forEach(u=>{this._showables[u].showOn.some(h=>l.includes(h))&&(this._showables[u].element.style.display="flex")})}this.hiddenControls=l,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return Ct(this._measureRef)}contain(){return _l(this._onResize)}hide(e,t){return Af(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return Af(n=>{this._showables[e]={element:n,showOn:t}})}}const Fl=".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 G1=Object.defineProperty,H1=Object.getOwnPropertyDescriptor,wi=(r,e,t,n)=>{for(var i=n>1?void 0:n?H1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&G1(e,t,i),i};let cn=class extends $e{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return ve`
2896
+ `}};mr([ee({type:Object})],Un.prototype,"config",2),mr([ee({type:Boolean})],Un.prototype,"disabled",2),mr([ee({type:Number})],Un.prototype,"aspectRatio",2),mr([ee({attribute:!1})],Un.prototype,"dataResolver",2),Un=mr([Rt("vmp-video-preview")],Un);class QB extends ei{constructor(e){if(super(e),e.type!==gn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Xt}}const bd=pn(QB);class bB{constructor(e){this.hiddenControls=[],this._measureRef=It(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var n,i,s;const o=this._measureRef.value,a=(s=(i=(n=t==null?void 0:t[0])==null?void 0:n.borderBoxSize)==null?void 0:i[0])==null?void 0:s.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(A=>{this._hideables[A].element.style.display=""}),Object.keys(this._showables).forEach(A=>{this._showables[A].element.style.display="none"});const l=[];for(;o.scrollWidth>o.offsetWidth;){const A=Object.keys(this._hideables).find(u=>this._hideables[u].hideIndex===l.length);if(!A)break;const c=this._hideables[A].element;c&&(c.style.display="none"),l.push(A),Object.keys(this._showables).forEach(u=>{this._showables[u].showOn.some(h=>l.includes(h))&&(this._showables[u].element.style.display="flex")})}this.hiddenControls=l,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return Ct(this._measureRef)}contain(){return pl(this._onResize)}hide(e,t){return bd(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return bd(n=>{this._showables[e]={element:n,showOn:t}})}}const El=".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 xB=Object.defineProperty,wB=Object.getOwnPropertyDescriptor,bi=(r,e,t,n)=>{for(var i=n>1?void 0:n?wB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&xB(e,t,i),i};let cn=class extends $e{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return ve`
2897
2897
  <div
2898
2898
  part="content"
2899
2899
  class=${Ve({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
2900
- style=${di({fontFamily:Lm({text:this.content,font:"var(--fontFamilies-sans)"})})}
2900
+ style=${ci({fontFamily:hp({text:this.content,font:"var(--fontFamilies-sans)"})})}
2901
2901
  >
2902
2902
  ${this.content}
2903
2903
  </div>
@@ -2938,7 +2938,7 @@ vec4 transition(vec2 uv) {
2938
2938
  text-overflow: ellipsis;
2939
2939
  overflow: hidden;
2940
2940
  }
2941
- `],wi([ee({type:Boolean})],cn.prototype,"semibold",2),wi([ee({type:Boolean})],cn.prototype,"truncate",2),wi([ee({type:String})],cn.prototype,"size",2),wi([ee({type:String})],cn.prototype,"content",2),cn=wi([Rt("vmp-text")],cn);var $1=Object.defineProperty,Y1=Object.getOwnPropertyDescriptor,Si=(r,e,t,n)=>{for(var i=n>1?void 0:n?Y1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&$1(e,t,i),i};let un=class extends $e{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=It()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var r,e;const t=(e=(r=this.items)==null?void 0:r.items.find(({id:n})=>this.subItemsActive===n))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=ln(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){var r,e;return ve`
2941
+ `],bi([ee({type:Boolean})],cn.prototype,"semibold",2),bi([ee({type:Boolean})],cn.prototype,"truncate",2),bi([ee({type:String})],cn.prototype,"size",2),bi([ee({type:String})],cn.prototype,"content",2),cn=bi([Rt("vmp-text")],cn);var SB=Object.defineProperty,RB=Object.getOwnPropertyDescriptor,xi=(r,e,t,n)=>{for(var i=n>1?void 0:n?RB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&SB(e,t,i),i};let un=class extends $e{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=It()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var r,e;const t=(e=(r=this.items)==null?void 0:r.items.find(({id:n})=>this.subItemsActive===n))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=ln(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){var r,e;return ve`
2942
2942
  <slot></slot>
2943
2943
  <div ${Ct(this._contentRef)} class="content">
2944
2944
  <div class="title">
@@ -2954,7 +2954,7 @@ vec4 transition(vec2 uv) {
2954
2954
  .content=${((r=this.visibleItems)==null?void 0:r.title)??"Sub Menu"}
2955
2955
  ></vmp-text>
2956
2956
  </div>
2957
- ${Id(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>ve`
2957
+ ${Mh(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>ve`
2958
2958
  <button
2959
2959
  class="item"
2960
2960
  @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}))}}
@@ -2964,7 +2964,7 @@ vec4 transition(vec2 uv) {
2964
2964
  </button>
2965
2965
  `)}
2966
2966
  </div>
2967
- `}};un.styles=[$e.styles??[],Yn(Fl),lt`
2967
+ `}};un.styles=[$e.styles??[],Vn(El),lt`
2968
2968
  :host {
2969
2969
  display: flex;
2970
2970
  }
@@ -3026,12 +3026,12 @@ vec4 transition(vec2 uv) {
3026
3026
  height: 20px;
3027
3027
  width: 20px;
3028
3028
  }
3029
- `],Si([ee({type:Object})],un.prototype,"items",2),Si([ee({type:Array})],un.prototype,"activeItems",2),Si([tt()],un.prototype,"visibleItems",2),Si([tt()],un.prototype,"subItemsActive",2),un=Si([Rt("vmp-menu")],un);var V1=Object.defineProperty,K1=Object.getOwnPropertyDescriptor,kl=(r,e,t,n)=>{for(var i=n>1?void 0:n?K1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&V1(e,t,i),i};let Ri=class extends $e{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=It()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=ln(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}updated(){var r,e;this.disabled?(r=this.tippy)==null||r.disable():(e=this.tippy)==null||e.enable()}render(){return ve`
3029
+ `],xi([ee({type:Object})],un.prototype,"items",2),xi([ee({type:Array})],un.prototype,"activeItems",2),xi([rt()],un.prototype,"visibleItems",2),xi([rt()],un.prototype,"subItemsActive",2),un=xi([Rt("vmp-menu")],un);var DB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,Il=(r,e,t,n)=>{for(var i=n>1?void 0:n?_B(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&DB(e,t,i),i};let wi=class extends $e{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=It()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=ln(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}updated(){var r,e;this.disabled?(r=this.tippy)==null||r.disable():(e=this.tippy)==null||e.enable()}render(){return ve`
3030
3030
  <slot></slot>
3031
3031
  <div ${Ct(this._contentRef)} class="content">
3032
3032
  <vmp-text content=${this.content}></vmp-text>
3033
3033
  </div>
3034
- `}};Ri.styles=[$e.styles??[],Yn(Fl),lt`
3034
+ `}};wi.styles=[$e.styles??[],Vn(El),lt`
3035
3035
  :host {
3036
3036
  display: flex;
3037
3037
  }
@@ -3045,7 +3045,7 @@ vec4 transition(vec2 uv) {
3045
3045
  background: var(--colors-dark-800);
3046
3046
  border-radius: var(--radii-medium);
3047
3047
  }
3048
- `],kl([ee({type:String})],Ri.prototype,"content",2),kl([ee({type:Boolean})],Ri.prototype,"disabled",2),Ri=kl([Rt("vmp-tooltip")],Ri);var J1=Object.defineProperty,W1=Object.getOwnPropertyDescriptor,Nl=(r,e,t,n)=>{for(var i=n>1?void 0:n?W1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&J1(e,t,i),i};let Di=class extends $e{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=It(),this._anchorRef=It(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=ln(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){return ve`
3048
+ `],Il([ee({type:String})],wi.prototype,"content",2),Il([ee({type:Boolean})],wi.prototype,"disabled",2),wi=Il([Rt("vmp-tooltip")],wi);var LB=Object.defineProperty,FB=Object.getOwnPropertyDescriptor,Cl=(r,e,t,n)=>{for(var i=n>1?void 0:n?FB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&LB(e,t,i),i};let Si=class extends $e{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=It(),this._anchorRef=It(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=ln(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){return ve`
3049
3049
  <vmp-icon-button
3050
3050
  ${Ct(this._anchorRef)}
3051
3051
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -3065,7 +3065,7 @@ vec4 transition(vec2 uv) {
3065
3065
  @blur=${()=>{var r;return(r=this.tippy)==null?void 0:r.hide()}}
3066
3066
  />
3067
3067
  </div>
3068
- `}};Di.styles=[$e.styles??[],Yn(Fl),lt`
3068
+ `}};Si.styles=[$e.styles??[],Vn(El),lt`
3069
3069
  .content {
3070
3070
  --volume-slider-height: 4px;
3071
3071
  --volume-slider-width: 78px;
@@ -3207,11 +3207,11 @@ vec4 transition(vec2 uv) {
3207
3207
  --volume-slider-height: 8px;
3208
3208
  color: var(--colors-light-800);
3209
3209
  }
3210
- `],Nl([ee({type:Number})],Di.prototype,"volume",2),Nl([ee({type:Boolean})],Di.prototype,"muted",2),Di=Nl([Rt("vmp-volume-button")],Di);var q1=Object.defineProperty,j1=Object.getOwnPropertyDescriptor,ao=(r,e,t,n)=>{for(var i=n>1?void 0:n?j1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&q1(e,t,i),i};let Un=class extends $e{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=It(),this._handleContainerResize=()=>{var r;const e=(r=this._containerRef.value)==null?void 0:r.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:r.clientX,y:r.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=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),i=(r.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:r.clientX,y:r.clientY,time:i*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=r=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:r.clientX,y:r.clientY},bubbles:!0,composed:!0}))}}render(){var r;const e=((r=this.buffer)==null?void 0:r.sort((t,n)=>t.start<n.start?-1:n.start<t.start?1:0).reduce((t,{start:n,end:i},s)=>{const o=t[s-1],a=Math.floor(n),l=Math.ceil(i);return t.push({id:n,start:Math.max(0,a),end:Math.min(l,100)}),o&&o.end>=n-1&&(t[s].start=o.end),t},[]))??[];return ve`
3210
+ `],Cl([ee({type:Number})],Si.prototype,"volume",2),Cl([ee({type:Boolean})],Si.prototype,"muted",2),Si=Cl([Rt("vmp-volume-button")],Si);var kB=Object.defineProperty,NB=Object.getOwnPropertyDescriptor,zs=(r,e,t,n)=>{for(var i=n>1?void 0:n?NB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&kB(e,t,i),i};let Gn=class extends $e{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=It(),this._handleContainerResize=()=>{var r;const e=(r=this._containerRef.value)==null?void 0:r.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:r.clientX,y:r.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=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),i=(r.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:r.clientX,y:r.clientY,time:i*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=r=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:r.clientX,y:r.clientY},bubbles:!0,composed:!0}))}}render(){var r;const e=((r=this.buffer)==null?void 0:r.sort((t,n)=>t.start<n.start?-1:n.start<t.start?1:0).reduce((t,{start:n,end:i},s)=>{const o=t[s-1],a=Math.floor(n),l=Math.ceil(i);return t.push({id:n,start:Math.max(0,a),end:Math.min(l,100)}),o&&o.end>=n-1&&(t[s].start=o.end),t},[]))??[];return ve`
3211
3211
  <div
3212
3212
  class="container"
3213
3213
  ${Ct(this._containerRef)}
3214
- ${_l(this._handleContainerResize)}
3214
+ ${pl(this._handleContainerResize)}
3215
3215
  @mouseenter=${this._handleMouseEnter}
3216
3216
  @mousemove=${this._handleMouseMove}
3217
3217
  @mouseleave=${this._handleMouseLeave}
@@ -3226,11 +3226,11 @@ vec4 transition(vec2 uv) {
3226
3226
  .value=${this.currentTime.toString()}
3227
3227
  data-testid="scrubber"
3228
3228
  />
3229
- ${Id(e,({id:t})=>t,t=>ve`
3229
+ ${Mh(e,({id:t})=>t,t=>ve`
3230
3230
  <div class="buffer" style=${`left: ${t.start}%; width: ${t.end-t.start}%`}></div>
3231
3231
  `)}
3232
3232
  </div>
3233
- `}};Un.styles=[$e.styles??[],lt`
3233
+ `}};Gn.styles=[$e.styles??[],lt`
3234
3234
  :host {
3235
3235
  --player-scrubber-height: 8px;
3236
3236
  --player-scrubber-shadow-width: 4000px;
@@ -3380,14 +3380,14 @@ vec4 transition(vec2 uv) {
3380
3380
  --player-scrubber-height: 16px;
3381
3381
  color: var(--colors-light-800);
3382
3382
  }
3383
- `],ao([ee({type:Number})],Un.prototype,"duration",2),ao([ee({type:Number})],Un.prototype,"currentTime",2),ao([ee({type:Array})],Un.prototype,"buffer",2),Un=ao([Rt("vmp-progress-scrubber")],Un);var X1=Object.defineProperty,z1=Object.getOwnPropertyDescriptor,st=(r,e,t,n)=>{for(var i=n>1?void 0:n?z1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&X1(e,t,i),i};let Ze=class extends $e{constructor(){super(...arguments),this.resizeHider=new U1(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=Dl,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:r}){this.volumeMenuOpen=r}_handleLanguageMenuOpen({detail:r}){this.languageMenuOpen=r}_handleLevelsMenuOpen({detail:r}){this.levelsMenuOpen=r}_handlePlaybackMenuToggle({detail:r}){this.playbackRateMenuOpen=r}_handleSettingsMenuToggle({detail:r}){this.settingsMenuOpen=r}hideMenus(){var r,e;(e=Array.from((r=this.shadowRoot)==null?void 0:r.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var n;(n=t.tippy)==null||n.hide()})}render(){var r,e,t,n,i,s,o,a,l,A,c,u,h,d,f;const g=((r=this.languages)==null?void 0:r.map(Y=>({id:`language-${Y.value}`,event:"language:click",label:Y.label,value:Y.value})))??[],p={title:"Languages",items:g},y={id:"languages",label:"Languages",subItems:p},Q=p.items.find(({value:Y})=>Y===this.language),b=((e=this.levels)==null?void 0:e.map((Y,ne)=>{const ce=Math.min(Y.width,Y.height);return{id:`level-${ne.toString()}`,event:"level:click",label:`${ce}p`,value:{resolution:ce,level:ne}}}))??[],v={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},w={id:"levels",label:"Quality",subItems:v},R=(t=v.items)==null?void 0:t.find(({value:Y})=>Y.level===this.level),k=[(g==null?void 0:g.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(Y=>{var ne;return(ne=this.controls)==null?void 0:ne.includes(Y)}),H={title:"Settings",items:[(g==null?void 0:g.length)&&y,v1,y1,w,B1].filter(Boolean).filter(({id:Y})=>k.includes(Y)&&this.resizeHider.hiddenControls.includes(Y))},V=(n=this.controls)==null?void 0:n.includes("progress"),O=(i=this.controls)==null?void 0:i.includes("navigation"),W=(s=this.controls)==null?void 0:s.includes("play"),ie=(o=this.controls)==null?void 0:o.includes("volume"),te=(a=this.controls)==null?void 0:a.includes("current-time"),le=(l=this.controls)==null?void 0:l.includes("duration"),D=(A=this.controls)==null?void 0:A.includes("languages"),P=(c=this.controls)==null?void 0:c.includes("levels"),j=(u=this.controls)==null?void 0:u.includes("speed"),_=(h=this.controls)==null?void 0:h.includes("captions"),S=(d=this.controls)==null?void 0:d.includes("fullscreen"),F=W||ie||te||le||D||P||j||_||S,J=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(f=this.level)==null?void 0:f.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return ve`
3383
+ `],zs([ee({type:Number})],Gn.prototype,"duration",2),zs([ee({type:Number})],Gn.prototype,"currentTime",2),zs([ee({type:Array})],Gn.prototype,"buffer",2),Gn=zs([Rt("vmp-progress-scrubber")],Gn);var MB=Object.defineProperty,PB=Object.getOwnPropertyDescriptor,st=(r,e,t,n)=>{for(var i=n>1?void 0:n?PB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&MB(e,t,i),i};let Ze=class extends $e{constructor(){super(...arguments),this.resizeHider=new bB(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=gl,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:r}){this.volumeMenuOpen=r}_handleLanguageMenuOpen({detail:r}){this.languageMenuOpen=r}_handleLevelsMenuOpen({detail:r}){this.levelsMenuOpen=r}_handlePlaybackMenuToggle({detail:r}){this.playbackRateMenuOpen=r}_handleSettingsMenuToggle({detail:r}){this.settingsMenuOpen=r}hideMenus(){var r,e;(e=Array.from((r=this.shadowRoot)==null?void 0:r.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var n;(n=t.tippy)==null||n.hide()})}render(){var r,e,t,n,i,s,o,a,l,A,c,u,h,d,f;const g=((r=this.languages)==null?void 0:r.map(Y=>({id:`language-${Y.value}`,event:"language:click",label:Y.label,value:Y.value})))??[],p={title:"Languages",items:g},C={id:"languages",label:"Languages",subItems:p},Q=p.items.find(({value:Y})=>Y===this.language),b=((e=this.levels)==null?void 0:e.map((Y,ne)=>{const ce=Math.min(Y.width,Y.height);return{id:`level-${ne.toString()}`,event:"level:click",label:`${ce}p`,value:{resolution:ce,level:ne}}}))??[],v={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},x={id:"levels",label:"Quality",subItems:v},R=(t=v.items)==null?void 0:t.find(({value:Y})=>Y.level===this.level),k=[(g==null?void 0:g.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(Y=>{var ne;return(ne=this.controls)==null?void 0:ne.includes(Y)}),$={title:"Settings",items:[(g==null?void 0:g.length)&&C,aB,lB,x,AB].filter(Boolean).filter(({id:Y})=>k.includes(Y)&&this.resizeHider.hiddenControls.includes(Y))},K=(n=this.controls)==null?void 0:n.includes("progress"),O=(i=this.controls)==null?void 0:i.includes("navigation"),W=(s=this.controls)==null?void 0:s.includes("play"),ie=(o=this.controls)==null?void 0:o.includes("volume"),te=(a=this.controls)==null?void 0:a.includes("current-time"),le=(l=this.controls)==null?void 0:l.includes("duration"),D=(A=this.controls)==null?void 0:A.includes("languages"),P=(c=this.controls)==null?void 0:c.includes("levels"),X=(u=this.controls)==null?void 0:u.includes("speed"),_=(h=this.controls)==null?void 0:h.includes("captions"),S=(d=this.controls)==null?void 0:d.includes("fullscreen"),F=W||ie||te||le||D||P||X||_||S,J=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(f=this.level)==null?void 0:f.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return ve`
3384
3384
  <div
3385
3385
  ${this.resizeHider.measure()}
3386
3386
  ${this.resizeHider.contain()}
3387
- class=${Ve({container:!0,hidden:!V&&!F})}
3387
+ class=${Ve({container:!0,hidden:!K&&!F})}
3388
3388
  >
3389
3389
  <div
3390
- class=${Ve({"scrubber-container":!0,hidden:!V})}
3390
+ class=${Ve({"scrubber-container":!0,hidden:!K})}
3391
3391
  >
3392
3392
  <vmp-progress-scrubber
3393
3393
  class=${Ve({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
@@ -3437,13 +3437,13 @@ vec4 transition(vec2 uv) {
3437
3437
  ${this.resizeHider.hide("current-time",2)}
3438
3438
  class=${Ve({hidden:!te})}
3439
3439
  ?semibold=${!0}
3440
- content="${Ll(this.currentTime)}${le?"/":null}"
3440
+ content="${ml(this.currentTime)}${le?"/":null}"
3441
3441
  ></vmp-text>
3442
3442
  <vmp-text
3443
3443
  ${this.resizeHider.hide("duration",6)}
3444
3444
  class=${Ve({hidden:!le})}
3445
3445
  ?semibold=${!0}
3446
- content=${Ll(this.duration)}
3446
+ content=${ml(this.duration)}
3447
3447
  ></vmp-text>
3448
3448
  </div>
3449
3449
  </div>
@@ -3472,8 +3472,8 @@ vec4 transition(vec2 uv) {
3472
3472
  </vmp-menu>
3473
3473
  <vmp-menu
3474
3474
  ${this.resizeHider.hide("playback-rate",5)}
3475
- class=${Ve({hidden:!j})}
3476
- .items=${nf}
3475
+ class=${Ve({hidden:!X})}
3476
+ .items=${vd}
3477
3477
  .activeItems=${J}
3478
3478
  @menu:toggle=${this._handlePlaybackMenuToggle}
3479
3479
  >
@@ -3510,7 +3510,7 @@ vec4 transition(vec2 uv) {
3510
3510
  </vmp-tooltip>
3511
3511
  <vmp-menu
3512
3512
  ${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
3513
- .items=${H}
3513
+ .items=${$}
3514
3514
  .activeItems=${J}
3515
3515
  @menu:toggle=${this._handleSettingsMenuToggle}
3516
3516
  >
@@ -3592,17 +3592,17 @@ vec4 transition(vec2 uv) {
3592
3592
  .hidden {
3593
3593
  display: none;
3594
3594
  }
3595
- `],st([ee({type:Boolean})],Ze.prototype,"playing",2),st([ee({type:Number})],Ze.prototype,"volume",2),st([ee({type:Boolean})],Ze.prototype,"muted",2),st([ee({type:Number})],Ze.prototype,"currentTime",2),st([ee({type:Number})],Ze.prototype,"duration",2),st([ee({type:Array})],Ze.prototype,"languages",2),st([ee({type:String})],Ze.prototype,"language",2),st([ee({type:Array,attribute:!1})],Ze.prototype,"levels",2),st([ee({type:Number})],Ze.prototype,"level",2),st([ee({type:Number})],Ze.prototype,"playbackRate",2),st([ee({type:Array})],Ze.prototype,"buffer",2),st([ee({type:Boolean})],Ze.prototype,"captions",2),st([ee({type:Boolean})],Ze.prototype,"fullscreen",2),st([ee({type:Array})],Ze.prototype,"controls",2),st([tt()],Ze.prototype,"volumeMenuOpen",2),st([tt()],Ze.prototype,"languageMenuOpen",2),st([tt()],Ze.prototype,"levelsMenuOpen",2),st([tt()],Ze.prototype,"playbackRateMenuOpen",2),st([tt()],Ze.prototype,"settingsMenuOpen",2),Ze=st([Rt("vmp-player-controls")],Ze);var Z1=Object.defineProperty,eT=Object.getOwnPropertyDescriptor,tT=(r,e,t,n)=>{for(var i=n>1?void 0:n?eT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Z1(e,t,i),i};let Ml=class extends $e{render(){return ve`<vmp-icon icon="loading"></vmp-icon>`}};Ml.styles=[$e.styles??[],lt`
3595
+ `],st([ee({type:Boolean})],Ze.prototype,"playing",2),st([ee({type:Number})],Ze.prototype,"volume",2),st([ee({type:Boolean})],Ze.prototype,"muted",2),st([ee({type:Number})],Ze.prototype,"currentTime",2),st([ee({type:Number})],Ze.prototype,"duration",2),st([ee({type:Array})],Ze.prototype,"languages",2),st([ee({type:String})],Ze.prototype,"language",2),st([ee({type:Array,attribute:!1})],Ze.prototype,"levels",2),st([ee({type:Number})],Ze.prototype,"level",2),st([ee({type:Number})],Ze.prototype,"playbackRate",2),st([ee({type:Array})],Ze.prototype,"buffer",2),st([ee({type:Boolean})],Ze.prototype,"captions",2),st([ee({type:Boolean})],Ze.prototype,"fullscreen",2),st([ee({type:Array})],Ze.prototype,"controls",2),st([rt()],Ze.prototype,"volumeMenuOpen",2),st([rt()],Ze.prototype,"languageMenuOpen",2),st([rt()],Ze.prototype,"levelsMenuOpen",2),st([rt()],Ze.prototype,"playbackRateMenuOpen",2),st([rt()],Ze.prototype,"settingsMenuOpen",2),Ze=st([Rt("vmp-player-controls")],Ze);var OB=Object.defineProperty,UB=Object.getOwnPropertyDescriptor,GB=(r,e,t,n)=>{for(var i=n>1?void 0:n?UB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&OB(e,t,i),i};let vl=class extends $e{render(){return ve`<vmp-icon icon="loading"></vmp-icon>`}};vl.styles=[$e.styles??[],lt`
3596
3596
  :host {
3597
3597
  display: flex;
3598
3598
  align-items: center;
3599
3599
  justify-content: center;
3600
3600
  }
3601
- `],Ml=tT([Rt("vmp-loading-spinner")],Ml);var rT=Object.defineProperty,nT=Object.getOwnPropertyDescriptor,cf=(r,e,t,n)=>{for(var i=n>1?void 0:n?nT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&rT(e,t,i),i};let lo=class extends $e{constructor(){super(...arguments),this.caption=""}render(){return ve`
3601
+ `],vl=GB([Rt("vmp-loading-spinner")],vl);var HB=Object.defineProperty,$B=Object.getOwnPropertyDescriptor,xd=(r,e,t,n)=>{for(var i=n>1?void 0:n?$B(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&HB(e,t,i),i};let Zs=class extends $e{constructor(){super(...arguments),this.caption=""}render(){return ve`
3602
3602
  <div class="container">
3603
3603
  <vmp-text content=${this.caption} size="large"></vmp-text>
3604
3604
  </div>
3605
- `}};lo.styles=[$e.styles??[],lt`
3605
+ `}};Zs.styles=[$e.styles??[],lt`
3606
3606
  .container {
3607
3607
  display: block;
3608
3608
  margin: 0 var(--space-small);
@@ -3621,7 +3621,7 @@ vec4 transition(vec2 uv) {
3621
3621
  /* Line height controls the spacing between the cloned boxes so has to override the default */
3622
3622
  line-height: 2.2;
3623
3623
  }
3624
- `],cf([ee({type:String})],lo.prototype,"caption",2),lo=cf([Rt("vmp-captions")],lo);var iT=Object.defineProperty,sT=Object.getOwnPropertyDescriptor,gt=(r,e,t,n)=>{for(var i=n>1?void 0:n?sT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&iT(e,t,i),i};const oT=3e3;let ot=class extends $e{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=Dl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=It()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},oT)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(r){var e;r.has("playing")&&this.playing&&this._startHideControls(),r.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var r;const e=(r=this.controls)==null?void 0:r.includes("play-large"),t=this.playing&&!this.showControls,n=!!(e&&!this.playing);return ve`
3624
+ `],xd([ee({type:String})],Zs.prototype,"caption",2),Zs=xd([Rt("vmp-captions")],Zs);var YB=Object.defineProperty,VB=Object.getOwnPropertyDescriptor,gt=(r,e,t,n)=>{for(var i=n>1?void 0:n?VB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&YB(e,t,i),i};const KB=3e3;let ot=class extends $e{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=gl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=It()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},KB)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(r){var e;r.has("playing")&&this.playing&&this._startHideControls(),r.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var r;const e=(r=this.controls)==null?void 0:r.includes("play-large"),t=this.playing&&!this.showControls,n=!!(e&&!this.playing);return ve`
3625
3625
  <div
3626
3626
  class=${Ve({container:!0,hide:t})}
3627
3627
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
@@ -3741,7 +3741,7 @@ vec4 transition(vec2 uv) {
3741
3741
  vmp-captions.hiddenControls {
3742
3742
  transform: translateY(calc(var(--space-small) * -1));
3743
3743
  }
3744
- `],gt([ee({type:Boolean})],ot.prototype,"loading",2),gt([ee({type:Boolean})],ot.prototype,"playing",2),gt([ee({type:Number})],ot.prototype,"volume",2),gt([ee({type:Boolean})],ot.prototype,"muted",2),gt([ee({type:Number})],ot.prototype,"currentTime",2),gt([ee({type:Number})],ot.prototype,"duration",2),gt([ee({type:Array})],ot.prototype,"languages",2),gt([ee({type:String})],ot.prototype,"language",2),gt([ee({type:Array,attribute:!1})],ot.prototype,"levels",2),gt([ee({type:Number})],ot.prototype,"level",2),gt([ee({type:Number})],ot.prototype,"playbackRate",2),gt([ee({type:String})],ot.prototype,"caption",2),gt([ee({type:Array})],ot.prototype,"buffer",2),gt([ee({type:Boolean})],ot.prototype,"captions",2),gt([ee({type:Boolean})],ot.prototype,"fullscreen",2),gt([ee({type:Array})],ot.prototype,"controls",2),gt([tt()],ot.prototype,"showControls",2),ot=gt([Rt("vmp-player-overlay")],ot);var aT=Object.defineProperty,lT=Object.getOwnPropertyDescriptor,nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?lT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&aT(e,t,i),i};const AT=1e3/60,cT=30;let Xe=class extends $e{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.dataResolver=fa,this.languageResolver=oE,this._sceneController=new E1(this),this._drawController=new h1(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=It(),this._canvasRef=It(),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 r;(r=this.shadowRoot)!=null&&r.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,AT):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=(r=performance.now())=>{if(this.composition){if(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e!=null&&e.key&&this.videos[e==null?void 0:e.key]&&this.videoState[e==null?void 0:e.key]){const t=this.videos[e==null?void 0:e.key],n=this.videoState[e==null?void 0:e.key];return!n||!n.initialised||n.waiting||t.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),r-(this._lastTimestamp??0)>1e3/cT){let e=this._drawController.currentTime;const t=(r-(this._lastTimestamp??r))/1e3*this.playbackRate;e+=t,this._drawController.currentTime=e,this._lastTimestamp=r}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=r=>{this._errors=[...this.errors,r.error],r.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(r=>{const e=setInterval(()=>{!!this.errors.find(n=>n.fatal)&&r(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&r(!0)},500);setTimeout(()=>{clearInterval(e),r(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.values(this.videos).forEach(({node:e})=>{e.playbackRate=r}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.values(this.videos).forEach(({node:t})=>{t.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:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.values(this.videos).forEach(({node:e})=>{e.muted=r}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.values(this.videos).forEach(({hls:e})=>{if(e){const t=e.levels.findIndex(n=>Math.min(n.height,n.width)===r);e.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r),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,Object.values(this.videos).forEach(({node:r})=>{r.pause()})}draw(r){return this._drawController.draw(r)}toggleFullscreen(r){r??this.fullscreen?C1():this._playerRef.value&&I1(this._playerRef.value)}connectedCallback(){var r;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(r=this.shadowRoot)!=null&&r.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(r){r.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),r.has("propLanguage")&&(this._language=this.propLanguage)}updated(r){r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&r.get("_processing")&&this.play(),r.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing"))}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this._observer)==null||r.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?ve`
3744
+ `],gt([ee({type:Boolean})],ot.prototype,"loading",2),gt([ee({type:Boolean})],ot.prototype,"playing",2),gt([ee({type:Number})],ot.prototype,"volume",2),gt([ee({type:Boolean})],ot.prototype,"muted",2),gt([ee({type:Number})],ot.prototype,"currentTime",2),gt([ee({type:Number})],ot.prototype,"duration",2),gt([ee({type:Array})],ot.prototype,"languages",2),gt([ee({type:String})],ot.prototype,"language",2),gt([ee({type:Array,attribute:!1})],ot.prototype,"levels",2),gt([ee({type:Number})],ot.prototype,"level",2),gt([ee({type:Number})],ot.prototype,"playbackRate",2),gt([ee({type:String})],ot.prototype,"caption",2),gt([ee({type:Array})],ot.prototype,"buffer",2),gt([ee({type:Boolean})],ot.prototype,"captions",2),gt([ee({type:Boolean})],ot.prototype,"fullscreen",2),gt([ee({type:Array})],ot.prototype,"controls",2),gt([rt()],ot.prototype,"showControls",2),ot=gt([Rt("vmp-player-overlay")],ot);var JB=Object.defineProperty,WB=Object.getOwnPropertyDescriptor,et=(r,e,t,n)=>{for(var i=n>1?void 0:n?WB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&JB(e,t,i),i};const qB=1e3/60,XB=30;let We=class extends $e{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.disabled=!1,this.dataResolver=zo,this.languageResolver=Vp,this._sceneController=new iB(this),this._drawController=new jy(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this._playerRef=It(),this._canvasRef=It(),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 r;(r=this.shadowRoot)!=null&&r.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,qB):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=(r=performance.now())=>{var e;if(this.composition){if(this._waiting=this._drawController.activeScenes.some(t=>Rr(t.layout.node).some(({key:i})=>{if(this.media[i]&&this.mediaState[i]){const s=this.media[i],o=this.mediaState[i];return!o||!o.initialised||o.waiting||s.node.readyState<3}})),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),r-(this._lastTimestamp??0)>1e3/XB){let t=this._drawController.currentTime;const n=(r-(this._lastTimestamp??r))/1e3*this.playbackRate;if(this.activeScenes[0]){const i=Rr(this.activeScenes[0].layout.node);(e=this._lastCurrentTime)!=null&&e.every((s,o)=>{const a=i[o].key,l=this.media[a];return s!==l.node.currentTime})&&(t+=n),this._lastCurrentTime=i.map(({key:s})=>this.media[s].node.currentTime)}else t+=n;this._drawController.currentTime=t,this._lastTimestamp=r}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=r=>{this._errors=[...this.errors,r.error],r.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(r=>{const e=setInterval(()=>{!!this.errors.find(n=>n.fatal)&&r(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&r(!0)},500);setTimeout(()=>{clearInterval(e),r(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get media(){return this._sceneController.media??{}}get mediaState(){return this._sceneController.mediaState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.values(this.media).forEach(({node:e})=>{e.playbackRate=r}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.values(this.media).forEach(({node:t,volume:n})=>{t.volume=e*n}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.values(this.media).forEach(({node:e,volume:t})=>{e.muted=t===0||r}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.values(this.media).forEach(({hls:e})=>{if(e){const t=e.levels.findIndex(n=>Math.min(n.height,n.width)===r);e.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._lastCurrentTime=null,this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,Object.values(this.media).forEach(({node:r})=>{r.pause()})}draw(r){return this._drawController.draw(r)}toggleFullscreen(r){r??this.fullscreen?oB():this._playerRef.value&&sB(this._playerRef.value)}connectedCallback(){var r;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(r=this.shadowRoot)!=null&&r.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(r){r.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),r.has("propLanguage")&&(this._language=this.propLanguage)}updated(r){r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&r.get("_processing")&&this.play(),r.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing"))}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this._observer)==null||r.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?ve`
3745
3745
  <style>
3746
3746
  :host {
3747
3747
  aspect-ratio: ${this.propAspectRatio};
@@ -3762,17 +3762,17 @@ vec4 transition(vec2 uv) {
3762
3762
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
3763
3763
  <vmp-text semibold content="Please try again later."></vmp-text>
3764
3764
  </div>
3765
- </div>`}render(){var r;const e=this.loading||this.processing||!this.composition||this.duration<=0,{height:t,width:n}=Kc({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??Dl)==null?void 0:r.filter(A=>!(A==="fullscreen"&&f1())),s=!(i!=null&&i.includes("preview")),o=this.loading||this.waiting||this.processing,a=!this.config,l=!!this.errors.find(A=>A.fatal);return ve`
3765
+ </div>`}render(){var r;const e=this.disabled||this.loading||this.processing||!this.composition||this.duration<=0,{height:t,width:n}=Wo({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??gl)==null?void 0:r.filter(A=>!(A==="fullscreen"&&Zy())),s=!(i!=null&&i.includes("preview")),o=this.loading||this.waiting||this.processing,a=!this.config,l=!!this.errors.find(A=>A.fatal);return ve`
3766
3766
  ${this._renderStyles()}
3767
3767
  <div
3768
3768
  ${Ct(this._playerRef)}
3769
3769
  class=${Ve({player:!0,responsive:!this.propAspectRatio})}
3770
- style=${di({aspectRatio:this.aspectRatio})}
3770
+ style=${ci({aspectRatio:this.aspectRatio})}
3771
3771
  >
3772
3772
  ${!o&&(a||l)?this._renderError():ve`<canvas
3773
3773
  ${Ct(this._canvasRef)}
3774
3774
  ${this._drawController.canvas()}
3775
- ${_l(this._handleCanvasResize)}
3775
+ ${pl(this._handleCanvasResize)}
3776
3776
  height=${t}
3777
3777
  width=${n}
3778
3778
  ></canvas>
@@ -3810,7 +3810,7 @@ vec4 transition(vec2 uv) {
3810
3810
  .dataResolver=${this.dataResolver}
3811
3811
  ></vmp-video-preview>`}
3812
3812
  </div>
3813
- `}};Xe.styles=[$e.styles??[],lt`
3813
+ `}};We.styles=[$e.styles??[],lt`
3814
3814
  :host {
3815
3815
  --player-border-radius: var(--vouch-media-player-border-radius, 0px);
3816
3816
 
@@ -3871,7 +3871,7 @@ vec4 transition(vec2 uv) {
3871
3871
  top: 0;
3872
3872
  left: 0;
3873
3873
  }
3874
- `],nt([ee({type:Boolean})],Xe.prototype,"debug",2),nt([ee({type:Object})],Xe.prototype,"config",2),nt([ee({type:String,attribute:"language"})],Xe.prototype,"propLanguage",2),nt([ee({type:Number,attribute:"aspectratio"})],Xe.prototype,"propAspectRatio",2),nt([ee({type:String})],Xe.prototype,"preload",2),nt([ee({type:Boolean})],Xe.prototype,"autoplay",2),nt([ee({type:Boolean})],Xe.prototype,"loading",2),nt([ee({type:Array})],Xe.prototype,"controls",2),nt([ee({attribute:!1})],Xe.prototype,"dataResolver",2),nt([ee({attribute:!1})],Xe.prototype,"languageResolver",2),nt([tt()],Xe.prototype,"_pageHidden",2),nt([tt()],Xe.prototype,"_aspectRatio",2),nt([tt()],Xe.prototype,"_processing",2),nt([tt()],Xe.prototype,"_waiting",2),nt([tt()],Xe.prototype,"_errors",2),nt([tt()],Xe.prototype,"_seeking",2),nt([tt()],Xe.prototype,"_language",2),nt([tt()],Xe.prototype,"_languages",2),nt([tt()],Xe.prototype,"_captions",2),nt([tt()],Xe.prototype,"_fullscreen",2),Xe=nt([Rt("vmp-media-player")],Xe);var uT=Object.defineProperty,hT=Object.getOwnPropertyDescriptor,bt=(r,e,t,n)=>{for(var i=n>1?void 0:n?hT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&uT(e,t,i),i};let pt=class extends vr{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 qf(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","scenesupdate","seeking","seeked","timeupdate","volumechange","processing","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new og(this),this._trackingController=new Xm(this),this._mediaPlayerRef=It()}get fetching(){return this._fetcherController.fetching}get waiting(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.waiting}get initialised(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.initialised}get seeking(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.seeking}get paused(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.paused}get captions(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.captions}get fullscreen(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.fullscreen}get duration(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.duration}set currentTime(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=r)}get currentTime(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.currentTime)??0}set playbackRate(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=r)}get playbackRate(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.playbackRate)??1}set volume(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=r)}get volume(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.volume)??1}set muted(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=r)}get muted(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.muted)??!1}get videoState(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var r;(r=this._mediaPlayerRef.value)==null||r.play()}pause(){var r;(r=this._mediaPlayerRef.value)==null||r.pause()}reset(r=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(r,e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?ve`
3874
+ `],et([ee({type:Boolean})],We.prototype,"debug",2),et([ee({type:Object})],We.prototype,"config",2),et([ee({type:String,attribute:"language"})],We.prototype,"propLanguage",2),et([ee({type:Number,attribute:"aspectratio"})],We.prototype,"propAspectRatio",2),et([ee({type:String})],We.prototype,"preload",2),et([ee({type:Boolean})],We.prototype,"autoplay",2),et([ee({type:Boolean})],We.prototype,"loading",2),et([ee({type:Boolean})],We.prototype,"disabled",2),et([ee({type:Array})],We.prototype,"controls",2),et([ee({attribute:!1})],We.prototype,"dataResolver",2),et([ee({attribute:!1})],We.prototype,"languageResolver",2),et([rt()],We.prototype,"_pageHidden",2),et([rt()],We.prototype,"_aspectRatio",2),et([rt()],We.prototype,"_processing",2),et([rt()],We.prototype,"_waiting",2),et([rt()],We.prototype,"_errors",2),et([rt()],We.prototype,"_seeking",2),et([rt()],We.prototype,"_language",2),et([rt()],We.prototype,"_languages",2),et([rt()],We.prototype,"_captions",2),et([rt()],We.prototype,"_fullscreen",2),We=et([Rt("vmp-media-player")],We);var jB=Object.defineProperty,zB=Object.getOwnPropertyDescriptor,bt=(r,e,t,n)=>{for(var i=n>1?void 0:n?zB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&jB(e,t,i),i};let pt=class extends vr{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 df(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","scenesupdate","seeking","seeked","timeupdate","volumechange","processing","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new Tf(this),this._trackingController=new Np(this),this._mediaPlayerRef=It()}get fetching(){return this._fetcherController.fetching}get waiting(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.waiting}get initialised(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.initialised}get seeking(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.seeking}get paused(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.paused}get captions(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.captions}get fullscreen(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.fullscreen}get duration(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.duration}set currentTime(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=r)}get currentTime(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.currentTime)??0}set playbackRate(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=r)}get playbackRate(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.playbackRate)??1}set volume(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=r)}get volume(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.volume)??1}set muted(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=r)}get muted(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.muted)??!1}get mediaState(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.mediaState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var r;(r=this._mediaPlayerRef.value)==null||r.play()}pause(){var r;(r=this._mediaPlayerRef.value)==null||r.pause()}reset(r=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(r,e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?ve`
3875
3875
  <style>
3876
3876
  :host {
3877
3877
  aspect-ratio: ${this.aspectRatio};
@@ -3900,12 +3900,12 @@ vec4 transition(vec2 uv) {
3900
3900
  :host {
3901
3901
  display: flex;
3902
3902
  }
3903
- `],bt([ee({type:Object})],pt.prototype,"data",2),bt([ee({type:String})],pt.prototype,"vouchId",2),bt([ee({type:String})],pt.prototype,"templateId",2),bt([ee({type:Array})],pt.prototype,"questions",2),bt([ee({type:String})],pt.prototype,"env",2),bt([ee({type:String})],pt.prototype,"apiKey",2),bt([ee({type:Boolean})],pt.prototype,"disableTracking",2),bt([ee({type:String})],pt.prototype,"trackingSource",2),bt([ee({type:Array})],pt.prototype,"controls",2),bt([ee({type:String})],pt.prototype,"preload",2),bt([ee({type:Boolean})],pt.prototype,"autoplay",2),bt([ee({type:Number})],pt.prototype,"aspectRatio",2),bt([ee({type:String})],pt.prototype,"language",2),bt([tt()],pt.prototype,"vouch",2),bt([tt()],pt.prototype,"template",2),pt=bt([Ui("vouch-embed-player")],pt);function Ao(r,e,t,n=20,i=0){let s=[];if(i>=n)return s;const o=l=>{const A=l.assignedNodes().filter(c=>c.nodeType===1);return A.length>0?Ao(A[0].parentElement,e,t,n,i+1):[]},a=Array.from(r.children||[]);for(const l of a)e(l)||(t(l)&&s.push(l),l.shadowRoot!=null?s.push(...Ao(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...Ao(l,e,t,n,i+1)));return s}function uf(r){return r.hasAttribute("hidden")||r.hasAttribute("aria-hidden")&&r.getAttribute("aria-hidden")!=="false"||r.style.display==="none"||r.style.opacity==="0"||r.style.visibility==="hidden"||r.style.visibility==="collapse"}function dT(r){return r.hasAttribute("disabled")||r.hasAttribute("aria-disabled")&&r.getAttribute("aria-disabled")!=="false"}function fT(r){return r.getAttribute("tabindex")==="-1"||uf(r)||dT(r)?!1:r.hasAttribute("tabindex")||(r instanceof HTMLAnchorElement||r instanceof HTMLAreaElement)&&r.hasAttribute("href")||r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r instanceof HTMLIFrameElement}const Pl=new Map;function gT(r,e,t){const n=Pl.get(t);n!=null&&window.clearTimeout(n),Pl.set(t,window.setTimeout(()=>{r(),Pl.delete(t)},e))}const hf=document.createElement("template");hf.innerHTML=`
3903
+ `],bt([ee({type:Object})],pt.prototype,"data",2),bt([ee({type:String})],pt.prototype,"vouchId",2),bt([ee({type:String})],pt.prototype,"templateId",2),bt([ee({type:Array})],pt.prototype,"questions",2),bt([ee({type:String})],pt.prototype,"env",2),bt([ee({type:String})],pt.prototype,"apiKey",2),bt([ee({type:Boolean})],pt.prototype,"disableTracking",2),bt([ee({type:String})],pt.prototype,"trackingSource",2),bt([ee({type:Array})],pt.prototype,"controls",2),bt([ee({type:String})],pt.prototype,"preload",2),bt([ee({type:Boolean})],pt.prototype,"autoplay",2),bt([ee({type:Number})],pt.prototype,"aspectRatio",2),bt([ee({type:String})],pt.prototype,"language",2),bt([rt()],pt.prototype,"vouch",2),bt([rt()],pt.prototype,"template",2),pt=bt([Pi("vouch-embed-player")],pt);function eo(r,e,t,n=20,i=0){let s=[];if(i>=n)return s;const o=l=>{const A=l.assignedNodes().filter(c=>c.nodeType===1);return A.length>0?eo(A[0].parentElement,e,t,n,i+1):[]},a=Array.from(r.children||[]);for(const l of a)e(l)||(t(l)&&s.push(l),l.shadowRoot!=null?s.push(...eo(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...eo(l,e,t,n,i+1)));return s}function wd(r){return r.hasAttribute("hidden")||r.hasAttribute("aria-hidden")&&r.getAttribute("aria-hidden")!=="false"||r.style.display==="none"||r.style.opacity==="0"||r.style.visibility==="hidden"||r.style.visibility==="collapse"}function ZB(r){return r.hasAttribute("disabled")||r.hasAttribute("aria-disabled")&&r.getAttribute("aria-disabled")!=="false"}function e1(r){return r.getAttribute("tabindex")==="-1"||wd(r)||ZB(r)?!1:r.hasAttribute("tabindex")||(r instanceof HTMLAnchorElement||r instanceof HTMLAreaElement)&&r.hasAttribute("href")||r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r instanceof HTMLIFrameElement}const yl=new Map;function t1(r,e,t){const n=yl.get(t);n!=null&&window.clearTimeout(n),yl.set(t,window.setTimeout(()=>{r(),yl.delete(t)},e))}const Sd=document.createElement("template");Sd.innerHTML=`
3904
3904
  <div id="start"></div>
3905
3905
  <div id="backup"></div>
3906
3906
  <slot></slot>
3907
3907
  <div id="end"></div>
3908
- `;class pT extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(hf.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Ao(this,uf,fT)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){gT(()=>{this.focused!==e&&(this._focused=e,this.render())},0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",pT);var mT=Object.defineProperty,ET=Object.getOwnPropertyDescriptor,Ol=(r,e,t,n)=>{for(var i=n>1?void 0:n?ET(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&mT(e,t,i),i};let _i=class extends vr{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ve`
3908
+ `;class r1 extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Sd.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return eo(this,wd,e1)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){t1(()=>{this.focused!==e&&(this._focused=e,this.render())},0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",r1);var n1=Object.defineProperty,i1=Object.getOwnPropertyDescriptor,Bl=(r,e,t,n)=>{for(var i=n>1?void 0:n?i1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&n1(e,t,i),i};let Ri=class extends vr{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ve`
3909
3909
  <div
3910
3910
  class=${Ve({container:!0,hidden:!this.open})}
3911
3911
  >
@@ -3916,7 +3916,7 @@ vec4 transition(vec2 uv) {
3916
3916
  <focus-trap>
3917
3917
  <div
3918
3918
  class=${Ve({"video-frame":!0,grow:this.aspectRatio===0})}
3919
- style=${di({aspectRatio:this.aspectRatio})}
3919
+ style=${ci({aspectRatio:this.aspectRatio})}
3920
3920
  >
3921
3921
  <slot></slot>
3922
3922
  <vmp-icon-button
@@ -3928,7 +3928,7 @@ vec4 transition(vec2 uv) {
3928
3928
  </div>
3929
3929
  </focus-trap>
3930
3930
  </div>
3931
- `}};_i.styles=[lt`
3931
+ `}};Ri.styles=[lt`
3932
3932
  :host {
3933
3933
  --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);
3934
3934
  --overlay-background-color: var(--vu-overlay-background-color, black);
@@ -3992,11 +3992,11 @@ vec4 transition(vec2 uv) {
3992
3992
  right: 0;
3993
3993
  margin: 10px;
3994
3994
  }
3995
- `],Ol([ee({type:Boolean})],_i.prototype,"open",2),Ol([ee({type:Number})],_i.prototype,"aspectRatio",2),_i=Ol([Ui("vouch-embed-dialog-overlay")],_i);var IT=Object.defineProperty,CT=Object.getOwnPropertyDescriptor,Ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?CT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&IT(e,t,i),i};let Nt=class extends vr{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._mediaPlayerRef=It(),this.open=!1,this._handleToggle=({detail:r})=>{var e,t,n;this.id===r&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(n=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||n.pause())},this._handleClose=()=>{var r,e;this.open=!1,(e=(r=this._mediaPlayerRef)==null?void 0:r.value)==null||e.pause()},this._handleDocumentKeyUp=r=>{r.key==="Escape"&&this._handleClose()}}connectedCallback(){super.connectedCallback(),document.addEventListener("dialogembed:click",this._handleToggle),document.addEventListener("keyup",this._handleDocumentKeyUp),document.addEventListener("close:click",this._handleClose),document.addEventListener("overlay:click",this._handleClose)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dialogembed:click",this._handleToggle),document.removeEventListener("keyup",this._handleDocumentKeyUp),document.removeEventListener("close:click",this._handleClose),document.removeEventListener("overlay:click",this._handleClose)}createRenderRoot(){const r=document.createElement("div");return document.body.appendChild(r),r}render(){return ve`
3995
+ `],Bl([ee({type:Boolean})],Ri.prototype,"open",2),Bl([ee({type:Number})],Ri.prototype,"aspectRatio",2),Ri=Bl([Pi("vouch-embed-dialog-overlay")],Ri);var s1=Object.defineProperty,o1=Object.getOwnPropertyDescriptor,Ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?o1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&s1(e,t,i),i};let Nt=class extends vr{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._mediaPlayerRef=It(),this.open=!1,this._handleToggle=({detail:r})=>{var e,t,n;this.id===r&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(n=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||n.pause())},this._handleClose=()=>{var r,e;this.open=!1,(e=(r=this._mediaPlayerRef)==null?void 0:r.value)==null||e.pause()},this._handleDocumentKeyUp=r=>{r.key==="Escape"&&this._handleClose()}}connectedCallback(){super.connectedCallback(),document.addEventListener("dialogembed:click",this._handleToggle),document.addEventListener("keyup",this._handleDocumentKeyUp),document.addEventListener("close:click",this._handleClose),document.addEventListener("overlay:click",this._handleClose)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dialogembed:click",this._handleToggle),document.removeEventListener("keyup",this._handleDocumentKeyUp),document.removeEventListener("close:click",this._handleClose),document.removeEventListener("overlay:click",this._handleClose)}createRenderRoot(){const r=document.createElement("div");return document.body.appendChild(r),r}render(){return ve`
3996
3996
  <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
3997
3997
  <vouch-embed-player
3998
3998
  ${Ct(this._mediaPlayerRef)}
3999
- style=${di({maxWidth:"100%",maxHeight:"100%"})}
3999
+ style=${ci({maxWidth:"100%",maxHeight:"100%"})}
4000
4000
  ?autoplay=${!1}
4001
4001
  vouchId=${At(this.vouchId)}
4002
4002
  templateId=${At(this.templateId)}
@@ -4010,7 +4010,7 @@ vec4 transition(vec2 uv) {
4010
4010
  aspectRatio=${this.aspectRatio}
4011
4011
  ></vouch-embed-player>
4012
4012
  </vouch-embed-dialog-overlay>
4013
- `}};Ot([ee({type:String})],Nt.prototype,"vouchId",2),Ot([ee({type:String})],Nt.prototype,"templateId",2),Ot([ee({type:Array})],Nt.prototype,"questions",2),Ot([ee({type:String})],Nt.prototype,"env",2),Ot([ee({type:String})],Nt.prototype,"apiKey",2),Ot([ee({type:Boolean})],Nt.prototype,"disableTracking",2),Ot([ee({type:String})],Nt.prototype,"trackingSource",2),Ot([ee({type:Array})],Nt.prototype,"controls",2),Ot([ee({type:String})],Nt.prototype,"preload",2),Ot([ee({type:Boolean})],Nt.prototype,"disableAutoplay",2),Ot([ee({type:Number})],Nt.prototype,"aspectRatio",2),Ot([tt()],Nt.prototype,"open",2),Nt=Ot([Ui("vouch-embed-dialog-portal")],Nt);var vT=Object.defineProperty,yT=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?yT(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&vT(e,t,i),i};return mt.DialogEmbed=class extends vr{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._id=Fr(),this._handleRootClick=()=>{this.dispatchEvent(new CustomEvent("dialogembed:click",{detail:this._id,bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleRootClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleRootClick)}render(){return ve`
4013
+ `}};Ot([ee({type:String})],Nt.prototype,"vouchId",2),Ot([ee({type:String})],Nt.prototype,"templateId",2),Ot([ee({type:Array})],Nt.prototype,"questions",2),Ot([ee({type:String})],Nt.prototype,"env",2),Ot([ee({type:String})],Nt.prototype,"apiKey",2),Ot([ee({type:Boolean})],Nt.prototype,"disableTracking",2),Ot([ee({type:String})],Nt.prototype,"trackingSource",2),Ot([ee({type:Array})],Nt.prototype,"controls",2),Ot([ee({type:String})],Nt.prototype,"preload",2),Ot([ee({type:Boolean})],Nt.prototype,"disableAutoplay",2),Ot([ee({type:Number})],Nt.prototype,"aspectRatio",2),Ot([rt()],Nt.prototype,"open",2),Nt=Ot([Pi("vouch-embed-dialog-portal")],Nt);var a1=Object.defineProperty,l1=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?l1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&a1(e,t,i),i};return mt.DialogEmbed=class extends vr{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._id=kr(),this._handleRootClick=()=>{this.dispatchEvent(new CustomEvent("dialogembed:click",{detail:this._id,bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleRootClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleRootClick)}render(){return ve`
4014
4014
  <slot>
4015
4015
  <vmp-button size="large">Play</vmp-button>
4016
4016
  </slot>
@@ -4038,5 +4038,5 @@ vec4 transition(vec2 uv) {
4038
4038
  width: fit-content;
4039
4039
  height: fit-content;
4040
4040
  }
4041
- `],qt([ee({type:String})],mt.DialogEmbed.prototype,"vouchId",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"templateId",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"questions",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"env",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"apiKey",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableTracking",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"trackingSource",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"controls",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"preload",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableAutoplay",2),qt([ee({type:Number})],mt.DialogEmbed.prototype,"aspectRatio",2),mt.DialogEmbed=qt([Ui("vouch-embed-dialog")],mt.DialogEmbed),Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"}),mt}({});
4041
+ `],qt([ee({type:String})],mt.DialogEmbed.prototype,"vouchId",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"templateId",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"questions",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"env",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"apiKey",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableTracking",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"trackingSource",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"controls",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"preload",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableAutoplay",2),qt([ee({type:Number})],mt.DialogEmbed.prototype,"aspectRatio",2),mt.DialogEmbed=qt([Pi("vouch-embed-dialog")],mt.DialogEmbed),Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"}),mt}({});
4042
4042
  //# sourceMappingURL=embed.iife.js.map