@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 embeds=function(Ne){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var hf;const ki=globalThis,fo=ki.ShadowRoot&&(ki.ShadyCSS===void 0||ki.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,go=Symbol(),Yl=new WeakMap;let Vl=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==go)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(fo&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Yl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Yl.set(t,e))}return e}toString(){return this.cssText}};const $n=r=>new Vl(typeof r=="string"?r:r+"",void 0,go),At=(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 Vl(t,r,go)},vf=(r,e)=>{if(fo)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=ki.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Kl=fo?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return $n(t)})(r):r;/**
5
+ */var Sd;const Li=globalThis,io=Li.ShadowRoot&&(Li.ShadyCSS===void 0||Li.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,so=Symbol(),wl=new WeakMap;let Sl=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==so)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(io&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=wl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&wl.set(t,e))}return e}toString(){return this.cssText}};const Yn=r=>new Sl(typeof r=="string"?r:r+"",void 0,so),At=(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 Sl(t,r,so)},Pd=(r,e)=>{if(io)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Li.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Rl=io?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Yn(t)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:yf,defineProperty:Bf,getOwnPropertyDescriptor:Tf,getOwnPropertyNames:Qf,getOwnPropertySymbols:bf,getPrototypeOf:xf}=Object,_r=globalThis,Jl=_r.trustedTypes,wf=Jl?Jl.emptyScript:"",po=_r.reactiveElementPolyfillSupport,Yn=(r,e)=>r,Ni={toAttribute(r,e){switch(e){case Boolean:r=r?wf: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}},Mi=(r,e)=>!yf(r,e),Wl={attribute:!0,type:String,converter:Ni,reflect:!1,hasChanged:Mi};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_r.litPropertyMetadata??(_r.litPropertyMetadata=new WeakMap);class hn 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=Wl){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&&Bf(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Tf(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)??Wl}static _$Ei(){if(this.hasOwnProperty(Yn("elementProperties")))return;const e=xf(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Yn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Yn("properties"))){const t=this.properties,n=[...Qf(t),...bf(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(Kl(i))}else e!==void 0&&t.push(Kl(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 vf(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:Ni).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:Ni;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??Mi)(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){}}hn.elementStyles=[],hn.shadowRootOptions={mode:"open"},hn[Yn("elementProperties")]=new Map,hn[Yn("finalized")]=new Map,po==null||po({ReactiveElement:hn}),(_r.reactiveElementVersions??(_r.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:Od,defineProperty:Ud,getOwnPropertyDescriptor:Gd,getOwnPropertyNames:Hd,getOwnPropertySymbols:$d,getPrototypeOf:Yd}=Object,Lr=globalThis,Dl=Lr.trustedTypes,Vd=Dl?Dl.emptyScript:"",oo=Lr.reactiveElementPolyfillSupport,Vn=(r,e)=>r,Fi={toAttribute(r,e){switch(e){case Boolean:r=r?Vd: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}},ki=(r,e)=>!Od(r,e),_l={attribute:!0,type:String,converter:Fi,reflect:!1,hasChanged:ki};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Lr.litPropertyMetadata??(Lr.litPropertyMetadata=new WeakMap);class hn 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=_l){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&&Ud(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Gd(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)??_l}static _$Ei(){if(this.hasOwnProperty(Vn("elementProperties")))return;const e=Yd(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=[...Hd(t),...$d(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(Rl(i))}else e!==void 0&&t.push(Rl(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 Pd(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:Fi).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:Fi;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??ki)(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){}}hn.elementStyles=[],hn.shadowRootOptions={mode:"open"},hn[Vn("elementProperties")]=new Map,hn[Vn("finalized")]=new Map,oo==null||oo({ReactiveElement:hn}),(Lr.reactiveElementVersions??(Lr.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Vn=globalThis,Pi=Vn.trustedTypes,ql=Pi?Pi.createPolicy("lit-html",{createHTML:r=>r}):void 0,mo="$lit$",Ir=`lit$${(Math.random()+"").slice(9)}$`,Eo="?"+Ir,Sf=`<${Eo}>`,$r=document,Kn=()=>$r.createComment(""),Jn=r=>r===null||typeof r!="object"&&typeof r!="function",jl=Array.isArray,Xl=r=>jl(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Io=`[
14
- \f\r]`,Wn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zl=/-->/g,Zl=/>/g,Yr=RegExp(`>|${Io}(?:([^\\s"'>=/]+)(${Io}*=${Io}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),eA=/'/g,tA=/"/g,rA=/^(?:script|style|textarea|title)$/i,Rf=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ve=Rf(1),qt=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),nA=new WeakMap,Vr=$r.createTreeWalker($r,129);function iA(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return ql!==void 0?ql.createHTML(e):e}const sA=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=Wn;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===Wn?c[1]==="!--"?o=zl:c[1]!==void 0?o=Zl:c[2]!==void 0?(rA.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Yr):c[3]!==void 0&&(o=Yr):o===Yr?c[0]===">"?(o=i??Wn,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,A=c[1],o=c[3]===void 0?Yr:c[3]==='"'?tA:eA):o===tA||o===eA?o=Yr:o===zl||o===Zl?o=Wn:(o=Yr,i=void 0);const d=o===Yr&&r[a+1].startsWith("/>")?" ":"";s+=o===Wn?l+Sf:u>=0?(n.push(A),l.slice(0,u)+mo+l.slice(u)+Ir+d):l+Ir+(u===-2?a:d)}return[iA(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class qn{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]=sA(e,t);if(this.el=qn.createElement(A,n),Vr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Vr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(mo)){const h=c[o++],d=i.getAttribute(u).split(Ir),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?aA:f[1]==="?"?lA:f[1]==="@"?AA:jn}),i.removeAttribute(u)}else u.startsWith(Ir)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(rA.test(i.tagName)){const u=i.textContent.split(Ir),h=u.length-1;if(h>0){i.textContent=Pi?Pi.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Kn()),Vr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Kn())}}}else if(i.nodeType===8)if(i.data===Eo)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Ir,u+1))!==-1;)l.push({type:7,index:s}),u+=Ir.length-1}s++}}static createElement(e,t){const n=$r.createElement("template");return n.innerHTML=e,n}}function Kr(r,e,t=r,n){var o,a;if(e===qt)return e;let i=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const s=Jn(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=Kr(r,i._$AS(r,e.values),i,n)),e}class oA{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)??$r).importNode(t,!0);Vr.currentNode=i;let s=Vr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new dn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new cA(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Vr.nextNode(),o++)}return Vr.currentNode=$r,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 dn{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=Kr(this,e,t),Jn(e)?e===tt||e==null||e===""?(this._$AH!==tt&&this._$AR(),this._$AH=tt):e!==this._$AH&&e!==qt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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&&Jn(this._$AH)?this._$AA.nextSibling.data=e:this.T($r.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=qn.createElement(iA(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 oA(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=nA.get(e.strings);return t===void 0&&nA.set(e.strings,t=new qn(e)),t}k(e){jl(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 dn(this.S(Kn()),this.S(Kn()),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 jn{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=Kr(this,e,t,0),o=!Jn(e)||e!==this._$AH&&e!==qt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Kr(this,a[n+l],t,l),A===qt&&(A=this._$AH[l]),o||(o=!Jn(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 aA extends jn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===tt?void 0:e}}class lA extends jn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==tt)}}class AA extends jn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Kr(this,e,t,0)??tt)===qt)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 cA{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){Kr(this,e)}}const Df={P:mo,A:Ir,C:Eo,M:1,L:sA,R:oA,D:Xl,V:Kr,I:dn,H:jn,N:lA,U:AA,B:aA,F:cA},Co=Vn.litHtmlPolyfillSupport;Co==null||Co(qn,dn),(Vn.litHtmlVersions??(Vn.litHtmlVersions=[])).push("3.1.2");const _f=(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 dn(e.insertBefore(Kn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
13
+ */const Kn=globalThis,Ni=Kn.trustedTypes,Ll=Ni?Ni.createPolicy("lit-html",{createHTML:r=>r}):void 0,ao="$lit$",Ir=`lit$${(Math.random()+"").slice(9)}$`,lo="?"+Ir,Kd=`<${lo}>`,$r=document,Jn=()=>$r.createComment(""),Wn=r=>r===null||typeof r!="object"&&typeof r!="function",Fl=Array.isArray,kl=r=>Fl(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Ao=`[
14
+ \f\r]`,qn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Nl=/-->/g,Ml=/>/g,Yr=RegExp(`>|${Ao}(?:([^\\s"'>=/]+)(${Ao}*=${Ao}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pl=/'/g,Ol=/"/g,Ul=/^(?:script|style|textarea|title)$/i,Jd=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ve=Jd(1),qt=Symbol.for("lit-noChange"),rt=Symbol.for("lit-nothing"),Gl=new WeakMap,Vr=$r.createTreeWalker($r,129);function Hl(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ll!==void 0?Ll.createHTML(e):e}const $l=(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=Nl:c[1]!==void 0?o=Ml:c[2]!==void 0?(Ul.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Yr):c[3]!==void 0&&(o=Yr):o===Yr?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?Yr:c[3]==='"'?Ol:Pl):o===Ol||o===Pl?o=Yr:o===Nl||o===Ml?o=qn:(o=Yr,i=void 0);const d=o===Yr&&r[a+1].startsWith("/>")?" ":"";s+=o===qn?l+Kd:u>=0?(n.push(A),l.slice(0,u)+ao+l.slice(u)+Ir+d):l+Ir+(u===-2?a:d)}return[Hl(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Xn{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]=$l(e,t);if(this.el=Xn.createElement(A,n),Vr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Vr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(ao)){const h=c[o++],d=i.getAttribute(u).split(Ir),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?Vl:f[1]==="?"?Kl:f[1]==="@"?Jl:jn}),i.removeAttribute(u)}else u.startsWith(Ir)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Ul.test(i.tagName)){const u=i.textContent.split(Ir),h=u.length-1;if(h>0){i.textContent=Ni?Ni.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Jn()),Vr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Jn())}}}else if(i.nodeType===8)if(i.data===lo)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(Ir,u+1))!==-1;)l.push({type:7,index:s}),u+=Ir.length-1}s++}}static createElement(e,t){const n=$r.createElement("template");return n.innerHTML=e,n}}function Kr(r,e,t=r,n){var o,a;if(e===qt)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=Kr(r,i._$AS(r,e.values),i,n)),e}class Yl{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)??$r).importNode(t,!0);Vr.currentNode=i;let s=Vr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new dn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new Wl(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Vr.nextNode(),o++)}return Vr.currentNode=$r,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 dn{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=rt,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=Kr(this,e,t),Wn(e)?e===rt||e==null||e===""?(this._$AH!==rt&&this._$AR(),this._$AH=rt):e!==this._$AH&&e!==qt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):kl(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!==rt&&Wn(this._$AH)?this._$AA.nextSibling.data=e:this.T($r.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=Xn.createElement(Hl(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 Yl(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Gl.get(e.strings);return t===void 0&&Gl.set(e.strings,t=new Xn(e)),t}k(e){Fl(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 dn(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 jn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=rt,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=rt}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Kr(this,e,t,0),o=!Wn(e)||e!==this._$AH&&e!==qt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Kr(this,a[n+l],t,l),A===qt&&(A=this._$AH[l]),o||(o=!Wn(A)||A!==this._$AH[l]),A===rt?e=rt:e!==rt&&(e+=(A??"")+s[l+1]),this._$AH[l]=A}o&&!i&&this.j(e)}j(e){e===rt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Vl extends jn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===rt?void 0:e}}class Kl extends jn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==rt)}}class Jl extends jn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Kr(this,e,t,0)??rt)===qt)return;const n=this._$AH,i=e===rt&&n!==rt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==rt&&(n===rt||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 Wl{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){Kr(this,e)}}const Wd={P:ao,A:Ir,C:lo,M:1,L:$l,R:Yl,D:kl,V:Kr,I:dn,H:jn,N:Kl,U:Jl,B:Vl,F:Wl},co=Kn.litHtmlPolyfillSupport;co==null||co(Xn,dn),(Kn.litHtmlVersions??(Kn.litHtmlVersions=[])).push("3.1.2");const qd=(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 dn(e.insertBefore(Jn(),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 Cr=class extends hn{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=_f(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 qt}};Cr._$litElement$=!0,Cr.finalized=!0,(hf=globalThis.litElementHydrateSupport)==null||hf.call(globalThis,{LitElement:Cr});const vo=globalThis.litElementPolyfillSupport;vo==null||vo({LitElement:Cr}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
19
+ */let Cr=class extends hn{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=qd(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 qt}};Cr._$litElement$=!0,Cr.finalized=!0,(Sd=globalThis.litElementHydrateSupport)==null||Sd.call(globalThis,{LitElement:Cr});const uo=globalThis.litElementPolyfillSupport;uo==null||uo({LitElement:Cr}),(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 Oi=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)};/**
23
+ */const Mi=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 Lf={attribute:!0,type:String,converter:Ni,reflect:!1,hasChanged:Mi},Ff=(r=Lf,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"?Ff(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 Xd={attribute:!0,type:String,converter:Fi,reflect:!1,hasChanged:ki},jd=(r=Xd,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"?jd(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 rt(r){return ee({...r,state:!0,attribute:!1})}/**
31
+ */function nt(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 ct=r=>r??tt;/**
35
+ */const ct=r=>r??rt;/**
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
39
- */const{I:kf}=Df,Nf=r=>r.strings===void 0,uA=()=>document.createComment(""),Xn=(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(uA(),i),a=n.insertBefore(uA(),i);t=new kf(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},Jr=(r,e,t=r)=>(r._$AI(e,t),r),Mf={},Pf=(r,e=Mf)=>r._$AH=e,Of=r=>r._$AH,yo=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:zd}=Wd,Zd=r=>r.strings===void 0,ql=()=>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(ql(),i),a=n.insertBefore(ql(),i);t=new zd(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},Jr=(r,e,t=r)=>(r._$AI(e,t),r),ef={},tf=(r,e=ef)=>r._$AH=e,rf=r=>r._$AH,ho=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 fn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},gn=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 fn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},gn=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)}};/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const Zn=(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),Zn(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)},hA=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),Hf(e)}};function Uf(r){this._$AN!==void 0?(Ui(this),this._$AM=r,hA(this)):this._$AM=r}function Gf(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++)Zn(n[s],!1),Ui(n[s]);else n!=null&&(Zn(n,!1),Ui(n));else Zn(this,r)}const Hf=r=>{r.type==fn.CHILD&&(r._$AP??(r._$AP=Gf),r._$AQ??(r._$AQ=Uf))};class dA extends zn{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),hA(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&&(Zn(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(){}}/**
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},Pi=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)},Xl=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),of(e)}};function nf(r){this._$AN!==void 0?(Pi(this),this._$AM=r,Xl(this)):this._$AM=r}function sf(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),Pi(n[s]);else n!=null&&(ei(n,!1),Pi(n));else ei(this,r)}const of=r=>{r.type==fn.CHILD&&(r._$AP??(r._$AP=sf),r._$AQ??(r._$AQ=nf))};class jl extends Zn{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Xl(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),Pi(this))}setValue(e){if(Zd(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 mt=()=>new $f;let $f=class{};const Bo=new WeakMap,Et=gn(class extends dA{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=Bo.get(e);t===void 0&&(t=new WeakMap,Bo.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=Bo.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 Yf(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class Vf{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=mt(),this.host=e,this._events=t,e.addController(this)}register(){return Et(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Yf(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const mt=()=>new af;let af=class{};const fo=new WeakMap,Et=gn(class extends jl{render(r){return rt}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)),rt}rt(r){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=fo.get(e);t===void 0&&(t=new WeakMap,fo.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=fo.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 lf(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class Af{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=mt(),this.host=e,this._events=t,e.addController(this)}register(){return Et(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(lf(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 Kf=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??Jf,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===Kf)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 Jf=(r,e)=>r===e||r.length===e.length&&r.every((t,n)=>!Mi(t,e[n]));let Hi;const Wf=new Uint8Array(16);function qf(){if(!Hi&&(Hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hi(Wf)}const It=[];for(let r=0;r<256;++r)It.push((r+256).toString(16).slice(1));function jf(r,e=0){return It[r[e+0]]+It[r[e+1]]+It[r[e+2]]+It[r[e+3]]+"-"+It[r[e+4]]+It[r[e+5]]+"-"+It[r[e+6]]+It[r[e+7]]+"-"+It[r[e+8]]+It[r[e+9]]+"-"+It[r[e+10]]+It[r[e+11]]+It[r[e+12]]+It[r[e+13]]+It[r[e+14]]+It[r[e+15]]}const fA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Lr(r,e,t){if(fA.randomUUID&&!e&&!r)return fA.randomUUID();r=r||{};const n=r.random||(r.rng||qf)();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 jf(n)}const gA="https://d2rxhdlm2q91uk.cloudfront.net",Xf="https://d1ix11aj5kfygl.cloudfront.net",zf="https://d157jlwnudd93d.cloudfront.net",pA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Zf="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",eg="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",tg="http://localhost:6060/v2",rg="https://embed-dev.vouchfor.com/v2",ng="https://embed-staging.vouchfor.com/v2",ig="https://embed.vouchfor.com/v2";function $i(r){if(!["local","dev","staging","prod"].includes(r))throw new Error(`Unknown environment: ${r}`);if(r==="local")return{videoUrl:gA,publicApiUrl:pA,embedApiUrl:tg};if(r==="dev")return{videoUrl:gA,publicApiUrl:pA,embedApiUrl:rg};if(r==="staging")return{videoUrl:Xf,publicApiUrl:Zf,embedApiUrl:ng};if(r==="prod")return{videoUrl:zf,publicApiUrl:eg,embedApiUrl:ig}}class sg{constructor(e){this._fetching=!1,this.getVouch=async(t,n,i)=>{var c;const{embedApiUrl:s}=$i(t),o=Lr(),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}=$i(t),o=Lr(),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 og=(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);!ag(i,s)&&n||Object.defineProperty(r,t,s)},ag=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)},lg=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Ag=(r,e)=>`/* Wrapped ${r}*/
56
- ${e}`,cg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),ug=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),hg=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=Ag.bind(null,n,e.toString());Object.defineProperty(i,"name",ug);const{writable:s,enumerable:o,configurable:a}=cg;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function dg(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))og(r,e,i,t);return lg(r,e),hg(r,e,n),r}const fg=new WeakMap,mA=new WeakMap;function Yi(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=mA.get(r)??new Set;u.add(c),mA.set(r,u)}return l};return dg(i,r,{ignoreNonConfigurable:!0}),fg.set(i,t),i}var EA=function(){};const gg=(r,e,t)=>Math.min(Math.max(t,r),e),IA=(r,e,t)=>{const n=e-r;return n===0?1:(t-r)/n},To=(r,e,t)=>-t*r+t*e+r,CA=(r,e)=>t=>Math.max(Math.min(t,e),r),ei=r=>r%1?Number(r.toFixed(5)):r,Vi=/(-)?([\d]*\.?[\d])+/g,Qo=/(#[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,pg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function ti(r){return typeof r=="string"}const Ki={test:r=>typeof r=="number",parse:parseFloat,transform:r=>r},vA=Object.assign(Object.assign({},Ki),{transform:CA(0,1)});Object.assign(Object.assign({},Ki),{default:1});const ri=(r=>({test:e=>ti(e)&&e.endsWith(r)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${r}`}))("%");Object.assign(Object.assign({},ri),{parse:r=>ri.parse(r)/100,transform:r=>ri.transform(r*100)});const bo=(r,e)=>t=>!!(ti(t)&&pg.test(t)&&t.startsWith(r)||e&&Object.prototype.hasOwnProperty.call(t,e)),yA=(r,e,t)=>n=>{if(!ti(n))return n;const[i,s,o,a]=n.match(Vi);return{[r]:parseFloat(i),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Wr={test:bo("hsl","hue"),parse:yA("hue","saturation","lightness"),transform:({hue:r,saturation:e,lightness:t,alpha:n=1})=>"hsla("+Math.round(r)+", "+ri.transform(ei(e))+", "+ri.transform(ei(t))+", "+ei(vA.transform(n))+")"},mg=CA(0,255),xo=Object.assign(Object.assign({},Ki),{transform:r=>Math.round(mg(r))}),Fr={test:bo("rgb","red"),parse:yA("red","green","blue"),transform:({red:r,green:e,blue:t,alpha:n=1})=>"rgba("+xo.transform(r)+", "+xo.transform(e)+", "+xo.transform(t)+", "+ei(vA.transform(n))+")"};function Eg(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 wo={test:bo("#"),parse:Eg,transform:Fr.transform},Ji={test:r=>Fr.test(r)||wo.test(r)||Wr.test(r),parse:r=>Fr.test(r)?Fr.parse(r):Wr.test(r)?Wr.parse(r):wo.parse(r),transform:r=>ti(r)?r:r.hasOwnProperty("red")?Fr.transform(r):Wr.transform(r)},BA="${c}",TA="${n}";function Ig(r){var e,t,n,i;return isNaN(r)&&ti(r)&&((t=(e=r.match(Vi))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((i=(n=r.match(Qo))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>0}function QA(r){typeof r=="number"&&(r=`${r}`);const e=[];let t=0;const n=r.match(Qo);n&&(t=n.length,r=r.replace(Qo,BA),e.push(...n.map(Ji.parse)));const i=r.match(Vi);return i&&(r=r.replace(Vi,TA),e.push(...i.map(Ki.parse))),{values:e,numColors:t,tokenised:r}}function bA(r){return QA(r).values}function xA(r){const{values:e,numColors:t,tokenised:n}=QA(r),i=e.length;return s=>{let o=n;for(let a=0;a<i;a++)o=o.replace(a<t?BA:TA,a<t?Ji.transform(s[a]):ei(s[a]));return o}}const Cg=r=>typeof r=="number"?0:r;function vg(r){const e=bA(r);return xA(r)(e.map(Cg))}const wA={test:Ig,parse:bA,createTransformer:xA,getAnimatableNone:vg};function So(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 SA({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=So(l,a,r+.3333333333333333),s=So(l,a,r),o=So(l,a,r-.3333333333333333)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}const yg=(r,e,t)=>{const n=r*r,i=e*e;return Math.sqrt(Math.max(0,t*(i-n)+n))},Bg=[wo,Fr,Wr],RA=r=>Bg.find(e=>e.test(r)),DA=(r,e)=>{let t=RA(r),n=RA(e),i=t.parse(r),s=n.parse(e);t===Wr&&(i=SA(i),t=Fr),n===Wr&&(s=SA(s),n=Fr);const o=Object.assign({},i);return a=>{for(const l in o)l!=="alpha"&&(o[l]=yg(i[l],s[l],a));return o.alpha=To(i.alpha,s.alpha,a),t.transform(o)}},Tg=r=>typeof r=="number",Qg=(r,e)=>t=>e(r(t)),_A=(...r)=>r.reduce(Qg);function LA(r,e){return Tg(r)?t=>To(r,e,t):Ji.test(r)?DA(r,e):NA(r,e)}const FA=(r,e)=>{const t=[...r],n=t.length,i=r.map((s,o)=>LA(s,e[o]));return s=>{for(let o=0;o<n;o++)t[o]=i[o](s);return t}},bg=(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]=LA(r[i],e[i]));return i=>{for(const s in n)t[s]=n[s](i);return t}};function kA(r){const e=wA.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 NA=(r,e)=>{const t=wA.createTransformer(e),n=kA(r),i=kA(e);return n.numHSL===i.numHSL&&n.numRGB===i.numRGB&&n.numNumbers>=i.numNumbers?_A(FA(n.parsed,i.parsed),t):o=>`${o>0?e:r}`},xg=(r,e)=>t=>To(r,e,t);function wg(r){if(typeof r=="number")return xg;if(typeof r=="string")return Ji.test(r)?DA:NA;if(Array.isArray(r))return FA;if(typeof r=="object")return bg}function Sg(r,e,t){const n=[],i=t||wg(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=_A(l,a)}n.push(a)}return n}function Rg([r,e],[t]){return n=>t(IA(r,e,n))}function Dg(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=IA(r[s],r[s+1],i);return e[s](a)}}function _g(r,e,{clamp:t=!0,ease:n,mixer:i}={}){const s=r.length;EA(s===e.length),EA(!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=Sg(e,n,i),a=s===2?Rg(r,o):Dg(r,o);return t?l=>a(gg(r[0],r[s-1],l)):a}const Wi=r=>e=>1-r(1-e),Ro=r=>e=>e<=.5?r(2*e)/2:(2-r(2*(1-e)))/2,Lg=r=>e=>Math.pow(e,r),MA=r=>e=>e*e*((r+1)*e-r),Fg=r=>{const e=MA(r);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},PA=1.525,kg=4/11,Ng=8/11,Mg=9/10,Pg=r=>r,Do=Lg(2),Og=Wi(Do),Ug=Ro(Do),OA=r=>1-Math.sin(Math.acos(r)),UA=Wi(OA),Gg=Ro(UA),_o=MA(PA),Hg=Wi(_o),$g=Ro(_o),Yg=Fg(PA),Vg=4356/361,Kg=35442/1805,Jg=16061/1805,qi=r=>{if(r===1||r===0)return r;const e=r*r;return r<kg?7.5625*e:r<Ng?9.075*e-9.9*r+3.4:r<Mg?Vg*e-Kg*r+Jg:10.8*r*r-20.52*r+10.72},Wg=Wi(qi),qg=r=>r<.5?.5*(1-qi(1-r*2)):.5*qi(r*2-1)+.5;var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Fo={exports:{}};(function(r,e){(function(t,n){n(e)})(pn,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 cf=Symbol();class Oi{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??uf,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===cf)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 uf=(r,e)=>r===e||r.length===e.length&&r.every((t,n)=>!ki(t,e[n]));let Ui;const hf=new Uint8Array(16);function df(){if(!Ui&&(Ui=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ui))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ui(hf)}const It=[];for(let r=0;r<256;++r)It.push((r+256).toString(16).slice(1));function ff(r,e=0){return It[r[e+0]]+It[r[e+1]]+It[r[e+2]]+It[r[e+3]]+"-"+It[r[e+4]]+It[r[e+5]]+"-"+It[r[e+6]]+It[r[e+7]]+"-"+It[r[e+8]]+It[r[e+9]]+"-"+It[r[e+10]]+It[r[e+11]]+It[r[e+12]]+It[r[e+13]]+It[r[e+14]]+It[r[e+15]]}const zl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fr(r,e,t){if(zl.randomUUID&&!e&&!r)return zl.randomUUID();r=r||{};const n=r.random||(r.rng||df)();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 ff(n)}const Zl="https://d2rxhdlm2q91uk.cloudfront.net",gf="https://d1ix11aj5kfygl.cloudfront.net",pf="https://d157jlwnudd93d.cloudfront.net",eA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",mf="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Ef="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",If="http://localhost:6060/v2",Cf="https://embed-dev.vouchfor.com/v2",vf="https://embed-staging.vouchfor.com/v2",yf="https://embed.vouchfor.com/v2";function Gi(r){if(!["local","dev","staging","prod"].includes(r))throw new Error(`Unknown environment: ${r}`);if(r==="local")return{videoUrl:Zl,publicApiUrl:eA,embedApiUrl:If};if(r==="dev")return{videoUrl:Zl,publicApiUrl:eA,embedApiUrl:Cf};if(r==="staging")return{videoUrl:gf,publicApiUrl:mf,embedApiUrl:vf};if(r==="prod")return{videoUrl:pf,publicApiUrl:Ef,embedApiUrl:yf}}class Bf{constructor(e){this._fetching=!1,this.getVouch=async(t,n,i)=>{var c;const{embedApiUrl:s}=Gi(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}=Gi(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 Oi(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 Oi(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 Tf=(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);!Qf(i,s)&&n||Object.defineProperty(r,t,s)},Qf=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)},bf=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},xf=(r,e)=>`/* Wrapped ${r}*/
56
+ ${e}`,wf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Sf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Rf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=xf.bind(null,n,e.toString());Object.defineProperty(i,"name",Sf);const{writable:s,enumerable:o,configurable:a}=wf;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function Df(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))Tf(r,e,i,t);return bf(r,e),Rf(r,e,n),r}const _f=new WeakMap,tA=new WeakMap;function go(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=tA.get(r)??new Set;u.add(c),tA.set(r,u)}return l};return Df(i,r,{ignoreNonConfigurable:!0}),_f.set(i,t),i}var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function po(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var mo={exports:{}};(function(r,e){(function(t,n){n(e)})(pn,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 Pe,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;(Pe=Y.exec(_))!==null;){var m=Pe[1],E=Pe[2],x=Pe[3],M=Pe[4],z=Pe[5],X=Pe.index;if(m)m==="("?(qe===0&&(Te==="n"?(T(X),Te="p"):Te==="f"&&(T(X),Te="fp")),qe++):m===")"?--qe===0&&Te!=="c"&&(T(X),Te="err"):qe===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",_,Pe.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Pe.index,u.exec(_)?Y.lastIndex=u.lastIndex:i("unclosed string",_,Pe.index)):E==='"'?(h.lastIndex=Pe.index,h.exec(_)?Y.lastIndex=h.lastIndex:i("unclosed string",_,Pe.index)):E==="`"&&(c.lastIndex=Pe.index,c.exec(_)?Y.lastIndex=c.lastIndex:i("unclosed string",_,Pe.index));else if(x)return T(X),ce=X+Pe[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,Pe){Qe.b=[],Qe.d=[];var we,qe=!1,Te=[];function T(_e,Nt){_e&&(_e=function(ht,Ot,mr,Er){var Bt,q;return typeof Ot.autoTrim=="string"?Bt=q=Ot.autoTrim:Array.isArray(Ot.autoTrim)&&(Bt=Ot.autoTrim[1],q=Ot.autoTrim[0]),(mr||mr===!1)&&(Bt=mr),(Er||Er===!1)&&(q=Er),Bt==="slurp"&&q==="slurp"?ht.trim():(Bt==="_"||Bt==="slurp"?ht=String.prototype.trimLeft?ht.trimLeft():ht.replace(/^[\s\uFEFF\xA0]+/,""):Bt!=="-"&&Bt!=="nl"||(ht=ht.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ht=String.prototype.trimRight?ht.trimRight():ht.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ht=ht.replace(/(?:\n|\r|\r\n)$/,"")),ht)}(_e,S,pe,Nt))&&(_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 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=X.n||"";S.async&&A.test(De)&&(X.a=!0,X.n=De.replace(A,"")),qe=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(!Pe)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 He=S.plugins[Le];He.processAST&&(Se.d=He.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||"",He=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Pe=y(pe,ge);!ne.raw&&S.autoEscape&&(Pe="c.l('F','e')("+Pe+")"),Y+="tR+="+Pe+";"}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,He,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,He){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?He(Le):ce(pe,ge+1,Se,Le,He)})})(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,He,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){He+=Qe,Se===ge.length-1?fe(He):ce(pe,ge,Se+1,Le,He,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 Pe,we={f:[]},Xe=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;(Pe=Y.exec(_))!==null;){var m=Pe[1],E=Pe[2],w=Pe[3],M=Pe[4],z=Pe[5],j=Pe.index;if(m)m==="("?(Xe===0&&(Te==="n"?(T(j),Te="p"):Te==="f"&&(T(j),Te="fp")),Xe++):m===")"?--Xe===0&&Te!=="c"&&(T(j),Te="err"):Xe===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",_,Pe.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Pe.index,u.exec(_)?Y.lastIndex=u.lastIndex:i("unclosed string",_,Pe.index)):E==='"'?(h.lastIndex=Pe.index,h.exec(_)?Y.lastIndex=h.lastIndex:i("unclosed string",_,Pe.index)):E==="`"&&(c.lastIndex=Pe.index,c.exec(_)?Y.lastIndex=c.lastIndex:i("unclosed string",_,Pe.index));else if(w)return T(j),ce=j+Pe[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,Pe){Qe.b=[],Qe.d=[];var we,Xe=!1,Te=[];function T(_e,Nt){_e&&(_e=function(ht,Ot,mr,Er){var Bt,q;return typeof Ot.autoTrim=="string"?Bt=q=Ot.autoTrim:Array.isArray(Ot.autoTrim)&&(Bt=Ot.autoTrim[1],q=Ot.autoTrim[0]),(mr||mr===!1)&&(Bt=mr),(Er||Er===!1)&&(q=Er),Bt==="slurp"&&q==="slurp"?ht.trim():(Bt==="_"||Bt==="slurp"?ht=String.prototype.trimLeft?ht.trimLeft():ht.replace(/^[\s\uFEFF\xA0]+/,""):Bt!=="-"&&Bt!=="nl"||(ht=ht.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ht=String.prototype.trimRight?ht.trimRight():ht.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ht=ht.replace(/(?:\n|\r|\r\n)$/,"")),ht)}(_e,S,pe,Nt))&&(_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 Xe?(Xe.d=Te,Qe.b.push(Xe)):Qe.d=Te,Qe;i("Helper start and end don't match",_,we.index+we[0].length)}else if(Ie==="b"){Xe?(Xe.d=Te,Qe.b.push(Xe)):Qe.d=Te;var De=j.n||"";S.async&&A.test(De)&&(j.a=!0,j.n=De.replace(A,"")),Xe=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(!Pe)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 He=S.plugins[Le];He.processAST&&(Se.d=He.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||"",He=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Pe=C(pe,ge);!ne.raw&&S.autoEscape&&(Pe="c.l('F','e')("+Pe+")"),Y+="tR+="+Pe+";"}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,He,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,He){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?He(Le):ce(pe,ge+1,Se,Le,He)})})(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,He,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){He+=Qe,Se===ge.length-1?fe(He):ce(pe,ge,Se+1,Le,He,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})})})(Fo,Fo.exports);var jg=Fo.exports;const Xg=(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)},Zg=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},e0=(r,e)=>`/* Wrapped ${r}*/
66
- ${e}`,t0=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),r0=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),n0=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=e0.bind(null,n,e.toString());Object.defineProperty(i,"name",r0),Object.defineProperty(r,"toString",{...t0,value:i})};function i0(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))Xg(r,e,i,t);return Zg(r,e),n0(r,e,n),r}const s0=new WeakMap;function ni(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 i0(i,r,{ignoreNonConfigurable:!0}),s0.set(i,t),i}var GA={},ko={},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 vr=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=vr;let No=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=No;let ji=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=ji;let Mo=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=Mo;let nr=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=nr;let ii=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=ii;let Xi=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=Xi;let si=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=si;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 qr=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=qr;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 Zi=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=Zi;let Po=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=Po;let es=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=es;let ts=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=ts;let rs=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=rs;let oi=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=oi;let ns=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=ns;var o0={ALIGN_AUTO:vr.Auto,ALIGN_FLEX_START:vr.FlexStart,ALIGN_CENTER:vr.Center,ALIGN_FLEX_END:vr.FlexEnd,ALIGN_STRETCH:vr.Stretch,ALIGN_BASELINE:vr.Baseline,ALIGN_SPACE_BETWEEN:vr.SpaceBetween,ALIGN_SPACE_AROUND:vr.SpaceAround,DIMENSION_WIDTH:No.Width,DIMENSION_HEIGHT:No.Height,DIRECTION_INHERIT:ji.Inherit,DIRECTION_LTR:ji.LTR,DIRECTION_RTL:ji.RTL,DISPLAY_FLEX:Mo.Flex,DISPLAY_NONE:Mo.None,EDGE_LEFT:nr.Left,EDGE_TOP:nr.Top,EDGE_RIGHT:nr.Right,EDGE_BOTTOM:nr.Bottom,EDGE_START:nr.Start,EDGE_END:nr.End,EDGE_HORIZONTAL:nr.Horizontal,EDGE_VERTICAL:nr.Vertical,EDGE_ALL:nr.All,ERRATA_NONE:ii.None,ERRATA_STRETCH_FLEX_BASIS:ii.StretchFlexBasis,ERRATA_ALL:ii.All,ERRATA_CLASSIC:ii.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Xi.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Xi.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Xi.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:si.Column,FLEX_DIRECTION_COLUMN_REVERSE:si.ColumnReverse,FLEX_DIRECTION_ROW:si.Row,FLEX_DIRECTION_ROW_REVERSE:si.RowReverse,GUTTER_COLUMN:zi.Column,GUTTER_ROW:zi.Row,GUTTER_ALL:zi.All,JUSTIFY_FLEX_START:qr.FlexStart,JUSTIFY_CENTER:qr.Center,JUSTIFY_FLEX_END:qr.FlexEnd,JUSTIFY_SPACE_BETWEEN:qr.SpaceBetween,JUSTIFY_SPACE_AROUND:qr.SpaceAround,JUSTIFY_SPACE_EVENLY:qr.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:Zi.Undefined,MEASURE_MODE_EXACTLY:Zi.Exactly,MEASURE_MODE_AT_MOST:Zi.AtMost,NODE_TYPE_DEFAULT:Po.Default,NODE_TYPE_TEXT:Po.Text,OVERFLOW_VISIBLE:es.Visible,OVERFLOW_HIDDEN:es.Hidden,OVERFLOW_SCROLL:es.Scroll,POSITION_TYPE_STATIC:ts.Static,POSITION_TYPE_RELATIVE:ts.Relative,POSITION_TYPE_ABSOLUTE:ts.Absolute,PRINT_OPTIONS_LAYOUT:rs.Layout,PRINT_OPTIONS_STYLE:rs.Style,PRINT_OPTIONS_CHILDREN:rs.Children,UNIT_UNDEFINED:oi.Undefined,UNIT_POINT:oi.Point,UNIT_PERCENT:oi.Percent,UNIT_AUTO:oi.Auto,WRAP_NO_WRAP:ns.NoWrap,WRAP_WRAP:ns.Wrap,WRAP_WRAP_REVERSE:ns.WrapReverse};Re.default=o0,Object.defineProperty(ko,"__esModule",{value:!0}),ko.default=l0;var kr=a0(Re);function HA(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(HA=function(n){return n?t:e})(r)}function a0(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=HA(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 l0(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={[kr.Unit.Point]:r.Node.prototype[i],[kr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[kr.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=kr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?kr.Unit.Percent:kr.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]:kr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...kr.default}}var $A={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/fwBgBH9/f38AYA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ACoCHCICQwAAAABdRQ0AIAKMIQELIAELhQECA38BfgJAIABCgICAgBBUBEAgACEFDAELA0AgAUEBayIBIABCCoAiBUL2AX4gAHynQTByOgAAIABC/////58BViECIAUhACACDQALCyAFpyICBEADQCABQQFrIgEgAkEKbiIDQfYBbCACakEwcjoAACACQQlLIQQgAyECIAQNAAsLIAELNwECf0EEEB0iAiABNgIAQQQQHSIDIAE2AgBBmTcgAEG6N0HqJEHCASACQbo3Qe4kQcMBIAMQBwteAQF/IABBADYCDCAAIAM2AhACQCABBEAgAUGAgICABE8NASABQQJ0EB0hBAsgACAENgIAIAAgBCACQQJ0aiICNgIIIAAgBCABQQJ0ajYCDCAAIAI2AgQgAA8LEFAAC9QBAgJ9AX8gAEHQAGohACABQQJ0QdAhaigCACEFAkACQAJAAn8gAUF+cUECRgRAIABBBSAFQY+evPwHEDMMAQsgACAFQY+evPwHEDILIgFB8OGD/AdGDQAgAUGPnrz8B0YNAkHwISEAAkAgAUGq1ar9B0cEQCABviIDIANbDQFB+CEhAAsgACoCACEDQwAAwH8hBCAAKAIEQQFrDgIDAQILIAFB/////3txQYCAgIACar4hAyABQYCAgIAEcUUNAgsgAyAClEMK1yM8lCEECyAEDwsgAwu4AgIHfwJ9IwBBEGsiAyQAAkAgACgCDCIBBEAgACoCiAQhCSAAKgKEBCEIAn0gAC0ABEEgcQRAIAAgCCAJQQAgAREmAAwBCyAAIAggCSABEScACyIIIAhbDQEgA0HRGjYCACAAIAMQLRAsAAsCQAJAIAAoArAEIgEgACgCrAQiBkcEQEEBIAEgBmtBAnUiASABQQFNGyEHA0AgBiAEQQJ0aigCACIBKAKkBEUEQCABKAIYIgVBgIAMcUGAgAhHBEAgBUENdkEHcSIFBH8gBQUgACgCGEEKdkEHcQtBBUYEQCAALQAYQQhxDQULIAEtAARBAnENBCACIAEgAhshAgsgBEEBaiIEIAdHDQELCyACDQILIAAqAogEIQgMAgsgASECCyACEEIgAioC6AGSIQgLIANBEGokACAIC28BAX8CQCAAQR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I4ITUgDigCMCEhIA4oAiwhGAJAAkACQAJAICdBAUYNAEMAAAAAIQICQAJAAkAgJCgCACIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iASABWw0BQfghIQULIAUqAgAhAkMAAMB/IQEgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhAQwBCyACIQELQwAAAAAhAgJAAkACQCAAKALYASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoBEUNAgJAAkAgACoCICIBIAFbBEAgASECDAELIAAqAhwiAkMAAAAAXkUNAQsgAiACXARAIDghAgwECyAAKgIgIQELIAEgAVwEQCAzIQIgACoCHCIBQwAAAABeRQ0DCyA4IQIgAUMAAAAAXA0CIDM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BCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5gYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSETIAGaIgG9I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BfyABIAAoAgQiBUEBdWohASAAKAIAIQAgASACIAMgBCAFQQFxBH8gASgCACAAaigCAAUgAAsRHAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEQAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEQwACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQkAC2EBAn8jAEEQayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBE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xEEQLEAAgACgCAEEAIAG2EC8QRAsRACAAKAIAQQFBqtWq/QcQPAsQACAAKAIAQQEgAbYQMRA8CxAAIAAoAgBBASABthAvEDwLEQAgACgCAEEAQarVqv0HEDwLEAAgACgCAEEAIAG2EDEQPAsQACAAKAIAQQAgAbYQLxA8C3ACAn0BfwJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsRACAAKAIAIAFBqtWq/QcQSwsQACAAKAIAIAEgArYQMRBLCxAAIAAoAgAgASACthAvEEsLcwEBfwJAIAAoAgAiACgCGCICQQR2QQdxIAFGDQAgACACQY9/cSABQQR0QfAAc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GwAAsxsAAGZpaWkAAAAArBsAAJwbAACcGwAAtBsAAKwbAACcGwAAnBsAALQbAACdGwAAnBsAAJwbAACcGwAAnBsAALQbAACtGwAAnBsAAKwbAACcGwAArRsAAKwbAACcGwAAeRsAAKwbAACcGwAAkRsAAK0bAACdGwAAAAAAAKwbAACcGwAAuhsAALobAACzGwAAdmlpZGRpAACZGwAAnRsAQbAnC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBgSgLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////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=MT(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 He=void 0;function fe(C){throw new He(C)}var Qe=C=>(C||fe("Cannot use deleted val. handle = "+C),ge[C].value),Pe=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,qe=void 0;function Te(C){for(var B="";Q[C];)B+=qe[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=mf(C);var B=Te(C);return Rr(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 Nt={};function ht(C,B){return B=M(C,B),x[B]}var Ot=void 0;function mr(C){throw new Ot(C)}function Er(C,B){return B.O&&B.N||mr("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&mr("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Bt(Object.create(C,{L:{value:B}}))}function Bt(C){return typeof FinalizationRegistry>"u"?(Bt=B=>B,C):(De=new FinalizationRegistry(B=>{ke(B.L)}),Bt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Bt(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 Oe={},Fe={};function je(C,B,L){function N(oe){oe=L(oe),oe.length!==C.length&&mr("Mismatched type converter count");for(var Ae=0;Ae<C.length;++Ae)xt(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),Oe.hasOwnProperty(oe)||(Oe[oe]=[]),Oe[oe].push(()=>{$[Ae]=z[oe],++se,se===Z.length&&N($)}))}),Z.length===0&&N($)}function bt(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 xt(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],Oe.hasOwnProperty(C)&&(B=Oe[C],delete Oe[C],B.forEach($=>$()))}function Un(C){fe(C.L.O.M.name+" instance already deleted")}function wt(){}function un(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 Gn(C,B){s.hasOwnProperty(C)?(fe("Cannot register public name '"+C+"' twice"),un(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 Hr(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 _i(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 Li(C,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Hl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),_i(B.L.N,B.L.O.M,this.M))}function Hn(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 "'+Hl(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=_i(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,Pe(function(){N.delete()})),C!==null&&C.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function yT(C,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Hl(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),_i(B.L.N,B.L.O.M,this.M))}function Sr(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=Hn:(this.toWireType=N?Li:yT,this.U=null)}function BT(C,B){s.hasOwnProperty(C)||mr("Replacing nonexistant public symbol"),s[C]=B,s[C].Y=void 0}function TT(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 tr(C,B){C=Te(C);var L=C.includes("j")?TT(C,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+C+": "+B),L}var df=void 0;function Ao(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 df(C+": "+N.map(X).join([", "]))}function Ol(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=[],Ge=[];return function(){if(arguments.length!==ae&&fe("function "+C+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ge.length=0,ye.length=se?2:1,ye[0]=$,se){var lt=B[1].toWireType(Ge,this);ye[1]=lt}for(var Ve=0;Ve<ae;++Ve)ue[Ve]=B[Ve+2].toWireType(Ge,arguments[Ve]),ye.push(ue[Ve]);if(Ve=N.apply(null,ye),oe)de(Ge);else for(var Ut=se?1:2;Ut<B.length;Ut++){var rr=Ut===1?lt:ue[Ut-2];B[Ut].U!==null&&B[Ut].U(rr)}return lt=Ae?B[0].fromWireType(Ve):void 0,lt}}function Ul(C,B){for(var L=[],N=0;N<C;N++)L.push(R[B+4*N>>2]);return L}function Gl(C){4<C&&--ge[C].fa===0&&(ge[C]=void 0,Se.push(C))}function Hl(C){if(C===null)return"null";var B=typeof C;return B==="object"||B==="array"||B==="function"?C.toString():""+C}function QT(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 bT(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 xT(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 wT(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 ST(C){return 2*C.length}function RT(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 DT(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 _T(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 LT={};function ff(C){var B=LT[C];return B===void 0?Te(C):B}var co=[];function FT(C){var B=co.length;return co.push(C),B}function kT(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 gf=[],NT=[null,[],[]];He=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 pf=Array(256),uo=0;256>uo;++uo)pf[uo]=String.fromCharCode(uo);qe=pf,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)},Ot=s.InternalError=Le("InternalError"),wt.prototype.isAliasOf=function(C){if(!(this instanceof wt&&C instanceof wt))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},wt.prototype.clone=function(){if(this.L.N||Un(this),this.L.$)return this.L.count.value+=1,this;var C=Bt,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},wt.prototype.delete=function(){this.L.N||Un(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)},wt.prototype.isDeleted=function(){return!this.L.N},wt.prototype.deleteLater=function(){return this.L.N||Un(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},Sr.prototype.pa=function(C){return this.ja&&(C=this.ja(C)),C},Sr.prototype.ga=function(C){this.V&&this.V(C)},Sr.prototype.argPackAdvance=8,Sr.prototype.readValueFromPointer=Ce,Sr.prototype.deleteObject=function(C){C!==null&&C.delete()},Sr.prototype.fromWireType=function(C){function B(){return this.ca?Er(this.M.W,{O:this.va,N:L,T:this,S:C}):Er(this.M.W,{O:this,N:C})}var L=this.pa(C);if(!L)return this.ga(C),null;var N=ht(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=Nt[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?Er(N.M.W,{O:N,N:$,T:this,S:C}):Er(N.M.W,{O:N,N:$})},df=s.UnboundTypeError=Le("UnboundTypeError");var MT=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},PT={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}}),Bt(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 Pe(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));je([C],Z,se=>{var oe={};return $.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ge=Ae.ra,lt=se[ae+$.length],Ve=Ae.xa,Ut=Ae.za;oe[Ae.na]={read:rr=>ue.fromWireType(ye(Ge,rr)),write:(rr,Fi)=>{var Dr=[];Ve(Ut,rr,lt.toWireType(Dr,Fi)),de(Dr)}}}),[{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=bt(L);B=Te(B),xt(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,Ge){ue=Te(ue),Z=tr($,Z),oe&&(oe=tr(se,oe)),ae&&(ae=tr(Ae,ae)),Ge=tr(ye,Ge);var lt=ce(ue);Gn(lt,function(){Ao("Cannot construct "+ue+" due to unbound types",[N])}),je([C,B,L],N?[N]:[],function(Ve){if(Ve=Ve[0],N)var Ut=Ve.M,rr=Ut.W;else rr=wt.prototype;Ve=pe(lt,function(){if(Object.getPrototypeOf(this)!==Fi)throw new He("Use 'new' to construct "+ue);if(Dr.X===void 0)throw new He(ue+" has no accessible constructor");var Cf=Dr.X[arguments.length];if(Cf===void 0)throw new He("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Dr.X).toString()+") parameters instead!");return Cf.apply(this,arguments)});var Fi=Object.create(rr,{constructor:{value:Ve}});Ve.prototype=Fi;var Dr=new Hr(ue,Ve,Fi,Ge,Ut,Z,oe,ae);Ut=new Sr(ue,Dr,!0,!1),rr=new Sr(ue+"*",Dr,!1,!1);var If=new Sr(ue+" const*",Dr,!1,!0);return Nt[C]={pointerType:rr,ka:If},BT(lt,Ve),[Ut,rr,If]})},c:function(C,B,L,N,$,Z,se){var oe=Ul(L,N);B=Te(B),Z=tr($,Z),je([],[C],function(Ae){function ae(){Ao("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):(un(ye,B,ue),ye[B].R[L-1]=ae),je([],oe,function(Ge){return Ge=Ol(ue,[Ge[0],null].concat(Ge.slice(1)),null,Z,se),ye[B].R===void 0?(Ge.Y=L-1,ye[B]=Ge):ye[B].R[L-1]=Ge,[]}),[]})},o:function(C,B,L,N,$,Z){0<B||j();var se=Ul(B,L);$=tr(N,$),je([],[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 He("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]=()=>{Ao("Cannot construct "+oe.name+" due to unbound types",se)},je([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Ol(Ae,ae,null,$,Z),[]}),[]})},a:function(C,B,L,N,$,Z,se,oe){var Ae=Ul(L,N);B=Te(B),Z=tr($,Z),je([],[C],function(ae){function ue(){Ao("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 Ge=ae.M.W,lt=Ge[B];return lt===void 0||lt.R===void 0&&lt.className!==ae.name&&lt.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ge[B]=ue):(un(Ge,B,ye),Ge[B].R[L-2]=ue),je([],Ae,function(Ve){return Ve=Ol(ye,Ve,ae,Z,se),Ge[B].R===void 0?(Ve.Y=L-2,Ge[B]=Ve):Ge[B].R[L-2]=Ve,[]}),[]})},A:function(C,B){B=Te(B),xt(C,{name:B,fromWireType:function(L){var N=Qe(L);return Gl(L),N},toWireType:function(L,N){return Pe(N)},argPackAdvance:8,readValueFromPointer:Ce,U:null})},m:function(C,B,L){L=bt(L),B=Te(B),xt(C,{name:B,fromWireType:function(N){return N},toWireType:function(N,$){return $},argPackAdvance:8,readValueFromPointer:QT(B,L),U:null})},d:function(C,B,L,N,$){B=Te(B),$===-1&&($=4294967295),$=bt(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},xt(C,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:bT(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),xt(C,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(C,B){B=Te(B);var L=B==="std::string";xt(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 Rr(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=$l(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&&(Rr(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(Rr,oe),oe},argPackAdvance:8,readValueFromPointer:Ce,U:function(N){Rr(N)}})},i:function(C,B,L){if(L=Te(L),B===2)var N=xT,$=wT,Z=ST,se=()=>v,oe=1;else B===4&&(N=RT,$=DT,Z=_T,se=()=>R,oe=2);xt(C,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ge=Ae+4,lt=0;lt<=ae;++lt){var Ve=Ae+4+lt*B;(lt==ae||ue[Ve>>oe]==0)&&(Ge=N(Ge,Ve-Ge),ye===void 0?ye=Ge:(ye+="\0",ye+=Ge),Ge=Ve+B)}return Rr(Ae),ye},toWireType:function(Ae,ae){typeof ae!="string"&&fe("Cannot pass non-string to C++ string type "+L);var ue=Z(ae),ye=$l(4+ue+B);return R[ye>>2]=ue>>oe,$(ae,ye+4,ue+B),Ae!==null&&Ae.push(Rr,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:function(Ae){Rr(Ae)}})},k:function(C,B,L,N,$,Z){q[C]={name:Te(B),ea:tr(L,N),V:tr($,Z),ha:[]}},h:function(C,B,L,N,$,Z,se,oe,Ae,ae){q[C].ha.push({na:Te(B),sa:L,qa:tr(N,$),ra:Z,ya:se,xa:tr(oe,Ae),za:ae})},C:function(C,B){B=Te(B),xt(C,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(C,B,L,N,$){C=co[C],B=Qe(B),L=ff(L);var Z=[];return R[N>>2]=Pe(Z),C(B,L,Z,$)},t:function(C,B,L,N){C=co[C],B=Qe(B),L=ff(L),C(B,L,null,N)},g:Gl,l:function(C,B){var L=kT(C,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var $=gf[B];if($!==void 0)return $;var Z=Array(C-1);return $=FT((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)}),gf[B]=$},q:function(C){4<C&&(ge[C].fa+=1)},r:function(C){var B=Qe(C);de(B),Gl(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=NT[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:PT};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 mf=s.___getTypeName=function(){return(mf=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 $l=s._malloc=function(){return($l=s._malloc=s.asm.H).apply(null,arguments)},Rr=s._free=function(){return(Rr=s._free=s.asm.J).apply(null,arguments)};s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.K).apply(null,arguments)};var ho;P=function C(){ho||Ef(),ho||(P=C)};function Ef(){function C(){if(!ho&&(ho=!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 Ef(),i.ready}})();r.exports=t})($A);var A0=$A.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(ko),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=A0;async function o(){return(0,t.default)(await s())}})(GA);function c0(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var u0=c0;/*!
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})})})(mo,mo.exports);var Lf=mo.exports;const Ff=(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);!kf(i,s)&&n||Object.defineProperty(r,t,s)},kf=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)},Nf=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Mf=(r,e)=>`/* Wrapped ${r}*/
66
+ ${e}`,Pf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Of=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Uf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=Mf.bind(null,n,e.toString());Object.defineProperty(i,"name",Of),Object.defineProperty(r,"toString",{...Pf,value:i})};function Gf(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))Ff(r,e,i,t);return Nf(r,e),Uf(r,e,n),r}const Hf=new WeakMap;function Wr(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 Gf(i,r,{ignoreNonConfigurable:!0}),Hf.set(i,t),i}var rA={},Eo={},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 vr=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=vr;let Io=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=Io;let Hi=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=Hi;let Co=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=Co;let nr=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=nr;let ti=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=ti;let $i=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=$i;let ri=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=ri;let Yi=function(r){return r[r.Column=0]="Column",r[r.Row=1]="Row",r[r.All=2]="All",r}({});Re.Gutter=Yi;let qr=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=qr;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 Vi=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=Vi;let vo=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=vo;let Ki=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=Ki;let Ji=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=Ji;let Wi=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=Wi;let ni=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=ni;let qi=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=qi;var $f={ALIGN_AUTO:vr.Auto,ALIGN_FLEX_START:vr.FlexStart,ALIGN_CENTER:vr.Center,ALIGN_FLEX_END:vr.FlexEnd,ALIGN_STRETCH:vr.Stretch,ALIGN_BASELINE:vr.Baseline,ALIGN_SPACE_BETWEEN:vr.SpaceBetween,ALIGN_SPACE_AROUND:vr.SpaceAround,DIMENSION_WIDTH:Io.Width,DIMENSION_HEIGHT:Io.Height,DIRECTION_INHERIT:Hi.Inherit,DIRECTION_LTR:Hi.LTR,DIRECTION_RTL:Hi.RTL,DISPLAY_FLEX:Co.Flex,DISPLAY_NONE:Co.None,EDGE_LEFT:nr.Left,EDGE_TOP:nr.Top,EDGE_RIGHT:nr.Right,EDGE_BOTTOM:nr.Bottom,EDGE_START:nr.Start,EDGE_END:nr.End,EDGE_HORIZONTAL:nr.Horizontal,EDGE_VERTICAL:nr.Vertical,EDGE_ALL:nr.All,ERRATA_NONE:ti.None,ERRATA_STRETCH_FLEX_BASIS:ti.StretchFlexBasis,ERRATA_ALL:ti.All,ERRATA_CLASSIC:ti.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:$i.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:$i.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:$i.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ri.Column,FLEX_DIRECTION_COLUMN_REVERSE:ri.ColumnReverse,FLEX_DIRECTION_ROW:ri.Row,FLEX_DIRECTION_ROW_REVERSE:ri.RowReverse,GUTTER_COLUMN:Yi.Column,GUTTER_ROW:Yi.Row,GUTTER_ALL:Yi.All,JUSTIFY_FLEX_START:qr.FlexStart,JUSTIFY_CENTER:qr.Center,JUSTIFY_FLEX_END:qr.FlexEnd,JUSTIFY_SPACE_BETWEEN:qr.SpaceBetween,JUSTIFY_SPACE_AROUND:qr.SpaceAround,JUSTIFY_SPACE_EVENLY:qr.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:Vi.Undefined,MEASURE_MODE_EXACTLY:Vi.Exactly,MEASURE_MODE_AT_MOST:Vi.AtMost,NODE_TYPE_DEFAULT:vo.Default,NODE_TYPE_TEXT:vo.Text,OVERFLOW_VISIBLE:Ki.Visible,OVERFLOW_HIDDEN:Ki.Hidden,OVERFLOW_SCROLL:Ki.Scroll,POSITION_TYPE_STATIC:Ji.Static,POSITION_TYPE_RELATIVE:Ji.Relative,POSITION_TYPE_ABSOLUTE:Ji.Absolute,PRINT_OPTIONS_LAYOUT:Wi.Layout,PRINT_OPTIONS_STYLE:Wi.Style,PRINT_OPTIONS_CHILDREN:Wi.Children,UNIT_UNDEFINED:ni.Undefined,UNIT_POINT:ni.Point,UNIT_PERCENT:ni.Percent,UNIT_AUTO:ni.Auto,WRAP_NO_WRAP:qi.NoWrap,WRAP_WRAP:qi.Wrap,WRAP_WRAP_REVERSE:qi.WrapReverse};Re.default=$f,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.default=Vf;var kr=Yf(Re);function nA(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(nA=function(n){return n?t:e})(r)}function Yf(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=nA(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 Vf(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={[kr.Unit.Point]:r.Node.prototype[i],[kr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[kr.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=kr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?kr.Unit.Percent:kr.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]:kr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...kr.default}}var iA={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/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YA3KAIAIQIMAQtBAUHwIhALIQJBhDdBAToAAEGANyACNgIACyACIAAgAUEAEBMLDwAgASAAKAIAaiACOQMACw0AIAEgACgCAGorAwALCwAgAARAIAAQKQsLLwAgACAAIAGWIAG8Qf////8HcUGAgID8B0sbIAEgALxB/////wdxQYCAgPwHTRsLlgMCA34CfyAAvSICQjSIp0H/D3EiBEH/D0YEQCAARAAAAAAAAPA/oiIAIACjDwsgAkIBhiIBQoCAgICAgIDw/wBYBEAgAEQAAAAAAAAAAKIgACABQoCAgICAgIDw/wBRGw8LAn4gBEUEQEEAIQQgAkIMhiIBQgBZBEADQCAEQQFrIQQgAUIBhiIBQgBZDQALCyACQQEgBGuthgwBCyACQv////////8Hg0KAgICAgICACIQLIQEgBEH/B0oEQANAAkAgAUKAgICAgICACH0iA0IAUw0AIAMiAUIAUg0AIABEAAAAAAAAAACiDwsgAUIBhiEBIARBAWsiBEH/B0oNAAtB/wchBAsCQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQv////////8HWARAA0AgBEEBayEEIAFCgICAgICAgARUIQUgAUIBhiEBIAUNAAsLIAJCgICAgICAgICAf4MgAUKAgICAgICACH0gBK1CNIaEIAFBASAEa62IIARBAEobhL8LigEBA38DQCAAQQR0IgFB1C5qIAFB0C5qIgI2AgAgAUHYLmogAjYCACAAQQFqIgBBwABHDQALQTAQTxpB8DZBEDYCAEH0NkEANgIAEIQBQfQ2QaA3KAIANgIAQaA3QfA2NgIAQaQ3QcYBNgIAQag3QQA2AgAQdkGoN0GgNygCADYCAEGgN0GkNzYCAAukAwEHfyAABEAjAEEgayIGJAAgACgCACIBKAKoBCIDBEAgAyABEGsaIAFBADYCqAQLIAEoArAEIgIgASgCrAQiA0cEQEEBIAIgA2tBAnUiAiACQQFNGyEEQQAhAgNAIAMgAkECdGooAgBBADYCqAQgAkEBaiICIARHDQALCyABIAM2ArAEAkAgAyABQbQEaiICKAIARg0AIAZBCGpBAEEA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AgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhAQwBCyACIQELQwAAAAAhAgJAAkACQCAAKALYASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoBEUNAgJAAkAgACoCICIBIAFbBEAgASECDAELIAAqAhwiAkMAAAAAXkUNAQsgAiACXARAIDghAgwECyAAKgIgIQELIAEgAVwEQCAzIQIgACoCHCIBQwAAAABeRQ0DCyA4IQIgAUMAAAAAXA0CIDMhAgwCCyA4IQILIAIgAlwNACACIDOTITUMAQsgM0MAAAAAXUUNACAzjCE1CyACITggKUUEQAJAIBggIUYEQEMAAAAAITQMAQtDAAAAACE5IBghBQNAIAUoAgAiDyATIA8qArQCIgEgQxAlITcCQCA1QwAAAABdBEAgNyAPED2MlCICQwAAA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YAECfwJAAkAgACgCrAQiAiAAKAKwBCIDRg0AA0AgAigCACABRg0BIAJBBGoiAiADRw0ACwwBCyACIANGDQAgAiACQQRqIgEgAyABaxA2GiAAIANBBGs2ArAEQQEPC0EACxMAIAAgASACEB8gACABIAIQIpILHAAgACABQQggAqcgAkIgiKcgA6cgA0IgiKcQFQsFABBQAAs5ACAARQRAQQAPCwJ/IAFBgH9xQYC/A0YgAUH/AE1yRQRAQdQ3QRk2AgBBfwwBCyAAIAE6AABBAQsLxAIAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAUEJaw4SAAoLDAoLAgMEBQwLDAwKCwcICQsgAiACKAIAIgFBBGo2AgAgACABKAIANgIADwsACyACIAIoAgAiAUEEajYCACAAIAEyAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEzAQA3AwAPCyACIAIoAgAiAUEEajYCACAAIAEwAAA3AwAPCyACIAIoAgAiAUEEajYCACAAIAExAAA3AwAPCwALIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASsDADkDAA8LIAAgAiADEQEACw8LIAIgAigCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAI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AAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5gYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSETIAGaIgG9IRkMAQsgBEGAEHEEQEEBIRFBnAkhEwwBC0GfCUGaCSAEQQFxIhEbIRMgEUUhFQsCQCAZQoCAgICAgID4/wCDQoCAgICAgID4/wBRBEAgAEEgIAIgEUEDaiIDIARB//97cRAoIAAgEyARECcgAEGTE0GDGyAFQSBxIgUbQbQWQY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oAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEQwACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQkAC2EBAn8jAEEQayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQ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n0BfwJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsRACAAKAIAIAFBqtWq/QcQSwsQACAAKAIAIAEgArYQMRBLCxAAIAAoAgAgASACthAvEEsLcwEBfwJAIAAoAgAiACgCGCICQQR2QQdxIAFGDQAgACACQY9/cSABQQR0QfAAcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt1AQF/AkAgACgCACIAKAIYIgJBEnZBA3EgAUYNACAAIAJB//9PcSABQRJ0QYCAMHFyNgIYA0AgAC0ABC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ACcGwAAuhsAALobAACzGwAAdmlpZGRpAACZGwAAnRsAQbAnC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBgSgLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////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=B1(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 He=void 0;function fe(y){throw new He(y)}var Qe=y=>(y||fe("Cannot use deleted val. handle = "+y),ge[y].value),Pe=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,Xe=void 0;function Te(y){for(var B="";Q[y];)B+=Xe[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=Fd(y);var B=Te(y);return Dr(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 Nt={};function ht(y,B){return B=M(y,B),w[B]}var Ot=void 0;function mr(y){throw new Ot(y)}function Er(y,B){return B.O&&B.N||mr("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&mr("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Bt(Object.create(y,{L:{value:B}}))}function Bt(y){return typeof FinalizationRegistry>"u"?(Bt=B=>B,y):(De=new FinalizationRegistry(B=>{ke(B.L)}),Bt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Bt(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 Oe={},Fe={};function je(y,B,L){function N(oe){oe=L(oe),oe.length!==y.length&&mr("Mismatched type converter count");for(var Ae=0;Ae<y.length;++Ae)xt(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),Oe.hasOwnProperty(oe)||(Oe[oe]=[]),Oe[oe].push(()=>{H[Ae]=z[oe],++se,se===Z.length&&N(H)}))}),Z.length===0&&N(H)}function bt(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 xt(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],Oe.hasOwnProperty(y)&&(B=Oe[y],delete Oe[y],B.forEach(H=>H()))}function Gn(y){fe(y.L.O.M.name+" instance already deleted")}function wt(){}function un(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 Hn(y,B){s.hasOwnProperty(y)?(fe("Cannot register public name '"+y+"' twice"),un(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 Hr(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 Ri(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 Di(y,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+bl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),Ri(B.L.N,B.L.O.M,this.M))}function $n(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 "'+bl(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=Ri(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,Pe(function(){N.delete()})),y!==null&&y.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function l1(y,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+bl(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),Ri(B.L.N,B.L.O.M,this.M))}function Rr(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=$n:(this.toWireType=N?Di:l1,this.U=null)}function A1(y,B){s.hasOwnProperty(y)||mr("Replacing nonexistant public symbol"),s[y]=B,s[y].Y=void 0}function c1(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 tr(y,B){y=Te(y);var L=y.includes("j")?c1(y,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+y+": "+B),L}var Rd=void 0;function eo(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 Rd(y+": "+N.map(j).join([", "]))}function Bl(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=[],Ge=[];return function(){if(arguments.length!==ae&&fe("function "+y+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ge.length=0,ye.length=se?2:1,ye[0]=H,se){var lt=B[1].toWireType(Ge,this);ye[1]=lt}for(var Ve=0;Ve<ae;++Ve)ue[Ve]=B[Ve+2].toWireType(Ge,arguments[Ve]),ye.push(ue[Ve]);if(Ve=N.apply(null,ye),oe)de(Ge);else for(var Ut=se?1:2;Ut<B.length;Ut++){var rr=Ut===1?lt:ue[Ut-2];B[Ut].U!==null&&B[Ut].U(rr)}return lt=Ae?B[0].fromWireType(Ve):void 0,lt}}function Tl(y,B){for(var L=[],N=0;N<y;N++)L.push(R[B+4*N>>2]);return L}function Ql(y){4<y&&--ge[y].fa===0&&(ge[y]=void 0,Se.push(y))}function bl(y){if(y===null)return"null";var B=typeof y;return B==="object"||B==="array"||B==="function"?y.toString():""+y}function u1(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 h1(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 d1(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 f1(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 g1(y){return 2*y.length}function p1(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 m1(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 E1(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 I1={};function Dd(y){var B=I1[y];return B===void 0?Te(y):B}var to=[];function C1(y){var B=to.length;return to.push(y),B}function v1(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 _d=[],y1=[null,[],[]];He=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 Ld=Array(256),ro=0;256>ro;++ro)Ld[ro]=String.fromCharCode(ro);Xe=Ld,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)},Ot=s.InternalError=Le("InternalError"),wt.prototype.isAliasOf=function(y){if(!(this instanceof wt&&y instanceof wt))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},wt.prototype.clone=function(){if(this.L.N||Gn(this),this.L.$)return this.L.count.value+=1,this;var y=Bt,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},wt.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)},wt.prototype.isDeleted=function(){return!this.L.N},wt.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(y){return this.ja&&(y=this.ja(y)),y},Rr.prototype.ga=function(y){this.V&&this.V(y)},Rr.prototype.argPackAdvance=8,Rr.prototype.readValueFromPointer=Ce,Rr.prototype.deleteObject=function(y){y!==null&&y.delete()},Rr.prototype.fromWireType=function(y){function B(){return this.ca?Er(this.M.W,{O:this.va,N:L,T:this,S:y}):Er(this.M.W,{O:this,N:y})}var L=this.pa(y);if(!L)return this.ga(y),null;var N=ht(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=Nt[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?Er(N.M.W,{O:N,N:H,T:this,S:y}):Er(N.M.W,{O:N,N:H})},Rd=s.UnboundTypeError=Le("UnboundTypeError");var B1=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},T1={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}}),Bt(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 Pe(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));je([y],Z,se=>{var oe={};return H.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ge=Ae.ra,lt=se[ae+H.length],Ve=Ae.xa,Ut=Ae.za;oe[Ae.na]={read:rr=>ue.fromWireType(ye(Ge,rr)),write:(rr,_i)=>{var _r=[];Ve(Ut,rr,lt.toWireType(_r,_i)),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(y,B,L,N,H){var Z=bt(L);B=Te(B),xt(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,Ge){ue=Te(ue),Z=tr(H,Z),oe&&(oe=tr(se,oe)),ae&&(ae=tr(Ae,ae)),Ge=tr(ye,Ge);var lt=ce(ue);Hn(lt,function(){eo("Cannot construct "+ue+" due to unbound types",[N])}),je([y,B,L],N?[N]:[],function(Ve){if(Ve=Ve[0],N)var Ut=Ve.M,rr=Ut.W;else rr=wt.prototype;Ve=pe(lt,function(){if(Object.getPrototypeOf(this)!==_i)throw new He("Use 'new' to construct "+ue);if(_r.X===void 0)throw new He(ue+" has no accessible constructor");var Md=_r.X[arguments.length];if(Md===void 0)throw new He("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(_r.X).toString()+") parameters instead!");return Md.apply(this,arguments)});var _i=Object.create(rr,{constructor:{value:Ve}});Ve.prototype=_i;var _r=new Hr(ue,Ve,_i,Ge,Ut,Z,oe,ae);Ut=new Rr(ue,_r,!0,!1),rr=new Rr(ue+"*",_r,!1,!1);var Nd=new Rr(ue+" const*",_r,!1,!0);return Nt[y]={pointerType:rr,ka:Nd},A1(lt,Ve),[Ut,rr,Nd]})},c:function(y,B,L,N,H,Z,se){var oe=Tl(L,N);B=Te(B),Z=tr(H,Z),je([],[y],function(Ae){function ae(){eo("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):(un(ye,B,ue),ye[B].R[L-1]=ae),je([],oe,function(Ge){return Ge=Bl(ue,[Ge[0],null].concat(Ge.slice(1)),null,Z,se),ye[B].R===void 0?(Ge.Y=L-1,ye[B]=Ge):ye[B].R[L-1]=Ge,[]}),[]})},o:function(y,B,L,N,H,Z){0<B||X();var se=Tl(B,L);H=tr(N,H),je([],[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 He("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]=()=>{eo("Cannot construct "+oe.name+" due to unbound types",se)},je([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Bl(Ae,ae,null,H,Z),[]}),[]})},a:function(y,B,L,N,H,Z,se,oe){var Ae=Tl(L,N);B=Te(B),Z=tr(H,Z),je([],[y],function(ae){function ue(){eo("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 Ge=ae.M.W,lt=Ge[B];return lt===void 0||lt.R===void 0&&lt.className!==ae.name&&lt.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ge[B]=ue):(un(Ge,B,ye),Ge[B].R[L-2]=ue),je([],Ae,function(Ve){return Ve=Bl(ye,Ve,ae,Z,se),Ge[B].R===void 0?(Ve.Y=L-2,Ge[B]=Ve):Ge[B].R[L-2]=Ve,[]}),[]})},A:function(y,B){B=Te(B),xt(y,{name:B,fromWireType:function(L){var N=Qe(L);return Ql(L),N},toWireType:function(L,N){return Pe(N)},argPackAdvance:8,readValueFromPointer:Ce,U:null})},m:function(y,B,L){L=bt(L),B=Te(B),xt(y,{name:B,fromWireType:function(N){return N},toWireType:function(N,H){return H},argPackAdvance:8,readValueFromPointer:u1(B,L),U:null})},d:function(y,B,L,N,H){B=Te(B),H===-1&&(H=4294967295),H=bt(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},xt(y,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:h1(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),xt(y,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(y,B){B=Te(B);var L=B==="std::string";xt(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 Dr(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=xl(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&&(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]=H[se];return N!==null&&N.push(Dr,oe),oe},argPackAdvance:8,readValueFromPointer:Ce,U:function(N){Dr(N)}})},i:function(y,B,L){if(L=Te(L),B===2)var N=d1,H=f1,Z=g1,se=()=>v,oe=1;else B===4&&(N=p1,H=m1,Z=E1,se=()=>R,oe=2);xt(y,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ge=Ae+4,lt=0;lt<=ae;++lt){var Ve=Ae+4+lt*B;(lt==ae||ue[Ve>>oe]==0)&&(Ge=N(Ge,Ve-Ge),ye===void 0?ye=Ge:(ye+="\0",ye+=Ge),Ge=Ve+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=xl(4+ue+B);return R[ye>>2]=ue>>oe,H(ae,ye+4,ue+B),Ae!==null&&Ae.push(Dr,ye),ye},argPackAdvance:8,readValueFromPointer:Ce,U:function(Ae){Dr(Ae)}})},k:function(y,B,L,N,H,Z){q[y]={name:Te(B),ea:tr(L,N),V:tr(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:tr(N,H),ra:Z,ya:se,xa:tr(oe,Ae),za:ae})},C:function(y,B){B=Te(B),xt(y,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(y,B,L,N,H){y=to[y],B=Qe(B),L=Dd(L);var Z=[];return R[N>>2]=Pe(Z),y(B,L,Z,H)},t:function(y,B,L,N){y=to[y],B=Qe(B),L=Dd(L),y(B,L,null,N)},g:Ql,l:function(y,B){var L=v1(y,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var H=_d[B];if(H!==void 0)return H;var Z=Array(y-1);return H=C1((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)}),_d[B]=H},q:function(y){4<y&&(ge[y].fa+=1)},r:function(y){var B=Qe(y);de(B),Ql(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=y1[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:T1};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 Fd=s.___getTypeName=function(){return(Fd=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 xl=s._malloc=function(){return(xl=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 no;P=function y(){no||kd(),no||(P=y)};function kd(){function y(){if(!no&&(no=!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 kd(),i.ready}})();r.exports=t})(iA);var Kf=iA.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(Eo),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=Kf;async function o(){return(0,t.default)(await s())}})(rA);function Jf(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var Wf=Jf;/*!
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 h0=function(r){return r!=null&&(YA(r)||d0(r)||!!r._isBuffer)};function YA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function d0(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&YA(r.slice(0,0))}var f0=u0,g0=h0,p0=typeof Float64Array<"u";function m0(r,e){return r[0]-e[0]}function E0(){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(m0);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function I0(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(is[r][0])}var i=["'use strict'"],s=f0(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(is[r],E0)}function C0(r){if(g0(r))return"buffer";if(p0)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 is={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function v0(r,e,t,n){if(r===void 0){var A=is.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=C0(r),l=is[a];l.length<=i+1;)l.push(I0(a,l.length-1));var A=l[i+1];return A(r,e,t,n)}var y0=v0,VA={};function B0(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 T0(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 Q0(r,e,t){return r.length===0?r:e?(t||r.sort(e),B0(r,e)):(t||r.sort(),T0(r))}var b0=Q0,x0=b0;function KA(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 w0(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(KA(e,t,n));for(var A=r;A<i;++A)l.push("}");return l.join(`
75
- `)}function S0(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 Oo(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 qf=function(r){return r!=null&&(sA(r)||Xf(r)||!!r._isBuffer)};function sA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Xf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&sA(r.slice(0,0))}var jf=Wf,zf=qf,Zf=typeof Float64Array<"u";function eg(r,e){return r[0]-e[0]}function tg(){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(eg);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function rg(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(Xi[r][0])}var i=["'use strict'"],s=jf(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(Xi[r],tg)}function ng(r){if(zf(r))return"buffer";if(Zf)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 Xi={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function ig(r,e,t,n){if(r===void 0){var A=Xi.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=ng(r),l=Xi[a];l.length<=i+1;)l.push(rg(a,l.length-1));var A=l[i+1];return A(r,e,t,n)}var sg=ig,oA={};function og(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 ag(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 lg(r,e,t){return r.length===0?r:e?(t||r.sort(e),og(r,e)):(t||r.sort(),ag(r))}var Ag=lg,cg=Ag;function aA(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 ug(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(aA(e,t,n));for(var A=r;A<i;++A)l.push("}");return l.join(`
75
+ `)}function hg(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 yo(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 R0(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 D0(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=x0([].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(Oo(r.pre,r,i));var v=Oo(r.body,r,i),w=S0(c);w<t?f.push(w0(w,c[0],r,v)):f.push(KA(c[0],r,v)),r.post.body.length>3&&f.push(Oo(r.post,r,i)),r.debug&&console.log("-----Generated cwise routine for ",e,`:
78
+ `).trim()}function dg(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 fg(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=cg([].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(yo(r.pre,r,i));var v=yo(r.body,r,i),x=hg(c);x<t?f.push(ug(x,c[0],r,v)):f.push(aA(c[0],r,v)),r.post.body.length>3&&f.push(yo(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,R0(i)].join(""),k=new Function(["function ",R,"(",d.join(","),"){",f.join(`
82
- `),"} return ",R].join(""));return k()}var _0=D0,L0=_0;function F0(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,dg(i)].join(""),k=new Function(["function ",R,"(",d.join(","),"){",f.join(`
82
+ `),"} return ",R].join(""));return k()}var gg=fg,pg=gg;function mg(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(L0.bind(void 0,r))}var k0=F0,N0=k0;function M0(){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 P0(r){var e=new M0;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,N0(e)}var O0=P0;(function(r){var e=O0,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"})})(VA);var Me={},Ze={},Uo=32;Ze.INT_BITS=Uo,Ze.INT_MAX=2147483647,Ze.INT_MIN=-1<<Uo-1,Ze.sign=function(r){return(r>0)-(r<0)},Ze.abs=function(r){var e=r>>Uo-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 JA(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=JA,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 ai=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}})(ai),Ze.reverse=function(r){return ai[r&255]<<24|ai[r>>>8&255]<<16|ai[r>>>16&255]<<8|ai[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>>>JA(r)+1};function WA(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]=WA(r,e,t+1);return i}function U0(r,e){var t,n;for(t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function G0(r,e){switch(typeof e>"u"&&(e=0),typeof r){case"number":if(r>0)return U0(r|0,e);break;case"object":if(typeof r.length=="number")return WA(r,e,0);break}return[]}var H0=G0,qA={},ss={};ss.byteLength=V0,ss.toByteArray=J0,ss.fromByteArray=j0;for(var ir=[],Gt=[],$0=typeof Uint8Array<"u"?Uint8Array:Array,Go="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mn=0,Y0=Go.length;mn<Y0;++mn)ir[mn]=Go[mn],Gt[Go.charCodeAt(mn)]=mn;Gt[45]=62,Gt[95]=63;function jA(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 V0(r){var e=jA(r),t=e[0],n=e[1];return(t+n)*3/4-n}function K0(r,e,t){return(e+t)*3/4-t}function J0(r){var e,t=jA(r),n=t[0],i=t[1],s=new $0(K0(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Gt[r.charCodeAt(l)]<<18|Gt[r.charCodeAt(l+1)]<<12|Gt[r.charCodeAt(l+2)]<<6|Gt[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Gt[r.charCodeAt(l)]<<2|Gt[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Gt[r.charCodeAt(l)]<<10|Gt[r.charCodeAt(l+1)]<<4|Gt[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function W0(r){return ir[r>>18&63]+ir[r>>12&63]+ir[r>>6&63]+ir[r&63]}function q0(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(W0(n));return i.join("")}function j0(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(q0(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(ir[e>>2]+ir[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ir[e>>10]+ir[e>>4&63]+ir[e<<2&63]+"=")),i.join("")}var Ho={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ho.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)},Ho.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(pg.bind(void 0,r))}var Eg=mg,Ig=Eg;function Cg(){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 vg(r){var e=new Cg;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,Ig(e)}var yg=vg;(function(r){var e=yg,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"})})(oA);var Me={},Ze={},Bo=32;Ze.INT_BITS=Bo,Ze.INT_MAX=2147483647,Ze.INT_MIN=-1<<Bo-1,Ze.sign=function(r){return(r>0)-(r<0)},Ze.abs=function(r){var e=r>>Bo-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 lA(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=lA,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 ii=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}})(ii),Ze.reverse=function(r){return ii[r&255]<<24|ii[r>>>8&255]<<16|ii[r>>>16&255]<<8|ii[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>>>lA(r)+1};function AA(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]=AA(r,e,t+1);return i}function Bg(r,e){var t,n;for(t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Tg(r,e){switch(typeof e>"u"&&(e=0),typeof r){case"number":if(r>0)return Bg(r|0,e);break;case"object":if(typeof r.length=="number")return AA(r,e,0);break}return[]}var Qg=Tg,cA={},ji={};ji.byteLength=wg,ji.toByteArray=Rg,ji.fromByteArray=Lg;for(var ir=[],Gt=[],bg=typeof Uint8Array<"u"?Uint8Array:Array,To="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mn=0,xg=To.length;mn<xg;++mn)ir[mn]=To[mn],Gt[To.charCodeAt(mn)]=mn;Gt[45]=62,Gt[95]=63;function uA(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 wg(r){var e=uA(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Sg(r,e,t){return(e+t)*3/4-t}function Rg(r){var e,t=uA(r),n=t[0],i=t[1],s=new bg(Sg(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Gt[r.charCodeAt(l)]<<18|Gt[r.charCodeAt(l+1)]<<12|Gt[r.charCodeAt(l+2)]<<6|Gt[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Gt[r.charCodeAt(l)]<<2|Gt[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Gt[r.charCodeAt(l)]<<10|Gt[r.charCodeAt(l+1)]<<4|Gt[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Dg(r){return ir[r>>18&63]+ir[r>>12&63]+ir[r>>6&63]+ir[r&63]}function _g(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(Dg(n));return i.join("")}function Lg(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(_g(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(ir[e>>2]+ir[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ir[e>>10]+ir[e>>4&63]+ir[e<<2&63]+"=")),i.join("")}var Qo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Qo.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)},Qo.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=ss,t=Ho,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"||qe(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,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,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(ht,Ot){return z===1?ht[Ot]:ht.readUInt16BE(Ot*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,Nt=0;Nt<Ie;Nt++)if(be(T,De+Nt)!==be(m,Nt)){_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(qe(Ie))return X;T[E+X]=Ie}return X}function V(T,m,E,x){return Pe(Le(m,T.length-E),T,E,x)}function O(T,m,E,x){return Pe(He(m),T,E,x)}function W(T,m,E,x){return Pe(Qe(m),T,E,x)}function ie(T,m,E,x){return Pe(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 He(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 Pe(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 qe(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}()})(qA);var Nr=Ze,Ct=H0,XA=qA.Buffer;pn.__TYPEDARRAY_POOL||(pn.__TYPEDARRAY_POOL={UINT8:Ct([32,0]),UINT16:Ct([32,0]),UINT32:Ct([32,0]),BIGUINT64:Ct([32,0]),INT8:Ct([32,0]),INT16:Ct([32,0]),INT32:Ct([32,0]),BIGINT64:Ct([32,0]),FLOAT:Ct([32,0]),DOUBLE:Ct([32,0]),DATA:Ct([32,0]),UINT8C:Ct([32,0]),BUFFER:Ct([32,0])});var X0=typeof Uint8ClampedArray<"u",z0=typeof BigUint64Array<"u",Z0=typeof BigInt64Array<"u",nt=pn.__TYPEDARRAY_POOL;nt.UINT8C||(nt.UINT8C=Ct([32,0])),nt.BIGUINT64||(nt.BIGUINT64=Ct([32,0])),nt.BIGINT64||(nt.BIGINT64=Ct([32,0])),nt.BUFFER||(nt.BUFFER=Ct([32,0]));var os=nt.DATA,as=nt.BUFFER;Me.free=function(e){if(XA.isBuffer(e))as[Nr.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=Nr.log2(t)|0;os[n].push(e)}};function zA(r){if(r){var e=r.length||r.byteLength,t=Nr.log2(e);os[t].push(r)}}function ep(r){zA(r.buffer)}Me.freeUint8=Me.freeUint16=Me.freeUint32=Me.freeBigUint64=Me.freeInt8=Me.freeInt16=Me.freeInt32=Me.freeBigInt64=Me.freeFloat32=Me.freeFloat=Me.freeFloat64=Me.freeDouble=Me.freeUint8Clamped=Me.freeDataView=ep,Me.freeArrayBuffer=zA,Me.freeBuffer=function(e){as[Nr.log2(e.length)].push(e)},Me.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Rt(e);switch(t){case"uint8":return $o(e);case"uint16":return ZA(e);case"uint32":return ec(e);case"int8":return tc(e);case"int16":return rc(e);case"int32":return nc(e);case"float":case"float32":return ic(e);case"double":case"float64":return sc(e);case"uint8_clamped":return oc(e);case"bigint64":return lc(e);case"biguint64":return ac(e);case"buffer":return cc(e);case"data":case"dataview":return Ac(e);default:return null}return null};function Rt(e){var e=Nr.nextPow2(e),t=Nr.log2(e),n=os[t];return n.length>0?n.pop():new ArrayBuffer(e)}Me.mallocArrayBuffer=Rt;function $o(r){return new Uint8Array(Rt(r),0,r)}Me.mallocUint8=$o;function ZA(r){return new Uint16Array(Rt(2*r),0,r)}Me.mallocUint16=ZA;function ec(r){return new Uint32Array(Rt(4*r),0,r)}Me.mallocUint32=ec;function tc(r){return new Int8Array(Rt(r),0,r)}Me.mallocInt8=tc;function rc(r){return new Int16Array(Rt(2*r),0,r)}Me.mallocInt16=rc;function nc(r){return new Int32Array(Rt(4*r),0,r)}Me.mallocInt32=nc;function ic(r){return new Float32Array(Rt(4*r),0,r)}Me.mallocFloat32=Me.mallocFloat=ic;function sc(r){return new Float64Array(Rt(8*r),0,r)}Me.mallocFloat64=Me.mallocDouble=sc;function oc(r){return X0?new Uint8ClampedArray(Rt(r),0,r):$o(r)}Me.mallocUint8Clamped=oc;function ac(r){return z0?new BigUint64Array(Rt(8*r),0,r):null}Me.mallocBigUint64=ac;function lc(r){return Z0?new BigInt64Array(Rt(8*r),0,r):null}Me.mallocBigInt64=lc;function Ac(r){return new DataView(Rt(r),0,r)}Me.mallocDataView=Ac;function cc(r){r=Nr.nextPow2(r);var e=Nr.log2(r),t=as[e];return t.length>0?t.pop():new XA(r)}Me.mallocBuffer=cc,Me.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,os[e].length=0,as[e].length=0};var ls=y0,Yo=VA,En=Me,tp=op,As=null,Vo=null,cs=null;function rp(r){As=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],Vo=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],cs=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function uc(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 hc=function(r,e){Yo.muls(r,e,255)};function Ko(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 us(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 li=us.prototype;Object.defineProperties(li,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&As.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),Vo.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&&As.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),Vo.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(),cs.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(),cs.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(cs.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 Ko(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,Ko(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,Ko(this,this._shape[0],r),r}}}),li.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},li.dispose=function(){this.gl.deleteTexture(this.handle)},li.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)},li.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=uc(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");np(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function dc(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 np(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=dc(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=ls(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=En.mallocFloat32(d):g=En.mallocUint8(d);var p=ls(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?hc(p,a):Yo.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?En.freeFloat32(g):En.freeUint8(g)}}function Jo(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 fc(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=Jo(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new us(r,o,e,t,n,i)}function ip(r,e,t,n,i,s){var o=Jo(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new us(r,o,t,n,i,s)}function sp(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=dc(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=ls(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=En.malloc(c,t);var h=ls(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?hc(h,e):Yo.assign(h,e),l=A.subarray(0,c)}var d=Jo(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||En.free(A),new us(r,d,n[0],n[1],a,o)}function op(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(As||rp(r),typeof arguments[1]=="number")return fc(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return fc(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=uc(e)?e:e.raw;if(t)return ip(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 sp(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const hs=Lo(tp);var gc={},pc=ap;function ap(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 ds=Ai,lp=pc,Xr=ds,Ap=cp;function mc(r){return function(){return r}}function Wo(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function cp(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 Xr("","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 Xr("","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 Xr("","Invalid uniform dimension type for matrix "+name+": "+H);r["uniformMatrix"+V+"fv"](n[Q],!1,b);break}else throw new Xr("","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 Xr("","Invalid data type");return u.charAt(0)==="b"?Wo(d,!1):Wo(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 Xr("","Invalid uniform dimension type for matrix "+name+": "+u);return Wo(d*d,0)}else throw new Xr("","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:mc(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=lp(t,!0);return{get:mc(A(c)),set:s(c),enumerable:!0,configurable:!0}}var up=fp,qo=ds;function Ec(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 jo=Ec.prototype;jo.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)},jo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(jo,"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 hp=[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 Xo(r,e,t,n,i,s,o){var a=hp[i],l=new Ec(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 dp(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)Xo(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 fp(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":Xo(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 qo("","Invalid data type for attribute "+l+": "+A);Xo(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 qo("","Invalid data type for attribute "+l+": "+A);dp(r,e,c,n,u,i,l)}else throw new qo("","Unknown data type for attribute "+l+": "+A);break}}return i}var zo={},Ic={};(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)})()})(Ic);var gp={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"},pp=gp,mp=function(e){return pp[e]},Cc=["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"],Ep=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],vc=["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"],Ip=Cc,Cp=Ip.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"]),Zo=vc;Zo=Zo.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var vp=Zo.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"]),yp=_p,Bp=Cc,yc=Ep,Tp=vc,Qp=Cp,bp=vp,jt=999,Bc=9999,ea=0,ta=1,Tc=2,Qc=3,bc=4,ci=5,xp=6,wp=7,Sp=8,xc=9,Rp=10,wc=11,Dp=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function _p(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=Tp,p=Bp;r.version==="300 es"&&(g=bp,p=Qp);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:Dp[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 ea:e=O();break;case ta:e=V();break;case Tc:e=H();break;case Qc:e=W();break;case bc:e=le();break;case wc:e=te();break;case ci:e=D();break;case Bc:e=P();break;case xc: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 w(j){return o.length&&b(o.join("")),n=Rp,b("(eof)"),a}function R(){return o=o.length?[]:o,s==="/"&&i==="*"?(c=t+e-1,n=ea,s=i,e+1):s==="/"&&i==="/"?(c=t+e-1,n=ta,s=i,e+1):i==="#"?(n=Tc,c=t+e,e):/\s/.test(i)?(n=xc,c=t+e,e):(u=/\d/.test(i),h=/[^\w_]/.test(i),c=t+e,n=u?bc:h?Qc:Bc,e)}function k(){return/[^\s]/g.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function H(){return(i==="\r"||i===`
95
- `)&&s!=="\\"?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function V(){return H()}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=ci,e;if(s==="/"&&i==="*")return n=ea,e;if(s==="/"&&i==="/")return n=ta,e;if(i==="."&&o.length){for(;ie(o););return n=ci,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=jt,e+1}var j=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||j){for(;ie(o););return n=jt,e}return o.push(i),s=i,e+1}function ie(j){var _=0,S,F;do{if(S=yc.indexOf(j.slice(0,j.length+_).join("")),F=yc[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=jt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=ci,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=wc,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 j=o.join("");return Q[j]?n=Sp:y[j]?n=wp:n=xp,b(o.join("")),n=jt,e}return o.push(i),s=i,e+1}}var Lp=yp,Fp=kp;function kp(r,e){var t=Lp(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var Np=function(e){return atob(e)},Mp=Fp,Pp=Np,Op=Up;function Up(r){for(var e=Array.isArray(r)?r:Mp(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?Pp(o):o).trim()}}}}/*!
91
+ */(function(r){var e=ji,t=Qo,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"||Xe(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,Xe(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(ht,Ot){return z===1?ht[Ot]:ht.readUInt16BE(Ot*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,Nt=0;Nt<Ie;Nt++)if(be(T,De+Nt)!==be(m,Nt)){_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(Xe(Ie))return j;T[E+j]=Ie}return j}function K(T,m,E,w){return Pe(Le(m,T.length-E),T,E,w)}function O(T,m,E,w){return Pe(He(m),T,E,w)}function W(T,m,E,w){return Pe(Qe(m),T,E,w)}function ie(T,m,E,w){return Pe(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 He(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 Pe(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 Xe(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}()})(cA);var Nr=Ze,Ct=Qg,hA=cA.Buffer;pn.__TYPEDARRAY_POOL||(pn.__TYPEDARRAY_POOL={UINT8:Ct([32,0]),UINT16:Ct([32,0]),UINT32:Ct([32,0]),BIGUINT64:Ct([32,0]),INT8:Ct([32,0]),INT16:Ct([32,0]),INT32:Ct([32,0]),BIGINT64:Ct([32,0]),FLOAT:Ct([32,0]),DOUBLE:Ct([32,0]),DATA:Ct([32,0]),UINT8C:Ct([32,0]),BUFFER:Ct([32,0])});var Fg=typeof Uint8ClampedArray<"u",kg=typeof BigUint64Array<"u",Ng=typeof BigInt64Array<"u",it=pn.__TYPEDARRAY_POOL;it.UINT8C||(it.UINT8C=Ct([32,0])),it.BIGUINT64||(it.BIGUINT64=Ct([32,0])),it.BIGINT64||(it.BIGINT64=Ct([32,0])),it.BUFFER||(it.BUFFER=Ct([32,0]));var zi=it.DATA,Zi=it.BUFFER;Me.free=function(e){if(hA.isBuffer(e))Zi[Nr.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=Nr.log2(t)|0;zi[n].push(e)}};function dA(r){if(r){var e=r.length||r.byteLength,t=Nr.log2(e);zi[t].push(r)}}function Mg(r){dA(r.buffer)}Me.freeUint8=Me.freeUint16=Me.freeUint32=Me.freeBigUint64=Me.freeInt8=Me.freeInt16=Me.freeInt32=Me.freeBigInt64=Me.freeFloat32=Me.freeFloat=Me.freeFloat64=Me.freeDouble=Me.freeUint8Clamped=Me.freeDataView=Mg,Me.freeArrayBuffer=dA,Me.freeBuffer=function(e){Zi[Nr.log2(e.length)].push(e)},Me.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Rt(e);switch(t){case"uint8":return bo(e);case"uint16":return fA(e);case"uint32":return gA(e);case"int8":return pA(e);case"int16":return mA(e);case"int32":return EA(e);case"float":case"float32":return IA(e);case"double":case"float64":return CA(e);case"uint8_clamped":return vA(e);case"bigint64":return BA(e);case"biguint64":return yA(e);case"buffer":return QA(e);case"data":case"dataview":return TA(e);default:return null}return null};function Rt(e){var e=Nr.nextPow2(e),t=Nr.log2(e),n=zi[t];return n.length>0?n.pop():new ArrayBuffer(e)}Me.mallocArrayBuffer=Rt;function bo(r){return new Uint8Array(Rt(r),0,r)}Me.mallocUint8=bo;function fA(r){return new Uint16Array(Rt(2*r),0,r)}Me.mallocUint16=fA;function gA(r){return new Uint32Array(Rt(4*r),0,r)}Me.mallocUint32=gA;function pA(r){return new Int8Array(Rt(r),0,r)}Me.mallocInt8=pA;function mA(r){return new Int16Array(Rt(2*r),0,r)}Me.mallocInt16=mA;function EA(r){return new Int32Array(Rt(4*r),0,r)}Me.mallocInt32=EA;function IA(r){return new Float32Array(Rt(4*r),0,r)}Me.mallocFloat32=Me.mallocFloat=IA;function CA(r){return new Float64Array(Rt(8*r),0,r)}Me.mallocFloat64=Me.mallocDouble=CA;function vA(r){return Fg?new Uint8ClampedArray(Rt(r),0,r):bo(r)}Me.mallocUint8Clamped=vA;function yA(r){return kg?new BigUint64Array(Rt(8*r),0,r):null}Me.mallocBigUint64=yA;function BA(r){return Ng?new BigInt64Array(Rt(8*r),0,r):null}Me.mallocBigInt64=BA;function TA(r){return new DataView(Rt(r),0,r)}Me.mallocDataView=TA;function QA(r){r=Nr.nextPow2(r);var e=Nr.log2(r),t=Zi[e];return t.length>0?t.pop():new hA(r)}Me.mallocBuffer=QA,Me.clearCache=function(){for(var e=0;e<32;++e)it.UINT8[e].length=0,it.UINT16[e].length=0,it.UINT32[e].length=0,it.INT8[e].length=0,it.INT16[e].length=0,it.INT32[e].length=0,it.FLOAT[e].length=0,it.DOUBLE[e].length=0,it.BIGUINT64[e].length=0,it.BIGINT64[e].length=0,it.UINT8C[e].length=0,zi[e].length=0,Zi[e].length=0};var es=sg,xo=oA,En=Me,Pg=$g,ts=null,wo=null,rs=null;function Og(r){ts=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],wo=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],rs=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function bA(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 xA=function(r,e){xo.muls(r,e,255)};function So(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 ns(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 si=ns.prototype;Object.defineProperties(si,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&ts.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.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&&ts.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.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(),rs.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(),rs.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(rs.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 So(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,So(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,So(this,this._shape[0],r),r}}}),si.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},si.dispose=function(){this.gl.deleteTexture(this.handle)},si.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)},si.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=bA(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");Ug(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function wA(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 Ug(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=wA(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=es(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=En.mallocFloat32(d):g=En.mallocUint8(d);var p=es(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?xA(p,a):xo.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?En.freeFloat32(g):En.freeUint8(g)}}function Ro(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 SA(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=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new ns(r,o,e,t,n,i)}function Gg(r,e,t,n,i,s){var o=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new ns(r,o,t,n,i,s)}function Hg(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=wA(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=es(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=En.malloc(c,t);var h=es(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?xA(h,e):xo.assign(h,e),l=A.subarray(0,c)}var d=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||En.free(A),new ns(r,d,n[0],n[1],a,o)}function $g(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(ts||Og(r),typeof arguments[1]=="number")return SA(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return SA(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=bA(e)?e:e.raw;if(t)return Gg(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 Hg(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const is=po(Pg);var RA={},DA=Yg;function Yg(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 oi(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}oi.prototype=new Error,oi.prototype.name="GLError",oi.prototype.constructor=oi;var ss=oi,Vg=DA,jr=ss,Kg=Jg;function _A(r){return function(){return r}}function Do(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Jg(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 jr("","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 jr("","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 jr("","Invalid uniform dimension type for matrix "+name+": "+$);r["uniformMatrix"+K+"fv"](n[Q],!1,b);break}else throw new jr("","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 jr("","Invalid data type");return u.charAt(0)==="b"?Do(d,!1):Do(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 jr("","Invalid uniform dimension type for matrix "+name+": "+u);return Do(d*d,0)}else throw new jr("","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:_A(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=Vg(t,!0);return{get:_A(A(c)),set:s(c),enumerable:!0,configurable:!0}}var Wg=jg,_o=ss;function LA(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 Lo=LA.prototype;Lo.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)},Lo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(Lo,"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 qg=[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 Fo(r,e,t,n,i,s,o){var a=qg[i],l=new LA(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 Xg(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)Fo(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 jg(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":Fo(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 _o("","Invalid data type for attribute "+l+": "+A);Fo(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 _o("","Invalid data type for attribute "+l+": "+A);Xg(r,e,c,n,u,i,l)}else throw new _o("","Unknown data type for attribute "+l+": "+A);break}}return i}var ko={},FA={};(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)})()})(FA);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"},Zg=zg,e0=function(e){return Zg[e]},kA=["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"],t0=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],NA=["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"],r0=kA,n0=r0.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"]),No=NA;No=No.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var i0=No.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"]),s0=g0,o0=kA,MA=t0,a0=NA,l0=n0,A0=i0,Xt=999,PA=9999,Mo=0,Po=1,OA=2,UA=3,GA=4,ai=5,c0=6,u0=7,h0=8,HA=9,d0=10,$A=11,f0=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function g0(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=a0,p=o0;r.version==="300 es"&&(g=A0,p=l0);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:f0[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 Mo:e=O();break;case Po:e=K();break;case OA:e=$();break;case UA:e=W();break;case GA:e=le();break;case $A:e=te();break;case ai:e=D();break;case PA:e=P();break;case HA: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 x(X){return o.length&&b(o.join("")),n=d0,b("(eof)"),a}function R(){return o=o.length?[]:o,s==="/"&&i==="*"?(c=t+e-1,n=Mo,s=i,e+1):s==="/"&&i==="/"?(c=t+e-1,n=Po,s=i,e+1):i==="#"?(n=OA,c=t+e,e):/\s/.test(i)?(n=HA,c=t+e,e):(u=/\d/.test(i),h=/[^\w_]/.test(i),c=t+e,n=u?GA:h?UA:PA,e)}function k(){return/[^\s]/g.test(i)?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function $(){return(i==="\r"||i===`
95
+ `)&&s!=="\\"?(b(o.join("")),n=Xt,e):(o.push(i),s=i,e+1)}function K(){return $()}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=ai,e;if(s==="/"&&i==="*")return n=Mo,e;if(s==="/"&&i==="/")return n=Po,e;if(i==="."&&o.length){for(;ie(o););return n=ai,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=Xt,e+1}var X=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||X){for(;ie(o););return n=Xt,e}return o.push(i),s=i,e+1}function ie(X){var _=0,S,F;do{if(S=MA.indexOf(X.slice(0,X.length+_).join("")),F=MA[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=Xt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=ai,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=$A,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 X=o.join("");return Q[X]?n=h0:C[X]?n=u0:n=c0,b(o.join("")),n=Xt,e}return o.push(i),s=i,e+1}}var p0=s0,m0=E0;function E0(r,e){var t=p0(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var I0=function(e){return atob(e)},C0=m0,v0=I0,y0=B0;function B0(r){for(var e=Array.isArray(r)?r:C0(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?v0(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 yr="",ra,Gp=Hp;function Hp(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(ra!==r||typeof ra>"u")ra=r,yr="";else if(yr.length>=t)return yr.substr(0,t);for(;t>yr.length&&e>1;)e&1&&(yr+=r),e>>=1,r+=r;return yr+=r,yr=yr.substr(0,t),yr}/*!
100
+ */var yr="",Oo,T0=Q0;function Q0(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(Oo!==r||typeof Oo>"u")Oo=r,yr="";else if(yr.length>=t)return yr.substr(0,t);for(;t>yr.length&&e>1;)e&1&&(yr+=r),e>>=1,r+=r;return yr+=r,yr=yr.substr(0,t),yr}/*!
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 $p=Gp,Yp=function(e,t,n){return n=typeof n<"u"?n+"":" ",$p(n,t)+e},Vp=Yp,Kp=Jp;function Jp(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=Vp(a,i-l);return A+t+s}).join(`
106
- `)}var fs=Ic.sprintf,Wp=mp,qp=Op,jp=Kp,Xp=zp;function zp(r,e,t){var n=qp(e)||"of unknown name (see npm glsl-shader-name)",i="unknown type";t!==void 0&&(i=t===Wp.FRAGMENT_SHADER?"fragment":"vertex");for(var s=fs(`Error compiling %s shader %s:
107
- `,i,n),o=fs("%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(fs("Could not parse error: %s",c));l[u]=c}}for(var h=jp(e).split(`
105
+ */var b0=T0,x0=function(e,t,n){return n=typeof n<"u"?n+"":" ",b0(n,t)+e},w0=x0,S0=R0;function R0(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=w0(a,i-l);return A+t+s}).join(`
106
+ `)}var os=FA.sprintf,D0=e0,_0=y0,L0=S0,F0=k0;function k0(r,e,t){var n=_0(e)||"of unknown name (see npm glsl-shader-name)",i="unknown type";t!==void 0&&(i=t===D0.FRAGMENT_SHADER?"fragment":"vertex");for(var s=os(`Error compiling %s shader %s:
107
+ `,i,n),o=os("%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(os("Could not parse error: %s",c));l[u]=c}}for(var h=L0(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+=fs(`^^^ %s
110
+ `,l[A+1]){var f=l[A+1];f=f.substr(f.split(":",3).join(":").length+1).trim(),s+=os(`^^^ %s
111
111
 
112
- `,f)}}return{long:s.trim(),short:o.trim()}}var na,Sc;function Zp(){if(Sc)return na;Sc=1,na=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 na}var ia,Rc;function em(){if(Rc)return ia;Rc=1;var r=Zp();ia=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 ia}var sa,Dc;function tm(){if(Dc)return sa;Dc=1;var r=em();sa=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 sa}zo.shader=am,zo.program=lm;var oa=ds,rm=Xp,nm=typeof WeakMap>"u"?tm():WeakMap,_c=new nm,im=0;function Lc(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}Lc.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 Fc(r){this.gl=r,this.shaders=[{},{}],this.programs={}}var kc=Fc.prototype;function sm(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=rm(i,t,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new oa(i,`Error compiling shader:
113
- `+i)}throw new oa(i,s.short,s.long)}return n}kc.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=sm(t,r,e);i=n[e]=new Lc(im++,e,r,s,[],1,this)}else i.count+=1;return i};function om(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 oa(a,"Error linking program: "+a)}return s}kc.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=om(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function Nc(r){var e=_c.get(r);return e||(e=new Fc(r),_c.set(r,e)),e}function am(r,e,t){return Nc(r).getShaderReference(e,t)}function lm(r,e,t,n,i){return Nc(r).getProgram(e,t,n,i)}var aa={};aa.uniforms=Am,aa.attributes=cm;var Mc={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"},gs=null;function Pc(r,e){if(!gs){var t=Object.keys(Mc);gs={};for(var n=0;n<t.length;++n){var i=t[n];gs[r[i]]=Mc[i]}}return gs[e]}function Am(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=Pc(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 cm(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:Pc(r,s.type)})}return n}var um=Ap,hm=up,Oc=pc,la=zo,Uc=aa,dm=ds;function Gc(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 Aa=Gc.prototype;Aa.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)},Aa.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 fm(r,e){return r.name<e.name?-1:1}Aa.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=la.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=la.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 dm(c,"Error linking program:"+c)}t=t||Uc.uniforms(o,A),n=n||Uc.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(fm);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=la.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:Oc(t),attributes:Oc(n)},s.attributes=hm(o,s,u,d),Object.defineProperty(s,"uniforms",um(o,s,t,v))};function gm(r,e,t,n,i){var s=new Gc(r);return s.update(e,t,n,i),s}var pm=gm;Object.defineProperty(gc,"__esModule",{value:!0});var mm=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},Em=pm,Im=Cm(Em);function Cm(r){return r&&r.__esModule?r:{default:r}}var vm=`attribute vec2 _p;
112
+ `,f)}}return{long:s.trim(),short:o.trim()}}var Uo,YA;function N0(){if(YA)return Uo;YA=1,Uo=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 Uo}var Go,VA;function M0(){if(VA)return Go;VA=1;var r=N0();Go=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 Go}var Ho,KA;function P0(){if(KA)return Ho;KA=1;var r=M0();Ho=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 Ho}ko.shader=Y0,ko.program=V0;var $o=ss,O0=F0,U0=typeof WeakMap>"u"?P0():WeakMap,JA=new U0,G0=0;function WA(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}WA.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 qA(r){this.gl=r,this.shaders=[{},{}],this.programs={}}var XA=qA.prototype;function H0(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=O0(i,t,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new $o(i,`Error compiling shader:
113
+ `+i)}throw new $o(i,s.short,s.long)}return n}XA.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=H0(t,r,e);i=n[e]=new WA(G0++,e,r,s,[],1,this)}else i.count+=1;return i};function $0(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 $o(a,"Error linking program: "+a)}return s}XA.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=$0(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function jA(r){var e=JA.get(r);return e||(e=new qA(r),JA.set(r,e)),e}function Y0(r,e,t){return jA(r).getShaderReference(e,t)}function V0(r,e,t,n,i){return jA(r).getProgram(e,t,n,i)}var Yo={};Yo.uniforms=K0,Yo.attributes=J0;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"},as=null;function ZA(r,e){if(!as){var t=Object.keys(zA);as={};for(var n=0;n<t.length;++n){var i=t[n];as[r[i]]=zA[i]}}return as[e]}function K0(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=ZA(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 J0(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:ZA(r,s.type)})}return n}var W0=Kg,q0=Wg,ec=DA,Vo=ko,tc=Yo,X0=ss;function rc(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 Ko=rc.prototype;Ko.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)},Ko.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 j0(r,e){return r.name<e.name?-1:1}Ko.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=Vo.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=Vo.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 X0(c,"Error linking program:"+c)}t=t||tc.uniforms(o,A),n=n||tc.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(j0);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=Vo.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:ec(t),attributes:ec(n)},s.attributes=q0(o,s,u,d),Object.defineProperty(s,"uniforms",W0(o,s,t,v))};function z0(r,e,t,n,i){var s=new rc(r);return s.update(e,t,n,i),s}var Z0=z0;Object.defineProperty(RA,"__esModule",{value:!0});var ep=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},tp=Z0,rp=np(tp);function np(r){return r&&r.__esModule?r:{default:r}}var ip=`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
- }`,ym={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"}},Bm=function(e,t){var n=ym[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
+ }`,sp={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"}},op=function(e,t){var n=sp[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);}`},Hc=gc.default=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=mm({resizeMode:"cover"},t),i=n.resizeMode,s=(0,Im.default)(r,vm,Bm(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()}}},Tm=[{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);}`},nc=RA.default=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=ep({resizeMode:"cover"},t),i=n.resizeMode,s=(0,rp.default)(r,ip,op(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()}}},ap=[{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 $c=Lo(Tm);var Yc;function Qm(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function bm(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function Vc({resolution:r,aspectRatio:e}){const t=Qm(r),n=bm(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 xm(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 Kc(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 wm(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}=xm(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}=Kc(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}=Kc(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 Jc(r,e,t,n=0){var i;const s=r.Node.create(),{layout:o,renderer:a,options:l}=t;wm(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)=>Jc(r,s,c,u)))??[]};return e.calculateLayout(),A}function Wc(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:Wc(r,A,f,g)}})}function ca(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(ca(s,e),a&&typeof a=="function"){const l=a({node:t,options:n,measureCanvas:e});t.setHeight(l)}ca(s,e)})}function Sm({yoga:r,recipe:e,measureCanvas:t}){const n=r.Node.create(),i=Jc(r,n,e);ca([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:Wc(n,[i])};return n.freeRecursive(),A}function qc({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 Rm=Yi(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(ui,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,...qc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(ui,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},qc({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}`});Yi(({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=Rm({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(ui))==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}`}),Yi(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(ui,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(ui,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 Dm={linear:Pg,easeIn:Do,easeInOut:Ug,easeOut:Og,circIn:OA,circInOut:Gg,circOut:UA,backIn:_o,backInOut:$g,backOut:Hg,anticipate:Yg,bounceIn:Wg,bounceInOut:qg,bounceOut:qi};Yi((r,e,{clamp:t=!0,ease:n="easeIn",...i}={})=>_g(r,e,{...i,clamp:t,ease:Dm[n]}),{cacheKey:([r,e,t])=>JSON.stringify({from:r,to:e,options:t})});const jc=[{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 _m({text:r,font:e}){let t=e;return jc.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}const ui=/(?<value>\d+\.?\d*)(?=px)/;let ps;const Lm=new Uint8Array(16);function Fm(){if(!ps&&(ps=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ps))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ps(Lm)}const vt=[];for(let r=0;r<256;++r)vt.push((r+256).toString(16).slice(1));function km(r,e=0){return vt[r[e+0]]+vt[r[e+1]]+vt[r[e+2]]+vt[r[e+3]]+"-"+vt[r[e+4]]+vt[r[e+5]]+"-"+vt[r[e+6]]+vt[r[e+7]]+"-"+vt[r[e+8]]+vt[r[e+9]]+"-"+vt[r[e+10]]+vt[r[e+11]]+vt[r[e+12]]+vt[r[e+13]]+vt[r[e+14]]+vt[r[e+15]]}const Xc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Nm(r,e,t){if(Xc.randomUUID&&!e&&!r)return Xc.randomUUID();r=r||{};const n=r.random||(r.rng||Fm)();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 km(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 Mm(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 Pm(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 Om=ni(()=>GA.loadYoga());jg.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${Pm(r)}"`:Mm(r)||Array.isArray(r)?JSON.stringify(r):r);const Um="3",Gm=(((Yc=$c)==null?void 0:Yc.default)??$c).reduce((r,e)=>(r[e.name]=e,r),{});function Hm({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=hs)==null?void 0:s.default)??hs)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=hs)==null?void 0:o.default)??hs)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=Hc)==null?void 0:a.default)??Hc)(l,Gm[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function $m(){return document.createElement("canvas")}function ms(r){let e=0;for(const t of r)Array.isArray(t)?e+=ms(t):e+=t;return e}function Ym(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 Zc({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 Zc({layout:n,canvases:e,sceneTime:t})}async function eu({config:r,canvasFactory:e=$m}){const t=await Om();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=Sm({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 Zc({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:Nm(),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=Ym(a),A=await Promise.all(a.reduce((d,f,g)=>{if(f.type!=="scene")return d;const p=ms(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=ms(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=ms(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));Hm({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 Vm={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 Km(r){const{publicApiUrl:e}=$i(r),t=Lr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Jm(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Lr()};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=Lr();return e||(e=Km(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Lr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=Lr(),(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 Wm(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function qm(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:Vm.version,templateVersion:Um,...n}}const tu=1;class jm{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=Wm(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}=$i(this.host.env),{client:n,tab:i,request:s,visitor:o}=Jm(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":qm(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+tu&&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]+tu&&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 ua={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof pn<"u"&&pn,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})(ua,ua.exports);var Xm=ua.exports;const ru=Lo(Xm);async function zm(r){var e;try{if((e=await ru(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function ha({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 Zm(r){try{return(await ru(r)).text()}catch{return null}}async function eE(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Zm(r):r}const tE=ni(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?eE(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function rE(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 nE=ni(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([ha({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]}),ha({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),ha({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 nu(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 iE=ni(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 da({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([iE(r,e,t),nE(e),tE({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=nu(e);return{...te,...D,key:ie,captions:le,wordTimings:rE((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=>nu(P).name===D.name))===t:!0}}const Es={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 sE({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&&Es[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:Es[h]}),d&&Es[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:Es[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 ic=po(ap);var sc;function lp(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function Ap(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function Jo({resolution:r,aspectRatio:e}){const t=lp(r),n=Ap(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 li=/(?<value>\d+\.?\d*)(?=px)/;function oc({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 cp=go(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(li,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,...oc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(li,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},oc({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}`}),ac=[{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 up({text:r,font:e}){let t=e;return ac.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}go(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(li,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(li,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 ls;const hp=new Uint8Array(16);function dp(){if(!ls&&(ls=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ls))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ls(hp)}const vt=[];for(let r=0;r<256;++r)vt.push((r+256).toString(16).slice(1));function fp(r,e=0){return vt[r[e+0]]+vt[r[e+1]]+vt[r[e+2]]+vt[r[e+3]]+"-"+vt[r[e+4]]+vt[r[e+5]]+"-"+vt[r[e+6]]+vt[r[e+7]]+"-"+vt[r[e+8]]+vt[r[e+9]]+"-"+vt[r[e+10]]+vt[r[e+11]]+vt[r[e+12]]+vt[r[e+13]]+vt[r[e+14]]+vt[r[e+15]]}const lc={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function gp(r,e,t){if(lc.randomUUID&&!e&&!r)return lc.randomUUID();r=r||{};const n=r.random||(r.rng||dp)();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 fp(n)}go(({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=cp({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(li))==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 pp(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 mp(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 Ep=Wr(()=>rA.loadYoga());Lf.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${mp(r)}"`:pp(r)||Array.isArray(r)?JSON.stringify(r):r);const Ip="3";function Cp(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 vp(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 Ac(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 cc(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}=vp(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}=Ac(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}=Ac(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 uc({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();cc(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 uc({yoga:r,index:g,parent:h,element:p,resolvers:i}));return t.calculateLayout(),{type:a,node:h,radius:Cp(l.radius),element:n,renderer:u,config:A,options:c,dependencies:d,childNodes:f}}function hc(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=>hc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function Wo(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 Wo(r,a,t),A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}}await Wo(r,a,t)}r.calculateLayout()}async function dc({root:r,resolvers:e,measureCanvas:t}){const n=await Ep(),i=n.Node.create();cc(n,i,{layout:r.layout});const s=await uc({yoga:n,index:0,parent:i,element:r.element,resolvers:e});await Wo(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:hc(i,s)};return i.freeRecursive(),c}async function yp({scene:r,start:e=0}){const{root:t,duration:n}=r,i=await dc({root:t});return{type:r.type,start:e,duration:n,layout:i,id:r.id,config:r}}async function fc(){return document.createElement("canvas")}function In(r){let e=0;for(const t of r)Array.isArray(t)?e+=In(t):e+=t;return e}function Bp(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 gc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return gc(t)}).filter(Boolean))??[]}}function pc({node:r,duration:e}){const t=[];r.type==="recipe"&&t.push({id:gp(),type:"scene",x:r.x,y:r.y,width:r.width,height:r.height,duration:e,root:{element:gc({...r.element,layout:{...r.element.layout,position:"static",width:"100%",height:"100%",margin:0}})}});for(const n of r.childNodes)t.push(...pc({node:n,duration:e}));return t}async function mc({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 mc({node:a,canvases:e,sceneTime:t})}async function Tp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await mc({node:n,canvases:e,sceneTime:t})}async function Qp({scene:r,start:e=0,resolvers:t,rootWidth:n,rootHeight:i,canvasFactory:s=fc}){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 dc({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 Tp({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:pc({node:v.node,duration:d})}}function bp(r){return r.some(({type:e})=>e==="scene"||e==="transition")}function xp(r){return r.type==="video"}const wp=(((sc=ic)==null?void 0:sc.default)??ic).reduce((r,e)=>(r[e.name]=e,r),{});function Sp({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=is)==null?void 0:s.default)??is)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=is)==null?void 0:o.default)??is)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=nc)==null?void 0:a.default)??nc)(l,wp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function Ec({config:r,resolvers:e,rootWidth:t,rootHeight:n,canvasFactory:i=fc}){const s=await Promise.all(r.tracks.map(async l=>{const A=Bp(l);if(!bp(l)){const f=await Promise.all(l.reduce((C,Q,b)=>{if(Q.type!=="audio")return C;const v=In(A.slice(0,b));return C.push(yp({scene:Q,start:v})),C},[])),g=l.reduce((C,Q,b)=>{if(Q.type!=="gap")return C;const v=In(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=In(A.slice(0,p));return f.push(Qp({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=In(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=In(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(!xp(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));Sp({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 Rp={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 Dp(r){const{publicApiUrl:e}=Gi(r),t=Fr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function _p(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=Dp(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 Lp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function Fp(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:Rp.version,templateVersion:Ip,...n}}const Ic=1;class kp{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=Lp(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}=Gi(this.host.env),{client:n,tab:i,request:s,visitor:o}=_p(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":Fp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+Ic&&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]+Ic&&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 qo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof pn<"u"&&pn,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})(qo,qo.exports);var Np=qo.exports;const Cc=po(Np);async function Mp(r){var e;try{if((e=await Cc(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function Xo({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=>Mp(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Pp(r){try{return(await Cc(r)).text()}catch{return null}}async function Op(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Pp(r):r}const Up=Wr(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?Op(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Gp(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 Hp=Wr(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([Xo({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]}),Xo({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),Xo({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 vc(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 $p=Wr(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 jo({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([$p(r,e,t),Hp(e),Up({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=vc(e);return{...te,...D,key:ie,captions:le,wordTimings:Gp((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=>vc(P).name===D.name))===t:!0}}const As={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 Yp({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&&As[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:As[h]}),d&&As[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:As[d]}),n},[]))??[]}/**
2456
2456
  * @license
2457
2457
  * Copyright 2018 Google LLC
2458
2458
  * SPDX-License-Identifier: BSD-3-Clause
2459
- */const Ke=gn(class extends zn{constructor(r){var e;if(super(r),r.type!==fn.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 qt}});/**
2459
+ */const Ke=gn(class extends Zn{constructor(r){var e;if(super(r),r.type!==fn.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 qt}});/**
2460
2460
  * @license
2461
2461
  * Copyright 2018 Google LLC
2462
2462
  * SPDX-License-Identifier: BSD-3-Clause
2463
- */const iu="important",oE=" !"+iu,hi=gn(class extends zn{constructor(r){var e;if(super(r),r.type!==fn.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(oE);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?iu:""):t[n]=i}}return qt}});function aE(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var su={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})()})(su);var fa=su.exports;function ou(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 dt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ou(Object(t),!0).forEach(function(n){cE(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ou(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lE(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 AE(r){var e=lE(r,"string");return typeof e=="symbol"?e:String(e)}function cE(r,e,t){return e=AE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function st(){return st=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},st.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},uE=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=hE},hE=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(){},ga={trace:zr,debug:zr,log:zr,warn:zr,info:zr,error:zr};let di=ga;function dE(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):zr}function fE(r,...e){e.forEach(function(t){di[t]=r[t]?r[t].bind(r):dE(t)})}function gE(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){fE(r,"debug","log","info","warn","error");try{di.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{di=ga}}else di=ga}const U=di,pE=/^(\d+)x(\d+)$/,au=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Xe{constructor(e){typeof e=="string"&&(e=Xe.parseAttrList(e)),st(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=pE.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(au.lastIndex=0;(t=au.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 mE(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function EE(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class lu{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=st(new Xe({}),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 Is{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 $e={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Au{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[$e.AUDIO]:null,[$e.VIDEO]:null,[$e.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=fa.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class pa extends Au{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 Is,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[$e.AUDIO]=null,e[$e.VIDEO]=null,e[$e.AUDIOVIDEO]=null}}class IE extends Au{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 Is,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 CE=10;class vE{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||CE}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 ma(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function yE(r){const e=Ea(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function BE(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 TE(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=ma(o)):t=yE(o)}}return t}function Ea(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const In=typeof self<"u"?self:void 0;var We={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Dt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function cu(r){switch(r){case Dt.FAIRPLAY:return We.FAIRPLAY;case Dt.PLAYREADY:return We.PLAYREADY;case Dt.WIDEVINE:return We.WIDEVINE;case Dt.CLEARKEY:return We.CLEARKEY}}var uu={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function QE(r){if(r===uu.WIDEVINE)return We.WIDEVINE}function hu(r){switch(r){case We.FAIRPLAY:return Dt.FAIRPLAY;case We.PLAYREADY:return Dt.PLAYREADY;case We.WIDEVINE:return Dt.WIDEVINE;case We.CLEARKEY:return Dt.CLEARKEY}}function Ia(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[We.FAIRPLAY,We.WIDEVINE,We.PLAYREADY,We.CLEARKEY].filter(i=>!!e[i]):[];return!n[We.WIDEVINE]&&t&&n.push(We.WIDEVINE),n}const du=function(r){return In!=null&&(r=In.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function bE(r,e,t,n){let i;switch(r){case We.FAIRPLAY:i=["cenc","sinf"];break;case We.WIDEVINE:case We.PLAYREADY:i=["cenc"];break;case We.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return xE(i,e,t,n)}function xE(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 Zr(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const Ca=(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,fu=(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,fi=(r,e)=>{const t=e;let n=0;for(;Ca(r,e);){n+=10;const i=Cs(r,e+6);n+=i,fu(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},Cs=(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},wE=(r,e)=>Ca(r,e)&&Cs(r,e+6)+10<=r.length-e,va=r=>{const e=pu(r);for(let t=0;t<e.length;t++){const n=e[t];if(gu(n))return FE(n)}},gu=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",SE=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=Cs(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},pu=r=>{let e=0;const t=[];for(;Ca(r,e);){const n=Cs(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=SE(r.subarray(e)),o=RE(s);o&&t.push(o),e+=s.size+10}fu(r,e)&&(e+=10)}return t},RE=r=>r.type==="PRIV"?DE(r):r.type[0]==="W"?LE(r):_E(r),DE=r=>{if(r.size<2)return;const e=sr(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},_E=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=sr(r.data.subarray(t),!0);t+=n.length+1;const i=sr(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=sr(r.data.subarray(1));return{key:r.type,data:e}},LE=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=sr(r.data.subarray(t),!0);t+=n.length+1;const i=sr(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=sr(r.data);return{key:r.type,data:e}},FE=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)}},sr=(r,e=!1)=>{const t=kE();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 ya;function kE(){if(!navigator.userAgent.includes("PlayStation 4"))return!ya&&typeof self.TextDecoder<"u"&&(ya=new self.TextDecoder("utf-8")),ya}const or={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}},vs=Math.pow(2,32)-1,NE=[].push,mu={video:1,audio:2,id3:3,text:4};function ut(r){return String.fromCharCode.apply(null,r)}function Eu(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=Cu(r,e);return t<0?4294967296+t:t}function Iu(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function Cu(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function Ba(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 ME(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=ut(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&&NE.apply(t,l)}i=a}return t}function PE(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=Iu(r,n),o=Iu(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Eu(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 vu(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=ut(u.subarray(8,12)),d={soun:$e.AUDIO,vide:$e.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=OE(f);e[l]={timescale:c,type:d},e[d]=dt({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 OE(r){const e=r.subarray(8),t=e.subarray(86),n=ut(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=ut(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ut(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+ys(o[1])+ys(o[2])+ys(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=Ta(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=Ta(a,l);const c=a[l++];if(c===64)i+="."+ys(c);else break;if(l+=12,a[l++]!==5)break;l=Ta(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+="."+ar(a)+"."+ar(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+ar(a)+"."+ar(l)+"."+ar(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+"."+ar(l)+A+"."+ar(h)+"."+d+"."+f+g+p+"."+ar(1)+"."+ar(1)+"."+ar(1)+"."+0;break}}return{codec:i,encrypted:s}}function Ta(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function ys(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function ar(r){return(r<10?"0":"")+r}function UE(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=yu(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: ${or.hexDump(f)} -> ${or.hexDump(t)}`),d.set(t,8))}})})}),r}function yu(r){const e=xe(r,["schm"])[0];if(e){const t=ut(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function GE(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===vs)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=vs+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 HE(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=$E(g[p]),!t&&d){const y=me(g[p],4);t=d*y}c.type===$e.VIDEO?n+=t/f:c.type===$e.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=PE(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 $E(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 YE(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),Ba(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/(vs+1)),d=Math.floor(u%(vs+1));Ba(l,4,h),Ba(l,8,d)}}})})})}function VE(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=Zr(r,0,n.byteOffset-8),e.remainder=Zr(r,n.byteOffset-8),e}function Ht(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Bu(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=KE(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=Cu(H,Y),Y+=4),e.type===$e.VIDEO){let pe=0;for(;pe<j;){const ge=me(n,ne);if(ne+=4,JE(o,n[ne])){const Se=n.subarray(ne,ne+ge);Tu(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=D/i}}))})})}),t}function KE(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 JE(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Tu(r,e,t,n){const i=Qu(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=Eu(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:sr(d),userDataBytes:d})}}}function Qu(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 WE(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ut(r.subarray(A,A+1))!=="\0";)t+=ut(r.subarray(A,A+1)),A+=1;for(t+=ut(r.subarray(A,A+1)),A+=1;ut(r.subarray(A,A+1))!=="\0";)n+=ut(r.subarray(A,A+1)),A+=1;n+=ut(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,uE(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;ut(r.subarray(A,A+1))!=="\0";)t+=ut(r.subarray(A,A+1)),A+=1;for(t+=ut(r.subarray(A,A+1)),A+=1;ut(r.subarray(A,A+1))!=="\0";)n+=ut(r.subarray(A,A+1)),A+=1;n+=ut(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 qE(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 jE(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),qE([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function XE(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=or.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 Bs={};class gi{static clearKeyUriToKeyIdMap(){Bs={}}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 Dt.FAIRPLAY:case Dt.WIDEVINE:case Dt.PLAYREADY:case Dt.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 gi(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=TE(this.uri);if(t)switch(this.keyFormat){case Dt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Dt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=jE(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=ma(c).subarray(0,16);BE(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=Bs[this.uri];if(!n){const i=Object.keys(Bs).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),Bs[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 bu=/\{\$([a-zA-Z0-9-_]+)\}/g;function xu(r){return bu.test(r)}function _t(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]=Qa(r,s))}}function Qa(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(bu,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 wu(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 ZE(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 en(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function eI(r){return typeof self<"u"&&r===self.ManagedMediaSource}const Ts={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 tI(r,e){const t=Ts[e];return!!t&&!!t[r.slice(0,4)]}function ba(r,e,t=!0){return!r.split(",").some(n=>!Su(n,e,t))}function Su(r,e,t=!0){var n;const i=en(t);return(n=i==null?void 0:i.isTypeSupported(pi(r,e)))!=null?n:!1}function pi(r,e){return`${e}/mp4;codecs="${r}"`}function Ru(r){if(r){const e=r.substring(0,4);return Ts.video[e]}return 2}function Qs(r){return r.split(",").reduce((e,t)=>{const n=Ts.video[t];return n?(n*2+e)/(e?3:2):(Ts.audio[t]+e)/(e?2:1)},0)}const xa={};function rI(r,e=!0){if(xa[r])return xa[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Su(t[n],"audio",e))return xa[r]=t[n],t[n];return r}const nI=/flac|opus/i;function bs(r,e=!0){return r.replace(nI,t=>rI(t.toLowerCase(),e))}function Du(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function iI(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 _u=/#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,Lu=/#EXT-X-MEDIA:(.*)/g,sI=/^#EXT(?:INF|-X-TARGETDURATION):/m,Fu=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"),oI=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 lr{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 fa.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return sI.test(e)}static parseMasterPlaylist(e,t){const n=xu(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];_u.lastIndex=0;let o;for(;(o=_u.exec(e))!=null;)if(o[1]){var a;const A=new Xe(o[1]);_t(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Qa(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:lr.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),aI(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 Xe(c);_t(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=ku(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 Xe(c);_t(i,u,["NAME","VALUE","QUERYPARAM"]),wu(i,u,t)}break}case"CONTENT-STEERING":{const u=new Xe(c);_t(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:lr.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=Nu(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(Lu.lastIndex=0;(i=Lu.exec(e))!==null;){const A=new Xe(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,_t(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?lr.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=lr.findGroup(u,Q.groupId)||u[0];Mu(Q,b,"audioCodec"),Mu(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new vE(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new pa(i,t),p,y,Q,b=-1,v=!1,w=null;for(Fu.lastIndex=0,a.m3u8=e,a.hasVariableRefs=xu(e);(p=Fu.exec(e))!==null;){v&&(v=!1,g=new pa(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&&Uu(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=Qa(a,O),Pu(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(oI),!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 Xe(W);_t(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 Xe(W);_t(a,te,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),_t(a,te,te.clientAttrs);const le=new lu(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 Xe(W);_t(a,te,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in te?ZE(a,te,o):wu(a,te,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(W);break;case"KEY":{const te=ku(W,t,a);if(te.isSupported()){if(te.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[te.keyFormat]&&(Q=st({},Q)),Q[te.keyFormat]=te}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${W}"`);break}case"START":a.startTimeOffset=Nu(W);break;case"MAP":{const te=new Xe(W);if(_t(a,te,["BYTERANGE","URI"]),g.duration){const le=new pa(i,t);Ou(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;Ou(g,te,n,Q),A=g,v=!0}break}case"SERVER-CONTROL":{const te=new Xe(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 Xe(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 Xe(W);_t(a,P,["BYTERANGE","URI"]);const j=new IE(P,g,t,D,le);te.push(j),g.duration+=j.duration;break}case"PRELOAD-HINT":{const te=new Xe(W);_t(a,te,["URI"]),a.preloadHint=te;break}case"RENDITION-REPORT":{const te=new Xe(W);_t(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&&(Pu(g,f),g.cc=d,a.fragmentHint=g,Q&&Uu(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&&lI(l,b),a}}function ku(r,e,t){var n,i;const s=new Xe(r);_t(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?lr.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new gi(o,u,c,h,l)}function Nu(r){const t=new Xe(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function aI(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>tI(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function Mu(r,e,t){const n=e[t];n&&(r[t]=n)}function lI(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 Pu(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 Ou(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 Uu(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 Ue={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Gu(r){const{type:e}=r;switch(e){case Ue.AUDIO_TRACK:return Ee.AUDIO;case Ue.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function wa(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class AI{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:Ue.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:Ue.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:Ue.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:Ue.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===Ue.MANIFEST?s=n.manifestLoadPolicy.default:s=st({},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===Ue.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Ue.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Ue.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=st({},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(),lr.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=wa(e,n),l=lr.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}=lr.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 Xe({}),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=wa(e,n),u=0,h=he(l)?l:he(a)?a:0,d=Gu(n),f=lr.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Ue.MANIFEST){const g={attrs:new Xe({}),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===Ue.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===Ue.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Ue.AUDIO_TRACK||e.type===Ue.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 Ue.MANIFEST:l=n?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,A=!0;break;case Ue.LEVEL:l=n?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,A=!1;break;case Ue.AUDIO_TRACK:l=n?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Ue.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=dt({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=wa(t,i),f=Gu(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 Ue.MANIFEST:case Ue.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Ue.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Ue.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function Hu(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 $u(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 Cn(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 Sa(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=uI(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 cI(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 uI(r,e,t){const n=[],i=cI(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 xs(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 Xt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const hI=.25;function Ra(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Yu(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?dt({type:i},n):n))}return s}const ws=(()=>{const r=Ra();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Da(r,e){return r.getTime()/1e3-e}function dI(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class fI{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&&(Cn(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 Hu(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=Ra();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===Xt.emsg&&!n||!i)continue;const A=pu(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>ws&&(u=ws),u-c<=0&&(u=c+hI);for(let d=0;d<A.length;d++){const f=A[d];if(!gu(f)){this.updateId3CueEnds(c,l);const g=Yu(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===ws&&(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===Xt.audioId3&&l:i==="video"?A=c=>c.type===Xt.emsg&&a:A=c=>c.type===Xt.audioId3&&l||c.type===Xt.emsg&&a,Sa(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=Ra();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=Da(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,y=ws;const Q=h.endDate;if(Q)y=Da(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=Da(v.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let v=0;v<b.length;v++){const w=b[v];if(!mE(w))continue;const R=g[w];if(R)p&&!f.durationKnown&&(R.endTime=y);else if(A){let k=h.attr[w];EE(w)&&(k=dI(k));const H=Yu(A,d,y,{key:w,data:k},Xt.dateRange);H&&(H.id=u,this.id3Track.addCue(H),g[w]=H)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class gI{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 _a=["NONE","TYPE-0","TYPE-1",null];function pI(r){return _a.indexOf(r)>-1}const Ss=["SDR","PQ","HLG"];function mI(r){return!!r&&Ss.indexOf(r)>-1}var Rs={No:"",Yes:"YES",v2:"v2"};function Vu(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?Rs.v2:Rs.Yes:Rs.No}class Ku{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 vn{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 Ju(this._audioGroups,e)}hasSubtitleGroup(e){return Ju(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 Ju(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function La(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 Wu(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--)La(g[d],g[d-1]);for(d=f;d<g.length-1;d++)La(g[d],g[d+1]);return r.fragmentHint&&La(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function EI(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(vI(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=II(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),CI(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?Wu(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):qu(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 II(r,e,t){const n=st({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new lu(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 CI(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 vI(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 qu(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||Fa(e,n[t].start)}function Fa(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 yI(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 BI(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 ju(r,e,t){var n;return r!=null&&r.details?Xu((n=r.details)==null?void 0:n.partList,e,t):null}function Xu(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 Ds(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 Zu(r,e){const t=Ds(e);return r.default[`${t?"timeout":"error"}Retry`]}function ka(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function eh(r){return dt(dt({},r),{errorRetry:null,timeoutRetry:null})}function _s(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(TI(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function TI(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const th={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 QI(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(xI(e,t,o))return o}return null}function Ls(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)&&Na(t,n,s)===0||bI(s,r,Math.min(i,n))))return s;const o=th.search(e,Na.bind(null,t,n));return o&&(o!==r||!s)?o:s}function bI(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 Na(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 xI(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function wI(r,e){return th.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var yt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class SI{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:yt.DoNothing,flags:zt.None};return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.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===Ue.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Ue.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=yt.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:yt.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:yt.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=Zu(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(_s(i,s,Ds(e),e.response))return{action:yt.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=Zu(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++,_s(a,l,Ds(e),e.response)))return{action:yt.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=Ls(e.frag,V.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(v===Ue.AUDIO_TRACK&&H.hasAudioGroup(w)||v===Ue.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:yt.SendAlternateToPenaltyBox,flags:zt.None,nextAutoLevel:c}}return{action:yt.SendAlternateToPenaltyBox,flags:zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case yt.DoNothing:break;case yt.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=_a[_a.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 Ma{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&&Vu(n);return new Ku(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&&EI(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=yI(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=Vu(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=Rs.No),new Ku(n,i,s)}checkRetry(e){const t=e.details,n=Ds(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===yt.RetryRequest||!i.resolved&&s===yt.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=ka(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 yn{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 RI{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 yn(e),this.fast_=new yn(t),this.defaultTTFB_=i,this.ttfb_=new yn(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new yn(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new yn(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new yn(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 rh={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},nh={};function DI(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 _I(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(rh);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:dt(dt({},s),{},{contentType:pi(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:pi(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=LI(l);return nh[A]||(nh[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 LI(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 FI(){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 kI(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||Ss.slice(0),t=e.preferHDR!==void 0?e.preferHDR:FI(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function NI(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}=kI(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 Br(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),w;if(!k.hasDefaultAudio)return Br(R,"no renditions with default or auto-select sound found"),w;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Br(R,`audio codec preference "${a}" not found`),w;if(o&&!l){if(!k.channels[o])return Br(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 Br(R,"no renditions with stereo sound found"),w;return k.minHeight>Q?(Br(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),w):k.minFramerate>b?(Br(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),w):g.some(H=>k.videoRanges[H]>0)?k.maxScore<f?(Br(R,`max score of ${k.maxScore} < selected max of ${f}`),w):w&&(Qs(R)>=Qs(w)||k.fragmentError>r[w].fragmentError)?w:(f=k.maxScore,R):(Br(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),w)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Br(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function MI(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 PI(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 Ar(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(Bn(r,i,t))return n}return-1}function Bn(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||OI(a,e.characteristics))&&(t===void 0||t(r,e))}function OI(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Tn(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 UI(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=ih(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 Ar(r,f,i)>-1});return u>-1?u:ih(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return Ar(r,f,i)>-1})}function ih(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 GI{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 yc="important",Vp=" !"+yc,Ai=gn(class extends Zn{constructor(r){var e;if(super(r),r.type!==fn.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(Vp);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?yc:""):t[n]=i}}return qt}});function Kp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Bc={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})()})(Bc);var zo=Bc.exports;function Tc(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 dt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Tc(Object(t),!0).forEach(function(n){qp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Tc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Jp(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 Wp(r){var e=Jp(r,"string");return typeof e=="symbol"?e:String(e)}function qp(r,e,t){return e=Wp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function st(){return st=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},st.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Xp=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=jp},jp=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(){},Zo={trace:zr,debug:zr,log:zr,warn:zr,info:zr,error:zr};let ci=Zo;function zp(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):zr}function Zp(r,...e){e.forEach(function(t){ci[t]=r[t]?r[t].bind(r):zp(t)})}function em(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){Zp(r,"debug","log","info","warn","error");try{ci.log(`Debug logs enabled for "${e}" in hls.js version 1.5.17`)}catch{ci=Zo}}else ci=Zo}const U=ci,tm=/^(\d+)x(\d+)$/,Qc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class ze{constructor(e){typeof e=="string"&&(e=ze.parseAttrList(e)),st(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=tm.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(Qc.lastIndex=0;(t=Qc.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 rm(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function nm(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class bc{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=st(new ze({}),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 $e={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class xc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[$e.AUDIO]:null,[$e.VIDEO]:null,[$e.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 ea extends xc{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[$e.AUDIO]=null,e[$e.VIDEO]=null,e[$e.AUDIOVIDEO]=null}}class im extends xc{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 sm=10;class om{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||sm}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 ta(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function am(r){const e=ra(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function lm(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 Am(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=ta(o)):t=am(o)}}return t}function ra(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"},Dt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function wc(r){switch(r){case Dt.FAIRPLAY:return Je.FAIRPLAY;case Dt.PLAYREADY:return Je.PLAYREADY;case Dt.WIDEVINE:return Je.WIDEVINE;case Dt.CLEARKEY:return Je.CLEARKEY}}var ui={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Sc(r){if(r===ui.WIDEVINE)return Je.WIDEVINE;if(r===ui.PLAYREADY)return Je.PLAYREADY;if(r===ui.CENC||r===ui.CLEARKEY)return Je.CLEARKEY}function Rc(r){switch(r){case Je.FAIRPLAY:return Dt.FAIRPLAY;case Je.PLAYREADY:return Dt.PLAYREADY;case Je.WIDEVINE:return Dt.WIDEVINE;case Je.CLEARKEY:return Dt.CLEARKEY}}function na(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 Dc=function(r){return Cn!=null&&(r=Cn.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function cm(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 um(i,e,t,n)}function um(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 Zr(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const ia=(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,_c=(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,hi=(r,e)=>{const t=e;let n=0;for(;ia(r,e);){n+=10;const i=us(r,e+6);n+=i,_c(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},us=(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},hm=(r,e)=>ia(r,e)&&us(r,e+6)+10<=r.length-e,sa=r=>{const e=Fc(r);for(let t=0;t<e.length;t++){const n=e[t];if(Lc(n))return Em(n)}},Lc=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",dm=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=us(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},Fc=r=>{let e=0;const t=[];for(;ia(r,e);){const n=us(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=dm(r.subarray(e)),o=fm(s);o&&t.push(o),e+=s.size+10}_c(r,e)&&(e+=10)}return t},fm=r=>r.type==="PRIV"?gm(r):r.type[0]==="W"?mm(r):pm(r),gm=r=>{if(r.size<2)return;const e=sr(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},pm=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=sr(r.data.subarray(t),!0);t+=n.length+1;const i=sr(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=sr(r.data.subarray(1));return{key:r.type,data:e}},mm=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=sr(r.data.subarray(t),!0);t+=n.length+1;const i=sr(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=sr(r.data);return{key:r.type,data:e}},Em=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)}},sr=(r,e=!1)=>{const t=Im();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 oa;function Im(){if(!navigator.userAgent.includes("PlayStation 4"))return!oa&&typeof self.TextDecoder<"u"&&(oa=new self.TextDecoder("utf-8")),oa}const or={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}},hs=Math.pow(2,32)-1,Cm=[].push,kc={video:1,audio:2,id3:3,text:4};function ut(r){return String.fromCharCode.apply(null,r)}function Nc(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=Pc(r,e);return t<0?4294967296+t:t}function Mc(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function Pc(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function aa(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 vm(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=ut(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&&Cm.apply(t,l)}i=a}return t}function ym(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=Mc(r,n),o=Mc(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Nc(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 Oc(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=ut(u.subarray(8,12)),d={soun:$e.AUDIO,vide:$e.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=Bm(f);e[l]={timescale:c,type:d},e[d]=dt({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 Bm(r){const e=r.subarray(8),t=e.subarray(86),n=ut(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=ut(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ut(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+ds(o[1])+ds(o[2])+ds(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=la(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=la(a,l);const c=a[l++];if(c===64)i+="."+ds(c);else break;if(l+=12,a[l++]!==5)break;l=la(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+="."+ar(a)+"."+ar(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+ar(a)+"."+ar(l)+"."+ar(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+"."+ar(l)+A+"."+ar(h)+"."+d+"."+f+g+p+"."+ar(1)+"."+ar(1)+"."+ar(1)+"."+0;break}}return{codec:i,encrypted:s}}function la(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function ds(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function ar(r){return(r<10?"0":"")+r}function Tm(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=Uc(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: ${or.hexDump(f)} -> ${or.hexDump(t)}`),d.set(t,8))}})})}),r}function Uc(r){const e=xe(r,["schm"])[0];if(e){const t=ut(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return null}function Qm(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===hs)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=hs+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 bm(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=xm(g[p]),!t&&d){const C=me(g[p],4);t=d*C}c.type===$e.VIDEO?n+=t/f:c.type===$e.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=ym(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 xm(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 wm(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),aa(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/(hs+1)),d=Math.floor(u%(hs+1));aa(l,4,h),aa(l,8,d)}}})})})}function Sm(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=Zr(r,0,n.byteOffset-8),e.remainder=Zr(r,n.byteOffset-8),e}function Ht(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Gc(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=Rm(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=Pc($,Y),Y+=4),e.type===$e.VIDEO){let pe=0;for(;pe<X;){const ge=me(n,ne);if(ne+=4,Dm(o,n[ne])){const Se=n.subarray(ne,ne+ge);Hc(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=D/i}}))})})}),t}function Rm(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 Dm(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Hc(r,e,t,n){const i=$c(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=Nc(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:sr(d),userDataBytes:d})}}}function $c(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 _m(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ut(r.subarray(A,A+1))!=="\0";)t+=ut(r.subarray(A,A+1)),A+=1;for(t+=ut(r.subarray(A,A+1)),A+=1;ut(r.subarray(A,A+1))!=="\0";)n+=ut(r.subarray(A,A+1)),A+=1;n+=ut(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,Xp(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;ut(r.subarray(A,A+1))!=="\0";)t+=ut(r.subarray(A,A+1)),A+=1;for(t+=ut(r.subarray(A,A+1)),A+=1;ut(r.subarray(A,A+1))!=="\0";)n+=ut(r.subarray(A,A+1)),A+=1;n+=ut(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 Lm(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 Fm(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),Lm([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function km(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=Nm(i);e.push(s),n+=s.size}}return e}function Nm(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=or.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 fs={};class di{static clearKeyUriToKeyIdMap(){fs={}}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 Dt.FAIRPLAY:case Dt.WIDEVINE:case Dt.PLAYREADY:case Dt.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=Mm(e);return new di(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=Am(this.uri);if(t)switch(this.keyFormat){case Dt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Dt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Fm(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=ta(c).subarray(0,16);lm(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=fs[this.uri];if(!n){const i=Object.keys(fs).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),fs[this.uri]=n}this.keyId=n}return this}}function Mm(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const Yc=/\{\$([a-zA-Z0-9-_]+)\}/g;function Vc(r){return Yc.test(r)}function _t(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]=Aa(r,s))}}function Aa(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(Yc,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 Kc(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 Pm(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 en(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Om(r){return typeof self<"u"&&r===self.ManagedMediaSource}const gs={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 Um(r,e){const t=gs[e];return!!t&&!!t[r.slice(0,4)]}function ca(r,e,t=!0){return!r.split(",").some(n=>!Jc(n,e,t))}function Jc(r,e,t=!0){var n;const i=en(t);return(n=i==null?void 0:i.isTypeSupported(fi(r,e)))!=null?n:!1}function fi(r,e){return`${e}/mp4;codecs="${r}"`}function Wc(r){if(r){const e=r.substring(0,4);return gs.video[e]}return 2}function ps(r){return r.split(",").reduce((e,t)=>{const n=gs.video[t];return n?(n*2+e)/(e?3:2):(gs.audio[t]+e)/(e?2:1)},0)}const ua={};function Gm(r,e=!0){if(ua[r])return ua[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Jc(t[n],"audio",e))return ua[r]=t[n],t[n];return r}const Hm=/flac|opus/i;function ms(r,e=!0){return r.replace(Hm,t=>Gm(t.toLowerCase(),e))}function qc(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function $m(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 Xc=/#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,jc=/#EXT-X-MEDIA:(.*)/g,Ym=/^#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"),Vm=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 lr{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 Ym.test(e)}static parseMasterPlaylist(e,t){const n=Vc(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];Xc.lastIndex=0;let o;for(;(o=Xc.exec(e))!=null;)if(o[1]){var a;const A=new ze(o[1]);_t(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Aa(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:lr.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),Km(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 ze(c);_t(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=Zc(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 ze(c);_t(i,u,["NAME","VALUE","QUERYPARAM"]),Kc(i,u,t)}break}case"CONTENT-STEERING":{const u=new ze(c);_t(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:lr.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=eu(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(jc.lastIndex=0;(i=jc.exec(e))!==null;){const A=new ze(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,_t(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?lr.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=lr.findGroup(u,Q.groupId)||u[0];tu(Q,b,"audioCodec"),tu(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new om(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new ea(i,t),p,C,Q,b=-1,v=!1,x=null;for(zc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Vc(e);(p=zc.exec(e))!==null;){v&&(v=!1,g=new ea(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&&iu(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=Aa(a,O),ru(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(Vm),!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 ze(W);_t(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 ze(W);_t(a,te,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),_t(a,te,te.clientAttrs);const le=new bc(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 ze(W);_t(a,te,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in te?Pm(a,te,o):Kc(a,te,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(W);break;case"KEY":{const te=Zc(W,t,a);if(te.isSupported()){if(te.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[te.keyFormat]&&(Q=st({},Q)),Q[te.keyFormat]=te}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${W}"`);break}case"START":a.startTimeOffset=eu(W);break;case"MAP":{const te=new ze(W);if(_t(a,te,["BYTERANGE","URI"]),g.duration){const le=new ea(i,t);nu(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;nu(g,te,n,Q),A=g,v=!0}break}case"SERVER-CONTROL":{const te=new ze(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 ze(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 ze(W);_t(a,P,["BYTERANGE","URI"]);const X=new im(P,g,t,D,le);te.push(X),g.duration+=X.duration;break}case"PRELOAD-HINT":{const te=new ze(W);_t(a,te,["URI"]),a.preloadHint=te;break}case"RENDITION-REPORT":{const te=new ze(W);_t(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&&(ru(g,f),g.cc=d,a.fragmentHint=g,Q&&iu(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&&Jm(l,b),a}}function Zc(r,e,t){var n,i;const s=new ze(r);_t(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?lr.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new di(o,u,c,h,l)}function eu(r){const t=new ze(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function Km(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>Um(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function tu(r,e,t){const n=e[t];n&&(r[t]=n)}function Jm(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 ru(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 nu(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 iu(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 Ue={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function su(r){const{type:e}=r;switch(e){case Ue.AUDIO_TRACK:return Ee.AUDIO;case Ue.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function ha(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Wm{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:Ue.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:Ue.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:Ue.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:Ue.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===Ue.MANIFEST?s=n.manifestLoadPolicy.default:s=st({},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===Ue.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Ue.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Ue.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=st({},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(),lr.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=ha(e,n),l=lr.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}=lr.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 ze({}),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=ha(e,n),u=0,h=he(l)?l:he(a)?a:0,d=su(n),f=lr.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Ue.MANIFEST){const g={attrs:new ze({}),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===Ue.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===Ue.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Ue.AUDIO_TRACK||e.type===Ue.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 Ue.MANIFEST:l=n?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,A=!0;break;case Ue.LEVEL:l=n?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,A=!1;break;case Ue.AUDIO_TRACK:l=n?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Ue.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=dt({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=ha(t,i),f=su(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 Ue.MANIFEST:case Ue.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Ue.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Ue.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function ou(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 au(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 da(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=Xm(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 qm(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 Xm(r,e,t){const n=[],i=qm(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 Es(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 jt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const jm=.25;function fa(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function lu(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?dt({type:i},n):n))}return s}const Is=(()=>{const r=fa();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ga(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 Zm{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 ou(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=fa();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===jt.emsg&&!n||!i)continue;const A=Fc(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>Is&&(u=Is),u-c<=0&&(u=c+jm);for(let d=0;d<A.length;d++){const f=A[d];if(!Lc(f)){this.updateId3CueEnds(c,l);const g=lu(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===Is&&(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===jt.audioId3&&l:i==="video"?A=c=>c.type===jt.emsg&&a:A=c=>c.type===jt.audioId3&&l||c.type===jt.emsg&&a,da(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=fa();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=ga(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,C=Is;const Q=h.endDate;if(Q)C=ga(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=ga(v.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let v=0;v<b.length;v++){const x=b[v];if(!rm(x))continue;const R=g[x];if(R)p&&!f.durationKnown&&(R.endTime=C);else if(A){let k=h.attr[x];nm(x)&&(k=zm(k));const $=lu(A,d,C,{key:x,data:k},jt.dateRange);$&&($.id=u,this.id3Track.addCue($),g[x]=$)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class eE{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 pa=["NONE","TYPE-0","TYPE-1",null];function tE(r){return pa.indexOf(r)>-1}const Cs=["SDR","PQ","HLG"];function rE(r){return!!r&&Cs.indexOf(r)>-1}var vs={No:"",Yes:"YES",v2:"v2"};function Au(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?vs.v2:vs.Yes:vs.No}class cu{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 uu(this._audioGroups,e)}hasSubtitleGroup(e){return uu(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 uu(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function ma(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 hu(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--)ma(g[d],g[d-1]);for(d=f;d<g.length-1;d++)ma(g[d],g[d+1]);return r.fragmentHint&&ma(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function nE(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(oE(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=iE(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),sE(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?hu(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):du(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 iE(r,e,t){const n=st({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new bc(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 sE(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 oE(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 du(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||Ea(e,n[t].start)}function Ea(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 aE(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 lE(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 fu(r,e,t){var n;return r!=null&&r.details?gu((n=r.details)==null?void 0:n.partList,e,t):null}function gu(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 pu(r){r.forEach((e,t)=>{const{details:n}=e;n!=null&&n.fragments&&n.fragments.forEach(i=>{i.level=t})})}function ys(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 mu(r,e){const t=ys(e);return r.default[`${t?"timeout":"error"}Retry`]}function Ia(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function Eu(r){return dt(dt({},r),{errorRetry:null,timeoutRetry:null})}function Bs(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(AE(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function AE(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const Iu={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 cE(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(hE(e,t,o))return o}return null}function Ts(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)&&Ca(t,n,s)===0||uE(s,r,Math.min(i,n))))return s;const o=Iu.search(e,Ca.bind(null,t,n));return o&&(o!==r||!s)?o:s}function uE(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 Ca(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 hE(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function dE(r,e){return Iu.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var yt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class fE{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:yt.DoNothing,flags:zt.None};return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.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===Ue.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Ue.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=yt.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:yt.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:yt.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=mu(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Bs(i,s,ys(e),e.response))return{action:yt.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=mu(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++,Bs(a,l,ys(e),e.response)))return{action:yt.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=Ts(e.frag,K.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(v===Ue.AUDIO_TRACK&&$.hasAudioGroup(x)||v===Ue.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:yt.SendAlternateToPenaltyBox,flags:zt.None,nextAutoLevel:c}}return{action:yt.SendAlternateToPenaltyBox,flags:zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case yt.DoNothing:break;case yt.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=pa[pa.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 va{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&&Au(n);return new cu(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&&nE(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=aE(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=Au(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=vs.No),new cu(n,i,s)}checkRetry(e){const t=e.details,n=ys(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===yt.RetryRequest||!i.resolved&&s===yt.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=Ia(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 gE{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 Cu={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},vu={};function pE(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 mE(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(Cu);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:dt(dt({},s),{},{contentType:fi(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:fi(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=EE(l);return vu[A]||(vu[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 EE(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 IE(){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 CE(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||Cs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:IE(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function vE(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}=CE(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 Br(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),x;if(!k.hasDefaultAudio)return Br(R,"no renditions with default or auto-select sound found"),x;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Br(R,`audio codec preference "${a}" not found`),x;if(o&&!l){if(!k.channels[o])return Br(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 Br(R,"no renditions with stereo sound found"),x;return k.minHeight>Q?(Br(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),x):k.minFramerate>b?(Br(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),x):g.some($=>k.videoRanges[$]>0)?k.maxScore<f?(Br(R,`max score of ${k.maxScore} < selected max of ${f}`),x):x&&(ps(R)>=ps(x)||k.fragmentError>r[x].fragmentError)?x:(f=k.maxScore,R):(Br(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),x)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Br(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function yE(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 BE(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 Ar(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||TE(a,e.characteristics))&&(t===void 0||t(r,e))}function TE(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 QE(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=yu(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 Ar(r,f,i)>-1});return u>-1?u:yu(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return Ar(r,f,i)>-1})}function yu(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 bE{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 RI(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=MI(g));if(v){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=PI(f,O,t,n)),P=NI(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"&&DI(P,O,R,k,e,H)?(P.supportedPromise=_I(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=rh}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 HI{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 ft={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class $I{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=Qn(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),Fs(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=Qn(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&&Fs(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||Fs(t))}getState(e){const t=Qn(e),n=this.fragments[t];return n?n.buffered?Fs(n)?ft.PARTIAL:ft.OK:ft.APPENDING:ft.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=Qn(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=Qn(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=Qn(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 Fs(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 Qn(r){return`${r.type}_${r.level}_${r.sn}`}const YI={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),YI}}}class Pa{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=ks(),this.buffering={audio:ks(),video:ks(),audiovideo:ks()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function ks(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Ns(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 VI(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function KI(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=Ns(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function sh(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function oh(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)sh(t[n],r);e.fragmentHint&&sh(e.fragmentHint,r),e.alignedSliding=!0}function JI(r,e,t){e&&(WI(r,t,e),!t.alignedSliding&&e&&Ms(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&qu(e,t))}function WI(r,e,t){if(VI(r,t,e)){const n=KI(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),oh(n.start,e))}}function Ms(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=Ns(n,o),s=Ns(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=Ns(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);oh(A,r)}const ah=Math.pow(2,17);class qI{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 Tr({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(Ah(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=lh(e),u=eh(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:ah};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 Tr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:dt({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 Tr({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 Tr({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(Ah(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=lh(e,t),u=eh(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ah};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 Tr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:dt({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 Tr({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 Tr({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 lh(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 Ah(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 Tr(n)}class Tr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class jI{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 XI{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?Zr(r,0,e-t):r}class ZI{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 eC=16;class Oa{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=Ht(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 ZI),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=Zr(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 XI(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new jI(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%eC;return n!==e.length&&(t=Zr(e,0,n),this.remainderData=Zr(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const tC={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 Ua extends HI{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 qI(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Oa(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)===ft.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)===ft.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?tC.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 Pa(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=ju(n,e.sn,u.index+1)||Xu(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?ju(a,s,o):null,A=l?l.fragment:BI(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=Ht(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){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===ft.OK||n===ft.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=QI(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=wI(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=Ls(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===ft.OK||f===ft.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)!==ft.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;JI(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===yt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=ka(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!==yt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===yt.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=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:Wu(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 ch{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=rC(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function rC(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 nC(){return typeof __HLS_WORKER_BUNDLE__=="function"}function iC(){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 sC(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function cr(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Ga{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=Ht(this.cachedData,e),this.cachedData=null);let n=fi(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?va(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=oC(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:Xt.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 wE(e,i)?(n=fi(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Xt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=Zr(e,s);this.cachedData?this.cachedData=Ht(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:cr(),id3Track:a,textTrack:cr()}}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:cr(),id3Track:this._id3Track,textTrack:cr()}}destroy(){}}const oC=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function aC(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 uh(r,e){return r[e]===255&&(r[e+1]&246)===240}function hh(r,e){return r[e+1]&1?7:9}function Ha(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function lC(r,e){return e+5<r.length}function Ps(r,e){return e+1<r.length&&uh(r,e)}function AC(r,e){return lC(r,e)&&uh(r,e)&&Ha(r,e)<=r.length-e}function cC(r,e){if(Ps(r,e)){const t=hh(r,e);if(e+t>=r.length)return!1;const n=Ha(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Ps(r,i)}return!1}function dh(r,e,t,n,i){if(!r.samplerate){const s=aC(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 fh(r){return 9216e4/r}function uC(r,e){const t=hh(r,e);if(e+t<=r.length){const n=Ha(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function gh(r,e,t,n,i){const s=fh(r.samplerate),o=n+i*s,a=uC(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 Os=null;const hC=[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],dC=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],fC=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],gC=[0,1,1,4];function ph(r,e,t,n,i){if(t+24>e.length)return;const s=mh(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 mh(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=hC[l*14+i-1]*1e3,u=dC[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=fC[t][n],f=gC[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Os===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Os=b?parseInt(b[1]):0}return!!Os&&Os<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function $a(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Eh(r,e){return e+1<r.length&&$a(r,e)}function pC(r,e){return $a(r,e)&&4<=r.length-e}function Ih(r,e){if(e+1<r.length&&$a(r,e)){const n=mh(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Eh(r,s)}return!1}class mC extends Ga{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=fi(e,0);let n=(t==null?void 0:t.length)||0;if(Ih(e,n))return!1;for(let i=e.length;n<i;n++)if(cC(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return AC(e,t)}appendFrame(e,t,n){dh(e,this.observer,t,n,e.manifestCodec);const i=gh(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const EC=/\/emsg[-/]ID3/i;class IC{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=cr("video",1),o=this.audioTrack=cr("audio",1),a=this.txtTrack=cr("text",1);if(this.id3Track=cr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=vu(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=mu.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return ME(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Ht(this.remainderData,e));const a=VE(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Bu(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=Bu(e,t),{videoTrack:t,audioTrack:cr(),id3Track:i,textTrack:cr()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=WE(s);if(EC.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:Xt.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 Ch=(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 CC extends Ga{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=vh(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=fi(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&va(t)!==void 0&&Ch(e,n)<16}}function vh(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 vC{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 yh{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 yC extends vC{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 yh(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,Tu(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,y=new yh(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=Ht(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=Ht(d.data,t))}return e.naluState=i,o}}class BC{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Oa(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=Qu(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 gt=188;class Mr{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 yC}static probe(e){const t=Mr.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(gt*5,t-gt)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=gt)if(e[l]===71&&(t-l===gt||e[l+gt]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+gt*99,e.length-gt)+1)),s||(s=Ya(e,l)===0),s&&a>1&&(o===0&&a>2||l+gt>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:mu[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=Mr.createTrack("video"),this._audioTrack=Mr.createTrack("audio",i),this._id3Track=Mr.createTrack("id3"),this._txtTrack=Mr.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=Ht(this.remainderData,e),b=e.length,this.remainderData=null),b<gt&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const v=Math.max(0,Mr.syncOffset(e));b-=(b-v)%gt,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+=gt)if(e[k]===71){const H=!!(e[k+1]&64),V=Ya(e,k),O=(e[k+3]&48)>>4;let W;if(O>1){if(W=k+5+e[k+4],W===k+gt)continue}else W=k+4;switch(V){case c:H&&(u&&(s=bn(u))&&this.videoParser.parseAVCPES(o,A,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(W,k+gt)),u.size+=k+gt-W);break;case h:if(H){if(f&&(s=bn(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+gt)),f.size+=k+gt-W);break;case d:H&&(g&&(s=bn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(W,k+gt)),g.size+=k+gt-W);break;case 0:H&&(W+=e[W]+1),Q=this._pmtId=TC(e,W);break;case Q:{H&&(W+=e[W]+1);const ie=QC(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&&Us(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=bn(o))?(this.videoParser.parseAVCPES(n,s,A,!0,this._duration),n.pesData=null):n.pesData=o,a&&(A=bn(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=bn(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 BC(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=Ht(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&&!Ps(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",Us(this.observer,new Error(u),h),!h)return}dh(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=fh(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=gh(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Ps(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(Eh(n,o)){const l=ph(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=vh(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=st({},t,{type:this._videoTrack?Xt.emsg:Xt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Ya(r,e){return((r[e+1]&31)<<8)+r[e+2]}function TC(r,e){return(r[e+10]&31)<<8|r[e+11]}function QC(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=Ya(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){Va("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){Va("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){Va("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 Us(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Us(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function Us(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 Va(r){U.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function bn(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]=Ht(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 bC extends Ga{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=fi(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&va(t)!==void 0&&Ch(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Ih(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return pC(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return ph(e,t,n,this.basePTS,this.frameIndex)}}class Bh{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 Pr=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/(Pr+1)),i=Math.floor(t%(Pr+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/(Pr+1)),i=Math.floor(t%(Pr+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/(Pr+1)),a=Math.floor(n%(Pr+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/(Pr+1)),o=Math.floor(t%(Pr+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 Ht(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 Th=9e4;function Ka(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function xC(r,e,t=1,n=!1){return Ka(r,e,1/t,n)}function mi(r,e=!1){return Ka(r,1e3,1/Th,e)}function wC(r,e=1){return Ka(r,Th,1/e)}const SC=10*1e3,Qh=1024,RC=1152,DC=1536;let xn=null,Ja=null;class Gs{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,xn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);xn=o?parseInt(o[1]):0}if(Ja===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Ja=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,$t(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=_C(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=($t(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=bh(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=xh(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,$t(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-$t(o[0].dts,o[0].pts);xn&&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=$t(F.pts-Q,c),F.dts=$t(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: ${mi(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${mi(-S,!0)} ms (${S}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!J||c>=o[0].pts||xn)){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: ${mi(Y,!0)}/${mi(d,!0)}, delta: ${mi(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,He=Se.data.byteLength;O.setUint32(u,He),u+=4,V.set(Le,u),u+=He,Y+=4+He}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 wh(F.key,h,Y,ce))}if(a.length){if(xn){if(xn<70){const S=a[0].flags;S.dependsOn=2,S.isNonSync=0}}else if(Ja&&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,st({},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 RC;case"ac3":return DC;default:return Qh}}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($t(g[0].pts-b,Q)-y)<20*c),g.forEach(function(P){P.pts=$t(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<SC&&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=Bh.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 wh(!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,st({},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*Qh,f=Math.ceil((h-u)/d),g=Bh.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 $t(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 _C(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function bh(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=$t(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=$t(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function xh(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=$t(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 wh{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 LC{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(UE(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=vu(e);i.audio&&(t=Sh(i.audio,$e.AUDIO)),i.video&&(n=Sh(i.video,$e.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=HE(h,f),p=GE(f,h),y=p===null?s:p;(FC(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;YE(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=bh(n,s,A,A),i.samples.length&&(u.text=xh(i,s,A)),u}}function FC(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 Sh(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===$e.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return bs(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 Qr;try{Qr=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),Qr=In==null?void 0:In.Date.now}const Hs=[{demux:IC,remux:LC},{demux:Mr,remux:Gs},{demux:mC,remux:Gs},{demux:bC,remux:Gs}];Hs.splice(2,0,{demux:CC,remux:Gs});class Rh{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=Qr();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=kC(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=Qr(),Wa(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=Qr(),Wa(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=Qr(),R}flush(e){const t=e.transmuxing;t.executeStart=Qr();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=Qr(),[Wa(e)];const c=l.flush(a);return $s(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=Qr()}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=Hs.length;h<d;h++){var a;if((a=Hs[h].demux)!=null&&a.probe(e)){o=Hs[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 Oa(this.config)),e}}function kC(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 Wa=r=>({remuxResult:{},chunkMeta:r});function $s(r){return"then"in r&&r.then instanceof Function}class NC{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 MC{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 Dh={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})(Dh);var PC=Dh.exports,qa=aE(PC);class _h{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 qa,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=en(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||nC())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=sC(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=iC()),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 Rh(this.observer,l,s,"",t)}return}this.transmuxer=new Rh(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 MC(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 gE(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=yE(g));if(v){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=BE(f,O,t,n)),P=vE(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"&&pE(P,O,R,k,e,$)?(P.supportedPromise=mE(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=Cu}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 xE{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 ft={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class wE{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),Qs(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&&Qs(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||Qs(t))}getState(e){const t=bn(e),n=this.fragments[t];return n?n.buffered?Qs(n)?ft.PARTIAL:ft.OK:ft.APPENDING:ft.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 Qs(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 SE={length:0,start:()=>0,end:()=>0};class We{static isBuffered(e,t){try{if(e){const n=We.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=We.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),SE}}}class ya{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=bs(),this.buffering={audio:bs(),video:bs(),audiovideo:bs()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function bs(){return{start:0,executeStart:0,executeEnd:0,end:0}}function xs(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 RE(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function DE(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=xs(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function Bu(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function Tu(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)Bu(t[n],r);e.fragmentHint&&Bu(e.fragmentHint,r),e.alignedSliding=!0}function _E(r,e,t){e&&(LE(r,t,e),!t.alignedSliding&&e&&ws(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&du(e,t))}function LE(r,e,t){if(RE(r,t,e)){const n=DE(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Tu(n.start,e))}}function ws(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=xs(n,o),s=xs(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=xs(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);Tu(A,r)}const Qu=Math.pow(2,17);class FE{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 Tr({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(xu(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=bu(e),u=Eu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Qu};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 Tr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:dt({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 Tr({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 Tr({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(xu(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=bu(e,t),u=Eu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Qu};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 Tr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:dt({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 Tr({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 Tr({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 bu(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 xu(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 Tr(n)}class Tr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class kE{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 NE{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 ME(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?Zr(r,0,e-t):r}class PE{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 OE=16;class Ba{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?ME(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=Ht(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 PE),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=Zr(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 NE(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new kE(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%OE;return n!==e.length&&(t=Zr(e,0,n),this.remainderData=Zr(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const UE={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 Ta extends xE{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 FE(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ba(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 We.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=We.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)===ft.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)===ft.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?UE.toString(We.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 ya(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=fu(n,e.sn,u.index+1)||gu(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?fu(a,s,o):null,A=l?l.fragment:lE(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=Ht(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(!We.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=We.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=We.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 We.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===ft.OK||n===ft.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=cE(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=dE(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=Ts(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===ft.OK||f===ft.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)!==ft.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;_E(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===yt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Ia(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!==yt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===yt.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=We.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:hu(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 wu{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=GE(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function GE(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 HE(){return typeof __HLS_WORKER_BUNDLE__=="function"}function $E(){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 YE(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function cr(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Qa{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=Ht(this.cachedData,e),this.cachedData=null);let n=hi(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?sa(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=VE(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:jt.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 hm(e,i)?(n=hi(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:jt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=Zr(e,s);this.cachedData?this.cachedData=Ht(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:cr(),id3Track:a,textTrack:cr()}}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:cr(),id3Track:this._id3Track,textTrack:cr()}}destroy(){}}const VE=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function KE(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 Su(r,e){return r[e]===255&&(r[e+1]&246)===240}function Ru(r,e){return r[e+1]&1?7:9}function ba(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function JE(r,e){return e+5<r.length}function Ss(r,e){return e+1<r.length&&Su(r,e)}function WE(r,e){return JE(r,e)&&Su(r,e)&&ba(r,e)<=r.length-e}function qE(r,e){if(Ss(r,e)){const t=Ru(r,e);if(e+t>=r.length)return!1;const n=ba(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Ss(r,i)}return!1}function Du(r,e,t,n,i){if(!r.samplerate){const s=KE(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 _u(r){return 9216e4/r}function XE(r,e){const t=Ru(r,e);if(e+t<=r.length){const n=ba(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Lu(r,e,t,n,i){const s=_u(r.samplerate),o=n+i*s,a=XE(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 Rs=null;const jE=[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],ZE=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],eI=[0,1,1,4];function Fu(r,e,t,n,i){if(t+24>e.length)return;const s=ku(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 ku(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=jE[l*14+i-1]*1e3,u=zE[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=ZE[t][n],f=eI[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Rs===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Rs=b?parseInt(b[1]):0}return!!Rs&&Rs<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function xa(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Nu(r,e){return e+1<r.length&&xa(r,e)}function tI(r,e){return xa(r,e)&&4<=r.length-e}function Mu(r,e){if(e+1<r.length&&xa(r,e)){const n=ku(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Nu(r,s)}return!1}class rI extends Qa{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=hi(e,0);let n=(t==null?void 0:t.length)||0;if(Mu(e,n))return!1;for(let i=e.length;n<i;n++)if(qE(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return WE(e,t)}appendFrame(e,t,n){Du(e,this.observer,t,n,e.manifestCodec);const i=Lu(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const nI=/\/emsg[-/]ID3/i;class iI{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=cr("video",1),o=this.audioTrack=cr("audio",1),a=this.txtTrack=cr("text",1);if(this.id3Track=cr("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Oc(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=kc.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return vm(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Ht(this.remainderData,e));const a=Sm(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Gc(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=Gc(e,t),{videoTrack:t,audioTrack:cr(),id3Track:i,textTrack:cr()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=_m(s);if(nI.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:jt.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 Pu=(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 sI extends Qa{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=Ou(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=hi(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&sa(t)!==void 0&&Pu(e,n)<16}}function Ou(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 oI{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 Uu{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 aI extends oI{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 Uu(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,Hc(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,C=new Uu(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=Ht(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=Ht(d.data,t))}return e.naluState=i,o}}class lI{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Ba(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=$c(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 gt=188;class Mr{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 aI}static probe(e){const t=Mr.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(gt*5,t-gt)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=gt)if(e[l]===71&&(t-l===gt||e[l+gt]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+gt*99,e.length-gt)+1)),s||(s=wa(e,l)===0),s&&a>1&&(o===0&&a>2||l+gt>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:kc[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=Mr.createTrack("video"),this._audioTrack=Mr.createTrack("audio",i),this._id3Track=Mr.createTrack("id3"),this._txtTrack=Mr.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=Ht(this.remainderData,e),b=e.length,this.remainderData=null),b<gt&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const v=Math.max(0,Mr.syncOffset(e));b-=(b-v)%gt,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+=gt)if(e[k]===71){const $=!!(e[k+1]&64),K=wa(e,k),O=(e[k+3]&48)>>4;let W;if(O>1){if(W=k+5+e[k+4],W===k+gt)continue}else W=k+4;switch(K){case c:$&&(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+gt)),u.size+=k+gt-W);break;case h:if($){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+gt)),f.size+=k+gt-W);break;case d:$&&(g&&(s=xn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(W,k+gt)),g.size+=k+gt-W);break;case 0:$&&(W+=e[W]+1),Q=this._pmtId=AI(e,W);break;case Q:{$&&(W+=e[W]+1);const ie=cI(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&&Ds(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=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 lI(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=Ht(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&&!Ss(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",Ds(this.observer,new Error(u),h),!h)return}Du(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=_u(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=Lu(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Ss(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(Nu(n,o)){const l=Fu(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=Ou(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=st({},t,{type:this._videoTrack?jt.emsg:jt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function wa(r,e){return((r[e+1]&31)<<8)+r[e+2]}function AI(r,e){return(r[e+10]&31)<<8|r[e+11]}function cI(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=wa(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){Sa("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){Sa("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){Sa("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 Ds(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Ds(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function Ds(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 Sa(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]=Ht(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 uI extends Qa{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=hi(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&sa(t)!==void 0&&Pu(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(Mu(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return tI(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return Fu(e,t,n,this.basePTS,this.frameIndex)}}class Gu{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 Pr=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/(Pr+1)),i=Math.floor(t%(Pr+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/(Pr+1)),i=Math.floor(t%(Pr+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/(Pr+1)),a=Math.floor(n%(Pr+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/(Pr+1)),o=Math.floor(t%(Pr+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 Ht(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 Hu=9e4;function Ra(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function hI(r,e,t=1,n=!1){return Ra(r,e,1/t,n)}function gi(r,e=!1){return Ra(r,1e3,1/Hu,e)}function dI(r,e=1){return Ra(r,Hu,1/e)}const fI=10*1e3,$u=1024,gI=1152,pI=1536;let wn=null,Da=null;class _s{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(Da===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Da=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,$t(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=mI(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=($t(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=Yu(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=Vu(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,$t(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-$t(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=$t(F.pts-Q,c),F.dts=$t(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: ${gi(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${gi(-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: ${gi(Y,!0)}/${gi(d,!0)}, delta: ${gi(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,He=Se.data.byteLength;O.setUint32(u,He),u+=4,K.set(Le,u),u+=He,Y+=4+He}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 Ku(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(Da&&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,st({},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 gI;case"ac3":return pI;default:return $u}}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($t(g[0].pts-b,Q)-C)<20*c),g.forEach(function(P){P.pts=$t(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<fI&&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=Gu.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 Ku(!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,st({},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*$u,f=Math.ceil((h-u)/d),g=Gu.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 $t(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 mI(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function Yu(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=$t(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=$t(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function Vu(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=$t(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 Ku{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 EI{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(Tm(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=Oc(e);i.audio&&(t=Ju(i.audio,$e.AUDIO)),i.video&&(n=Ju(i.video,$e.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=bm(h,f),p=Qm(f,h),C=p===null?s:p;(II(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;wm(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=Yu(n,s,A,A),i.samples.length&&(u.text=Vu(i,s,A)),u}}function II(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 Ju(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===$e.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return ms(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 Qr;try{Qr=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),Qr=Cn==null?void 0:Cn.Date.now}const Ls=[{demux:iI,remux:EI},{demux:Mr,remux:_s},{demux:rI,remux:_s},{demux:uI,remux:_s}];Ls.splice(2,0,{demux:sI,remux:_s});class Wu{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=Qr();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=CI(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=Qr(),_a(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=Qr(),_a(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=Qr(),R}flush(e){const t=e.transmuxing;t.executeStart=Qr();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=Qr(),[_a(e)];const c=l.flush(a);return Fs(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=Qr()}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=Ls.length;h<d;h++){var a;if((a=Ls[h].demux)!=null&&a.probe(e)){o=Ls[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 Ba(this.config)),e}}function CI(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 _a=r=>({remuxResult:{},chunkMeta:r});function Fs(r){return"then"in r&&r.then instanceof Function}class vI{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 yI{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 qu={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})(qu);var BI=qu.exports,La=Kp(BI);class Xu{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 La,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=en(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||HE())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=YE(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=$E()),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 Wu(this.observer,l,s,"",t)}return}this.transmuxer=new Wu(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 yI(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 NC(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);$s(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);$s(n)||t.async?($s(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 Lh(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!wn(r[t].attrs,e[t].attrs))return!1;return!0}function wn(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 ja(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const Fh=100;class OC extends Ua{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(Fh),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);Na(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,$e.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&&!wn(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 vn(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(Fh):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)Ms(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 _h(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 Pa(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 ch,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,dt({},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)===Ue.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!==$e.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==$e.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[$e.AUDIO]={startPTS:p,endPTS:y,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo($e.AUDIO,p,y,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=st({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=st({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===ft.NOT_LOADED||i===ft.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&&Ms(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,dt({},e))}}class UC extends Ma{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=Ar(l,a,Tn);if(h>-1)s=a[h];else{const d=Ar(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===Ue.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&&Bn(e,i,Tn))return i;const s=Ar(e,this.tracksInGroup,Tn);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=UI(e,t.levels,n,o,Tn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=Ar(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,dt({},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||Bn(e,i,Tn)))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(Bn({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},c,Tn))return A}for(let A=0;A<t.length;A++){const c=t[A];if(wn(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return A}for(let A=0;A<t.length;A++){const c=t[A];if(wn(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 kh=500;class GC extends Ua{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(kh),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&&Lh(this.levels,t)){this.levels=t.map(n=>new vn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new vn(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(kh)}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?(Ms(o,u),A=o.fragments[0].start):h&&(A=h.start,Fa(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,Fa(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&&(Ls(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=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 y=i.maxFragLookUpTolerance,Q=a>f-y?0:y;g=Ls(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)===ft.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===ft.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 HC(this.tracksBuffered[this.currentTrackId]||[])}}class HC{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 $C extends Ma{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=xs(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),xs(this.media.textTracks).forEach(t=>{Cn(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=Ar(a,o);if(c>-1)s=o[c];else{const u=Ar(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||Bn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(wn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(wn(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(ja(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Ue.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&&Bn(e,n))return n;const i=Ar(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=Ar(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=xs(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>ja(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 YC{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 Nh=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class VC{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=eI(en(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 YC(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=en(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,Mh(n),KC(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&&Mh(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=Du(l.codec,l.levelCodec),g=f==null?void 0:f.replace(Nh,"$1");let p=Du(c,u);const y=(a=p)==null?void 0:a.replace(Nh,"$1");if(p&&g!==y){o.slice(0,5)==="audio"&&(p=bs(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]=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: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[$e.AUDIOVIDEO]?s.push("audiovideo"):(o[$e.AUDIO]&&s.push("audio"),o[$e.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: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=bs(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 Mh(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function KC(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const JC={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},Ph=r=>String.fromCharCode(JC[r]||r),Zt=15,br=100,WC={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},qC={17:2,18:4,21:6,22:8,23:10,19:13,20:15},jC={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},XC={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 ZC{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 tn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Oh{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let 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 ev{constructor(){this.uchar=" ",this.penState=new Oh}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class tv{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Oh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<br;t++)this.chars.push(new ev);this.logger=e}equals(e){for(let t=0;t<br;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<br;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<br;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>br&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=br)}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=Ph(e);if(this.pos>=br){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<br;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<br;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 Xa{constructor(e){this.rows=[],this.currRow=Zt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Zt;t++)this.rows.push(new tv(e));this.logger=e}reset(){for(let e=0;e<Zt;e++)this.rows[e].clear();this.currRow=Zt-1}equals(e){let t=!0;for(let n=0;n<Zt;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<Zt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Zt;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<Zt;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<Zt;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 Uh{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 Xa(n),this.nonDisplayedMemory=new Xa(n),this.lastOutputScreen=new Xa(n),this.currRollUpRow=this.displayedMemory.rows[Zt-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[Zt-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 Gh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=nv(),this.logger=void 0;const i=this.logger=new ZC;this.channels=[null,new Uh(e,t,i),new Uh(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,()=>"["+tn([t[n],t[n+1]])+"] -> ("+tn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(rv(i,s,l)){Ys(null,null,l),this.logger.log(3,()=>"Repeated command ("+tn([i,s])+") is dropped");continue}Ys(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 Ys(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 "+tn([i,s])+" orig: "+tn([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 ("+tn([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?WC[e]:jC[e]:n=o===1?qC[e]:XC[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 '"+Ph(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 = "+tn(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()}Ys(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 Ys(r,e,t){t.a=r,t.b=e}function rv(r,e,t){return t.a===r&&t.b===e}function nv(){return{a:null,b:null}}class Vs{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(In!=null&&In.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 iv{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Hh(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 sv{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 $h(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 Za=new za(0,0,""),Ks=Za.align==="middle"?"middle":"center";function ov(r,e,t){const n=r;function i(){const a=Hh(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 sv;$h(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",Ks,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Ks,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Ks,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&Za.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",Ks);let u=A.get("position","auto");u==="auto"&&Za.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 Yh(r){return r.replace(/<br(?: \/)?>/gi,`
2478
- `)}class av{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new iv,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=Yh(s);o<s.length&&s[o]!=="\r"&&s[o]!==`
2476
+ initSegmentChange: ${$}`);const O=new vI(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);Fs(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);Fs(n)||t.async?(Fs(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 ju(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 Fa(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const zu=100;class TI extends Ta{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=We.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Ca(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,$e.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&&!Sn(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 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(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)ws(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 Xu(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 ya(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 wu,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&&We.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,dt({},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)===Ue.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!==$e.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==$e.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[$e.AUDIO]={startPTS:p,endPTS:C,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo($e.AUDIO,p,C,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=st({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=st({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===ft.NOT_LOADED||i===ft.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&&ws(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,dt({},e))}}class QI extends va{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=Ar(l,a,Qn);if(h>-1)s=a[h];else{const d=Ar(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===Ue.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=Ar(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=QE(e,t.levels,n,o,Qn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=Ar(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,dt({},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 Zu=500;class bI extends Ta{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(Zu),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&&ju(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(Zu)}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?(ws(o,u),A=o.fragments[0].start):h&&(A=h.start,Ea(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,Ea(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&&(Ts(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=We.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=Ts(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)===ft.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===ft.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 xI(this.tracksBuffered[this.currentTrackId]||[])}}class xI{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 wI extends va{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=Es(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),Es(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=Ar(a,o);if(c>-1)s=o[c];else{const u=Ar(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(Fa(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Ue.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=Ar(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=Ar(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=Es(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>Fa(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 SI{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 eh=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class RI{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=Om(en(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 SI(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=en(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,th(n),DI(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&&th(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=qc(l.codec,l.levelCodec),g=f==null?void 0:f.replace(eh,"$1");let p=qc(c,u);const C=(a=p)==null?void 0:a.replace(eh,"$1");if(p&&g!==C){o.slice(0,5)==="audio"&&(p=ms(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]=We.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[$e.AUDIOVIDEO]?s.push("audiovideo"):(o[$e.AUDIO]&&s.push("audio"),o[$e.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=We.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=We.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=ms(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 th(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function DI(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const _I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},rh=r=>String.fromCharCode(_I[r]||r),Zt=15,br=100,LI={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},FI={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kI={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},NI={25:2,26:4,29:6,30:8,31:10,27:13,28:15},MI=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class PI{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 tn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class nh{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let 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 OI{constructor(){this.uchar=" ",this.penState=new nh}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class UI{constructor(e){this.chars=[],this.pos=0,this.currPenState=new nh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<br;t++)this.chars.push(new OI);this.logger=e}equals(e){for(let t=0;t<br;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<br;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<br;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>br&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=br)}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=rh(e);if(this.pos>=br){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<br;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<br;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 ka{constructor(e){this.rows=[],this.currRow=Zt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Zt;t++)this.rows.push(new UI(e));this.logger=e}reset(){for(let e=0;e<Zt;e++)this.rows[e].clear();this.currRow=Zt-1}equals(e){let t=!0;for(let n=0;n<Zt;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<Zt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Zt;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<Zt;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<Zt;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 ih{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 ka(n),this.nonDisplayedMemory=new ka(n),this.lastOutputScreen=new ka(n),this.currRollUpRow=this.displayedMemory.rows[Zt-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[Zt-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 sh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=HI(),this.logger=void 0;const i=this.logger=new PI;this.channels=[null,new ih(e,t,i),new ih(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,()=>"["+tn([t[n],t[n+1]])+"] -> ("+tn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(GI(i,s,l)){ks(null,null,l),this.logger.log(3,()=>"Repeated command ("+tn([i,s])+") is dropped");continue}ks(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 ks(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 "+tn([i,s])+" orig: "+tn([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 ("+tn([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?LI[e]:kI[e]:n=o===1?FI[e]:NI[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 '"+rh(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 = "+tn(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=MI[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()}ks(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 ks(r,e,t){t.a=r,t.b=e}function GI(r,e,t){return t.a===r&&t.b===e}function HI(){return{a:null,b:null}}class Ns{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 Na=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,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 $I{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function oh(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 YI{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 ah(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 Ma=new Na(0,0,""),Ms=Ma.align==="middle"?"middle":"center";function VI(r,e,t){const n=r;function i(){const a=oh(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 YI;ah(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",Ms,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Ms,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Ms,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&Ma.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",Ms);let u=A.get("position","auto");u==="auto"&&Ma.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 lh(r){return r.replace(/<br(?: \/)?>/gi,`
2478
+ `)}class KI{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new $I,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=lh(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){$h(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{ov(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){ah(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 Na(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{VI(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 lv=/\r\n|\n\r|\n|\r/g,el=function(e,t,n=0){return e.slice(n,n+t.length)===t},Av=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},tl=function(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()};function rl(r,e,t){return tl(r.toString())+tl(e.toString())+tl(t)}const cv=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 uv(r,e,t,n,i,s,o){const a=new av,l=sr(new Uint8Array(r)).trim().replace(lv,`
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 JI=/\r\n|\n\r|\n|\r/g,Pa=function(e,t,n=0){return e.slice(n,n+t.length)===t},WI=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},Oa=function(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()};function Ua(r,e,t){return Oa(r.toString())+Oa(e.toString())+Oa(t)}const qI=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 XI(r,e,t,n,i,s,o){const a=new KI,l=sr(new Uint8Array(r)).trim().replace(JI,`
2484
2484
  `).split(`
2485
- `),A=[],c=e?wC(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:cv(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=$t((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=rl(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(el(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(y=>{el(y,"LOCAL:")?u=y.slice(6):el(y,"MPEGTS:")&&(h=parseInt(y.slice(7)))});try{d=Av(u)/1e3}catch(y){f=y}return}else p===""&&(g=!1);a.parse(p+`
2486
- `)}),a.flush()}const nl="stpp.ttml.im1t",Vh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Kh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,hv={left:"start",center:"center",right:"end",start:"start",end:"end"};function Jh(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=>sr(a)),o=xC(e.baseTime,1,e.timescale);try{s.forEach(a=>t(dv(a,o)))}catch(a){n(a)}}function dv(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=Wh(il(i,"styling","style")),A=Wh(il(i,"layout","region")),c=il(i,"body","[begin]");return[].map.call(c,u=>{const h=qh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=ol(u.getAttribute("begin"),o),f=ol(u.getAttribute("dur"),o);let g=ol(u.getAttribute("end"),o);if(d===null)throw jh(u);if(g===null){if(f===null)throw jh(u);g=d+f}const p=new za(d-e,g-e,h);p.id=rl(p.startTime,p.endTime,p.text);const y=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=fv(y,Q,l),{textAlign:v}=b;if(v){const w=hv[v];w&&(p.lineAlign=w),p.align=v}return st(p,b),p}).filter(u=>u!==null)}function il(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function Wh(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function qh(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?qh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function fv(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=sl(e,n,l)||sl(r,n,l)||sl(i,n,l);return A&&(a[l]=A),a},{})}function sl(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function jh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function ol(r,e){if(!r)return null;let t=Hh(r);return t===null&&(Vh.test(r)?t=gv(r,e):Kh.test(r)&&(t=pv(r,e))),t}function gv(r,e){const t=Vh.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 pv(r,e){const t=Kh.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 mv{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=Zh(),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 Vs(this,"textTrack1"),t=new Vs(this,"textTrack2"),n=new Vs(this,"textTrack3"),i=new Vs(this,"textTrack4");this.cea608Parser1=new Gh(1,e,t),this.cea608Parser2=new Gh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=Ev(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,Cn(n[e]),Hu(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=>{Cn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Zh(),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++)Cn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===nl);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Lh(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?xs(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)Cn(c);else{const u=Xh(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===nl?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;Jh(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?Ht(n.initSegment.data,new Uint8Array(i)):i;uv(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||Jh(t,this.initPTS[e.cc],()=>{n.textCodec=nl,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=>$u(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=>Sa(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>Sa(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 Xh(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===Xh(e)&&ja(e,r)}function Ev(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function Zh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class al{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,al.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 Iv{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 Js="[eme]";class Sn{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=Sn.CDMCleanupPromise?[Sn.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,Js),this.log=U.log.bind(U,Js),this.warn=U.warn.bind(U,Js),this.error=U.error.bind(U,Js),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===We.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 Yt?a(u):a(new Yt({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 du===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=bE(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: ${or.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 or.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${or.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(cu).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=hu(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 Yt?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=cu(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 Yt({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[We.FAIRPLAY]){const c=ut(new Uint8Array(n));try{const u=ma(JSON.parse(c).sinf),h=yu(new Uint8Array(u));if(!h)return;i=h.subarray(8,24),s=We.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=XE(n);if(c===null)return;c.version===0&&c.systemId===uu.WIDEVINE&&c.data&&(i=c.data.subarray(8,24)),s=QE(c.systemId)}if(!s||!i)return;const o=or.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=or.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 gi("ISO-23001-7",o,(h=hu(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 qa,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===We.FAIRPLAY&&(this.updateKeySession(e,Ea("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 Yt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Yt({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 Yt({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: ${or.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${or.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 Yt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:dt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Yt({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 Yt({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 Yt({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 Ea(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 Yt({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==We.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={},gi.clearKeyUriToKeyIdMap();const n=t.length;Sn.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}`)})}}}Sn.CDMCleanupPromise=void 0;class Yt 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 Tt;(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"})(Tt||(Tt={}));var ll;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(ll||(ll={}));var rn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(rn||(rn={}));const Cv={[rn.OBJECT]:["br","d","ot","tb"],[rn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[rn.SESSION]:["cid","pr","sf","sid","st","v"],[rn.STATUS]:["bs","rtp"]};class Rn{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(n=>n instanceof Rn?n:new Rn(n))),this.value=e,this.params=t}}class ed{constructor(e){this.description=void 0,this.description=e}}const vv="Dict";function yv(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 Bv(r,e,t,n){return new Error(`failed to ${r} "${yv(e)}" as ${t}`,{cause:n})}const td="Bare Item",Tv="Boolean",Qv="Byte Sequence",bv="Decimal",xv="Integer";function wv(r){return r<-999999999999999||999999999999999<r}const Sv=/[\x00-\x1f\x7f]+/,Rv="Token",Dv="Key";function ur(r,e,t){return Bv("serialize",r,e,t)}function _v(r){if(typeof r!="boolean")throw ur(r,Tv);return r?"?1":"?0"}function Lv(r){return btoa(String.fromCharCode(...r))}function Fv(r){if(ArrayBuffer.isView(r)===!1)throw ur(r,Qv);return`:${Lv(r)}:`}function rd(r){if(wv(r))throw ur(r,xv);return r.toString()}function kv(r){return`@${rd(r.getTime()/1e3)}`}function nd(r,e){if(r<0)return-nd(-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 Nv(r){const e=nd(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ur(r,bv);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Mv="String";function Pv(r){if(Sv.test(r))throw ur(r,Mv);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ov(r){return r.description||r.toString().slice(7,-1)}function id(r){const e=Ov(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ur(e,Rv);return e}function Al(r){switch(typeof r){case"number":if(!he(r))throw ur(r,td);return Number.isInteger(r)?rd(r):Nv(r);case"string":return Pv(r);case"symbol":return id(r);case"boolean":return _v(r);case"object":if(r instanceof Date)return kv(r);if(r instanceof Uint8Array)return Fv(r);if(r instanceof ed)return id(r);default:throw ur(r,td)}}function cl(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw ur(r,Dv);return r}function ul(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${cl(e)}`:`;${cl(e)}=${Al(t)}`).join("")}function sd(r){return r instanceof Rn?`${Al(r.value)}${ul(r.params)}`:Al(r)}function Uv(r){return`(${r.value.map(sd).join(" ")})${ul(r.params)}`}function Gv(r,e={whitespace:!0}){if(typeof r!="object")throw ur(r,vv);const t=r instanceof Map?r.entries():Object.entries(r),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof Rn||(s=new Rn(s));let o=cl(i);return s.value===!0?o+=ul(s.params):(o+="=",Array.isArray(s.value)?o+=Uv(s):o+=sd(s)),o}).join(`,${n}`)}function Hv(r,e){return Gv(r,e)}const $v=r=>r==="ot"||r==="sf"||r==="st",Yv=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function Vv(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 Kv(){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 Ws=r=>Math.round(r),Jv=(r,e)=>(e!=null&&e.baseUrl&&(r=Vv(r,e.baseUrl)),encodeURIComponent(r)),qs=r=>Ws(r/100)*100,Wv={br:Ws,d:Ws,bl:qs,dl:qs,mtp:qs,nor:Jv,rtp:qs,tb:Ws};function qv(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=st({},Wv,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||Yv(a)&&($v(o)&&typeof a=="string"&&(a=new ed(a)),t[o]=a))}),t}function od(r,e={}){return r?Hv(qv(r,e),st({whitespace:!1},e)):""}function jv(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(Cv).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])||rn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=od(a,e),s),{})}function Xv(r,e,t){return st(r,jv(e,t))}const zv="CMCD";function Zv(r,e={}){if(!r)return"";const t=od(r,e);return`${zv}=${encodeURIComponent(t)}`}const ad=/CMCD=[^&#]+/;function ey(r,e,t){const n=Zv(e,t);if(!n)return r;if(ad.test(r))return r.replace(ad,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class ty{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:Tt.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===Tt.VIDEO||a===Tt.AUDIO||a==Tt.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||Kv(),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:ll.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){st(t,this.createData());const n=t.ot===Tt.INIT||t.ot===Tt.VIDEO||t.ot===Tt.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={}),Xv(e.headers,t)):e.url=ey(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Tt.TIMED_TEXT;if(e.sn==="initSegment")return Tt.INIT;if(t==="audio")return Tt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Tt.VIDEO:Tt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Tt.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===Tt.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 ry=3e5;class ny{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)===yt.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]>ry&&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===Ue.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Ue.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 Xe(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=Ad(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new vn({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),ld(this.audioTracks,n,l,o),ld(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 ld(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=st({},o);return a.details=void 0,a.attrs=new Xe(a.attrs),a.url=a.attrs.URI=Ad(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 Ad(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 iy=/^age:\s*[\d.]+\s*$/im;class cd{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 Is,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};_s(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(_s(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=ka(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&&iy.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 sy(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const oy=/(\d+)-(\d+)\/(\d+)/;class ud{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||cy,this.controller=new self.AbortController,this.stats=new Is}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=ay(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 uy(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=Ay(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 ch,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 ay(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(st({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function ly(r){const e=oy.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Ay(r){const e=r.get("Content-Range");if(e){const n=ly(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function cy(r,e){return new self.Request(r.url,e)}class uy extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const hy=/\s/,dy={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++)hy.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=Yh(A.trim()),f=rl(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=>$u(r,h))),i}},fy={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},hd=dt(dt({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:cd,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:GI,bufferController:VC,capLevelController:al,errorController:SI,fpsController:Iv,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:du,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:fy},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},gy()),{},{subtitleStreamController:GC,subtitleTrackController:$C,timelineController:mv,audioStreamController:OC,audioTrackController:UC,emeController:Sn,cmcdController:ty,contentSteeringController:ny});function gy(){return{cueHandler:dy,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 py(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=hl(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])}`)}),dt(dt({},t),e)}function hl(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(hl):Object.keys(r).reduce((e,t)=>(e[t]=hl(r[t]),e),{}):r}function my(r){const e=r.loader;e!==ud&&e!==cd?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):sy()&&(r.loader=ud,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let dl;class Ey extends Ma{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&&(dl||(dl=/chrome|firefox/i.test(navigator.userAgent)),dl&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=bs(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=iI(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&&!ba(f,"audio",n)||g&&!ba(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 vn(c);s[O]=ie,i.push(ie)}else s[O].addGroupId("audio",d.AUDIO),s[O].addGroupId("text",d.SUBTITLES);else{const W=new vn(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))&&mI(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||ba(g.audioCodec,"audio",f)),dd(o)}t.subtitles&&(a=t.subtitles,dd(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 Ss.indexOf(f.videoRange)-Ss.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=Ru(f.videoCodec),y=Ru(g.videoCodec);if(p!==y)return y-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=Qs(f.codecSet),y=Qs(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===hd.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===Ue.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 dd(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class Iy{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 Tr({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,dt({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 fd(){return self.SourceBuffer||self.WebKitSourceBuffer}function gd(){if(!en())return!1;const e=fd();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Cy(){if(!gd())return!1;const r=en();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(pi(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(pi(e,"audio"))))}function vy(){var r;const e=fd();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const yy=250,js=2,By=.1,Ty=.05;class Qy{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>js,y=!u||t&&t.start<=o||u-o>js&&!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:js,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>=yy&&(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: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=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 y=h.getPartialFragment(p);if(y)p+=y.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(a+Ty,s+By);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 by=100;class xy extends Ua{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(by),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)!==ft.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?$e.AUDIO:$e.VIDEO,y=(p===$e.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===ft.NOT_LOADED||i===ft.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 Qy(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&&!vy(),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 _h(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new Pa(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)===Ue.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||!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!==$e.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===$e.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 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>js&&(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[$e.AUDIO]={startPTS:y,endPTS:Q,startDTS:b,endDTS:v}),l.setElementaryStreamInfo($e.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(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 xr{static get version(){return"1.5.11"}static isMSESupported(){return gd()}static isSupported(){return Cy()}static getMediaSource(){return en()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return K}static get DefaultConfig(){return xr.defaultConfig?xr.defaultConfig:hd}static set DefaultConfig(e){xr.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 qa,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,gE(e.debug||!1,"Hls instance");const t=this.config=py(xr.DefaultConfig,e);this.userConfig=e,t.progressive&&my(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 AI(this),f=new fI(this),g=t.contentSteeringController,p=g?new g(this):null,y=this.levelController=new Ey(this,p),Q=new $I(this),b=new Iy(this.config),v=this.streamController=new xy(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(gI,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=fa.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){pI(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}}xr.defaultConfig=void 0;function wy(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Sy(r){return r}function Ry(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||Sy,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=wy(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 pd=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Dy(r,e){return!!(r===e||pd(r)&&pd(e))}function _y(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!Dy(r[t],e[t]))return!1;return!0}function Ly(r,e){e===void 0&&(e=_y);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?dI(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:qI(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=$t((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=Ua(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(Pa(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(C=>{Pa(C,"LOCAL:")?u=C.slice(6):Pa(C,"MPEGTS:")&&(h=parseInt(C.slice(7)))});try{d=WI(u)/1e3}catch(C){f=C}return}else p===""&&(g=!1);a.parse(p+`
2486
+ `)}),a.flush()}const Ga="stpp.ttml.im1t",Ah=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ch=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,jI={left:"start",center:"center",right:"end",start:"start",end:"end"};function uh(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=>sr(a)),o=hI(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=hh(Ha(i,"styling","style")),A=hh(Ha(i,"layout","region")),c=Ha(i,"body","[begin]");return[].map.call(c,u=>{const h=dh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=Ya(u.getAttribute("begin"),o),f=Ya(u.getAttribute("dur"),o);let g=Ya(u.getAttribute("end"),o);if(d===null)throw fh(u);if(g===null){if(f===null)throw fh(u);g=d+f}const p=new Na(d-e,g-e,h);p.id=Ua(p.startTime,p.endTime,p.text);const C=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=ZI(C,Q,l),{textAlign:v}=b;if(v){const x=jI[v];x&&(p.lineAlign=x),p.align=v}return st(p,b),p}).filter(u=>u!==null)}function Ha(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function hh(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function dh(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?dh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function ZI(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=$a(e,n,l)||$a(r,n,l)||$a(i,n,l);return A&&(a[l]=A),a},{})}function $a(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function fh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function Ya(r,e){if(!r)return null;let t=oh(r);return t===null&&(Ah.test(r)?t=eC(r,e):ch.test(r)&&(t=tC(r,e))),t}function eC(r,e){const t=Ah.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 tC(r,e){const t=ch.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 rC{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=mh(),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 Ns(this,"textTrack1"),t=new Ns(this,"textTrack2"),n=new Ns(this,"textTrack3"),i=new Ns(this,"textTrack4");this.cea608Parser1=new sh(1,e,t),this.cea608Parser2=new sh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=nC(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(ph(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]),ou(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=mh(),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===Ga);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(ju(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Es(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]&&ph(a[h],l)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)vn(c);else{const u=gh(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===Ga?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;uh(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?Ht(n.initSegment.data,new Uint8Array(i)):i;XI(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||uh(t,this.initPTS[e.cc],()=>{n.textCodec=Ga,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=>au(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=>da(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>da(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 gh(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function ph(r,e){return!!r&&r.kind===gh(e)&&Fa(e,r)}function nC(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function mh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Va{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,Va.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 iC{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 Ps="[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,Ps),this.log=U.log.bind(U,Ps),this.warn=U.warn.bind(U,Ps),this.error=U.error.bind(U,Ps),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 Yt?a(u):a(new Yt({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 Dc===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=cm(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: ${or.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 or.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${or.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=na(this.config),s=e.map(wc).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=Rc(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 Yt?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=wc(e.keyFormat),s=i?[i]:na(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=na(this.config)),e.length===0)throw new Yt({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[Je.FAIRPLAY]){const u=ut(new Uint8Array(n));try{const h=ta(JSON.parse(u).sinf),d=Uc(new Uint8Array(h));if(!d)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=d.subarray(8,24),o=Je.FAIRPLAY}catch(h){this.warn(`${i} Failed to parse sinf: ${h}`);return}}else{const u=km(n),h=u.filter(d=>d.systemId===ui.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=>Sc(d.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(o=Sc(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=or.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=or.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 di("ISO-23001-7",a,(d=Rc(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 La,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===Je.FAIRPLAY&&(this.updateKeySession(e,ra("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 Yt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Yt({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 Yt({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: ${or.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${or.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 Yt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:dt({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Yt({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 Yt({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 Yt({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 ra(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 Yt({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==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={},di.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 Yt 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 Tt;(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"})(Tt||(Tt={}));var Ka;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Ka||(Ka={}));var rn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(rn||(rn={}));const sC={[rn.OBJECT]:["br","d","ot","tb"],[rn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[rn.SESSION]:["cid","pr","sf","sid","st","v"],[rn.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 Eh{constructor(e){this.description=void 0,this.description=e}}const oC="Dict";function aC(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 lC(r,e,t,n){return new Error(`failed to ${r} "${aC(e)}" as ${t}`,{cause:n})}const Ih="Bare Item",AC="Boolean",cC="Byte Sequence",uC="Decimal",hC="Integer";function dC(r){return r<-999999999999999||999999999999999<r}const fC=/[\x00-\x1f\x7f]+/,gC="Token",pC="Key";function ur(r,e,t){return lC("serialize",r,e,t)}function mC(r){if(typeof r!="boolean")throw ur(r,AC);return r?"?1":"?0"}function EC(r){return btoa(String.fromCharCode(...r))}function IC(r){if(ArrayBuffer.isView(r)===!1)throw ur(r,cC);return`:${EC(r)}:`}function Ch(r){if(dC(r))throw ur(r,hC);return r.toString()}function CC(r){return`@${Ch(r.getTime()/1e3)}`}function vh(r,e){if(r<0)return-vh(-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 vC(r){const e=vh(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ur(r,uC);const t=e.toString();return t.includes(".")?t:`${t}.0`}const yC="String";function BC(r){if(fC.test(r))throw ur(r,yC);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function TC(r){return r.description||r.toString().slice(7,-1)}function yh(r){const e=TC(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ur(e,gC);return e}function Ja(r){switch(typeof r){case"number":if(!he(r))throw ur(r,Ih);return Number.isInteger(r)?Ch(r):vC(r);case"string":return BC(r);case"symbol":return yh(r);case"boolean":return mC(r);case"object":if(r instanceof Date)return CC(r);if(r instanceof Uint8Array)return IC(r);if(r instanceof Eh)return yh(r);default:throw ur(r,Ih)}}function Wa(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw ur(r,pC);return r}function qa(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${Wa(e)}`:`;${Wa(e)}=${Ja(t)}`).join("")}function Bh(r){return r instanceof Dn?`${Ja(r.value)}${qa(r.params)}`:Ja(r)}function QC(r){return`(${r.value.map(Bh).join(" ")})${qa(r.params)}`}function bC(r,e={whitespace:!0}){if(typeof r!="object")throw ur(r,oC);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=Wa(i);return s.value===!0?o+=qa(s.params):(o+="=",Array.isArray(s.value)?o+=QC(s):o+=Bh(s)),o}).join(`,${n}`)}function xC(r,e){return bC(r,e)}const wC=r=>r==="ot"||r==="sf"||r==="st",SC=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function RC(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 DC(){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 Os=r=>Math.round(r),_C=(r,e)=>(e!=null&&e.baseUrl&&(r=RC(r,e.baseUrl)),encodeURIComponent(r)),Us=r=>Os(r/100)*100,LC={br:Os,d:Os,bl:Us,dl:Us,mtp:Us,nor:_C,rtp:Us,tb:Os};function FC(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=st({},LC,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||SC(a)&&(wC(o)&&typeof a=="string"&&(a=new Eh(a)),t[o]=a))}),t}function Th(r,e={}){return r?xC(FC(r,e),st({whitespace:!1},e)):""}function kC(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(sC).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])||rn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=Th(a,e),s),{})}function NC(r,e,t){return st(r,kC(e,t))}const MC="CMCD";function PC(r,e={}){if(!r)return"";const t=Th(r,e);return`${MC}=${encodeURIComponent(t)}`}const Qh=/CMCD=[^&#]+/;function OC(r,e,t){const n=PC(e,t);if(!n)return r;if(Qh.test(r))return r.replace(Qh,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class UC{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:Tt.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===Tt.VIDEO||a===Tt.AUDIO||a==Tt.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||DC(),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:Ka.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){st(t,this.createData());const n=t.ot===Tt.INIT||t.ot===Tt.VIDEO||t.ot===Tt.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={}),NC(e.headers,t)):e.url=OC(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Tt.TIMED_TEXT;if(e.sn==="initSegment")return Tt.INIT;if(t==="audio")return Tt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Tt.VIDEO:Tt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Tt.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===Tt.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:We.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 GC=3e5;class HC{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)===yt.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]>GC&&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,pu(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===Ue.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Ue.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 ze(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=xh(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),bh(this.audioTracks,n,l,o),bh(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 bh(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=st({},o);return a.details=void 0,a.attrs=new ze(a.attrs),a.url=a.attrs.URI=xh(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 xh(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 $C=/^age:\s*[\d.]+\s*$/im;class wh{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};Bs(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(Bs(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=Ia(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&&$C.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 YC(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const VC=/(\d+)-(\d+)\/(\d+)/;class Sh{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||qC,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=KC(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 XC(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=WC(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 wu,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 KC(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(st({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function JC(r){const e=VC.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function WC(r){const e=r.get("Content-Range");if(e){const n=JC(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function qC(r,e){return new self.Request(r.url,e)}class XC extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const jC=/\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++)jC.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=lh(A.trim()),f=Ua(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=>au(r,h))),i}},ZC={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Rh=dt(dt({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:wh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:bE,bufferController:RI,capLevelController:Va,errorController:fE,fpsController:iC,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:Dc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:ZC},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},ev()),{},{subtitleStreamController:bI,subtitleTrackController:wI,timelineController:rC,audioStreamController:TI,audioTrackController:QI,emeController:Rn,cmcdController:UC,contentSteeringController:HC});function ev(){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 tv(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=Xa(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])}`)}),dt(dt({},t),e)}function Xa(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(Xa):Object.keys(r).reduce((e,t)=>(e[t]=Xa(r[t]),e),{}):r}function rv(r){const e=r.loader;e!==Sh&&e!==wh?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):YC()&&(r.loader=Sh,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let ja;class nv extends va{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&&(ja||(ja=/chrome|firefox/i.test(navigator.userAgent)),ja&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=ms(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=$m(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&&!ca(f,"audio",n)||g&&!ca(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 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:C})=>(!!f||!!(p&&C))&&rE(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||ca(g.audioCodec,"audio",f)),Dh(o)}t.subtitles&&(a=t.subtitles,Dh(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 Cs.indexOf(f.videoRange)-Cs.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=Wc(f.videoCodec),C=Wc(g.videoCodec);if(p!==C)return C-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=ps(f.codecSet),C=ps(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===Rh.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===Ue.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));pu(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 Dh(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class iv{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 Tr({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,dt({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 _h(){return self.SourceBuffer||self.WebKitSourceBuffer}function Lh(){if(!en())return!1;const e=_h();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function sv(){if(!Lh())return!1;const r=en();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(fi(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(fi(e,"audio"))))}function ov(){var r;const e=_h();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const av=250,Gs=2,lv=.1,Av=.05;class cv{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||!We.getBuffered(i).length){this.nudgeRetry=0;return}const c=We.bufferInfo(i,o,0),u=c.nextStart||0;if(a){const p=c.len>Gs,C=!u||t&&t.start<=o||u-o>Gs&&!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:Gs,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>=av&&(this._reportStall(c),!this.media))return;const g=We.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=We.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+Av,s+lv);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 uv=100;class hv extends Ta{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(uv),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)!==ft.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?$e.AUDIO:$e.VIDEO,C=(p===$e.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===ft.NOT_LOADED||i===ft.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 cv(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&&!ov(),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 Xu(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new ya(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)===Ue.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||!We.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!==$e.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===$e.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=We.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>Gs&&(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[$e.AUDIO]={startPTS:C,endPTS:Q,startDTS:b,endDTS:v}),l.setElementaryStreamInfo($e.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(We.isBuffered(e,n)?t=this.getAppendedFrag(n):We.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 xr{static get version(){return"1.5.17"}static isMSESupported(){return Lh()}static isSupported(){return sv()}static getMediaSource(){return en()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return V}static get DefaultConfig(){return xr.defaultConfig?xr.defaultConfig:Rh}static set DefaultConfig(e){xr.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 La,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,em(e.debug||!1,"Hls instance");const t=this.config=tv(xr.DefaultConfig,e);this.userConfig=e,t.progressive&&rv(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 Wm(this),f=new Zm(this),g=t.contentSteeringController,p=g?new g(this):null,C=this.levelController=new nv(this,p),Q=new wE(this),b=new iv(this.config),v=this.streamController=new hv(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(eE,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){tE(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}}xr.defaultConfig=void 0;function dv(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function fv(r){return r}function gv(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||fv,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=dv(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 Fh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function pv(r,e){return!!(r===e||Fh(r)&&Fh(e))}function mv(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!pv(r[t],e[t]))return!1;return!0}function Ev(r,e){e===void 0&&(e=mv);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 md=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Ed=gn(class extends zn{constructor(r){if(super(r),r.type!==fn.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=Of(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]=Jr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Jr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Jr(i[u],s[f]),Xn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Jr(i[h],s[d]),Xn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=md(o,d,f),c=md(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=Xn(r,i[u]);Jr(y,s[d]),l[d]=y}else l[d]=Jr(p,s[d]),Xn(r,i[u],p),i[g]=null;d++}else yo(i[h]),h--;else yo(i[u]),u++;for(;d<=f;){const g=Xn(r,l[f+1]);Jr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&yo(g)}return this.ut=o,Pf(r,l),qt}});var Lt="top",Vt="bottom",Kt="right",Ft="left",fl="auto",Ei=[Lt,Vt,Kt,Ft],Dn="start",Ii="end",Fy="clippingParents",Id="viewport",Ci="popper",ky="reference",Cd=Ei.reduce(function(r,e){return r.concat([e+"-"+Dn,e+"-"+Ii])},[]),vd=[].concat(Ei,[fl]).reduce(function(r,e){return r.concat([e,e+"-"+Dn,e+"-"+Ii])},[]),Ny="beforeRead",My="read",Py="afterRead",Oy="beforeMain",Uy="main",Gy="afterMain",Hy="beforeWrite",$y="write",Yy="afterWrite",Vy=[Ny,My,Py,Oy,Uy,Gy,Hy,$y,Yy];function hr(r){return r?(r.nodeName||"").toLowerCase():null}function Mt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function nn(r){var e=Mt(r).Element;return r instanceof e||r instanceof Element}function Jt(r){var e=Mt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function gl(r){if(typeof ShadowRoot>"u")return!1;var e=Mt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function Ky(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];!Jt(s)||!hr(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 Jy(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},{});!Jt(i)||!hr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const yd={name:"applyStyles",enabled:!0,phase:"write",fn:Ky,effect:Jy,requires:["computeStyles"]};function dr(r){return r.split("-")[0]}var sn=Math.max,Xs=Math.min,_n=Math.round;function pl(){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 Bd(){return!/^((?!chrome|android).)*safari/i.test(pl())}function Ln(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Jt(r)&&(i=r.offsetWidth>0&&_n(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&_n(n.height)/r.offsetHeight||1);var o=nn(r)?Mt(r):window,a=o.visualViewport,l=!Bd()&&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 ml(r){var e=Ln(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 Td(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&gl(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function wr(r){return Mt(r).getComputedStyle(r)}function Wy(r){return["table","td","th"].indexOf(hr(r))>=0}function Or(r){return((nn(r)?r.ownerDocument:r.document)||window.document).documentElement}function zs(r){return hr(r)==="html"?r:r.assignedSlot||r.parentNode||(gl(r)?r.host:null)||Or(r)}function Qd(r){return!Jt(r)||wr(r).position==="fixed"?null:r.offsetParent}function qy(r){var e=/firefox/i.test(pl()),t=/Trident/i.test(pl());if(t&&Jt(r)){var n=wr(r);if(n.position==="fixed")return null}var i=zs(r);for(gl(i)&&(i=i.host);Jt(i)&&["html","body"].indexOf(hr(i))<0;){var s=wr(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 vi(r){for(var e=Mt(r),t=Qd(r);t&&Wy(t)&&wr(t).position==="static";)t=Qd(t);return t&&(hr(t)==="html"||hr(t)==="body"&&wr(t).position==="static")?e:t||qy(r)||e}function El(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function yi(r,e,t){return sn(r,Xs(e,t))}function jy(r,e,t){var n=yi(r,e,t);return n>t?t:n}function bd(){return{top:0,right:0,bottom:0,left:0}}function xd(r){return Object.assign({},bd(),r)}function wd(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var Xy=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,xd(typeof e!="number"?e:wd(e,Ei))};function zy(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=dr(t.placement),l=El(a),A=[Ft,Kt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=Xy(i.padding,t),h=ml(s),d=l==="y"?Lt:Ft,f=l==="y"?Vt:Kt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],y=vi(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=yi(v,R,w),H=l;t.modifiersData[n]=(e={},e[H]=k,e.centerOffset=k-R,e)}}function Zy(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)||Td(e.elements.popper,i)&&(e.elements.arrow=i))}const eB={name:"arrow",enabled:!0,phase:"main",fn:zy,effect:Zy,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Fn(r){return r.split("-")[1]}var tB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function rB(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:_n(t*i)/i||0,y:_n(n*i)/i||0}}function Sd(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=Ft,v=Lt,w=window;if(A){var R=vi(t),k="clientHeight",H="clientWidth";if(R===Mt(t)&&(R=Or(t),wr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",H="scrollWidth")),R=R,i===Lt||(i===Ft||i===Kt)&&s===Ii){v=Vt;var V=u&&R===w&&w.visualViewport?w.visualViewport.height:R[k];g-=V-n.height,g*=l?1:-1}if(i===Ft||(i===Lt||i===Vt)&&s===Ii){b=Kt;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&&tB),ie=c===!0?rB({x:d,y:g},Mt(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 nB(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:dr(e.placement),variation:Fn(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,Sd(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,Sd(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 iB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:nB,data:{}};var Zs={passive:!0};function sB(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=Mt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Zs)}),a&&l.addEventListener("resize",t.update,Zs),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Zs)}),a&&l.removeEventListener("resize",t.update,Zs)}}const oB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:sB,data:{}};var aB={left:"right",right:"left",bottom:"top",top:"bottom"};function eo(r){return r.replace(/left|right|bottom|top/g,function(e){return aB[e]})}var lB={start:"end",end:"start"};function Rd(r){return r.replace(/start|end/g,function(e){return lB[e]})}function Il(r){var e=Mt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function Cl(r){return Ln(Or(r)).left+Il(r).scrollLeft}function AB(r,e){var t=Mt(r),n=Or(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Bd();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Cl(r),y:l}}function cB(r){var e,t=Or(r),n=Il(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=sn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+Cl(r),l=-n.scrollTop;return wr(i||t).direction==="rtl"&&(a+=sn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function vl(r){var e=wr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function Dd(r){return["html","body","#document"].indexOf(hr(r))>=0?r.ownerDocument.body:Jt(r)&&vl(r)?r:Dd(zs(r))}function Bi(r,e){var t;e===void 0&&(e=[]);var n=Dd(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Mt(n),o=i?[s].concat(s.visualViewport||[],vl(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(Bi(zs(o)))}function yl(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function uB(r,e){var t=Ln(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 _d(r,e,t){return e===Id?yl(AB(r,t)):nn(e)?uB(e,t):yl(cB(Or(r)))}function hB(r){var e=Bi(zs(r)),t=["absolute","fixed"].indexOf(wr(r).position)>=0,n=t&&Jt(r)?vi(r):r;return nn(n)?e.filter(function(i){return nn(i)&&Td(i,n)&&hr(i)!=="body"}):[]}function dB(r,e,t,n){var i=e==="clippingParents"?hB(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=_d(r,A,n);return l.top=sn(c.top,l.top),l.right=Xs(c.right,l.right),l.bottom=Xs(c.bottom,l.bottom),l.left=sn(c.left,l.left),l},_d(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 Ld(r){var e=r.reference,t=r.element,n=r.placement,i=n?dr(n):null,s=n?Fn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Lt:l={x:o,y:e.y-t.height};break;case Vt:l={x:o,y:e.y+e.height};break;case Kt:l={x:e.x+e.width,y:a};break;case Ft:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?El(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case Dn:l[A]=l[A]-(e[c]/2-t[c]/2);break;case Ii:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Ti(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?Fy:a,A=t.rootBoundary,c=A===void 0?Id:A,u=t.elementContext,h=u===void 0?Ci:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,y=xd(typeof p!="number"?p:wd(p,Ei)),Q=h===Ci?ky:Ci,b=r.rects.popper,v=r.elements[f?Q:h],w=dB(nn(v)?v:v.contextElement||Or(r.elements.popper),l,c,o),R=Ln(r.elements.reference),k=Ld({reference:R,element:b,strategy:"absolute",placement:i}),H=yl(Object.assign({},b,k)),V=h===Ci?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===Ci&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Kt,Vt].indexOf(te)>=0?1:-1,D=[Lt,Vt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function fB(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?vd:l,c=Fn(n),u=c?a?Cd:Cd.filter(function(f){return Fn(f)===c}):Ei,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]=Ti(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[dr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function gB(r){if(dr(r)===fl)return[];var e=eo(r);return[Rd(r),e,Rd(e)]}function pB(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=dr(p),Q=y===p,b=l||(Q||!f?[eo(p)]:gB(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(dr(pe)===fl?fB(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=dr(W),te=Fn(W)===Dn,le=[Lt,Vt].indexOf(ie)>=0,D=le?"width":"height",P=Ti(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),j=le?te?Kt:Ft:te?Vt:Lt;w[D]>R[D]&&(j=eo(j));var _=eo(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(He){return He})});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 mB={name:"flip",enabled:!0,phase:"main",fn:pB,requiresIfExists:["offset"],data:{_skip:!1}};function Fd(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 kd(r){return[Lt,Kt,Vt,Ft].some(function(e){return r[e]>=0})}function EB(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ti(e,{elementContext:"reference"}),a=Ti(e,{altBoundary:!0}),l=Fd(o,n),A=Fd(a,i,s),c=kd(l),u=kd(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 IB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:EB};function CB(r,e,t){var n=dr(r),i=[Ft,Lt].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,[Ft,Kt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function vB(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=vd.reduce(function(c,u){return c[u]=CB(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 yB={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:vB};function BB(r){var e=r.state,t=r.name;e.modifiersData[t]=Ld({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const TB={name:"popperOffsets",enabled:!0,phase:"read",fn:BB,data:{}};function QB(r){return r==="x"?"y":"x"}function bB(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=Ti(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),y=dr(e.placement),Q=Fn(e.placement),b=!Q,v=El(y),w=QB(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"?Lt:Ft,D=v==="y"?Vt:Kt,P=v==="y"?"height":"width",j=R[v],_=j+p[le],S=j-p[D],F=d?-H[P]/2:0,J=Q===Dn?k[P]:H[P],Y=Q===Dn?-H[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?ml(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:bd(),ge=pe[le],Se=pe[D],Le=yi(0,k[P],ce[P]),He=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&&vi(e.elements.arrow),Pe=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,qe=j+He-we-Pe,Te=j+fe-we,T=yi(d?Xs(_,qe):_,j,d?sn(S,Te):S);R[v]=T,ie[v]=T-j}if(a){var m,E=v==="x"?Lt:Ft,x=v==="x"?Vt:Kt,M=R[w],z=w==="y"?"height":"width",X=M+p[E],Ie=M-p[x],be=[Lt,Ft].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,Nt=d&&be?jy(ke,M,_e):yi(d?ke:X,M,d?_e:Ie);R[w]=Nt,ie[w]=Nt-M}e.modifiersData[n]=ie}}const xB={name:"preventOverflow",enabled:!0,phase:"main",fn:bB,requiresIfExists:["offset"]};function wB(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function SB(r){return r===Mt(r)||!Jt(r)?Il(r):wB(r)}function RB(r){var e=r.getBoundingClientRect(),t=_n(e.width)/r.offsetWidth||1,n=_n(e.height)/r.offsetHeight||1;return t!==1||n!==1}function DB(r,e,t){t===void 0&&(t=!1);var n=Jt(e),i=Jt(e)&&RB(e),s=Or(e),o=Ln(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((hr(e)!=="body"||vl(s))&&(a=SB(e)),Jt(e)?(l=Ln(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Cl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function _B(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 LB(r){var e=_B(r);return Vy.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function FB(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function kB(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 Nd={placement:"bottom",modifiers:[],strategy:"absolute"};function Md(){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 NB(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?Nd:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Nd,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:nn(a)?Bi(a):a.contextElement?Bi(a.contextElement):[],popper:Bi(l)};var b=LB(kB([].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(Md(Q,b)){c.rects={reference:DB(Q,vi(b),c.options.strategy==="fixed"),popper:ml(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:FB(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!Md(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 MB=[oB,TB,iB,yd,yB,mB,xB,eB,IB],PB=NB({defaultModifiers:MB}),OB="tippy-box",Pd="tippy-content",UB="tippy-backdrop",Od="tippy-arrow",Ud="tippy-svg-arrow",on={passive:!0,capture:!0},Gd=function(){return document.body};function Bl(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function Tl(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Hd(r,e){return typeof r=="function"?r.apply(void 0,e):r}function $d(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function GB(r){return r.split(/\s+/).filter(Boolean)}function kn(r){return[].concat(r)}function Yd(r,e){r.indexOf(e)===-1&&r.push(e)}function HB(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function $B(r){return r.split("-")[0]}function to(r){return[].slice.call(r)}function Vd(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function Qi(){return document.createElement("div")}function ro(r){return["Element","Fragment"].some(function(e){return Tl(r,e)})}function YB(r){return Tl(r,"NodeList")}function VB(r){return Tl(r,"MouseEvent")}function KB(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function JB(r){return ro(r)?[r]:YB(r)?to(r):Array.isArray(r)?r:to(document.querySelectorAll(r))}function Ql(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Kd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function WB(r){var e,t=kn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function qB(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=$B(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 bl(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function Jd(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 fr={isTouch:!1},Wd=0;function jB(){fr.isTouch||(fr.isTouch=!0,window.performance&&document.addEventListener("mousemove",qd))}function qd(){var r=performance.now();r-Wd<20&&(fr.isTouch=!1,document.removeEventListener("mousemove",qd)),Wd=r}function XB(){var r=document.activeElement;if(KB(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function zB(){document.addEventListener("touchstart",jB,on),window.addEventListener("blur",XB)}var ZB=typeof window<"u"&&typeof document<"u",e1=ZB?!!window.msCrypto:!1,t1={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},r1={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},er=Object.assign({appendTo:Gd,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},t1,r1),n1=Object.keys(er),i1=function(e){var t=Object.keys(e);t.forEach(function(n){er[n]=e[n]})};function jd(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=er[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function s1(r,e){var t=e?Object.keys(jd(Object.assign({},er,{plugins:e}))):n1,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 Xd(r,e){var t=Object.assign({},e,{content:Hd(e.content,[r])},e.ignoreAttributes?{}:s1(r,e.plugins));return t.aria=Object.assign({},er.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 o1=function(){return"innerHTML"};function xl(r,e){r[o1()]=e}function zd(r){var e=Qi();return r===!0?e.className=Od:(e.className=Ud,ro(r)?e.appendChild(r):xl(e,r)),e}function Zd(r,e){ro(e.content)?(xl(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?xl(r,e.content):r.textContent=e.content)}function wl(r){var e=r.firstElementChild,t=to(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(Pd)}),arrow:t.find(function(n){return n.classList.contains(Od)||n.classList.contains(Ud)}),backdrop:t.find(function(n){return n.classList.contains(UB)})}}function ef(r){var e=Qi(),t=Qi();t.className=OB,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=Qi();n.className=Pd,n.setAttribute("data-state","hidden"),Zd(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=wl(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)&&Zd(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}}ef.$$tippy=!0;var a1=1,no=[],Sl=[];function l1(r,e){var t=Xd(r,Object.assign({},er,jd(Vd(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=$d(qe,t.interactiveDebounce),g,p=a1++,y=null,Q=HB(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:Qi(),popperInstance:y,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Nt,show:ht,hide:Ot,hideWithInteractivity:mr,enable:be,disable:De,unmount:Er,destroy:Bt};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?WB(q):document}function D(){return wl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||fr.isTouch||c&&c.type==="focus"?0:Bl(v.props.delay,q?0:1,er.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 Oe;(Oe=v.props)[q].apply(Oe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Oe=kn(v.props.triggerTarget||r);Oe.forEach(function(Fe){var je=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,je?je+" "+Ce:Ce);else{var bt=je&&je.replace(Ce,"").trim();bt?Fe.setAttribute(de,bt):Fe.removeAttribute(de)}})}}function F(){if(!(V||!v.props.aria.expanded)){var q=kn(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),no=no.filter(function(q){return q!==f})}function Y(q){if(!(fr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&Jd(R,de))){if(kn(v.props.triggerTarget||r).some(function(Ce){return Jd(Ce,de)})){if(fr.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,on),q.addEventListener("touchstart",ce,on),q.addEventListener("touchmove",ne,on)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,on),q.removeEventListener("touchstart",ce,on),q.removeEventListener("touchmove",ne,on)}function Se(q,de){He(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){He(q,de)}function He(q,de){var Ce=D().box;function Oe(Fe){Fe.target===Ce&&(bl(Ce,"remove",Oe),de())}if(q===0)return de();bl(Ce,"remove",u),bl(Ce,"add",Oe),u=Oe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Oe=kn(v.props.triggerTarget||r);Oe.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})),GB(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(e1?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Pe(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Oe=q.handler,Fe=q.options;de.removeEventListener(Ce,Oe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Oe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&VB(q)&&no.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&&!Oe&&Ie(q)}}function qe(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Oe=z().concat(R).map(function(Fe){var je,bt=Fe._tippy,xt=(je=bt.popperInstance)==null?void 0:je.state;return xt?{popperRect:Fe.getBoundingClientRect(),popperState:xt,props:t}:null}).filter(Boolean);qB(Oe,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 fr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){x();var q=v.props,de=q.popperOptions,Ce=q.placement,Oe=q.offset,Fe=q.getReferenceClientRect,je=q.moveTransition,bt=ie()?wl(R).arrow:null,xt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,Un={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Gn){var Hr=Gn.state;if(ie()){var _i=D(),Li=_i.box;["placement","reference-hidden","escaped"].forEach(function(Hn){Hn==="placement"?Li.setAttribute("data-placement",Hr.placement):Hr.attributes.popper["data-popper-"+Hn]?Li.setAttribute("data-"+Hn,""):Li.removeAttribute("data-"+Hn)}),Hr.attributes.popper={}}}},wt=[{name:"offset",options:{offset:Oe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!je}},Un];ie()&&bt&&wt.push({name:"arrow",options:{element:bt,padding:3}}),wt.push.apply(wt,(de==null?void 0:de.modifiers)||[]),v.popperInstance=PB(xt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:wt}))}function x(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===Gd||q==="parent"?de=Ce.parentNode:de=Hd(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return to(R.querySelectorAll("[data-tippy-root]"))}function X(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Oe=Ce[0],Fe=Ce[1];fr.isTouch&&Oe==="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]),Pe();var de=v.props,Ce=Xd(r,Object.assign({},de,Vd(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=$d(qe,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?kn(de.triggerTarget).forEach(function(Oe){Oe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),j(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Oe){requestAnimationFrame(Oe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Nt(q){v.setProps({content:q})}function ht(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Oe=fr.isTouch&&!v.props.touch,Fe=Bl(v.props.duration,0,er.duration);if(!(q||de||Ce||Oe)&&!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 je=D(),bt=je.box,xt=je.content;Ql([bt,xt],0)}h=function(){var wt;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var un=D(),Gn=un.box,Hr=un.content;Ql([Gn,Hr],Fe),Kd([Gn,Hr],"visible")}S(),F(),Yd(Sl,v),(wt=v.popperInstance)==null||wt.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ot(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Oe=Bl(v.props.duration,1,er.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(),je=Fe.box,bt=Fe.content;v.props.animation&&(Ql([je,bt],Oe),Kd([je,bt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Oe,v.unmount):v.unmount()}}function mr(q){le().addEventListener("mousemove",f),Yd(no,f),f(q)}function Er(){v.state.isVisible&&v.hide(),v.state.isMounted&&(x(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),Sl=Sl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Bt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Pe(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function an(r,e){e===void 0&&(e={});var t=er.plugins.concat(e.plugins||[]);zB();var n=Object.assign({},e,{plugins:t}),i=JB(r),s=i.reduce(function(o,a){var l=a&&l1(a,n);return l&&o.push(l),o},[]);return ro(r)?s[0]:s}an.defaultProps=er,an.setDefaultProps=i1,an.currentInput=fr,Object.assign({},yd,{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)}}),an.setDefaultProps({render:ef});class io 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 A1=5;function c1(r,e){const t=r.map(({id:i})=>i).join("|"),n=e.map(({id:i})=>i).join("|");return t===n}class u1{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=mt(),this._controls=mt(),this.host=e}set activeScenes(e){c1(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-A1&&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 Et(this._canvas)}controls(){return Et(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 io("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 tf(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 h1(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function d1(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function f1(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 tf(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 g1(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 xr({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(xr.Events.LEVEL_LOADED,async()=>{l||A==null||A.stopLoad();const c=await tf(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 p1(r){const{src:e,playlist:t}=r;return t&&!h1()&&xr.isSupported()?g1(t,r):f1(e,r)}let m1=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=ni(async t=>{const{id:n,key:i}=t,s=await p1(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 io(`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 Gi(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 eu({config:s})}catch(s){throw new io("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 E1(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function I1(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Rl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],C1={id:"captions",event:"captions:click",label:"Closed Captions"},v1={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},rf={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}]},y1={id:"playbackRate",label:"Playback playbackRate",subItems:rf};class B1 extends dA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==fn.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)),qt}}const Dl=gn(B1),T1=Ly(()=>{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=jc.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]}),gr={"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"},Q1={colors:gr,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 ${gr["dark-100"]}`,medium:`0 .125rem .625rem ${gr["dark-100"]}`,large:`0 .25rem 1rem ${gr["dark-50"]}`,xl:`.25rem .25rem 1rem ${gr["dark-250"]}`,xxl:`0 .25rem 2rem ${gr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${gr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${gr["dark-50"]}`,text:`0 0 .25rem ${gr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:gr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},nf=Ry(Q1,{delimiter:"-"}),b1=Object.keys(nf).map(r=>$n(`:host { --${r}: ${nf[r]}; }`)),Ye=(r=>{const e=class extends r{firstUpdated(){T1().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],b1,At`
2492
+ */const kh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Nh=gn(class extends Zn{constructor(r){if(super(r),r.type!==fn.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=rf(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]=Jr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Jr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Jr(i[u],s[f]),zn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Jr(i[h],s[d]),zn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=kh(o,d,f),c=kh(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]);Jr(C,s[d]),l[d]=C}else l[d]=Jr(p,s[d]),zn(r,i[u],p),i[g]=null;d++}else ho(i[h]),h--;else ho(i[u]),u++;for(;d<=f;){const g=zn(r,l[f+1]);Jr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&ho(g)}return this.ut=o,tf(r,l),qt}});var Lt="top",Vt="bottom",Kt="right",Ft="left",za="auto",pi=[Lt,Vt,Kt,Ft],_n="start",mi="end",Iv="clippingParents",Mh="viewport",Ei="popper",Cv="reference",Ph=pi.reduce(function(r,e){return r.concat([e+"-"+_n,e+"-"+mi])},[]),Oh=[].concat(pi,[za]).reduce(function(r,e){return r.concat([e,e+"-"+_n,e+"-"+mi])},[]),vv="beforeRead",yv="read",Bv="afterRead",Tv="beforeMain",Qv="main",bv="afterMain",xv="beforeWrite",wv="write",Sv="afterWrite",Rv=[vv,yv,Bv,Tv,Qv,bv,xv,wv,Sv];function hr(r){return r?(r.nodeName||"").toLowerCase():null}function Mt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function nn(r){var e=Mt(r).Element;return r instanceof e||r instanceof Element}function Jt(r){var e=Mt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function Za(r){if(typeof ShadowRoot>"u")return!1;var e=Mt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function Dv(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];!Jt(s)||!hr(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 _v(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},{});!Jt(i)||!hr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Uh={name:"applyStyles",enabled:!0,phase:"write",fn:Dv,effect:_v,requires:["computeStyles"]};function dr(r){return r.split("-")[0]}var sn=Math.max,Hs=Math.min,Ln=Math.round;function el(){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 Gh(){return!/^((?!chrome|android).)*safari/i.test(el())}function Fn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Jt(r)&&(i=r.offsetWidth>0&&Ln(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ln(n.height)/r.offsetHeight||1);var o=nn(r)?Mt(r):window,a=o.visualViewport,l=!Gh()&&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 tl(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 Hh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&Za(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function wr(r){return Mt(r).getComputedStyle(r)}function Lv(r){return["table","td","th"].indexOf(hr(r))>=0}function Or(r){return((nn(r)?r.ownerDocument:r.document)||window.document).documentElement}function $s(r){return hr(r)==="html"?r:r.assignedSlot||r.parentNode||(Za(r)?r.host:null)||Or(r)}function $h(r){return!Jt(r)||wr(r).position==="fixed"?null:r.offsetParent}function Fv(r){var e=/firefox/i.test(el()),t=/Trident/i.test(el());if(t&&Jt(r)){var n=wr(r);if(n.position==="fixed")return null}var i=$s(r);for(Za(i)&&(i=i.host);Jt(i)&&["html","body"].indexOf(hr(i))<0;){var s=wr(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 Ii(r){for(var e=Mt(r),t=$h(r);t&&Lv(t)&&wr(t).position==="static";)t=$h(t);return t&&(hr(t)==="html"||hr(t)==="body"&&wr(t).position==="static")?e:t||Fv(r)||e}function rl(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Ci(r,e,t){return sn(r,Hs(e,t))}function kv(r,e,t){var n=Ci(r,e,t);return n>t?t:n}function Yh(){return{top:0,right:0,bottom:0,left:0}}function Vh(r){return Object.assign({},Yh(),r)}function Kh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var Nv=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Vh(typeof e!="number"?e:Kh(e,pi))};function Mv(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=dr(t.placement),l=rl(a),A=[Ft,Kt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=Nv(i.padding,t),h=tl(s),d=l==="y"?Lt:Ft,f=l==="y"?Vt:Kt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],C=Ii(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=Ci(v,R,x),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function Pv(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)||Hh(e.elements.popper,i)&&(e.elements.arrow=i))}const Ov={name:"arrow",enabled:!0,phase:"main",fn:Mv,effect:Pv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function kn(r){return r.split("-")[1]}var Uv={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Gv(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 Jh(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=Ft,v=Lt,x=window;if(A){var R=Ii(t),k="clientHeight",$="clientWidth";if(R===Mt(t)&&(R=Or(t),wr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Lt||(i===Ft||i===Kt)&&s===mi){v=Vt;var K=u&&R===x&&x.visualViewport?x.visualViewport.height:R[k];g-=K-n.height,g*=l?1:-1}if(i===Ft||(i===Lt||i===Vt)&&s===mi){b=Kt;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&&Uv),ie=c===!0?Gv({x:d,y:g},Mt(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 Hv(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:dr(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,Jh(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,Jh(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 $v={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Hv,data:{}};var Ys={passive:!0};function Yv(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=Mt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Ys)}),a&&l.addEventListener("resize",t.update,Ys),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Ys)}),a&&l.removeEventListener("resize",t.update,Ys)}}const Vv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Yv,data:{}};var Kv={left:"right",right:"left",bottom:"top",top:"bottom"};function Vs(r){return r.replace(/left|right|bottom|top/g,function(e){return Kv[e]})}var Jv={start:"end",end:"start"};function Wh(r){return r.replace(/start|end/g,function(e){return Jv[e]})}function nl(r){var e=Mt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function il(r){return Fn(Or(r)).left+nl(r).scrollLeft}function Wv(r,e){var t=Mt(r),n=Or(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Gh();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+il(r),y:l}}function qv(r){var e,t=Or(r),n=nl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=sn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+il(r),l=-n.scrollTop;return wr(i||t).direction==="rtl"&&(a+=sn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function sl(r){var e=wr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function qh(r){return["html","body","#document"].indexOf(hr(r))>=0?r.ownerDocument.body:Jt(r)&&sl(r)?r:qh($s(r))}function vi(r,e){var t;e===void 0&&(e=[]);var n=qh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Mt(n),o=i?[s].concat(s.visualViewport||[],sl(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(vi($s(o)))}function ol(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function Xv(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 Xh(r,e,t){return e===Mh?ol(Wv(r,t)):nn(e)?Xv(e,t):ol(qv(Or(r)))}function jv(r){var e=vi($s(r)),t=["absolute","fixed"].indexOf(wr(r).position)>=0,n=t&&Jt(r)?Ii(r):r;return nn(n)?e.filter(function(i){return nn(i)&&Hh(i,n)&&hr(i)!=="body"}):[]}function zv(r,e,t,n){var i=e==="clippingParents"?jv(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=Xh(r,A,n);return l.top=sn(c.top,l.top),l.right=Hs(c.right,l.right),l.bottom=Hs(c.bottom,l.bottom),l.left=sn(c.left,l.left),l},Xh(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 jh(r){var e=r.reference,t=r.element,n=r.placement,i=n?dr(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 Lt:l={x:o,y:e.y-t.height};break;case Vt:l={x:o,y:e.y+e.height};break;case Kt:l={x:e.x+e.width,y:a};break;case Ft:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?rl(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 mi:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function yi(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?Iv:a,A=t.rootBoundary,c=A===void 0?Mh:A,u=t.elementContext,h=u===void 0?Ei:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,C=Vh(typeof p!="number"?p:Kh(p,pi)),Q=h===Ei?Cv:Ei,b=r.rects.popper,v=r.elements[f?Q:h],x=zv(nn(v)?v:v.contextElement||Or(r.elements.popper),l,c,o),R=Fn(r.elements.reference),k=jh({reference:R,element:b,strategy:"absolute",placement:i}),$=ol(Object.assign({},b,k)),K=h===Ei?$: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===Ei&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Kt,Vt].indexOf(te)>=0?1:-1,D=[Lt,Vt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function Zv(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?Oh:l,c=kn(n),u=c?a?Ph:Ph.filter(function(f){return kn(f)===c}):pi,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]=yi(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[dr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function ey(r){if(dr(r)===za)return[];var e=Vs(r);return[Wh(r),e,Wh(e)]}function ty(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=dr(p),Q=C===p,b=l||(Q||!f?[Vs(p)]:ey(p)),v=[p].concat(b).reduce(function(ce,pe){return ce.concat(dr(pe)===za?Zv(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=dr(W),te=kn(W)===_n,le=[Lt,Vt].indexOf(ie)>=0,D=le?"width":"height",P=yi(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?te?Kt:Ft:te?Vt:Lt;x[D]>R[D]&&(X=Vs(X));var _=Vs(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(He){return He})});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 ry={name:"flip",enabled:!0,phase:"main",fn:ty,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 Zh(r){return[Lt,Kt,Vt,Ft].some(function(e){return r[e]>=0})}function ny(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=yi(e,{elementContext:"reference"}),a=yi(e,{altBoundary:!0}),l=zh(o,n),A=zh(a,i,s),c=Zh(l),u=Zh(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 iy={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ny};function sy(r,e,t){var n=dr(r),i=[Ft,Lt].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,[Ft,Kt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function oy(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Oh.reduce(function(c,u){return c[u]=sy(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 ay={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:oy};function ly(r){var e=r.state,t=r.name;e.modifiersData[t]=jh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Ay={name:"popperOffsets",enabled:!0,phase:"read",fn:ly,data:{}};function cy(r){return r==="x"?"y":"x"}function uy(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=yi(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),C=dr(e.placement),Q=kn(e.placement),b=!Q,v=rl(C),x=cy(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"?Lt:Ft,D=v==="y"?Vt:Kt,P=v==="y"?"height":"width",X=R[v],_=X+p[le],S=X-p[D],F=d?-$[P]/2:0,J=Q===_n?k[P]:$[P],Y=Q===_n?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?tl(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Yh(),ge=pe[le],Se=pe[D],Le=Ci(0,k[P],ce[P]),He=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&&Ii(e.elements.arrow),Pe=Qe?v==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[v])!=null?te:0,Xe=X+He-we-Pe,Te=X+fe-we,T=Ci(d?Hs(_,Xe):_,X,d?sn(S,Te):S);R[v]=T,ie[v]=T-X}if(a){var m,E=v==="x"?Lt:Ft,w=v==="x"?Vt:Kt,M=R[x],z=x==="y"?"height":"width",j=M+p[E],Ie=M-p[w],be=[Lt,Ft].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,Nt=d&&be?kv(ke,M,_e):Ci(d?ke:j,M,d?_e:Ie);R[x]=Nt,ie[x]=Nt-M}e.modifiersData[n]=ie}}const hy={name:"preventOverflow",enabled:!0,phase:"main",fn:uy,requiresIfExists:["offset"]};function dy(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function fy(r){return r===Mt(r)||!Jt(r)?nl(r):dy(r)}function gy(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 py(r,e,t){t===void 0&&(t=!1);var n=Jt(e),i=Jt(e)&&gy(e),s=Or(e),o=Fn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((hr(e)!=="body"||sl(s))&&(a=fy(e)),Jt(e)?(l=Fn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=il(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function my(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 Ey(r){var e=my(r);return Rv.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function Iy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function Cy(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 ed={placement:"bottom",modifiers:[],strategy:"absolute"};function td(){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 vy(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?ed:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ed,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:nn(a)?vi(a):a.contextElement?vi(a.contextElement):[],popper:vi(l)};var b=Ey(Cy([].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(td(Q,b)){c.rects={reference:py(Q,Ii(b),c.options.strategy==="fixed"),popper:tl(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:Iy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!td(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 yy=[Vv,Ay,$v,Uh,ay,ry,hy,Ov,iy],By=vy({defaultModifiers:yy}),Ty="tippy-box",rd="tippy-content",Qy="tippy-backdrop",nd="tippy-arrow",id="tippy-svg-arrow",on={passive:!0,capture:!0},sd=function(){return document.body};function al(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function ll(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function od(r,e){return typeof r=="function"?r.apply(void 0,e):r}function ad(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function by(r){return r.split(/\s+/).filter(Boolean)}function Nn(r){return[].concat(r)}function ld(r,e){r.indexOf(e)===-1&&r.push(e)}function xy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function wy(r){return r.split("-")[0]}function Ks(r){return[].slice.call(r)}function Ad(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 Js(r){return["Element","Fragment"].some(function(e){return ll(r,e)})}function Sy(r){return ll(r,"NodeList")}function Ry(r){return ll(r,"MouseEvent")}function Dy(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function _y(r){return Js(r)?[r]:Sy(r)?Ks(r):Array.isArray(r)?r:Ks(document.querySelectorAll(r))}function Al(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function cd(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Ly(r){var e,t=Nn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function Fy(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=wy(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 cl(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function ud(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 fr={isTouch:!1},hd=0;function ky(){fr.isTouch||(fr.isTouch=!0,window.performance&&document.addEventListener("mousemove",dd))}function dd(){var r=performance.now();r-hd<20&&(fr.isTouch=!1,document.removeEventListener("mousemove",dd)),hd=r}function Ny(){var r=document.activeElement;if(Dy(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function My(){document.addEventListener("touchstart",ky,on),window.addEventListener("blur",Ny)}var Py=typeof window<"u"&&typeof document<"u",Oy=Py?!!window.msCrypto:!1,Uy={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Gy={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},er=Object.assign({appendTo:sd,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},Uy,Gy),Hy=Object.keys(er),$y=function(e){var t=Object.keys(e);t.forEach(function(n){er[n]=e[n]})};function fd(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=er[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Yy(r,e){var t=e?Object.keys(fd(Object.assign({},er,{plugins:e}))):Hy,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 gd(r,e){var t=Object.assign({},e,{content:od(e.content,[r])},e.ignoreAttributes?{}:Yy(r,e.plugins));return t.aria=Object.assign({},er.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 Vy=function(){return"innerHTML"};function ul(r,e){r[Vy()]=e}function pd(r){var e=Bi();return r===!0?e.className=nd:(e.className=id,Js(r)?e.appendChild(r):ul(e,r)),e}function md(r,e){Js(e.content)?(ul(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ul(r,e.content):r.textContent=e.content)}function hl(r){var e=r.firstElementChild,t=Ks(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(rd)}),arrow:t.find(function(n){return n.classList.contains(nd)||n.classList.contains(id)}),backdrop:t.find(function(n){return n.classList.contains(Qy)})}}function Ed(r){var e=Bi(),t=Bi();t.className=Ty,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=Bi();n.className=rd,n.setAttribute("data-state","hidden"),md(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=hl(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)&&md(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(pd(o.arrow))):l.appendChild(pd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}Ed.$$tippy=!0;var Ky=1,Ws=[],dl=[];function Jy(r,e){var t=gd(r,Object.assign({},er,fd(Ad(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=ad(Xe,t.interactiveDebounce),g,p=Ky++,C=null,Q=xy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:p,reference:r,popper:Bi(),popperInstance:C,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Nt,show:ht,hide:Ot,hideWithInteractivity:mr,enable:be,disable:De,unmount:Er,destroy:Bt};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?Ly(q):document}function D(){return hl(R)}function P(q){return v.state.isMounted&&!v.state.isVisible||fr.isTouch||c&&c.type==="focus"?0:al(v.props.delay,q?0:1,er.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 Oe;(Oe=v.props)[q].apply(Oe,de)}}function S(){var q=v.props.aria;if(q.content){var de="aria-"+q.content,Ce=R.id,Oe=Nn(v.props.triggerTarget||r);Oe.forEach(function(Fe){var je=Fe.getAttribute(de);if(v.state.isVisible)Fe.setAttribute(de,je?je+" "+Ce:Ce);else{var bt=je&&je.replace(Ce,"").trim();bt?Fe.setAttribute(de,bt):Fe.removeAttribute(de)}})}}function F(){if(!(K||!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),Ws=Ws.filter(function(q){return q!==f})}function Y(q){if(!(fr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(v.props.interactive&&ud(R,de))){if(Nn(v.props.triggerTarget||r).some(function(Ce){return ud(Ce,de)})){if(fr.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,on),q.addEventListener("touchstart",ce,on),q.addEventListener("touchmove",ne,on)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,on),q.removeEventListener("touchstart",ce,on),q.removeEventListener("touchmove",ne,on)}function Se(q,de){He(q,function(){!v.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){He(q,de)}function He(q,de){var Ce=D().box;function Oe(Fe){Fe.target===Ce&&(cl(Ce,"remove",Oe),de())}if(q===0)return de();cl(Ce,"remove",u),cl(Ce,"add",Oe),u=Oe}function fe(q,de,Ce){Ce===void 0&&(Ce=!1);var Oe=Nn(v.props.triggerTarget||r);Oe.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})),by(v.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Oy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Pe(){d.forEach(function(q){var de=q.node,Ce=q.eventType,Oe=q.handler,Fe=q.options;de.removeEventListener(Ce,Oe,Fe)}),d=[]}function we(q){var de,Ce=!1;if(!(!v.state.isEnabled||m(q)||a)){var Oe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!v.state.isVisible&&Ry(q)&&Ws.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&&!Oe&&Ie(q)}}function Xe(q){var de=q.target,Ce=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&Ce)){var Oe=z().concat(R).map(function(Fe){var je,bt=Fe._tippy,xt=(je=bt.popperInstance)==null?void 0:je.state;return xt?{popperRect:Fe.getBoundingClientRect(),popperState:xt,props:t}:null}).filter(Boolean);Fy(Oe,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 fr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){w();var q=v.props,de=q.popperOptions,Ce=q.placement,Oe=q.offset,Fe=q.getReferenceClientRect,je=q.moveTransition,bt=ie()?hl(R).arrow:null,xt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,Gn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Hn){var Hr=Hn.state;if(ie()){var Ri=D(),Di=Ri.box;["placement","reference-hidden","escaped"].forEach(function($n){$n==="placement"?Di.setAttribute("data-placement",Hr.placement):Hr.attributes.popper["data-popper-"+$n]?Di.setAttribute("data-"+$n,""):Di.removeAttribute("data-"+$n)}),Hr.attributes.popper={}}}},wt=[{name:"offset",options:{offset:Oe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!je}},Gn];ie()&&bt&&wt.push({name:"arrow",options:{element:bt,padding:3}}),wt.push.apply(wt,(de==null?void 0:de.modifiers)||[]),v.popperInstance=By(xt,R,Object.assign({},de,{placement:Ce,onFirstUpdate:h,modifiers:wt}))}function w(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function M(){var q=v.props.appendTo,de,Ce=te();v.props.interactive&&q===sd||q==="parent"?de=Ce.parentNode:de=od(q,[Ce]),de.contains(R)||de.appendChild(R),v.state.isMounted=!0,E()}function z(){return Ks(R.querySelectorAll("[data-tippy-root]"))}function j(q){v.clearDelayTimeouts(),q&&_("onTrigger",[v,q]),pe();var de=P(!0),Ce=O(),Oe=Ce[0],Fe=Ce[1];fr.isTouch&&Oe==="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]),Pe();var de=v.props,Ce=gd(r,Object.assign({},de,Ad(q),{ignoreAttributes:!0}));v.props=Ce,Qe(),de.interactiveDebounce!==Ce.interactiveDebounce&&(J(),f=ad(Xe,Ce.interactiveDebounce)),de.triggerTarget&&!Ce.triggerTarget?Nn(de.triggerTarget).forEach(function(Oe){Oe.removeAttribute("aria-expanded")}):Ce.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,Ce),v.popperInstance&&(E(),z().forEach(function(Oe){requestAnimationFrame(Oe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[v,q])}}function Nt(q){v.setProps({content:q})}function ht(){var q=v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Oe=fr.isTouch&&!v.props.touch,Fe=al(v.props.duration,0,er.duration);if(!(q||de||Ce||Oe)&&!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 je=D(),bt=je.box,xt=je.content;Al([bt,xt],0)}h=function(){var wt;if(!(!v.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=v.props.moveTransition,ie()&&v.props.animation){var un=D(),Hn=un.box,Hr=un.content;Al([Hn,Hr],Fe),cd([Hn,Hr],"visible")}S(),F(),ld(dl,v),(wt=v.popperInstance)==null||wt.forceUpdate(),_("onMount",[v]),v.props.animation&&ie()&&Le(Fe,function(){v.state.isShown=!0,_("onShown",[v])})}},M()}}function Ot(){var q=!v.state.isVisible,de=v.state.isDestroyed,Ce=!v.state.isEnabled,Oe=al(v.props.duration,1,er.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(),je=Fe.box,bt=Fe.content;v.props.animation&&(Al([je,bt],Oe),cd([je,bt],"hidden"))}S(),F(),v.props.animation?ie()&&Se(Oe,v.unmount):v.unmount()}}function mr(q){le().addEventListener("mousemove",f),ld(Ws,f),f(q)}function Er(){v.state.isVisible&&v.hide(),v.state.isMounted&&(w(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),dl=dl.filter(function(q){return q!==v}),v.state.isMounted=!1,_("onHidden",[v]))}function Bt(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Pe(),delete r._tippy,v.state.isDestroyed=!0,_("onDestroy",[v]))}}function an(r,e){e===void 0&&(e={});var t=er.plugins.concat(e.plugins||[]);My();var n=Object.assign({},e,{plugins:t}),i=_y(r),s=i.reduce(function(o,a){var l=a&&Jy(a,n);return l&&o.push(l),o},[]);return Js(r)?s[0]:s}an.defaultProps=er,an.setDefaultProps=$y,an.currentInput=fr,Object.assign({},Uh,{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)}}),an.setDefaultProps({render:Ed});function Sr(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(Sr).filter(Boolean)),n}class qs 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 Wy=5;function qy(r,e){return r.length!==e.length||r.some((t,n)=>t!==e[n])}class Xy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=mt(),this._controls=mt(),this.host=e}set activeScenes(e){qy(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-Wy&&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 Et(this._canvas)}controls(){return Et(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{Sr(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=>{Sr(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 qs("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 Id(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 jy(){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 Zy(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 Id(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 eB({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 xr({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(xr.Events.LEVEL_LOADED,async()=>{a||l==null||l.stopLoad();const A=await Id(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 tB(r){const{playlist:e}=r;return e&&!jy()&&xr.isSupported()?eB({...r,playlist:e}):Zy(r)}const rB=Wr(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 nB=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=Wr(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=Wr(async t=>{const{key:n,volume:i}=t,s=await tB(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=>Sr(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 qs(`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 Oi(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}=Jo({aspectRatio:n,resolution:1080});try{const A=await Ec({config:e,resolvers:{text:async({options:c})=>{const u=await rB(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 qs("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=Sr(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;Sr(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 iB(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function sB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const fl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],oB={id:"captions",event:"captions:click",label:"Closed Captions"},aB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Cd={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}]},lB={id:"playbackRate",label:"Playback playbackRate",subItems:Cd};class AB extends jl{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==fn.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)),qt}}const gl=gn(AB),cB=Ev(()=>{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=ac.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]}),gr={"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"},uB={colors:gr,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 ${gr["dark-100"]}`,medium:`0 .125rem .625rem ${gr["dark-100"]}`,large:`0 .25rem 1rem ${gr["dark-50"]}`,xl:`.25rem .25rem 1rem ${gr["dark-250"]}`,xxl:`0 .25rem 2rem ${gr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${gr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${gr["dark-50"]}`,text:`0 0 .25rem ${gr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:gr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},vd=gv(uB,{delimiter:"-"}),hB=Object.keys(vd).map(r=>Yn(`:host { --${r}: ${vd[r]}; }`)),Ye=(r=>{const e=class extends r{firstUpdated(){cB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],hB,At`
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})(Cr),x1=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),w1=(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))}}},St=r=>e=>typeof e=="function"?x1(r,e):w1(r,e);class S1{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 eu({config:t})}catch(n){throw new io("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 sf(r,e,t){return Math.min(Math.max(e,r),t)}function bi(r,e){return e?e instanceof ShadowRoot?bi(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:bi(r,e.parentNode):null}function _l(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 R1=Object.defineProperty,D1=Object.getOwnPropertyDescriptor,Nn=(r,e,t,n)=>{for(var i=n>1?void 0:n?D1(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&&R1(e,t,i),i};let Ur=class extends Ye{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`<button
2573
+ `],e})(Cr),dB=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),fB=(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))}}},St=r=>e=>typeof e=="function"?dB(r,e):fB(r,e);class gB{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 Oi(this.host,async([e,t])=>{try{if(!t||e)return;try{this.composition=await Ec({config:t,rootWidth:0,rootHeight:0})}catch(n){throw new qs("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 yd(r,e,t){return Math.min(Math.max(e,r),t)}function Ti(r,e){return e?e instanceof ShadowRoot?Ti(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:Ti(r,e.parentNode):null}function pl(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 pB=Object.defineProperty,mB=Object.getOwnPropertyDescriptor,Mn=(r,e,t,n)=>{for(var i=n>1?void 0:n?mB(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&&pB(e,t,i),i};let Ur=class extends Ye{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`<button
2574
2574
  class=${Ke({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
- `],Nn([ee({type:Boolean})],Ur.prototype,"active",2),Nn([ee({type:String})],Ur.prototype,"size",2),Nn([ee({type:String})],Ur.prototype,"rounded",2),Nn([ee({type:String})],Ur.prototype,"weight",2),Nn([ee({type:String})],Ur.prototype,"icon",2),Ur=Nn([St("vmp-button")],Ur);const of={"arrow-left":()=>ve`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
2654
+ `],Mn([ee({type:Boolean})],Ur.prototype,"active",2),Mn([ee({type:String})],Ur.prototype,"size",2),Mn([ee({type:String})],Ur.prototype,"rounded",2),Mn([ee({type:String})],Ur.prototype,"weight",2),Mn([ee({type:String})],Ur.prototype,"icon",2),Ur=Mn([St("vmp-button")],Ur);const Bd={"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 _1=Object.defineProperty,L1=Object.getOwnPropertyDescriptor,af=(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&&_1(e,t,i),i};let so=class extends Ye{render(){return!this.icon||!Object.keys(of).includes(this.icon)?null:of[this.icon]()}};so.styles=[Ye.styles??[],At`
2815
+ </svg>`};var EB=Object.defineProperty,IB=Object.getOwnPropertyDescriptor,Td=(r,e,t,n)=>{for(var i=n>1?void 0:n?IB(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&&EB(e,t,i),i};let Xs=class extends Ye{render(){return!this.icon||!Object.keys(Bd).includes(this.icon)?null:Bd[this.icon]()}};Xs.styles=[Ye.styles??[],At`
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
- `],af([ee({type:String})],so.prototype,"icon",2),so=af([St("vmp-icon")],so);var F1=Object.defineProperty,k1=Object.getOwnPropertyDescriptor,Mn=(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&&F1(e,t,i),i};let Gr=class extends Ye{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ve`
2822
+ `],Td([ee({type:String})],Xs.prototype,"icon",2),Xs=Td([St("vmp-icon")],Xs);var CB=Object.defineProperty,vB=Object.getOwnPropertyDescriptor,Pn=(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&&CB(e,t,i),i};let Gr=class extends Ye{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=${ct(this.size)}
@@ -2846,11 +2846,11 @@ vec4 transition(vec2 uv) {
2846
2846
  height: 32px;
2847
2847
  width: 32px;
2848
2848
  }
2849
- `],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([St("vmp-icon-button")],Gr);var N1=Object.defineProperty,M1=Object.getOwnPropertyDescriptor,pr=(r,e,t,n)=>{for(var i=n>1?void 0:n?M1(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 ln=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=da,this._currentTime=0,this._sceneController=new S1(this),this._canvasRef=mt(),this._previewRef=mt(),this._previewTimeRef=mt(),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(${sf(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(${sf(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",_l(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=bi("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=bi("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}=Vc({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
+ `],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([St("vmp-icon-button")],Gr);var yB=Object.defineProperty,BB=Object.getOwnPropertyDescriptor,pr=(r,e,t,n)=>{for(var i=n>1?void 0:n?BB(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};let ln=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=jo,this._currentTime=0,this._sceneController=new gB(this),this._canvasRef=mt(),this._previewRef=mt(),this._previewTimeRef=mt(),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(${yd(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&&Sr(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(${yd(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",pl(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=Ti("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=Ti("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}=Jo({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
  ${Et(this._previewRef)}
2852
2852
  class="preview"
2853
- style=${hi({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
2853
+ style=${Ai({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
2854
2854
  >
2855
2855
  <canvas ${Et(this._canvasRef)} class="preview-canvas" width=${i} height=${n}></canvas>
2856
2856
  <vmp-text ${Et(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
- `],pr([ee({type:Object})],ln.prototype,"config",2),pr([ee({type:Boolean})],ln.prototype,"disabled",2),pr([ee({type:Number})],ln.prototype,"aspectRatio",2),pr([ee({attribute:!1})],ln.prototype,"dataResolver",2),ln=pr([St("vmp-video-preview-content")],ln);let Pn=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=da}render(){return ve`
2889
+ `],pr([ee({type:Object})],ln.prototype,"config",2),pr([ee({type:Boolean})],ln.prototype,"disabled",2),pr([ee({type:Number})],ln.prototype,"aspectRatio",2),pr([ee({attribute:!1})],ln.prototype,"dataResolver",2),ln=pr([St("vmp-video-preview-content")],ln);let On=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=jo}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
- `}};pr([ee({type:Object})],Pn.prototype,"config",2),pr([ee({type:Boolean})],Pn.prototype,"disabled",2),pr([ee({type:Number})],Pn.prototype,"aspectRatio",2),pr([ee({attribute:!1})],Pn.prototype,"dataResolver",2),Pn=pr([St("vmp-video-preview")],Pn);class P1 extends zn{constructor(e){if(super(e),e.type!==fn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),qt}}const lf=gn(P1);class O1{constructor(e){this.hiddenControls=[],this._measureRef=mt(),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 Et(this._measureRef)}contain(){return Dl(this._onResize)}hide(e,t){return lf(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return lf(n=>{this._showables[e]={element:n,showOn:t}})}}const Ll=".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 U1=Object.defineProperty,G1=Object.getOwnPropertyDescriptor,xi=(r,e,t,n)=>{for(var i=n>1?void 0:n?G1(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&&U1(e,t,i),i};let An=class extends Ye{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return ve`
2896
+ `}};pr([ee({type:Object})],On.prototype,"config",2),pr([ee({type:Boolean})],On.prototype,"disabled",2),pr([ee({type:Number})],On.prototype,"aspectRatio",2),pr([ee({attribute:!1})],On.prototype,"dataResolver",2),On=pr([St("vmp-video-preview")],On);class TB extends Zn{constructor(e){if(super(e),e.type!==fn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),qt}}const Qd=gn(TB);class QB{constructor(e){this.hiddenControls=[],this._measureRef=mt(),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 Et(this._measureRef)}contain(){return gl(this._onResize)}hide(e,t){return Qd(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return Qd(n=>{this._showables[e]={element:n,showOn:t}})}}const ml=".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 bB=Object.defineProperty,xB=Object.getOwnPropertyDescriptor,Qi=(r,e,t,n)=>{for(var i=n>1?void 0:n?xB(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 Ye{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=${Ke({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
2900
- style=${hi({fontFamily:_m({text:this.content,font:"var(--fontFamilies-sans)"})})}
2900
+ style=${Ai({fontFamily:up({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
- `],xi([ee({type:Boolean})],An.prototype,"semibold",2),xi([ee({type:Boolean})],An.prototype,"truncate",2),xi([ee({type:String})],An.prototype,"size",2),xi([ee({type:String})],An.prototype,"content",2),An=xi([St("vmp-text")],An);var H1=Object.defineProperty,$1=Object.getOwnPropertyDescriptor,wi=(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&&H1(e,t,i),i};let cn=class extends Ye{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=mt()}_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=an(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
+ `],Qi([ee({type:Boolean})],An.prototype,"semibold",2),Qi([ee({type:Boolean})],An.prototype,"truncate",2),Qi([ee({type:String})],An.prototype,"size",2),Qi([ee({type:String})],An.prototype,"content",2),An=Qi([St("vmp-text")],An);var wB=Object.defineProperty,SB=Object.getOwnPropertyDescriptor,bi=(r,e,t,n)=>{for(var i=n>1?void 0:n?SB(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&&wB(e,t,i),i};let cn=class extends Ye{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=mt()}_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=an(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 ${Et(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
- ${Ed(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>ve`
2957
+ ${Nh(((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
- `}};cn.styles=[Ye.styles??[],$n(Ll),At`
2967
+ `}};cn.styles=[Ye.styles??[],Yn(ml),At`
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
- `],wi([ee({type:Object})],cn.prototype,"items",2),wi([ee({type:Array})],cn.prototype,"activeItems",2),wi([rt()],cn.prototype,"visibleItems",2),wi([rt()],cn.prototype,"subItemsActive",2),cn=wi([St("vmp-menu")],cn);var Y1=Object.defineProperty,V1=Object.getOwnPropertyDescriptor,Fl=(r,e,t,n)=>{for(var i=n>1?void 0:n?V1(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&&Y1(e,t,i),i};let Si=class extends Ye{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=mt()}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=an(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
+ `],bi([ee({type:Object})],cn.prototype,"items",2),bi([ee({type:Array})],cn.prototype,"activeItems",2),bi([nt()],cn.prototype,"visibleItems",2),bi([nt()],cn.prototype,"subItemsActive",2),cn=bi([St("vmp-menu")],cn);var RB=Object.defineProperty,DB=Object.getOwnPropertyDescriptor,El=(r,e,t,n)=>{for(var i=n>1?void 0:n?DB(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&&RB(e,t,i),i};let xi=class extends Ye{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=mt()}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=an(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 ${Et(this._contentRef)} class="content">
3032
3032
  <vmp-text content=${this.content}></vmp-text>
3033
3033
  </div>
3034
- `}};Si.styles=[Ye.styles??[],$n(Ll),At`
3034
+ `}};xi.styles=[Ye.styles??[],Yn(ml),At`
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
- `],Fl([ee({type:String})],Si.prototype,"content",2),Fl([ee({type:Boolean})],Si.prototype,"disabled",2),Si=Fl([St("vmp-tooltip")],Si);var K1=Object.defineProperty,J1=Object.getOwnPropertyDescriptor,kl=(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&&K1(e,t,i),i};let Ri=class extends Ye{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=mt(),this._anchorRef=mt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=an(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
+ `],El([ee({type:String})],xi.prototype,"content",2),El([ee({type:Boolean})],xi.prototype,"disabled",2),xi=El([St("vmp-tooltip")],xi);var _B=Object.defineProperty,LB=Object.getOwnPropertyDescriptor,Il=(r,e,t,n)=>{for(var i=n>1?void 0:n?LB(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&&_B(e,t,i),i};let wi=class extends Ye{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=mt(),this._anchorRef=mt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=an(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
  ${Et(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
- `}};Ri.styles=[Ye.styles??[],$n(Ll),At`
3068
+ `}};wi.styles=[Ye.styles??[],Yn(ml),At`
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
- `],kl([ee({type:Number})],Ri.prototype,"volume",2),kl([ee({type:Boolean})],Ri.prototype,"muted",2),Ri=kl([St("vmp-volume-button")],Ri);var W1=Object.defineProperty,q1=Object.getOwnPropertyDescriptor,oo=(r,e,t,n)=>{for(var i=n>1?void 0:n?q1(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&&W1(e,t,i),i};let On=class extends Ye{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=mt(),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
+ `],Il([ee({type:Number})],wi.prototype,"volume",2),Il([ee({type:Boolean})],wi.prototype,"muted",2),wi=Il([St("vmp-volume-button")],wi);var FB=Object.defineProperty,kB=Object.getOwnPropertyDescriptor,js=(r,e,t,n)=>{for(var i=n>1?void 0:n?kB(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&&FB(e,t,i),i};let Un=class extends Ye{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=mt(),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
  ${Et(this._containerRef)}
3214
- ${Dl(this._handleContainerResize)}
3214
+ ${gl(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
- ${Ed(e,({id:t})=>t,t=>ve`
3229
+ ${Nh(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
- `}};On.styles=[Ye.styles??[],At`
3233
+ `}};Un.styles=[Ye.styles??[],At`
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
- `],oo([ee({type:Number})],On.prototype,"duration",2),oo([ee({type:Number})],On.prototype,"currentTime",2),oo([ee({type:Array})],On.prototype,"buffer",2),On=oo([St("vmp-progress-scrubber")],On);var j1=Object.defineProperty,X1=Object.getOwnPropertyDescriptor,ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?X1(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 et=class extends Ye{constructor(){super(...arguments),this.resizeHider=new O1(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=Rl,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,C1,v1,w,y1].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
+ `],js([ee({type:Number})],Un.prototype,"duration",2),js([ee({type:Number})],Un.prototype,"currentTime",2),js([ee({type:Array})],Un.prototype,"buffer",2),Un=js([St("vmp-progress-scrubber")],Un);var NB=Object.defineProperty,MB=Object.getOwnPropertyDescriptor,ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?MB(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&&NB(e,t,i),i};let et=class extends Ye{constructor(){super(...arguments),this.resizeHider=new QB(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=fl,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,oB,aB,x,lB].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=${Ke({container:!0,hidden:!V&&!F})}
3387
+ class=${Ke({container:!0,hidden:!K&&!F})}
3388
3388
  >
3389
3389
  <div
3390
- class=${Ke({"scrubber-container":!0,hidden:!V})}
3390
+ class=${Ke({"scrubber-container":!0,hidden:!K})}
3391
3391
  >
3392
3392
  <vmp-progress-scrubber
3393
3393
  class=${Ke({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=${Ke({hidden:!te})}
3439
3439
  ?semibold=${!0}
3440
- content="${_l(this.currentTime)}${le?"/":null}"
3440
+ content="${pl(this.currentTime)}${le?"/":null}"
3441
3441
  ></vmp-text>
3442
3442
  <vmp-text
3443
3443
  ${this.resizeHider.hide("duration",6)}
3444
3444
  class=${Ke({hidden:!le})}
3445
3445
  ?semibold=${!0}
3446
- content=${_l(this.duration)}
3446
+ content=${pl(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=${Ke({hidden:!j})}
3476
- .items=${rf}
3475
+ class=${Ke({hidden:!X})}
3476
+ .items=${Cd}
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
- `],ot([ee({type:Boolean})],et.prototype,"playing",2),ot([ee({type:Number})],et.prototype,"volume",2),ot([ee({type:Boolean})],et.prototype,"muted",2),ot([ee({type:Number})],et.prototype,"currentTime",2),ot([ee({type:Number})],et.prototype,"duration",2),ot([ee({type:Array})],et.prototype,"languages",2),ot([ee({type:String})],et.prototype,"language",2),ot([ee({type:Array,attribute:!1})],et.prototype,"levels",2),ot([ee({type:Number})],et.prototype,"level",2),ot([ee({type:Number})],et.prototype,"playbackRate",2),ot([ee({type:Array})],et.prototype,"buffer",2),ot([ee({type:Boolean})],et.prototype,"captions",2),ot([ee({type:Boolean})],et.prototype,"fullscreen",2),ot([ee({type:Array})],et.prototype,"controls",2),ot([rt()],et.prototype,"volumeMenuOpen",2),ot([rt()],et.prototype,"languageMenuOpen",2),ot([rt()],et.prototype,"levelsMenuOpen",2),ot([rt()],et.prototype,"playbackRateMenuOpen",2),ot([rt()],et.prototype,"settingsMenuOpen",2),et=ot([St("vmp-player-controls")],et);var z1=Object.defineProperty,Z1=Object.getOwnPropertyDescriptor,eT=(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&&z1(e,t,i),i};let Nl=class extends Ye{render(){return ve`<vmp-icon icon="loading"></vmp-icon>`}};Nl.styles=[Ye.styles??[],At`
3595
+ `],ot([ee({type:Boolean})],et.prototype,"playing",2),ot([ee({type:Number})],et.prototype,"volume",2),ot([ee({type:Boolean})],et.prototype,"muted",2),ot([ee({type:Number})],et.prototype,"currentTime",2),ot([ee({type:Number})],et.prototype,"duration",2),ot([ee({type:Array})],et.prototype,"languages",2),ot([ee({type:String})],et.prototype,"language",2),ot([ee({type:Array,attribute:!1})],et.prototype,"levels",2),ot([ee({type:Number})],et.prototype,"level",2),ot([ee({type:Number})],et.prototype,"playbackRate",2),ot([ee({type:Array})],et.prototype,"buffer",2),ot([ee({type:Boolean})],et.prototype,"captions",2),ot([ee({type:Boolean})],et.prototype,"fullscreen",2),ot([ee({type:Array})],et.prototype,"controls",2),ot([nt()],et.prototype,"volumeMenuOpen",2),ot([nt()],et.prototype,"languageMenuOpen",2),ot([nt()],et.prototype,"levelsMenuOpen",2),ot([nt()],et.prototype,"playbackRateMenuOpen",2),ot([nt()],et.prototype,"settingsMenuOpen",2),et=ot([St("vmp-player-controls")],et);var PB=Object.defineProperty,OB=Object.getOwnPropertyDescriptor,UB=(r,e,t,n)=>{for(var i=n>1?void 0:n?OB(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&&PB(e,t,i),i};let Cl=class extends Ye{render(){return ve`<vmp-icon icon="loading"></vmp-icon>`}};Cl.styles=[Ye.styles??[],At`
3596
3596
  :host {
3597
3597
  display: flex;
3598
3598
  align-items: center;
3599
3599
  justify-content: center;
3600
3600
  }
3601
- `],Nl=eT([St("vmp-loading-spinner")],Nl);var tT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,Af=(r,e,t,n)=>{for(var i=n>1?void 0:n?rT(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&&tT(e,t,i),i};let ao=class extends Ye{constructor(){super(...arguments),this.caption=""}render(){return ve`
3601
+ `],Cl=UB([St("vmp-loading-spinner")],Cl);var GB=Object.defineProperty,HB=Object.getOwnPropertyDescriptor,bd=(r,e,t,n)=>{for(var i=n>1?void 0:n?HB(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&&GB(e,t,i),i};let zs=class extends Ye{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
- `}};ao.styles=[Ye.styles??[],At`
3605
+ `}};zs.styles=[Ye.styles??[],At`
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
- `],Af([ee({type:String})],ao.prototype,"caption",2),ao=Af([St("vmp-captions")],ao);var nT=Object.defineProperty,iT=Object.getOwnPropertyDescriptor,pt=(r,e,t,n)=>{for(var i=n>1?void 0:n?iT(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&&nT(e,t,i),i};const sT=3e3;let at=class extends Ye{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=Rl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=mt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},sT)}_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
+ `],bd([ee({type:String})],zs.prototype,"caption",2),zs=bd([St("vmp-captions")],zs);var $B=Object.defineProperty,YB=Object.getOwnPropertyDescriptor,pt=(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&&$B(e,t,i),i};const VB=3e3;let at=class extends Ye{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=fl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=mt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},VB)}_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=${Ke({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
- `],pt([ee({type:Boolean})],at.prototype,"loading",2),pt([ee({type:Boolean})],at.prototype,"playing",2),pt([ee({type:Number})],at.prototype,"volume",2),pt([ee({type:Boolean})],at.prototype,"muted",2),pt([ee({type:Number})],at.prototype,"currentTime",2),pt([ee({type:Number})],at.prototype,"duration",2),pt([ee({type:Array})],at.prototype,"languages",2),pt([ee({type:String})],at.prototype,"language",2),pt([ee({type:Array,attribute:!1})],at.prototype,"levels",2),pt([ee({type:Number})],at.prototype,"level",2),pt([ee({type:Number})],at.prototype,"playbackRate",2),pt([ee({type:String})],at.prototype,"caption",2),pt([ee({type:Array})],at.prototype,"buffer",2),pt([ee({type:Boolean})],at.prototype,"captions",2),pt([ee({type:Boolean})],at.prototype,"fullscreen",2),pt([ee({type:Array})],at.prototype,"controls",2),pt([rt()],at.prototype,"showControls",2),at=pt([St("vmp-player-overlay")],at);var oT=Object.defineProperty,aT=Object.getOwnPropertyDescriptor,it=(r,e,t,n)=>{for(var i=n>1?void 0:n?aT(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&&oT(e,t,i),i};const lT=1e3/60,AT=30;let ze=class extends Ye{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.dataResolver=da,this.languageResolver=sE,this._sceneController=new m1(this),this._drawController=new u1(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=mt(),this._canvasRef=mt(),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,lT):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/AT){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?I1():this._playerRef.value&&E1(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
+ `],pt([ee({type:Boolean})],at.prototype,"loading",2),pt([ee({type:Boolean})],at.prototype,"playing",2),pt([ee({type:Number})],at.prototype,"volume",2),pt([ee({type:Boolean})],at.prototype,"muted",2),pt([ee({type:Number})],at.prototype,"currentTime",2),pt([ee({type:Number})],at.prototype,"duration",2),pt([ee({type:Array})],at.prototype,"languages",2),pt([ee({type:String})],at.prototype,"language",2),pt([ee({type:Array,attribute:!1})],at.prototype,"levels",2),pt([ee({type:Number})],at.prototype,"level",2),pt([ee({type:Number})],at.prototype,"playbackRate",2),pt([ee({type:String})],at.prototype,"caption",2),pt([ee({type:Array})],at.prototype,"buffer",2),pt([ee({type:Boolean})],at.prototype,"captions",2),pt([ee({type:Boolean})],at.prototype,"fullscreen",2),pt([ee({type:Array})],at.prototype,"controls",2),pt([nt()],at.prototype,"showControls",2),at=pt([St("vmp-player-overlay")],at);var KB=Object.defineProperty,JB=Object.getOwnPropertyDescriptor,tt=(r,e,t,n)=>{for(var i=n>1?void 0:n?JB(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};const WB=1e3/60,qB=30;let qe=class extends Ye{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.disabled=!1,this.dataResolver=jo,this.languageResolver=Yp,this._sceneController=new nB(this),this._drawController=new Xy(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=mt(),this._canvasRef=mt(),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,WB):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=>Sr(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/qB){let t=this._drawController.currentTime;const n=(r-(this._lastTimestamp??r))/1e3*this.playbackRate;if(this.activeScenes[0]){const i=Sr(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?sB():this._playerRef.value&&iB(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}=Vc({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??Rl)==null?void 0:r.filter(A=>!(A==="fullscreen"&&d1())),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}=Jo({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??fl)==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
  ${Et(this._playerRef)}
3769
3769
  class=${Ke({player:!0,responsive:!this.propAspectRatio})}
3770
- style=${hi({aspectRatio:this.aspectRatio})}
3770
+ style=${Ai({aspectRatio:this.aspectRatio})}
3771
3771
  >
3772
3772
  ${!o&&(a||l)?this._renderError():ve`<canvas
3773
3773
  ${Et(this._canvasRef)}
3774
3774
  ${this._drawController.canvas()}
3775
- ${Dl(this._handleCanvasResize)}
3775
+ ${gl(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
- `}};ze.styles=[Ye.styles??[],At`
3813
+ `}};qe.styles=[Ye.styles??[],At`
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
- `],it([ee({type:Boolean})],ze.prototype,"debug",2),it([ee({type:Object})],ze.prototype,"config",2),it([ee({type:String,attribute:"language"})],ze.prototype,"propLanguage",2),it([ee({type:Number,attribute:"aspectratio"})],ze.prototype,"propAspectRatio",2),it([ee({type:String})],ze.prototype,"preload",2),it([ee({type:Boolean})],ze.prototype,"autoplay",2),it([ee({type:Boolean})],ze.prototype,"loading",2),it([ee({type:Array})],ze.prototype,"controls",2),it([ee({attribute:!1})],ze.prototype,"dataResolver",2),it([ee({attribute:!1})],ze.prototype,"languageResolver",2),it([rt()],ze.prototype,"_pageHidden",2),it([rt()],ze.prototype,"_aspectRatio",2),it([rt()],ze.prototype,"_processing",2),it([rt()],ze.prototype,"_waiting",2),it([rt()],ze.prototype,"_errors",2),it([rt()],ze.prototype,"_seeking",2),it([rt()],ze.prototype,"_language",2),it([rt()],ze.prototype,"_languages",2),it([rt()],ze.prototype,"_captions",2),it([rt()],ze.prototype,"_fullscreen",2),ze=it([St("vmp-media-player")],ze);var cT=Object.defineProperty,uT=Object.getOwnPropertyDescriptor,Qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?uT(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&&cT(e,t,i),i};Ne.PlayerEmbed=class extends Cr{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 Vf(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 sg(this),this._trackingController=new jm(this),this._mediaPlayerRef=mt()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get videoState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var n;(n=this._mediaPlayerRef.value)==null||n.reset(e,t)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?ve`
3874
+ `],tt([ee({type:Boolean})],qe.prototype,"debug",2),tt([ee({type:Object})],qe.prototype,"config",2),tt([ee({type:String,attribute:"language"})],qe.prototype,"propLanguage",2),tt([ee({type:Number,attribute:"aspectratio"})],qe.prototype,"propAspectRatio",2),tt([ee({type:String})],qe.prototype,"preload",2),tt([ee({type:Boolean})],qe.prototype,"autoplay",2),tt([ee({type:Boolean})],qe.prototype,"loading",2),tt([ee({type:Boolean})],qe.prototype,"disabled",2),tt([ee({type:Array})],qe.prototype,"controls",2),tt([ee({attribute:!1})],qe.prototype,"dataResolver",2),tt([ee({attribute:!1})],qe.prototype,"languageResolver",2),tt([nt()],qe.prototype,"_pageHidden",2),tt([nt()],qe.prototype,"_aspectRatio",2),tt([nt()],qe.prototype,"_processing",2),tt([nt()],qe.prototype,"_waiting",2),tt([nt()],qe.prototype,"_errors",2),tt([nt()],qe.prototype,"_seeking",2),tt([nt()],qe.prototype,"_language",2),tt([nt()],qe.prototype,"_languages",2),tt([nt()],qe.prototype,"_captions",2),tt([nt()],qe.prototype,"_fullscreen",2),qe=tt([St("vmp-media-player")],qe);var XB=Object.defineProperty,jB=Object.getOwnPropertyDescriptor,Qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?jB(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};Ne.PlayerEmbed=class extends Cr{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 Af(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 Bf(this),this._trackingController=new kp(this),this._mediaPlayerRef=mt()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get mediaState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.mediaState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var n;(n=this._mediaPlayerRef.value)==null||n.reset(e,t)}_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
- `],Qt([ee({type:Object})],Ne.PlayerEmbed.prototype,"data",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"vouchId",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"templateId",2),Qt([ee({type:Array})],Ne.PlayerEmbed.prototype,"questions",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"env",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"apiKey",2),Qt([ee({type:Boolean})],Ne.PlayerEmbed.prototype,"disableTracking",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"trackingSource",2),Qt([ee({type:Array})],Ne.PlayerEmbed.prototype,"controls",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"preload",2),Qt([ee({type:Boolean})],Ne.PlayerEmbed.prototype,"autoplay",2),Qt([ee({type:Number})],Ne.PlayerEmbed.prototype,"aspectRatio",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"language",2),Qt([rt()],Ne.PlayerEmbed.prototype,"vouch",2),Qt([rt()],Ne.PlayerEmbed.prototype,"template",2),Ne.PlayerEmbed=Qt([Oi("vouch-embed-player")],Ne.PlayerEmbed);function lo(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?lo(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(...lo(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...lo(l,e,t,n,i+1)));return s}function cf(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 hT(r){return r.hasAttribute("disabled")||r.hasAttribute("aria-disabled")&&r.getAttribute("aria-disabled")!=="false"}function dT(r){return r.getAttribute("tabindex")==="-1"||cf(r)||hT(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 Ml=new Map;function fT(r,e,t){const n=Ml.get(t);n!=null&&window.clearTimeout(n),Ml.set(t,window.setTimeout(()=>{r(),Ml.delete(t)},e))}const uf=document.createElement("template");uf.innerHTML=`
3903
+ `],Qt([ee({type:Object})],Ne.PlayerEmbed.prototype,"data",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"vouchId",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"templateId",2),Qt([ee({type:Array})],Ne.PlayerEmbed.prototype,"questions",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"env",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"apiKey",2),Qt([ee({type:Boolean})],Ne.PlayerEmbed.prototype,"disableTracking",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"trackingSource",2),Qt([ee({type:Array})],Ne.PlayerEmbed.prototype,"controls",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"preload",2),Qt([ee({type:Boolean})],Ne.PlayerEmbed.prototype,"autoplay",2),Qt([ee({type:Number})],Ne.PlayerEmbed.prototype,"aspectRatio",2),Qt([ee({type:String})],Ne.PlayerEmbed.prototype,"language",2),Qt([nt()],Ne.PlayerEmbed.prototype,"vouch",2),Qt([nt()],Ne.PlayerEmbed.prototype,"template",2),Ne.PlayerEmbed=Qt([Mi("vouch-embed-player")],Ne.PlayerEmbed);function Zs(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?Zs(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(...Zs(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...Zs(l,e,t,n,i+1)));return s}function xd(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 ZB(r){return r.getAttribute("tabindex")==="-1"||xd(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 vl=new Map;function e1(r,e,t){const n=vl.get(t);n!=null&&window.clearTimeout(n),vl.set(t,window.setTimeout(()=>{r(),vl.delete(t)},e))}const wd=document.createElement("template");wd.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 gT extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(uf.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 lo(this,cf,dT)}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){fT(()=>{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",gT);var pT=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,Pl=(r,e,t,n)=>{for(var i=n>1?void 0:n?mT(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&&pT(e,t,i),i};let Di=class extends Cr{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ve`
3908
+ `;class t1 extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(wd.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 Zs(this,xd,ZB)}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){e1(()=>{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",t1);var r1=Object.defineProperty,n1=Object.getOwnPropertyDescriptor,yl=(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&&r1(e,t,i),i};let Si=class extends Cr{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ve`
3909
3909
  <div
3910
3910
  class=${Ke({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=${Ke({"video-frame":!0,grow:this.aspectRatio===0})}
3919
- style=${hi({aspectRatio:this.aspectRatio})}
3919
+ style=${Ai({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
- `}};Di.styles=[At`
3931
+ `}};Si.styles=[At`
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
- `],Pl([ee({type:Boolean})],Di.prototype,"open",2),Pl([ee({type:Number})],Di.prototype,"aspectRatio",2),Di=Pl([Oi("vouch-embed-dialog-overlay")],Di);var ET=Object.defineProperty,IT=Object.getOwnPropertyDescriptor,Pt=(r,e,t,n)=>{for(var i=n>1?void 0:n?IT(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&&ET(e,t,i),i};let kt=class extends Cr{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=mt(),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
+ `],yl([ee({type:Boolean})],Si.prototype,"open",2),yl([ee({type:Number})],Si.prototype,"aspectRatio",2),Si=yl([Mi("vouch-embed-dialog-overlay")],Si);var i1=Object.defineProperty,s1=Object.getOwnPropertyDescriptor,Pt=(r,e,t,n)=>{for(var i=n>1?void 0:n?s1(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&&i1(e,t,i),i};let kt=class extends Cr{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=mt(),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
  ${Et(this._mediaPlayerRef)}
3999
- style=${hi({maxWidth:"100%",maxHeight:"100%"})}
3999
+ style=${Ai({maxWidth:"100%",maxHeight:"100%"})}
4000
4000
  ?autoplay=${!1}
4001
4001
  vouchId=${ct(this.vouchId)}
4002
4002
  templateId=${ct(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
- `}};Pt([ee({type:String})],kt.prototype,"vouchId",2),Pt([ee({type:String})],kt.prototype,"templateId",2),Pt([ee({type:Array})],kt.prototype,"questions",2),Pt([ee({type:String})],kt.prototype,"env",2),Pt([ee({type:String})],kt.prototype,"apiKey",2),Pt([ee({type:Boolean})],kt.prototype,"disableTracking",2),Pt([ee({type:String})],kt.prototype,"trackingSource",2),Pt([ee({type:Array})],kt.prototype,"controls",2),Pt([ee({type:String})],kt.prototype,"preload",2),Pt([ee({type:Boolean})],kt.prototype,"disableAutoplay",2),Pt([ee({type:Number})],kt.prototype,"aspectRatio",2),Pt([rt()],kt.prototype,"open",2),kt=Pt([Oi("vouch-embed-dialog-portal")],kt);var CT=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,Wt=(r,e,t,n)=>{for(var i=n>1?void 0:n?vT(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&&CT(e,t,i),i};return Ne.DialogEmbed=class extends Cr{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=Lr(),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
+ `}};Pt([ee({type:String})],kt.prototype,"vouchId",2),Pt([ee({type:String})],kt.prototype,"templateId",2),Pt([ee({type:Array})],kt.prototype,"questions",2),Pt([ee({type:String})],kt.prototype,"env",2),Pt([ee({type:String})],kt.prototype,"apiKey",2),Pt([ee({type:Boolean})],kt.prototype,"disableTracking",2),Pt([ee({type:String})],kt.prototype,"trackingSource",2),Pt([ee({type:Array})],kt.prototype,"controls",2),Pt([ee({type:String})],kt.prototype,"preload",2),Pt([ee({type:Boolean})],kt.prototype,"disableAutoplay",2),Pt([ee({type:Number})],kt.prototype,"aspectRatio",2),Pt([nt()],kt.prototype,"open",2),kt=Pt([Mi("vouch-embed-dialog-portal")],kt);var o1=Object.defineProperty,a1=Object.getOwnPropertyDescriptor,Wt=(r,e,t,n)=>{for(var i=n>1?void 0:n?a1(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&&o1(e,t,i),i};return Ne.DialogEmbed=class extends Cr{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`
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
- `],Wt([ee({type:String})],Ne.DialogEmbed.prototype,"vouchId",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"templateId",2),Wt([ee({type:Array})],Ne.DialogEmbed.prototype,"questions",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"env",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"apiKey",2),Wt([ee({type:Boolean})],Ne.DialogEmbed.prototype,"disableTracking",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"trackingSource",2),Wt([ee({type:Array})],Ne.DialogEmbed.prototype,"controls",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"preload",2),Wt([ee({type:Boolean})],Ne.DialogEmbed.prototype,"disableAutoplay",2),Wt([ee({type:Number})],Ne.DialogEmbed.prototype,"aspectRatio",2),Ne.DialogEmbed=Wt([Oi("vouch-embed-dialog")],Ne.DialogEmbed),Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"}),Ne}({});
4041
+ `],Wt([ee({type:String})],Ne.DialogEmbed.prototype,"vouchId",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"templateId",2),Wt([ee({type:Array})],Ne.DialogEmbed.prototype,"questions",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"env",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"apiKey",2),Wt([ee({type:Boolean})],Ne.DialogEmbed.prototype,"disableTracking",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"trackingSource",2),Wt([ee({type:Array})],Ne.DialogEmbed.prototype,"controls",2),Wt([ee({type:String})],Ne.DialogEmbed.prototype,"preload",2),Wt([ee({type:Boolean})],Ne.DialogEmbed.prototype,"disableAutoplay",2),Wt([ee({type:Number})],Ne.DialogEmbed.prototype,"aspectRatio",2),Ne.DialogEmbed=Wt([Mi("vouch-embed-dialog")],Ne.DialogEmbed),Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"}),Ne}({});
4042
4042
  //# sourceMappingURL=embeds.iife.js.map