@vouchfor/embeds 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. package/dist/es/{browser-1b4c09f1.js → browser-f8654733.js} +2 -2
  2. package/dist/es/{browser-1b4c09f1.js.map → browser-f8654733.js.map} +1 -1
  3. package/dist/es/embeds.js +1 -1
  4. package/dist/es/{index-37e10211.js → index-65006a92.js} +2153 -2150
  5. package/dist/es/index-65006a92.js.map +1 -0
  6. package/dist/iife/dialog-embed/{browser-aef6773c.js → browser-b36b6e3e.js} +2 -2
  7. package/dist/iife/dialog-embed/{browser-aef6773c.js.map → browser-b36b6e3e.js.map} +1 -1
  8. package/dist/iife/dialog-embed/embed.iife.js +83 -83
  9. package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
  10. package/dist/iife/dialog-embed/embed.js +1 -1
  11. package/dist/iife/dialog-embed/{index-98ee90b7.js → index-72887ffc.js} +2420 -2404
  12. package/dist/iife/dialog-embed/index-72887ffc.js.map +1 -0
  13. package/dist/iife/embeds.iife.js +82 -82
  14. package/dist/iife/embeds.iife.js.map +1 -1
  15. package/dist/iife/player-embed/{browser-3fc50faa.js → browser-69a47b14.js} +2 -2
  16. package/dist/iife/player-embed/{browser-3fc50faa.js.map → browser-69a47b14.js.map} +1 -1
  17. package/dist/iife/player-embed/embed.iife.js +80 -80
  18. package/dist/iife/player-embed/embed.iife.js.map +1 -1
  19. package/dist/iife/player-embed/embed.js +1 -1
  20. package/dist/iife/player-embed/{index-ec0750d4.js → index-854590ba.js} +2389 -2373
  21. package/dist/iife/player-embed/index-854590ba.js.map +1 -0
  22. package/package.json +2 -2
  23. package/dist/es/index-37e10211.js.map +0 -1
  24. package/dist/iife/dialog-embed/index-98ee90b7.js.map +0 -1
  25. package/dist/iife/player-embed/index-ec0750d4.js.map +0 -1
@@ -1,36 +1,36 @@
1
- var Xy=Object.defineProperty;var zy=(Ye,li,qt)=>li in Ye?Xy(Ye,li,{enumerable:!0,configurable:!0,writable:!0,value:qt}):Ye[li]=qt;var ld=(Ye,li,qt)=>(zy(Ye,typeof li!="symbol"?li+"":li,qt),qt);var dialogEmbed=function(Ye){var ed;"use strict";function li(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
1
+ var zy=Object.defineProperty;var Zy=(Ye,li,qt)=>li in Ye?zy(Ye,li,{enumerable:!0,configurable:!0,writable:!0,value:qt}):Ye[li]=qt;var cd=(Ye,li,qt)=>(Zy(Ye,typeof li!="symbol"?li+"":li,qt),qt);var dialogEmbed=function(Ye){var td;"use strict";function li(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const qt=globalThis,jn=qt.ShadowRoot&&(qt.ShadyCSS===void 0||qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,mA=Symbol(),CA=new WeakMap;let ud=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==mA)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(jn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=CA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&CA.set(t,e))}return e}toString(){return this.cssText}};const dd=s=>new ud(typeof s=="string"?s:s+"",void 0,mA),gd=(s,e)=>{if(jn)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=qt.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},yA=jn?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return dd(t)})(s):s;/**
5
+ */const qt=globalThis,jn=qt.ShadowRoot&&(qt.ShadyCSS===void 0||qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,mA=Symbol(),CA=new WeakMap;let dd=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==mA)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(jn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=CA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&CA.set(t,e))}return e}toString(){return this.cssText}};const gd=s=>new dd(typeof s=="string"?s:s+"",void 0,mA),fd=(s,e)=>{if(jn)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=qt.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},yA=jn?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return gd(t)})(s):s;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:fd,defineProperty:pd,getOwnPropertyDescriptor:Ed,getOwnPropertyNames:Id,getOwnPropertySymbols:md,getPrototypeOf:Cd}=Object,Qi=globalThis,vA=Qi.trustedTypes,yd=vA?vA.emptyScript:"",Xn=Qi.reactiveElementPolyfillSupport,_s=(s,e)=>s,Lr={toAttribute(s,e){switch(e){case Boolean:s=s?yd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},zn=(s,e)=>!fd(s,e),BA={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:zn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Qi.litPropertyMetadata??(Qi.litPropertyMetadata=new WeakMap);let ks=class 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=BA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&pd(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Ed(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??BA}static _$Ei(){if(this.hasOwnProperty(_s("elementProperties")))return;const e=Cd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_s("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_s("properties"))){const t=this.properties,i=[...Id(t),...md(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(yA(r))}else e!==void 0&&t.push(yA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return gd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Lr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Lr;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??zn)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$E_)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}};ks.elementStyles=[],ks.shadowRootOptions={mode:"open"},ks[_s("elementProperties")]=new Map,ks[_s("finalized")]=new Map,Xn==null||Xn({ReactiveElement:ks}),(Qi.reactiveElementVersions??(Qi.reactiveElementVersions=[])).push("2.0.2");/**
9
+ */const{is:pd,defineProperty:Ed,getOwnPropertyDescriptor:Id,getOwnPropertyNames:md,getOwnPropertySymbols:Cd,getPrototypeOf:yd}=Object,bi=globalThis,vA=bi.trustedTypes,vd=vA?vA.emptyScript:"",Xn=bi.reactiveElementPolyfillSupport,_s=(s,e)=>s,Lr={toAttribute(s,e){switch(e){case Boolean:s=s?vd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},zn=(s,e)=>!pd(s,e),BA={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:zn};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),bi.litPropertyMetadata??(bi.litPropertyMetadata=new WeakMap);let ks=class 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=BA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&Ed(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Id(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??BA}static _$Ei(){if(this.hasOwnProperty(_s("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(_s("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_s("properties"))){const t=this.properties,i=[...md(t),...Cd(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(yA(r))}else e!==void 0&&t.push(yA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return fd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Lr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Lr;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??zn)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$E_)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}};ks.elementStyles=[],ks.shadowRootOptions={mode:"open"},ks[_s("elementProperties")]=new Map,ks[_s("finalized")]=new Map,Xn==null||Xn({ReactiveElement:ks}),(bi.reactiveElementVersions??(bi.reactiveElementVersions=[])).push("2.0.2");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Fs=globalThis,_r=Fs.trustedTypes,QA=_r?_r.createPolicy("lit-html",{createHTML:s=>s}):void 0,Zn="$lit$",ci=`lit$${(Math.random()+"").slice(9)}$`,eo="?"+ci,vd=`<${eo}>`,Hi=document,kr=()=>Hi.createComment(""),Ns=s=>s===null||typeof s!="object"&&typeof s!="function",bA=Array.isArray,SA=s=>bA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",to=`[
13
+ */const Fs=globalThis,_r=Fs.trustedTypes,QA=_r?_r.createPolicy("lit-html",{createHTML:s=>s}):void 0,Zn="$lit$",ci=`lit$${(Math.random()+"").slice(9)}$`,eo="?"+ci,Bd=`<${eo}>`,Hi=document,kr=()=>Hi.createComment(""),Ns=s=>s===null||typeof s!="object"&&typeof s!="function",bA=Array.isArray,SA=s=>bA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",to=`[
14
14
  \f\r]`,Ms=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wA=/-->/g,TA=/>/g,$i=RegExp(`>|${to}(?:([^\\s"'>=/]+)(${to}*=${to}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),xA=/'/g,DA=/"/g,RA=/^(?:script|style|textarea|title)$/i,bi=Symbol.for("lit-noChange"),qe=Symbol.for("lit-nothing"),LA=new WeakMap,Yi=Hi.createTreeWalker(Hi,129);function _A(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return QA!==void 0?QA.createHTML(e):e}const kA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ms;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Ms?c[1]==="!--"?o=wA:c[1]!==void 0?o=TA:c[2]!==void 0?(RA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=$i):c[3]!==void 0&&(o=$i):o===$i?c[0]===">"?(o=r??Ms,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?$i:c[3]==='"'?DA:xA):o===DA||o===xA?o=$i:o===wA||o===TA?o=Ms:(o=$i,r=void 0);const d=o===$i&&s[a+1].startsWith("/>")?" ":"";n+=o===Ms?A+vd:h>=0?(i.push(l),A.slice(0,h)+Zn+A.slice(h)+ci+d):A+ci+(h===-2?a:d)}return[_A(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};let io=class cd{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=kA(e,t);if(this.el=cd.createElement(l,i),Yi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Yi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Zn)){const u=c[o++],d=r.getAttribute(h).split(ci),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?NA:g[1]==="?"?MA:g[1]==="@"?OA:Os}),r.removeAttribute(h)}else h.startsWith(ci)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(RA.test(r.tagName)){const h=r.textContent.split(ci),u=h.length-1;if(u>0){r.textContent=_r?_r.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],kr()),Yi.nextNode(),A.push({type:2,index:++n});r.append(h[u],kr())}}}else if(r.nodeType===8)if(r.data===eo)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(ci,h+1))!==-1;)A.push({type:7,index:n}),h+=ci.length-1}n++}}static createElement(e,t){const i=Hi.createElement("template");return i.innerHTML=e,i}};function Ki(s,e,t=s,i){var o,a;if(e===bi)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Ns(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=Ki(s,r._$AS(s,e.values),r,i)),e}let FA=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Hi).importNode(t,!0);Yi.currentNode=r;let n=Yi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new so(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new PA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Yi.nextNode(),o++)}return Yi.currentNode=Hi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},so=class hd{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=qe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ki(this,e,t),Ns(e)?e===qe||e==null||e===""?(this._$AH!==qe&&this._$AR(),this._$AH=qe):e!==this._$AH&&e!==bi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):SA(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==qe&&Ns(this._$AH)?this._$AA.nextSibling.data=e:this.$(Hi.createTextNode(e)),this._$AH=e}g(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=io.createElement(_A(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new FA(r,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=LA.get(e.strings);return t===void 0&&LA.set(e.strings,t=new io(e)),t}T(e){bA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new hd(this.k(kr()),this.k(kr()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},Os=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=qe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=qe}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Ki(this,e,t,0),o=!Ns(e)||e!==this._$AH&&e!==bi,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Ki(this,a[i+A],t,A),l===bi&&(l=this._$AH[A]),o||(o=!Ns(l)||l!==this._$AH[A]),l===qe?e=qe:e!==qe&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.O(e)}O(e){e===qe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},NA=class extends Os{constructor(){super(...arguments),this.type=3}O(e){this.element[this.name]=e===qe?void 0:e}},MA=class extends Os{constructor(){super(...arguments),this.type=4}O(e){this.element.toggleAttribute(this.name,!!e&&e!==qe)}},OA=class extends Os{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Ki(this,e,t,0)??qe)===bi)return;const i=this._$AH,r=e===qe&&i!==qe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==qe&&(i===qe||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}},PA=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ki(this,e)}};const Bd={j:Zn,P:ci,A:eo,C:1,M:kA,L:FA,R:SA,V:Ki,D:so,I:Os,H:MA,N:OA,U:NA,B:PA},ro=Fs.litHtmlPolyfillSupport;ro==null||ro(io,so),(Fs.litHtmlVersions??(Fs.litHtmlVersions=[])).push("3.1.0");/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),xA=/'/g,DA=/"/g,RA=/^(?:script|style|textarea|title)$/i,Si=Symbol.for("lit-noChange"),qe=Symbol.for("lit-nothing"),LA=new WeakMap,Yi=Hi.createTreeWalker(Hi,129);function _A(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return QA!==void 0?QA.createHTML(e):e}const kA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ms;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Ms?c[1]==="!--"?o=wA:c[1]!==void 0?o=TA:c[2]!==void 0?(RA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=$i):c[3]!==void 0&&(o=$i):o===$i?c[0]===">"?(o=r??Ms,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?$i:c[3]==='"'?DA:xA):o===DA||o===xA?o=$i:o===wA||o===TA?o=Ms:(o=$i,r=void 0);const d=o===$i&&s[a+1].startsWith("/>")?" ":"";n+=o===Ms?A+Bd:h>=0?(i.push(l),A.slice(0,h)+Zn+A.slice(h)+ci+d):A+ci+(h===-2?a:d)}return[_A(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};let io=class hd{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=kA(e,t);if(this.el=hd.createElement(l,i),Yi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Yi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Zn)){const u=c[o++],d=r.getAttribute(h).split(ci),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?NA:g[1]==="?"?MA:g[1]==="@"?OA:Os}),r.removeAttribute(h)}else h.startsWith(ci)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(RA.test(r.tagName)){const h=r.textContent.split(ci),u=h.length-1;if(u>0){r.textContent=_r?_r.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],kr()),Yi.nextNode(),A.push({type:2,index:++n});r.append(h[u],kr())}}}else if(r.nodeType===8)if(r.data===eo)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(ci,h+1))!==-1;)A.push({type:7,index:n}),h+=ci.length-1}n++}}static createElement(e,t){const i=Hi.createElement("template");return i.innerHTML=e,i}};function Ki(s,e,t=s,i){var o,a;if(e===Si)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Ns(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=Ki(s,r._$AS(s,e.values),r,i)),e}let FA=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Hi).importNode(t,!0);Yi.currentNode=r;let n=Yi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new so(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new PA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Yi.nextNode(),o++)}return Yi.currentNode=Hi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},so=class ud{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=qe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ki(this,e,t),Ns(e)?e===qe||e==null||e===""?(this._$AH!==qe&&this._$AR(),this._$AH=qe):e!==this._$AH&&e!==Si&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):SA(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==qe&&Ns(this._$AH)?this._$AA.nextSibling.data=e:this.$(Hi.createTextNode(e)),this._$AH=e}g(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=io.createElement(_A(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new FA(r,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=LA.get(e.strings);return t===void 0&&LA.set(e.strings,t=new io(e)),t}T(e){bA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new ud(this.k(kr()),this.k(kr()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},Os=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=qe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=qe}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Ki(this,e,t,0),o=!Ns(e)||e!==this._$AH&&e!==Si,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Ki(this,a[i+A],t,A),l===Si&&(l=this._$AH[A]),o||(o=!Ns(l)||l!==this._$AH[A]),l===qe?e=qe:e!==qe&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.O(e)}O(e){e===qe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},NA=class extends Os{constructor(){super(...arguments),this.type=3}O(e){this.element[this.name]=e===qe?void 0:e}},MA=class extends Os{constructor(){super(...arguments),this.type=4}O(e){this.element.toggleAttribute(this.name,!!e&&e!==qe)}},OA=class extends Os{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Ki(this,e,t,0)??qe)===Si)return;const i=this._$AH,r=e===qe&&i!==qe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==qe&&(i===qe||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}},PA=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ki(this,e)}};const Qd={j:Zn,P:ci,A:eo,C:1,M:kA,L:FA,R:SA,V:Ki,D:so,I:Os,H:MA,N:OA,U:NA,B:PA},ro=Fs.litHtmlPolyfillSupport;ro==null||ro(io,so),(Fs.litHtmlVersions??(Fs.litHtmlVersions=[])).push("3.1.0");/**
16
16
  * @license
17
17
  * Copyright 2019 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */const Fr=globalThis,no=Fr.ShadowRoot&&(Fr.ShadyCSS===void 0||Fr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oo=Symbol(),UA=new WeakMap;let GA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==oo)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(no&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=UA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&UA.set(t,e))}return e}toString(){return this.cssText}};const Ps=s=>new GA(typeof s=="string"?s:s+"",void 0,oo),Ze=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new GA(t,s,oo)},Qd=(s,e)=>{if(no)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Fr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},HA=no?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Ps(t)})(s):s;/**
19
+ */const Fr=globalThis,no=Fr.ShadowRoot&&(Fr.ShadyCSS===void 0||Fr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oo=Symbol(),UA=new WeakMap;let GA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==oo)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(no&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=UA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&UA.set(t,e))}return e}toString(){return this.cssText}};const Ps=s=>new GA(typeof s=="string"?s:s+"",void 0,oo),Ze=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new GA(t,s,oo)},bd=(s,e)=>{if(no)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Fr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},HA=no?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Ps(t)})(s):s;/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const{is:bd,defineProperty:Sd,getOwnPropertyDescriptor:wd,getOwnPropertyNames:Td,getOwnPropertySymbols:xd,getPrototypeOf:Dd}=Object,Si=globalThis,$A=Si.trustedTypes,Rd=$A?$A.emptyScript:"",ao=Si.reactiveElementPolyfillSupport,Us=(s,e)=>s,Ao={toAttribute(s,e){switch(e){case Boolean:s=s?Rd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},YA=(s,e)=>!bd(s,e),KA={attribute:!0,type:String,converter:Ao,reflect:!1,hasChanged:YA};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Si.litPropertyMetadata??(Si.litPropertyMetadata=new WeakMap);let cs=class 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=KA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&Sd(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=wd(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??KA}static _$Ei(){if(this.hasOwnProperty(Us("elementProperties")))return;const e=Dd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Us("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Us("properties"))){const t=this.properties,i=[...Td(t),...xd(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(HA(r))}else e!==void 0&&t.push(HA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Qd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Ao).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Ao;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??YA)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$E_)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}};cs.elementStyles=[],cs.shadowRootOptions={mode:"open"},cs[Us("elementProperties")]=new Map,cs[Us("finalized")]=new Map,ao==null||ao({ReactiveElement:cs}),(Si.reactiveElementVersions??(Si.reactiveElementVersions=[])).push("2.0.2");/**
23
+ */const{is:Sd,defineProperty:wd,getOwnPropertyDescriptor:Td,getOwnPropertyNames:xd,getOwnPropertySymbols:Dd,getPrototypeOf:Rd}=Object,wi=globalThis,$A=wi.trustedTypes,Ld=$A?$A.emptyScript:"",ao=wi.reactiveElementPolyfillSupport,Us=(s,e)=>s,Ao={toAttribute(s,e){switch(e){case Boolean:s=s?Ld:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},YA=(s,e)=>!Sd(s,e),KA={attribute:!0,type:String,converter:Ao,reflect:!1,hasChanged:YA};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),wi.litPropertyMetadata??(wi.litPropertyMetadata=new WeakMap);let cs=class 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=KA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&wd(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Td(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??KA}static _$Ei(){if(this.hasOwnProperty(Us("elementProperties")))return;const e=Rd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Us("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Us("properties"))){const t=this.properties,i=[...xd(t),...Dd(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(HA(r))}else e!==void 0&&t.push(HA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Ao).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Ao;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??YA)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$E_)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}};cs.elementStyles=[],cs.shadowRootOptions={mode:"open"},cs[Us("elementProperties")]=new Map,cs[Us("finalized")]=new Map,ao==null||ao({ReactiveElement:cs}),(wi.reactiveElementVersions??(wi.reactiveElementVersions=[])).push("2.0.2");/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Gs=globalThis,Nr=Gs.trustedTypes,VA=Nr?Nr.createPolicy("lit-html",{createHTML:s=>s}):void 0,JA="$lit$",wi=`lit$${(Math.random()+"").slice(9)}$`,WA="?"+wi,Ld=`<${WA}>`,Vi=document,Hs=()=>Vi.createComment(""),$s=s=>s===null||typeof s!="object"&&typeof s!="function",qA=Array.isArray,_d=s=>qA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",lo=`[
27
+ */const Gs=globalThis,Nr=Gs.trustedTypes,VA=Nr?Nr.createPolicy("lit-html",{createHTML:s=>s}):void 0,JA="$lit$",Ti=`lit$${(Math.random()+"").slice(9)}$`,WA="?"+Ti,_d=`<${WA}>`,Vi=document,Hs=()=>Vi.createComment(""),$s=s=>s===null||typeof s!="object"&&typeof s!="function",qA=Array.isArray,kd=s=>qA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",lo=`[
28
28
  \f\r]`,Ys=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jA=/-->/g,XA=/>/g,Ji=RegExp(`>|${lo}(?:([^\\s"'>=/]+)(${lo}*=${lo}*(?:[^
29
- \f\r"'\`<>=]|("|')|))|$)`,"g"),zA=/'/g,ZA=/"/g,el=/^(?:script|style|textarea|title)$/i,kd=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),ge=kd(1),Ti=Symbol.for("lit-noChange"),st=Symbol.for("lit-nothing"),tl=new WeakMap,Wi=Vi.createTreeWalker(Vi,129);function il(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return VA!==void 0?VA.createHTML(e):e}const Fd=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ys;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Ys?c[1]==="!--"?o=jA:c[1]!==void 0?o=XA:c[2]!==void 0?(el.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Ji):c[3]!==void 0&&(o=Ji):o===Ji?c[0]===">"?(o=r??Ys,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Ji:c[3]==='"'?ZA:zA):o===ZA||o===zA?o=Ji:o===jA||o===XA?o=Ys:(o=Ji,r=void 0);const d=o===Ji&&s[a+1].startsWith("/>")?" ":"";n+=o===Ys?A+Ld:h>=0?(i.push(l),A.slice(0,h)+JA+A.slice(h)+wi+d):A+wi+(h===-2?a:d)}return[il(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Ks{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=Fd(e,t);if(this.el=Ks.createElement(l,i),Wi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Wi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(JA)){const u=c[o++],d=r.getAttribute(h).split(wi),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?Md:g[1]==="?"?Od:g[1]==="@"?Pd:Mr}),r.removeAttribute(h)}else h.startsWith(wi)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(el.test(r.tagName)){const h=r.textContent.split(wi),u=h.length-1;if(u>0){r.textContent=Nr?Nr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Hs()),Wi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Hs())}}}else if(r.nodeType===8)if(r.data===WA)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(wi,h+1))!==-1;)A.push({type:7,index:n}),h+=wi.length-1}n++}}static createElement(e,t){const i=Vi.createElement("template");return i.innerHTML=e,i}}function hs(s,e,t=s,i){var o,a;if(e===Ti)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=$s(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=hs(s,r._$AS(s,e.values),r,i)),e}let Nd=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Vi).importNode(t,!0);Wi.currentNode=r;let n=Wi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new Vs(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new Ud(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Wi.nextNode(),o++)}return Wi.currentNode=Vi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}};class Vs{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=st,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=hs(this,e,t),$s(e)?e===st||e==null||e===""?(this._$AH!==st&&this._$AR(),this._$AH=st):e!==this._$AH&&e!==Ti&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):_d(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==st&&$s(this._$AH)?this._$AA.nextSibling.data=e:this.$(Vi.createTextNode(e)),this._$AH=e}g(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ks.createElement(il(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Nd(r,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=tl.get(e.strings);return t===void 0&&tl.set(e.strings,t=new Ks(e)),t}T(e){qA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new Vs(this.k(Hs()),this.k(Hs()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Mr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=st,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=st}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=hs(this,e,t,0),o=!$s(e)||e!==this._$AH&&e!==Ti,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=hs(this,a[i+A],t,A),l===Ti&&(l=this._$AH[A]),o||(o=!$s(l)||l!==this._$AH[A]),l===st?e=st:e!==st&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.O(e)}O(e){e===st?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Md extends Mr{constructor(){super(...arguments),this.type=3}O(e){this.element[this.name]=e===st?void 0:e}}class Od extends Mr{constructor(){super(...arguments),this.type=4}O(e){this.element.toggleAttribute(this.name,!!e&&e!==st)}}class Pd extends Mr{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=hs(this,e,t,0)??st)===Ti)return;const i=this._$AH,r=e===st&&i!==st||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==st&&(i===st||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Ud{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){hs(this,e)}}const co=Gs.litHtmlPolyfillSupport;co==null||co(Ks,Vs),(Gs.litHtmlVersions??(Gs.litHtmlVersions=[])).push("3.1.0");const Gd=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new Vs(e.insertBefore(Hs(),n),n,void 0,t??{})}return r._$AI(s),r};/**
29
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),zA=/'/g,ZA=/"/g,el=/^(?:script|style|textarea|title)$/i,Fd=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),ge=Fd(1),xi=Symbol.for("lit-noChange"),st=Symbol.for("lit-nothing"),tl=new WeakMap,Wi=Vi.createTreeWalker(Vi,129);function il(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return VA!==void 0?VA.createHTML(e):e}const Nd=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ys;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Ys?c[1]==="!--"?o=jA:c[1]!==void 0?o=XA:c[2]!==void 0?(el.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Ji):c[3]!==void 0&&(o=Ji):o===Ji?c[0]===">"?(o=r??Ys,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Ji:c[3]==='"'?ZA:zA):o===ZA||o===zA?o=Ji:o===jA||o===XA?o=Ys:(o=Ji,r=void 0);const d=o===Ji&&s[a+1].startsWith("/>")?" ":"";n+=o===Ys?A+_d:h>=0?(i.push(l),A.slice(0,h)+JA+A.slice(h)+Ti+d):A+Ti+(h===-2?a:d)}return[il(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Ks{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=Nd(e,t);if(this.el=Ks.createElement(l,i),Wi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Wi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(JA)){const u=c[o++],d=r.getAttribute(h).split(Ti),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?Od:g[1]==="?"?Pd:g[1]==="@"?Ud:Mr}),r.removeAttribute(h)}else h.startsWith(Ti)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(el.test(r.tagName)){const h=r.textContent.split(Ti),u=h.length-1;if(u>0){r.textContent=Nr?Nr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Hs()),Wi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Hs())}}}else if(r.nodeType===8)if(r.data===WA)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(Ti,h+1))!==-1;)A.push({type:7,index:n}),h+=Ti.length-1}n++}}static createElement(e,t){const i=Vi.createElement("template");return i.innerHTML=e,i}}function hs(s,e,t=s,i){var o,a;if(e===xi)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=$s(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=hs(s,r._$AS(s,e.values),r,i)),e}let Md=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Vi).importNode(t,!0);Wi.currentNode=r;let n=Wi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new Vs(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new Gd(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Wi.nextNode(),o++)}return Wi.currentNode=Vi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}};class Vs{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=st,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=hs(this,e,t),$s(e)?e===st||e==null||e===""?(this._$AH!==st&&this._$AR(),this._$AH=st):e!==this._$AH&&e!==xi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):kd(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==st&&$s(this._$AH)?this._$AA.nextSibling.data=e:this.$(Vi.createTextNode(e)),this._$AH=e}g(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ks.createElement(il(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new Md(r,this),a=o.u(this.options);o.p(t),this.$(a),this._$AH=o}}_$AC(e){let t=tl.get(e.strings);return t===void 0&&tl.set(e.strings,t=new Ks(e)),t}T(e){qA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new Vs(this.k(Hs()),this.k(Hs()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Mr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=st,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=st}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=hs(this,e,t,0),o=!$s(e)||e!==this._$AH&&e!==xi,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=hs(this,a[i+A],t,A),l===xi&&(l=this._$AH[A]),o||(o=!$s(l)||l!==this._$AH[A]),l===st?e=st:e!==st&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.O(e)}O(e){e===st?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Od extends Mr{constructor(){super(...arguments),this.type=3}O(e){this.element[this.name]=e===st?void 0:e}}class Pd extends Mr{constructor(){super(...arguments),this.type=4}O(e){this.element.toggleAttribute(this.name,!!e&&e!==st)}}class Ud extends Mr{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=hs(this,e,t,0)??st)===xi)return;const i=this._$AH,r=e===st&&i!==st||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==st&&(i===st||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Gd{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){hs(this,e)}}const co=Gs.litHtmlPolyfillSupport;co==null||co(Ks,Vs),(Gs.litHtmlVersions??(Gs.litHtmlVersions=[])).push("3.1.0");const Hd=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new Vs(e.insertBefore(Hs(),n),n,void 0,t??{})}return r._$AI(s),r};/**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */let hi=class extends cs{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=Gd(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 Ti}};hi._$litElement$=!0,hi.finalized=!0,(ed=globalThis.litElementHydrateSupport)==null||ed.call(globalThis,{LitElement:hi});const ho=globalThis.litElementPolyfillSupport;ho==null||ho({LitElement:hi}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.2");/**
33
+ */let hi=class extends cs{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=Hd(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 xi}};hi._$litElement$=!0,hi.finalized=!0,(td=globalThis.litElementHydrateSupport)==null||td.call(globalThis,{LitElement:hi});const ho=globalThis.litElementPolyfillSupport;ho==null||ho({LitElement:hi}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.2");/**
34
34
  * @license
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
@@ -38,7 +38,7 @@ var Xy=Object.defineProperty;var zy=(Ye,li,qt)=>li in Ye?Xy(Ye,li,{enumerable:!0
38
38
  * @license
39
39
  * Copyright 2017 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
- */const Hd={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:zn},$d=(s=Hd,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.C(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function J(s){return(e,t)=>typeof t=="object"?$d(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
41
+ */const $d={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:zn},Yd=(s=$d,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.C(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function J(s){return(e,t)=>typeof t=="object"?Yd(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
42
42
  * @license
43
43
  * Copyright 2017 Google LLC
44
44
  * SPDX-License-Identifier: BSD-3-Clause
@@ -46,11 +46,11 @@ var Xy=Object.defineProperty;var zy=(Ye,li,qt)=>li in Ye?Xy(Ye,li,{enumerable:!0
46
46
  * @license
47
47
  * Copyright 2018 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
49
- */const et=s=>s??qe;let Pr;const Yd=new Uint8Array(16);function Kd(){if(!Pr&&(Pr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pr(Yd)}const At=[];for(let s=0;s<256;++s)At.push((s+256).toString(16).slice(1));function Vd(s,e=0){return At[s[e+0]]+At[s[e+1]]+At[s[e+2]]+At[s[e+3]]+"-"+At[s[e+4]]+At[s[e+5]]+"-"+At[s[e+6]]+At[s[e+7]]+"-"+At[s[e+8]]+At[s[e+9]]+"-"+At[s[e+10]]+At[s[e+11]]+At[s[e+12]]+At[s[e+13]]+At[s[e+14]]+At[s[e+15]]}const sl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xi(s,e,t){if(sl.randomUUID&&!e&&!s)return sl.randomUUID();s=s||{};const i=s.random||(s.rng||Kd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return Vd(i)}/**
49
+ */const et=s=>s??qe;let Pr;const Kd=new Uint8Array(16);function Vd(){if(!Pr&&(Pr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pr(Kd)}const At=[];for(let s=0;s<256;++s)At.push((s+256).toString(16).slice(1));function Jd(s,e=0){return At[s[e+0]]+At[s[e+1]]+At[s[e+2]]+At[s[e+3]]+"-"+At[s[e+4]]+At[s[e+5]]+"-"+At[s[e+6]]+At[s[e+7]]+"-"+At[s[e+8]]+At[s[e+9]]+"-"+At[s[e+10]]+At[s[e+11]]+At[s[e+12]]+At[s[e+13]]+At[s[e+14]]+At[s[e+15]]}const sl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Di(s,e,t){if(sl.randomUUID&&!e&&!s)return sl.randomUUID();s=s||{};const i=s.random||(s.rng||Vd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return Jd(i)}/**
50
50
  * @license
51
51
  * Copyright 2020 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */const{D:Jd}=Bd,Wd=s=>s.strings===void 0,rl=()=>document.createComment(""),Js=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(rl(),r),a=i.insertBefore(rl(),r);t=new Jd(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},qi=(s,e,t=s)=>(s._$AI(e,t),s),qd={},jd=(s,e=qd)=>s._$AH=e,Xd=s=>s._$AH,uo=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
53
+ */const{D:Wd}=Qd,qd=s=>s.strings===void 0,rl=()=>document.createComment(""),Js=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(rl(),r),a=i.insertBefore(rl(),r);t=new Wd(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},qi=(s,e,t=s)=>(s._$AI(e,t),s),jd={},Xd=(s,e=jd)=>s._$AH=e,zd=s=>s._$AH,uo=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
54
54
  * @license
55
55
  * Copyright 2017 Google LLC
56
56
  * SPDX-License-Identifier: BSD-3-Clause
@@ -58,40 +58,40 @@ var Xy=Object.defineProperty;var zy=(Ye,li,qt)=>li in Ye?Xy(Ye,li,{enumerable:!0
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */const qs=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),qs(r,e);return!0},Ur=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},nl=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),eg(e)}};function zd(s){this._$AN!==void 0?(Ur(this),this._$AM=s,nl(this)):this._$AM=s}function Zd(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)qs(i[n],!1),Ur(i[n]);else i!=null&&(qs(i,!1),Ur(i));else qs(this,s)}const eg=s=>{s.type==us.CHILD&&(s._$AP??(s._$AP=Zd),s._$AQ??(s._$AQ=zd))};let ol=class extends Ws{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),nl(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&(qs(this,e),Ur(this))}setValue(e){if(Wd(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(){}};/**
61
+ */const qs=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),qs(r,e);return!0},Ur=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},nl=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),tg(e)}};function Zd(s){this._$AN!==void 0?(Ur(this),this._$AM=s,nl(this)):this._$AM=s}function eg(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)qs(i[n],!1),Ur(i[n]);else i!=null&&(qs(i,!1),Ur(i));else qs(this,s)}const tg=s=>{s.type==us.CHILD&&(s._$AP??(s._$AP=eg),s._$AQ??(s._$AQ=Zd))};let ol=class extends Ws{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),nl(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&(qs(this,e),Ur(this))}setValue(e){if(qd(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(){}};/**
62
62
  * @license
63
63
  * Copyright 2020 Google LLC
64
64
  * SPDX-License-Identifier: BSD-3-Clause
65
- */const lt=()=>new tg;let tg=class{};const go=new WeakMap,ct=ds(class extends ol{render(s){return qe}update(s,[e]){var i;const t=e!==this.G;return t&&this.G!==void 0&&this.ot(void 0),(t||this.rt!==this.lt)&&(this.G=e,this.ct=(i=s.options)==null?void 0:i.host,this.ot(this.lt=s.element)),qe}ot(s){if(typeof this.G=="function"){const e=this.ct??globalThis;let t=go.get(e);t===void 0&&(t=new WeakMap,go.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ct,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ct,s)}else this.G.value=s}get rt(){var s,e;return typeof this.G=="function"?(s=go.get(this.ct??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});function ig(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class sg{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=lt(),this.host=e,this._events=t,e.addController(this)}register(){return ct(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(ig(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
65
+ */const lt=()=>new ig;let ig=class{};const go=new WeakMap,ct=ds(class extends ol{render(s){return qe}update(s,[e]){var i;const t=e!==this.G;return t&&this.G!==void 0&&this.ot(void 0),(t||this.rt!==this.lt)&&(this.G=e,this.ct=(i=s.options)==null?void 0:i.host,this.ot(this.lt=s.element)),qe}ot(s){if(typeof this.G=="function"){const e=this.ct??globalThis;let t=go.get(e);t===void 0&&(t=new WeakMap,go.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ct,void 0),t.set(this.G,s),s!==void 0&&this.G.call(this.ct,s)}else this.G.value=s}get rt(){var s,e;return typeof this.G=="function"?(s=go.get(this.ct??globalThis))==null?void 0:s.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});function sg(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class rg{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=lt(),this.host=e,this._events=t,e.addController(this)}register(){return ct(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(sg(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
66
66
  * @license
67
67
  * Copyright 2019 Google LLC
68
68
  * SPDX-License-Identifier: BSD-3-Clause
69
- */const Gr=globalThis,fo=Gr.ShadowRoot&&(Gr.ShadyCSS===void 0||Gr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,al=Symbol(),Al=new WeakMap;let rg=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==al)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 i=t!==void 0&&t.length===1;i&&(e=Al.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Al.set(t,e))}return e}toString(){return this.cssText}};const ng=s=>new rg(typeof s=="string"?s:s+"",void 0,al),og=(s,e)=>{if(fo)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Gr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},ll=fo?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return ng(t)})(s):s;/**
69
+ */const Gr=globalThis,fo=Gr.ShadowRoot&&(Gr.ShadyCSS===void 0||Gr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,al=Symbol(),Al=new WeakMap;let ng=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==al)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 i=t!==void 0&&t.length===1;i&&(e=Al.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Al.set(t,e))}return e}toString(){return this.cssText}};const og=s=>new ng(typeof s=="string"?s:s+"",void 0,al),ag=(s,e)=>{if(fo)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=Gr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},ll=fo?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return og(t)})(s):s;/**
70
70
  * @license
71
71
  * Copyright 2017 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */const{is:ag,defineProperty:Ag,getOwnPropertyDescriptor:lg,getOwnPropertyNames:cg,getOwnPropertySymbols:hg,getPrototypeOf:ug}=Object,Di=globalThis,cl=Di.trustedTypes,dg=cl?cl.emptyScript:"",po=Di.reactiveElementPolyfillSupport,js=(s,e)=>s,Eo={toAttribute(s,e){switch(e){case Boolean:s=s?dg:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Io=(s,e)=>!ag(s,e),hl={attribute:!0,type:String,converter:Eo,reflect:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Di.litPropertyMetadata??(Di.litPropertyMetadata=new WeakMap);class Xs 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=hl){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&Ag(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=lg(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??hl}static _$Ei(){if(this.hasOwnProperty(js("elementProperties")))return;const e=ug(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(js("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(js("properties"))){const t=this.properties,i=[...cg(t),...hg(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(ll(r))}else e!==void 0&&t.push(ll(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=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._$ES??(this._$ES=[])).push(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$ES)==null||t.splice(this._$ES.indexOf(e)>>>0,1)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return og(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Eo).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Eo;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Io)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$ES)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}}Xs.elementStyles=[],Xs.shadowRootOptions={mode:"open"},Xs[js("elementProperties")]=new Map,Xs[js("finalized")]=new Map,po==null||po({ReactiveElement:Xs}),(Di.reactiveElementVersions??(Di.reactiveElementVersions=[])).push("2.0.0");/**
73
+ */const{is:Ag,defineProperty:lg,getOwnPropertyDescriptor:cg,getOwnPropertyNames:hg,getOwnPropertySymbols:ug,getPrototypeOf:dg}=Object,Ri=globalThis,cl=Ri.trustedTypes,gg=cl?cl.emptyScript:"",po=Ri.reactiveElementPolyfillSupport,js=(s,e)=>s,Eo={toAttribute(s,e){switch(e){case Boolean:s=s?gg:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Io=(s,e)=>!Ag(s,e),hl={attribute:!0,type:String,converter:Eo,reflect:!1,hasChanged:Io};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ri.litPropertyMetadata??(Ri.litPropertyMetadata=new WeakMap);class Xs 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=hl){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&lg(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=cg(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??hl}static _$Ei(){if(this.hasOwnProperty(js("elementProperties")))return;const e=dg(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(js("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(js("properties"))){const t=this.properties,i=[...hg(t),...ug(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(ll(r))}else e!==void 0&&t.push(ll(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=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._$ES??(this._$ES=[])).push(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$ES)==null||t.splice(this._$ES.indexOf(e)>>>0,1)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ag(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Eo).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Eo;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Io)(r?n:this[e],t))return;this.C(e,t,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.C(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$ES)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$ET()}catch(r){throw e=!1,this._$ET(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}}Xs.elementStyles=[],Xs.shadowRootOptions={mode:"open"},Xs[js("elementProperties")]=new Map,Xs[js("finalized")]=new Map,po==null||po({ReactiveElement:Xs}),(Ri.reactiveElementVersions??(Ri.reactiveElementVersions=[])).push("2.0.0");/**
74
74
  * @license
75
75
  * Copyright 2017 Google LLC
76
76
  * SPDX-License-Identifier: BSD-3-Clause
77
- */const gg=Symbol();class Hr{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??fg,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(h){n=!0,i=h}if(this.u===r){if(t===gg)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const fg=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!Io(t,e[i])),ul="https://d2rxhdlm2q91uk.cloudfront.net",pg="https://d1ix11aj5kfygl.cloudfront.net",Eg="https://d157jlwnudd93d.cloudfront.net",dl="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Ig="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",mg="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",Cg="http://localhost:6060/v2",yg="https://embed-dev.vouchfor.com/v2",vg="https://embed-staging.vouchfor.com/v2",Bg="https://embed.vouchfor.com/v2";function $r(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:ul,publicApiUrl:dl,embedApiUrl:Cg};if(s==="dev")return{videoUrl:ul,publicApiUrl:dl,embedApiUrl:yg};if(s==="staging")return{videoUrl:pg,publicApiUrl:Ig,embedApiUrl:vg};if(s==="prod")return{videoUrl:Eg,publicApiUrl:mg,embedApiUrl:Bg}}class Qg{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=$r(t),o=xi(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=$r(t),o=xi(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Hr(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let h;o&&(this.fetching=!0,h=await this.getTemplate(t,i,o)),this._vouch=r,e.template=h??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[h,u]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=h,e.template=u??((c=(l=h==null?void 0:h.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Hr(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const bg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Sg(r,n)&&i||Object.defineProperty(s,t,n)},Sg=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},wg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Tg=(s,e)=>`/* Wrapped ${s}*/
78
- ${e}`,xg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Dg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Rg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Tg.bind(null,i,e.toString());Object.defineProperty(r,"name",Dg),Object.defineProperty(s,"toString",{...xg,value:r})};function Lg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))bg(s,e,r,t);return wg(s,e),Rg(s,e,i),s}const _g=new WeakMap,gl=new WeakMap;function mo(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const h=gl.get(s)??new Set;h.add(c),gl.set(s,h)}return A};return Lg(r,s,{ignoreNonConfigurable:!0}),_g.set(r,t),r}var fl=function(){};const kg=(s,e,t)=>Math.min(Math.max(t,s),e),pl=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},Co=(s,e,t)=>-t*s+t*e+s,El=(s,e)=>t=>Math.max(Math.min(t,e),s),zs=s=>s%1?Number(s.toFixed(5)):s,Yr=/(-)?([\d]*\.?[\d])+/g,yo=/(#[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,Fg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Zs(s){return typeof s=="string"}const Kr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},Il=Object.assign(Object.assign({},Kr),{transform:El(0,1)});Object.assign(Object.assign({},Kr),{default:1});const er=(s=>({test:e=>Zs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},er),{parse:s=>er.parse(s)/100,transform:s=>er.transform(s*100)});const vo=(s,e)=>t=>!!(Zs(t)&&Fg.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),ml=(s,e,t)=>i=>{if(!Zs(i))return i;const[r,n,o,a]=i.match(Yr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ji={test:vo("hsl","hue"),parse:ml("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+er.transform(zs(e))+", "+er.transform(zs(t))+", "+zs(Il.transform(i))+")"},Ng=El(0,255),Bo=Object.assign(Object.assign({},Kr),{transform:s=>Math.round(Ng(s))}),Ri={test:vo("rgb","red"),parse:ml("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+Bo.transform(s)+", "+Bo.transform(e)+", "+Bo.transform(t)+", "+zs(Il.transform(i))+")"};function Mg(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Qo={test:vo("#"),parse:Mg,transform:Ri.transform},Vr={test:s=>Ri.test(s)||Qo.test(s)||ji.test(s),parse:s=>Ri.test(s)?Ri.parse(s):ji.test(s)?ji.parse(s):Qo.parse(s),transform:s=>Zs(s)?s:s.hasOwnProperty("red")?Ri.transform(s):ji.transform(s)},Cl="${c}",yl="${n}";function Og(s){var e,t,i,r;return isNaN(s)&&Zs(s)&&((t=(e=s.match(Yr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(yo))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function vl(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(yo);i&&(t=i.length,s=s.replace(yo,Cl),e.push(...i.map(Vr.parse)));const r=s.match(Yr);return r&&(s=s.replace(Yr,yl),e.push(...r.map(Kr.parse))),{values:e,numColors:t,tokenised:s}}function Bl(s){return vl(s).values}function Ql(s){const{values:e,numColors:t,tokenised:i}=vl(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?Cl:yl,a<t?Vr.transform(n[a]):zs(n[a]));return o}}const Pg=s=>typeof s=="number"?0:s;function Ug(s){const e=Bl(s);return Ql(s)(e.map(Pg))}const bl={test:Og,parse:Bl,createTransformer:Ql,getAnimatableNone:Ug};function bo(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function Sl({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=bo(A,a,s+.3333333333333333),n=bo(A,a,s),o=bo(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const Gg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},Hg=[Qo,Ri,ji],wl=s=>Hg.find(e=>e.test(s)),Tl=(s,e)=>{let t=wl(s),i=wl(e),r=t.parse(s),n=i.parse(e);t===ji&&(r=Sl(r),t=Ri),i===ji&&(n=Sl(n),i=Ri);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=Gg(r[A],n[A],a));return o.alpha=Co(r.alpha,n.alpha,a),t.transform(o)}},$g=s=>typeof s=="number",Yg=(s,e)=>t=>e(s(t)),xl=(...s)=>s.reduce(Yg);function Dl(s,e){return $g(s)?t=>Co(s,e,t):Vr.test(s)?Tl(s,e):_l(s,e)}const Rl=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>Dl(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},Kg=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=Dl(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function Ll(s){const e=bl.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const _l=(s,e)=>{const t=bl.createTransformer(e),i=Ll(s),r=Ll(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?xl(Rl(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},Vg=(s,e)=>t=>Co(s,e,t);function Jg(s){if(typeof s=="number")return Vg;if(typeof s=="string")return Vr.test(s)?Tl:_l;if(Array.isArray(s))return Rl;if(typeof s=="object")return Kg}function Wg(s,e,t){const i=[],r=t||Jg(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=xl(A,a)}i.push(a)}return i}function qg([s,e],[t]){return i=>t(pl(s,e,i))}function jg(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=pl(s[n],s[n+1],r);return e[n](a)}}function Xg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;fl(n===e.length),fl(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=Wg(e,i,r),a=n===2?qg(s,o):jg(s,o);return t?A=>a(kg(s[0],s[n-1],A)):a}const Jr=s=>e=>1-s(1-e),So=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,zg=s=>e=>Math.pow(e,s),kl=s=>e=>e*e*((s+1)*e-s),Zg=s=>{const e=kl(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},Fl=1.525,ef=4/11,tf=8/11,sf=9/10,rf=s=>s,wo=zg(2),nf=Jr(wo),of=So(wo),Nl=s=>1-Math.sin(Math.acos(s)),Ml=Jr(Nl),af=So(Ml),To=kl(Fl),Af=Jr(To),lf=So(To),cf=Zg(Fl),hf=4356/361,uf=35442/1805,df=16061/1805,Wr=s=>{if(s===1||s===0)return s;const e=s*s;return s<ef?7.5625*e:s<tf?9.075*e-9.9*s+3.4:s<sf?hf*e-uf*s+df:10.8*s*s-20.52*s+10.72},gf=Jr(Wr),ff=s=>s<.5?.5*(1-Wr(1-s*2)):.5*Wr(s*2-1)+.5,pf=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Ef(r,n)&&i||Object.defineProperty(s,t,n)},Ef=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},If=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},mf=(s,e)=>`/* Wrapped ${s}*/
79
- ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),vf=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=mf.bind(null,i,e.toString());Object.defineProperty(r,"name",yf),Object.defineProperty(s,"toString",{...Cf,value:r})};function Bf(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))pf(s,e,r,t);return If(s,e),vf(s,e,i),s}const Qf=new WeakMap;function Li(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Bf(r,s,{ignoreNonConfigurable:!0}),Qf.set(r,t),r}var qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xo(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Do={exports:{}};(function(s,e){(function(t,i){i(e)})(qr,function(t){function i(B){var w,N,H=new Error(B);return w=H,N=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,N):w.__proto__=N,H}function r(B,w,N){var H=w.slice(0,N).split(/\n/),K=H.length,X=H[K-1].length+1;throw i(B+=" at line "+K+" col "+X+`:
77
+ */const fg=Symbol();class Hr{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??pg,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(h){n=!0,i=h}if(this.u===r){if(t===fg)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const pg=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!Io(t,e[i])),ul="https://d2rxhdlm2q91uk.cloudfront.net",Eg="https://d1ix11aj5kfygl.cloudfront.net",Ig="https://d157jlwnudd93d.cloudfront.net",dl="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",mg="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Cg="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",yg="http://localhost:6060/v2",vg="https://embed-dev.vouchfor.com/v2",Bg="https://embed-staging.vouchfor.com/v2",Qg="https://embed.vouchfor.com/v2";function $r(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:ul,publicApiUrl:dl,embedApiUrl:yg};if(s==="dev")return{videoUrl:ul,publicApiUrl:dl,embedApiUrl:vg};if(s==="staging")return{videoUrl:Eg,publicApiUrl:mg,embedApiUrl:Bg};if(s==="prod")return{videoUrl:Ig,publicApiUrl:Cg,embedApiUrl:Qg}}class bg{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=$r(t),o=Di(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=$r(t),o=Di(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Hr(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let h;o&&(this.fetching=!0,h=await this.getTemplate(t,i,o)),this._vouch=r,e.template=h??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[h,u]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=h,e.template=u??((c=(l=h==null?void 0:h.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Hr(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const Sg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!wg(r,n)&&i||Object.defineProperty(s,t,n)},wg=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Tg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},xg=(s,e)=>`/* Wrapped ${s}*/
78
+ ${e}`,Dg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Rg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Lg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=xg.bind(null,i,e.toString());Object.defineProperty(r,"name",Rg),Object.defineProperty(s,"toString",{...Dg,value:r})};function _g(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Sg(s,e,r,t);return Tg(s,e),Lg(s,e,i),s}const kg=new WeakMap,gl=new WeakMap;function mo(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const h=gl.get(s)??new Set;h.add(c),gl.set(s,h)}return A};return _g(r,s,{ignoreNonConfigurable:!0}),kg.set(r,t),r}var fl=function(){};const Fg=(s,e,t)=>Math.min(Math.max(t,s),e),pl=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},Co=(s,e,t)=>-t*s+t*e+s,El=(s,e)=>t=>Math.max(Math.min(t,e),s),zs=s=>s%1?Number(s.toFixed(5)):s,Yr=/(-)?([\d]*\.?[\d])+/g,yo=/(#[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,Ng=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Zs(s){return typeof s=="string"}const Kr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},Il=Object.assign(Object.assign({},Kr),{transform:El(0,1)});Object.assign(Object.assign({},Kr),{default:1});const er=(s=>({test:e=>Zs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},er),{parse:s=>er.parse(s)/100,transform:s=>er.transform(s*100)});const vo=(s,e)=>t=>!!(Zs(t)&&Ng.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),ml=(s,e,t)=>i=>{if(!Zs(i))return i;const[r,n,o,a]=i.match(Yr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ji={test:vo("hsl","hue"),parse:ml("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+er.transform(zs(e))+", "+er.transform(zs(t))+", "+zs(Il.transform(i))+")"},Mg=El(0,255),Bo=Object.assign(Object.assign({},Kr),{transform:s=>Math.round(Mg(s))}),Li={test:vo("rgb","red"),parse:ml("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+Bo.transform(s)+", "+Bo.transform(e)+", "+Bo.transform(t)+", "+zs(Il.transform(i))+")"};function Og(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Qo={test:vo("#"),parse:Og,transform:Li.transform},Vr={test:s=>Li.test(s)||Qo.test(s)||ji.test(s),parse:s=>Li.test(s)?Li.parse(s):ji.test(s)?ji.parse(s):Qo.parse(s),transform:s=>Zs(s)?s:s.hasOwnProperty("red")?Li.transform(s):ji.transform(s)},Cl="${c}",yl="${n}";function Pg(s){var e,t,i,r;return isNaN(s)&&Zs(s)&&((t=(e=s.match(Yr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(yo))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function vl(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(yo);i&&(t=i.length,s=s.replace(yo,Cl),e.push(...i.map(Vr.parse)));const r=s.match(Yr);return r&&(s=s.replace(Yr,yl),e.push(...r.map(Kr.parse))),{values:e,numColors:t,tokenised:s}}function Bl(s){return vl(s).values}function Ql(s){const{values:e,numColors:t,tokenised:i}=vl(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?Cl:yl,a<t?Vr.transform(n[a]):zs(n[a]));return o}}const Ug=s=>typeof s=="number"?0:s;function Gg(s){const e=Bl(s);return Ql(s)(e.map(Ug))}const bl={test:Pg,parse:Bl,createTransformer:Ql,getAnimatableNone:Gg};function bo(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function Sl({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=bo(A,a,s+.3333333333333333),n=bo(A,a,s),o=bo(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const Hg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},$g=[Qo,Li,ji],wl=s=>$g.find(e=>e.test(s)),Tl=(s,e)=>{let t=wl(s),i=wl(e),r=t.parse(s),n=i.parse(e);t===ji&&(r=Sl(r),t=Li),i===ji&&(n=Sl(n),i=Li);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=Hg(r[A],n[A],a));return o.alpha=Co(r.alpha,n.alpha,a),t.transform(o)}},Yg=s=>typeof s=="number",Kg=(s,e)=>t=>e(s(t)),xl=(...s)=>s.reduce(Kg);function Dl(s,e){return Yg(s)?t=>Co(s,e,t):Vr.test(s)?Tl(s,e):_l(s,e)}const Rl=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>Dl(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},Vg=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=Dl(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function Ll(s){const e=bl.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const _l=(s,e)=>{const t=bl.createTransformer(e),i=Ll(s),r=Ll(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?xl(Rl(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},Jg=(s,e)=>t=>Co(s,e,t);function Wg(s){if(typeof s=="number")return Jg;if(typeof s=="string")return Vr.test(s)?Tl:_l;if(Array.isArray(s))return Rl;if(typeof s=="object")return Vg}function qg(s,e,t){const i=[],r=t||Wg(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=xl(A,a)}i.push(a)}return i}function jg([s,e],[t]){return i=>t(pl(s,e,i))}function Xg(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=pl(s[n],s[n+1],r);return e[n](a)}}function zg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;fl(n===e.length),fl(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=qg(e,i,r),a=n===2?jg(s,o):Xg(s,o);return t?A=>a(Fg(s[0],s[n-1],A)):a}const Jr=s=>e=>1-s(1-e),So=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,Zg=s=>e=>Math.pow(e,s),kl=s=>e=>e*e*((s+1)*e-s),ef=s=>{const e=kl(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},Fl=1.525,tf=4/11,sf=8/11,rf=9/10,nf=s=>s,wo=Zg(2),of=Jr(wo),af=So(wo),Nl=s=>1-Math.sin(Math.acos(s)),Ml=Jr(Nl),Af=So(Ml),To=kl(Fl),lf=Jr(To),cf=So(To),hf=ef(Fl),uf=4356/361,df=35442/1805,gf=16061/1805,Wr=s=>{if(s===1||s===0)return s;const e=s*s;return s<tf?7.5625*e:s<sf?9.075*e-9.9*s+3.4:s<rf?uf*e-df*s+gf:10.8*s*s-20.52*s+10.72},ff=Jr(Wr),pf=s=>s<.5?.5*(1-Wr(1-s*2)):.5*Wr(s*2-1)+.5,Ef=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!If(r,n)&&i||Object.defineProperty(s,t,n)},If=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},mf=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Cf=(s,e)=>`/* Wrapped ${s}*/
79
+ ${e}`,yf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),vf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Bf=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Cf.bind(null,i,e.toString());Object.defineProperty(r,"name",vf),Object.defineProperty(s,"toString",{...yf,value:r})};function Qf(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Ef(s,e,r,t);return mf(s,e),Bf(s,e,i),s}const bf=new WeakMap;function ui(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Qf(r,s,{ignoreNonConfigurable:!0}),bf.set(r,t),r}var qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xo(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Do={exports:{}};(function(s,e){(function(t,i){i(e)})(qr,function(t){function i(B){var w,N,H=new Error(B);return w=H,N=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,N):w.__proto__=N,H}function r(B,w,N){var H=w.slice(0,N).split(/\n/),K=H.length,X=H[K-1].length+1;throw i(B+=" at line "+K+" col "+X+`:
80
80
 
81
81
  `+w.split(/\n/)[K-1]+`
82
82
  `+Array(X).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(B){if(!(B instanceof SyntaxError))throw B}function a(B,w){return Object.prototype.hasOwnProperty.call(B,w)}function A(B,w,N){for(var H in w)a(w,H)&&(w[H]==null||typeof w[H]!="object"||H!=="storage"&&H!=="prefixes"||N?B[H]=w[H]:B[H]=A({},w[H]));return B}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(B){return d.test(B)?B.replace(d,"\\$&"):B}function f(B,w){w.rmWhitespace&&(B=B.replace(/[\r\n]+/g,`
83
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,h.lastIndex=0,u.lastIndex=0;var N=w.prefixes,H=[N.h,N.b,N.i,N.r,N.c,N.e].reduce(function(ne,Ie){return ne&&Ie?ne+"|"+g(Ie):Ie?g(Ie):ne},""),K=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(w.tags[1])+")","g"),X=new RegExp("([^]*?)"+g(w.tags[0])+"(-|_)?\\s*("+H+")?\\s*","g"),se=0,ue=!1;function Ae(ne,Ie){var Be,he={f:[]},le=0,oe="c";function we(We){var at=B.slice(se,We),Xe=at.trim();if(oe==="f")Xe==="safe"?he.raw=!0:w.async&&l.test(Xe)?(Xe=Xe.replace(l,""),he.f.push([Xe,"",!0])):he.f.push([Xe,""]);else if(oe==="fp")he.f[he.f.length-1][1]+=Xe;else if(oe==="err"){if(Xe){var It=at.search(/\S/);r("invalid syntax",B,se+It)}}else he[oe]=Xe;se=We+1}for(Ie==="h"||Ie==="b"||Ie==="c"?oe="n":Ie==="r"&&(he.raw=!0,Ie="i"),K.lastIndex=se;(Be=K.exec(B))!==null;){var Oe=Be[1],Le=Be[2],Me=Be[3],Pe=Be[4],xe=Be[5],ve=Be.index;if(Oe)Oe==="("?(le===0&&(oe==="n"?(we(ve),oe="p"):oe==="f"&&(we(ve),oe="fp")),le++):Oe===")"?--le===0&&oe!=="c"&&(we(ve),oe="err"):le===0&&Oe==="|"?(we(ve),oe="f"):Oe==="=>"&&(we(ve),se+=1,oe="res");else if(Le)if(Le==="/*"){var He=B.indexOf("*/",K.lastIndex);He===-1&&r("unclosed comment",B,Be.index),K.lastIndex=He+2}else Le==="'"?(h.lastIndex=Be.index,h.exec(B)?K.lastIndex=h.lastIndex:r("unclosed string",B,Be.index)):Le==='"'?(u.lastIndex=Be.index,u.exec(B)?K.lastIndex=u.lastIndex:r("unclosed string",B,Be.index)):Le==="`"&&(c.lastIndex=Be.index,c.exec(B)?K.lastIndex=c.lastIndex:r("unclosed string",B,Be.index));else if(Me)return we(ve),se=ve+Be[0].length,X.lastIndex=se,ue=xe,Pe&&Ie==="h"&&(Ie="s"),he.t=Ie,he}return r("unclosed tag",B,ne),he}var Ce=function ne(Ie,Be){Ie.b=[],Ie.d=[];var he,le=!1,oe=[];function we(It,Ci){It&&(It=function(mt,oi,ai,Ai){var gt,G;return typeof oi.autoTrim=="string"?gt=G=oi.autoTrim:Array.isArray(oi.autoTrim)&&(gt=oi.autoTrim[1],G=oi.autoTrim[0]),(ai||ai===!1)&&(gt=ai),(Ai||Ai===!1)&&(G=Ai),gt==="slurp"&&G==="slurp"?mt.trim():(gt==="_"||gt==="slurp"?mt=String.prototype.trimLeft?mt.trimLeft():mt.replace(/^[\s\uFEFF\xA0]+/,""):gt!=="-"&&gt!=="nl"||(mt=mt.replace(/^(?:\n|\r|\r\n)/,"")),G==="_"||G==="slurp"?mt=String.prototype.trimRight?mt.trimRight():mt.replace(/[\s\uFEFF\xA0]+$/,""):G!=="-"&&G!=="nl"||(mt=mt.replace(/(?:\n|\r|\r\n)$/,"")),mt)}(It,w,ue,Ci))&&(It=It.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),oe.push(It))}for(;(he=X.exec(B))!==null;){var Oe,Le=he[1],Me=he[2],Pe=he[3]||"";for(var xe in N)if(N[xe]===Pe){Oe=xe;break}we(Le,Me),se=he.index+he[0].length,Oe||r("unrecognized tag type: "+Pe,B,se);var ve=Ae(he.index,Oe),He=ve.t;if(He==="h"){var We=ve.n||"";w.async&&l.test(We)&&(ve.a=!0,ve.n=We.replace(l,"")),ve=ne(ve),oe.push(ve)}else if(He==="c"){if(Ie.n===ve.n)return le?(le.d=oe,Ie.b.push(le)):Ie.d=oe,Ie;r("Helper start and end don't match",B,he.index+he[0].length)}else if(He==="b"){le?(le.d=oe,Ie.b.push(le)):Ie.d=oe;var at=ve.n||"";w.async&&l.test(at)&&(ve.a=!0,ve.n=at.replace(l,"")),le=ve,oe=[]}else if(He==="s"){var Xe=ve.n||"";w.async&&l.test(Xe)&&(ve.a=!0,ve.n=Xe.replace(l,"")),oe.push(ve)}else oe.push(ve)}if(!Be)throw i('unclosed helper "'+Ie.n+'"');return we(B.slice(se,B.length),!1),Ie.d=oe,Ie}({f:[]},!0);if(w.plugins)for(var be=0;be<w.plugins.length;be++){var Re=w.plugins[be];Re.processAST&&(Ce.d=Re.processAST(Ce.d,w))}return Ce.d}function p(B,w){var N=f(B,w),H="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+T(N,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var K=0;K<w.plugins.length;K++){var X=w.plugins[K];X.processFnString&&(H=X.processFnString(H,w))}return H}function y(B,w){for(var N=0;N<w.length;N++){var H=w[N][0],K=w[N][1];B=(w[N][2]?"await ":"")+"c.l('F','"+H+"')("+B,K&&(B+=","+K),B+=")"}return B}function v(B,w,N,H,K,X){var se="{exec:"+(K?"async ":"")+C(N,w,B)+",params:["+H+"]";return X&&(se+=",name:'"+X+"'"),K&&(se+=",async:true"),se+="}"}function Q(B,w){for(var N="[",H=0;H<B.length;H++){var K=B[H];N+=v(w,K.res||"",K.d,K.p||"",K.a,K.n),H<B.length&&(N+=",")}return N+="]"}function C(B,w,N){return"function("+w+"){var tR='';"+T(B,N)+"return tR}"}function T(B,w){for(var N=0,H=B.length,K="";N<H;N++){var X=B[N];if(typeof X=="string")K+="tR+='"+X+"';";else{var se=X.t,ue=X.c||"",Ae=X.f,Ce=X.n||"",be=X.p||"",Re=X.res||"",ne=X.b,Ie=!!X.a;if(se==="i"){w.defaultFilter&&(ue="c.l('F','"+w.defaultFilter+"')("+ue+")");var Be=y(ue,Ae);!X.raw&&w.autoEscape&&(Be="c.l('F','e')("+Be+")"),K+="tR+="+Be+";"}else if(se==="h")if(w.storage.nativeHelpers.get(Ce))K+=w.storage.nativeHelpers.get(Ce)(X,w);else{var he=(Ie?"await ":"")+"c.l('H','"+Ce+"')("+v(w,Re,X.d,be,Ie);he+=ne?","+Q(ne,w):",[]",K+="tR+="+y(he+=",c)",Ae)+";"}else se==="s"?K+="tR+="+y((Ie?"await ":"")+"c.l('H','"+Ce+"')({params:["+be+"]},[],c)",Ae)+";":se==="e"&&(K+=ue+`
84
- `)}}return K}var b=function(){function B(w){this.cache=w}return B.prototype.define=function(w,N){this.cache[w]=N},B.prototype.get=function(w){return this.cache[w]},B.prototype.remove=function(w){delete this.cache[w]},B.prototype.reset=function(){this.cache={}},B.prototype.load=function(w){A(this.cache,w,!0)},B}();function L(B,w,N,H){if(w&&w.length>0)throw i((H?"Native":"")+"Helper '"+B+"' doesn't accept blocks");if(N&&N.length>0)throw i((H?"Native":"")+"Helper '"+B+"' doesn't accept filters")}var R={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function P(B){return R[B]}var k=new b({}),q=new b({each:function(B,w){var N="",H=B.params[0];if(L("each",w,!1),B.async)return new Promise(function(X){(function se(ue,Ae,Ce,be,Re){Ce(ue[Ae],Ae).then(function(ne){be+=ne,Ae===ue.length-1?Re(be):se(ue,Ae+1,Ce,be,Re)})})(H,0,B.exec,N,X)});for(var K=0;K<H.length;K++)N+=B.exec(H[K],K);return N},foreach:function(B,w){var N=B.params[0];if(L("foreach",w,!1),B.async)return new Promise(function(X){(function se(ue,Ae,Ce,be,Re,ne){be(Ae[Ce],ue[Ae[Ce]]).then(function(Ie){Re+=Ie,Ce===Ae.length-1?ne(Re):se(ue,Ae,Ce+1,be,Re,ne)})})(N,Object.keys(N),0,B.exec,"",X)});var H="";for(var K in N)a(N,K)&&(H+=B.exec(K,N[K]));return H},include:function(B,w,N){L("include",w,!1);var H=N.storage.templates.get(B.params[0]);if(!H)throw i('Could not fetch template "'+B.params[0]+'"');return H(B.params[1],N)},extends:function(B,w,N){var H=B.params[1]||{};H.content=B.exec();for(var K=0;K<w.length;K++){var X=w[K];H[X.name]=X.exec()}var se=N.storage.templates.get(B.params[0]);if(!se)throw i('Could not fetch template "'+B.params[0]+'"');return se(H,N)},useScope:function(B,w){return L("useScope",w,!1),B.exec(B.params[0])}}),$=new b({if:function(B,w){L("if",!1,B.f,!0);var N="if("+B.p+"){"+T(B.d,w)+"}";if(B.b)for(var H=0;H<B.b.length;H++){var K=B.b[H];K.n==="else"?N+="else{"+T(K.d,w)+"}":K.n==="elif"&&(N+="else if("+K.p+"){"+T(K.d,w)+"}")}return N},try:function(B,w){if(L("try",!1,B.f,!0),!B.b||B.b.length!==1||B.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var N="try{"+T(B.d,w)+"}",H=B.b[0];return N+="catch"+(H.res?"("+H.res+")":"")+"{"+T(H.d,w)+"}"},block:function(B,w){return L("block",B.b,B.f,!0),"if(!"+w.varName+"["+B.p+"]){tR+=("+C(B.d,"",w)+")()}else{tR+="+w.varName+"["+B.p+"]}"}}),te=new b({e:function(B){var w=String(B);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,P):w}}),ee={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(B,w){if(B==="H"){var N=this.storage.helpers.get(w);if(N)return N;throw i("Can't find helper '"+w+"'")}if(B==="F"){var H=this.storage.filters.get(w);if(H)return H;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:q,nativeHelpers:$,filters:te,templates:k},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function S(B,w){var N={};return A(N,ee),w&&A(N,w),B&&A(N,B),N.l.bind(N),N}function D(B,w){var N=S(w||{}),H=Function;if(N.async){if(!o)throw i("This environment doesn't support async/await");H=o}try{return new H(N.varName,"c","cb",p(B,N))}catch(K){throw K instanceof SyntaxError?i(`Bad template syntax
83
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,h.lastIndex=0,u.lastIndex=0;var N=w.prefixes,H=[N.h,N.b,N.i,N.r,N.c,N.e].reduce(function(oe,Ie){return oe&&Ie?oe+"|"+g(Ie):Ie?g(Ie):oe},""),K=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(w.tags[1])+")","g"),X=new RegExp("([^]*?)"+g(w.tags[0])+"(-|_)?\\s*("+H+")?\\s*","g"),se=0,ue=!1;function le(oe,Ie){var ve,ce={f:[]},Ae=0,ne="c";function be(We){var at=B.slice(se,We),Xe=at.trim();if(ne==="f")Xe==="safe"?ce.raw=!0:w.async&&l.test(Xe)?(Xe=Xe.replace(l,""),ce.f.push([Xe,"",!0])):ce.f.push([Xe,""]);else if(ne==="fp")ce.f[ce.f.length-1][1]+=Xe;else if(ne==="err"){if(Xe){var It=at.search(/\S/);r("invalid syntax",B,se+It)}}else ce[ne]=Xe;se=We+1}for(Ie==="h"||Ie==="b"||Ie==="c"?ne="n":Ie==="r"&&(ce.raw=!0,Ie="i"),K.lastIndex=se;(ve=K.exec(B))!==null;){var Oe=ve[1],Te=ve[2],ke=ve[3],Pe=ve[4],De=ve[5],Be=ve.index;if(Oe)Oe==="("?(Ae===0&&(ne==="n"?(be(Be),ne="p"):ne==="f"&&(be(Be),ne="fp")),Ae++):Oe===")"?--Ae===0&&ne!=="c"&&(be(Be),ne="err"):Ae===0&&Oe==="|"?(be(Be),ne="f"):Oe==="=>"&&(be(Be),se+=1,ne="res");else if(Te)if(Te==="/*"){var He=B.indexOf("*/",K.lastIndex);He===-1&&r("unclosed comment",B,ve.index),K.lastIndex=He+2}else Te==="'"?(h.lastIndex=ve.index,h.exec(B)?K.lastIndex=h.lastIndex:r("unclosed string",B,ve.index)):Te==='"'?(u.lastIndex=ve.index,u.exec(B)?K.lastIndex=u.lastIndex:r("unclosed string",B,ve.index)):Te==="`"&&(c.lastIndex=ve.index,c.exec(B)?K.lastIndex=c.lastIndex:r("unclosed string",B,ve.index));else if(ke)return be(Be),se=Be+ve[0].length,X.lastIndex=se,ue=De,Pe&&Ie==="h"&&(Ie="s"),ce.t=Ie,ce}return r("unclosed tag",B,oe),ce}var Ce=function oe(Ie,ve){Ie.b=[],Ie.d=[];var ce,Ae=!1,ne=[];function be(It,yi){It&&(It=function(mt,oi,ai,Ai){var gt,G;return typeof oi.autoTrim=="string"?gt=G=oi.autoTrim:Array.isArray(oi.autoTrim)&&(gt=oi.autoTrim[1],G=oi.autoTrim[0]),(ai||ai===!1)&&(gt=ai),(Ai||Ai===!1)&&(G=Ai),gt==="slurp"&&G==="slurp"?mt.trim():(gt==="_"||gt==="slurp"?mt=String.prototype.trimLeft?mt.trimLeft():mt.replace(/^[\s\uFEFF\xA0]+/,""):gt!=="-"&&gt!=="nl"||(mt=mt.replace(/^(?:\n|\r|\r\n)/,"")),G==="_"||G==="slurp"?mt=String.prototype.trimRight?mt.trimRight():mt.replace(/[\s\uFEFF\xA0]+$/,""):G!=="-"&&G!=="nl"||(mt=mt.replace(/(?:\n|\r|\r\n)$/,"")),mt)}(It,w,ue,yi))&&(It=It.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),ne.push(It))}for(;(ce=X.exec(B))!==null;){var Oe,Te=ce[1],ke=ce[2],Pe=ce[3]||"";for(var De in N)if(N[De]===Pe){Oe=De;break}be(Te,ke),se=ce.index+ce[0].length,Oe||r("unrecognized tag type: "+Pe,B,se);var Be=le(ce.index,Oe),He=Be.t;if(He==="h"){var We=Be.n||"";w.async&&l.test(We)&&(Be.a=!0,Be.n=We.replace(l,"")),Be=oe(Be),ne.push(Be)}else if(He==="c"){if(Ie.n===Be.n)return Ae?(Ae.d=ne,Ie.b.push(Ae)):Ie.d=ne,Ie;r("Helper start and end don't match",B,ce.index+ce[0].length)}else if(He==="b"){Ae?(Ae.d=ne,Ie.b.push(Ae)):Ie.d=ne;var at=Be.n||"";w.async&&l.test(at)&&(Be.a=!0,Be.n=at.replace(l,"")),Ae=Be,ne=[]}else if(He==="s"){var Xe=Be.n||"";w.async&&l.test(Xe)&&(Be.a=!0,Be.n=Xe.replace(l,"")),ne.push(Be)}else ne.push(Be)}if(!ve)throw i('unclosed helper "'+Ie.n+'"');return be(B.slice(se,B.length),!1),Ie.d=ne,Ie}({f:[]},!0);if(w.plugins)for(var Se=0;Se<w.plugins.length;Se++){var Le=w.plugins[Se];Le.processAST&&(Ce.d=Le.processAST(Ce.d,w))}return Ce.d}function p(B,w){var N=f(B,w),H="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+T(N,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var K=0;K<w.plugins.length;K++){var X=w.plugins[K];X.processFnString&&(H=X.processFnString(H,w))}return H}function y(B,w){for(var N=0;N<w.length;N++){var H=w[N][0],K=w[N][1];B=(w[N][2]?"await ":"")+"c.l('F','"+H+"')("+B,K&&(B+=","+K),B+=")"}return B}function v(B,w,N,H,K,X){var se="{exec:"+(K?"async ":"")+C(N,w,B)+",params:["+H+"]";return X&&(se+=",name:'"+X+"'"),K&&(se+=",async:true"),se+="}"}function Q(B,w){for(var N="[",H=0;H<B.length;H++){var K=B[H];N+=v(w,K.res||"",K.d,K.p||"",K.a,K.n),H<B.length&&(N+=",")}return N+="]"}function C(B,w,N){return"function("+w+"){var tR='';"+T(B,N)+"return tR}"}function T(B,w){for(var N=0,H=B.length,K="";N<H;N++){var X=B[N];if(typeof X=="string")K+="tR+='"+X+"';";else{var se=X.t,ue=X.c||"",le=X.f,Ce=X.n||"",Se=X.p||"",Le=X.res||"",oe=X.b,Ie=!!X.a;if(se==="i"){w.defaultFilter&&(ue="c.l('F','"+w.defaultFilter+"')("+ue+")");var ve=y(ue,le);!X.raw&&w.autoEscape&&(ve="c.l('F','e')("+ve+")"),K+="tR+="+ve+";"}else if(se==="h")if(w.storage.nativeHelpers.get(Ce))K+=w.storage.nativeHelpers.get(Ce)(X,w);else{var ce=(Ie?"await ":"")+"c.l('H','"+Ce+"')("+v(w,Le,X.d,Se,Ie);ce+=oe?","+Q(oe,w):",[]",K+="tR+="+y(ce+=",c)",le)+";"}else se==="s"?K+="tR+="+y((Ie?"await ":"")+"c.l('H','"+Ce+"')({params:["+Se+"]},[],c)",le)+";":se==="e"&&(K+=ue+`
84
+ `)}}return K}var b=function(){function B(w){this.cache=w}return B.prototype.define=function(w,N){this.cache[w]=N},B.prototype.get=function(w){return this.cache[w]},B.prototype.remove=function(w){delete this.cache[w]},B.prototype.reset=function(){this.cache={}},B.prototype.load=function(w){A(this.cache,w,!0)},B}();function L(B,w,N,H){if(w&&w.length>0)throw i((H?"Native":"")+"Helper '"+B+"' doesn't accept blocks");if(N&&N.length>0)throw i((H?"Native":"")+"Helper '"+B+"' doesn't accept filters")}var R={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function P(B){return R[B]}var k=new b({}),q=new b({each:function(B,w){var N="",H=B.params[0];if(L("each",w,!1),B.async)return new Promise(function(X){(function se(ue,le,Ce,Se,Le){Ce(ue[le],le).then(function(oe){Se+=oe,le===ue.length-1?Le(Se):se(ue,le+1,Ce,Se,Le)})})(H,0,B.exec,N,X)});for(var K=0;K<H.length;K++)N+=B.exec(H[K],K);return N},foreach:function(B,w){var N=B.params[0];if(L("foreach",w,!1),B.async)return new Promise(function(X){(function se(ue,le,Ce,Se,Le,oe){Se(le[Ce],ue[le[Ce]]).then(function(Ie){Le+=Ie,Ce===le.length-1?oe(Le):se(ue,le,Ce+1,Se,Le,oe)})})(N,Object.keys(N),0,B.exec,"",X)});var H="";for(var K in N)a(N,K)&&(H+=B.exec(K,N[K]));return H},include:function(B,w,N){L("include",w,!1);var H=N.storage.templates.get(B.params[0]);if(!H)throw i('Could not fetch template "'+B.params[0]+'"');return H(B.params[1],N)},extends:function(B,w,N){var H=B.params[1]||{};H.content=B.exec();for(var K=0;K<w.length;K++){var X=w[K];H[X.name]=X.exec()}var se=N.storage.templates.get(B.params[0]);if(!se)throw i('Could not fetch template "'+B.params[0]+'"');return se(H,N)},useScope:function(B,w){return L("useScope",w,!1),B.exec(B.params[0])}}),$=new b({if:function(B,w){L("if",!1,B.f,!0);var N="if("+B.p+"){"+T(B.d,w)+"}";if(B.b)for(var H=0;H<B.b.length;H++){var K=B.b[H];K.n==="else"?N+="else{"+T(K.d,w)+"}":K.n==="elif"&&(N+="else if("+K.p+"){"+T(K.d,w)+"}")}return N},try:function(B,w){if(L("try",!1,B.f,!0),!B.b||B.b.length!==1||B.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var N="try{"+T(B.d,w)+"}",H=B.b[0];return N+="catch"+(H.res?"("+H.res+")":"")+"{"+T(H.d,w)+"}"},block:function(B,w){return L("block",B.b,B.f,!0),"if(!"+w.varName+"["+B.p+"]){tR+=("+C(B.d,"",w)+")()}else{tR+="+w.varName+"["+B.p+"]}"}}),te=new b({e:function(B){var w=String(B);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,P):w}}),Z={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(B,w){if(B==="H"){var N=this.storage.helpers.get(w);if(N)return N;throw i("Can't find helper '"+w+"'")}if(B==="F"){var H=this.storage.filters.get(w);if(H)return H;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:q,nativeHelpers:$,filters:te,templates:k},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function S(B,w){var N={};return A(N,Z),w&&A(N,w),B&&A(N,B),N.l.bind(N),N}function D(B,w){var N=S(w||{}),H=Function;if(N.async){if(!o)throw i("This environment doesn't support async/await");H=o}try{return new H(N.varName,"c","cb",p(B,N))}catch(K){throw K instanceof SyntaxError?i(`Bad template syntax
85
85
 
86
86
  `+K.message+`
87
87
  `+Array(K.message.length+1).join("=")+`
88
- `+p(B,N)):K}}function U(B,w){var N;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(N=typeof B=="function"?B:D(B,w),w.cache&&w.name&&w.storage.templates.define(w.name,N),N)}ee.l.bind(ee),t.compile=D,t.compileScope=T,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=ee,t.filters=te,t.getConfig=S,t.helpers=q,t.nativeHelpers=$,t.parse=f,t.render=function(B,w,N,H){var K=S(N||{});if(!K.async)return U(B,K)(w,K);if(!H){if(typeof n=="function")return new n(function(X,se){try{X(U(B,K)(w,K))}catch(ue){se(ue)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{U(B,K)(w,K,H)}catch(X){return H(X)}},t.templates=k,Object.defineProperty(t,"__esModule",{value:!0})})})(Do,Do.exports);var jr=Do.exports,Ol={},Ro={},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.default=ye.Wrap=ye.Unit=ye.PrintOptions=ye.PositionType=ye.Overflow=ye.NodeType=ye.MeasureMode=ye.LogLevel=ye.Justify=ye.Gutter=ye.FlexDirection=ye.ExperimentalFeature=ye.Errata=ye.Edge=ye.Display=ye.Direction=ye.Dimension=ye.Align=void 0;let ui=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s}({});ye.Align=ui;let Lo=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});ye.Dimension=Lo;let Xr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});ye.Direction=Xr;let _o=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});ye.Display=_o;let jt=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({});ye.Edge=jt;let tr=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({});ye.Errata=tr;let zr=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});ye.ExperimentalFeature=zr;let ir=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});ye.FlexDirection=ir;let Zr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});ye.Gutter=Zr;let Xi=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({});ye.Justify=Xi;let zi=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({});ye.LogLevel=zi;let en=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});ye.MeasureMode=en;let ko=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});ye.NodeType=ko;let tn=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});ye.Overflow=tn;let sn=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});ye.PositionType=sn;let rn=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});ye.PrintOptions=rn;let sr=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});ye.Unit=sr;let nn=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});ye.Wrap=nn;var bf={ALIGN_AUTO:ui.Auto,ALIGN_FLEX_START:ui.FlexStart,ALIGN_CENTER:ui.Center,ALIGN_FLEX_END:ui.FlexEnd,ALIGN_STRETCH:ui.Stretch,ALIGN_BASELINE:ui.Baseline,ALIGN_SPACE_BETWEEN:ui.SpaceBetween,ALIGN_SPACE_AROUND:ui.SpaceAround,DIMENSION_WIDTH:Lo.Width,DIMENSION_HEIGHT:Lo.Height,DIRECTION_INHERIT:Xr.Inherit,DIRECTION_LTR:Xr.LTR,DIRECTION_RTL:Xr.RTL,DISPLAY_FLEX:_o.Flex,DISPLAY_NONE:_o.None,EDGE_LEFT:jt.Left,EDGE_TOP:jt.Top,EDGE_RIGHT:jt.Right,EDGE_BOTTOM:jt.Bottom,EDGE_START:jt.Start,EDGE_END:jt.End,EDGE_HORIZONTAL:jt.Horizontal,EDGE_VERTICAL:jt.Vertical,EDGE_ALL:jt.All,ERRATA_NONE:tr.None,ERRATA_STRETCH_FLEX_BASIS:tr.StretchFlexBasis,ERRATA_ALL:tr.All,ERRATA_CLASSIC:tr.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:zr.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:zr.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:zr.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ir.Column,FLEX_DIRECTION_COLUMN_REVERSE:ir.ColumnReverse,FLEX_DIRECTION_ROW:ir.Row,FLEX_DIRECTION_ROW_REVERSE:ir.RowReverse,GUTTER_COLUMN:Zr.Column,GUTTER_ROW:Zr.Row,GUTTER_ALL:Zr.All,JUSTIFY_FLEX_START:Xi.FlexStart,JUSTIFY_CENTER:Xi.Center,JUSTIFY_FLEX_END:Xi.FlexEnd,JUSTIFY_SPACE_BETWEEN:Xi.SpaceBetween,JUSTIFY_SPACE_AROUND:Xi.SpaceAround,JUSTIFY_SPACE_EVENLY:Xi.SpaceEvenly,LOG_LEVEL_ERROR:zi.Error,LOG_LEVEL_WARN:zi.Warn,LOG_LEVEL_INFO:zi.Info,LOG_LEVEL_DEBUG:zi.Debug,LOG_LEVEL_VERBOSE:zi.Verbose,LOG_LEVEL_FATAL:zi.Fatal,MEASURE_MODE_UNDEFINED:en.Undefined,MEASURE_MODE_EXACTLY:en.Exactly,MEASURE_MODE_AT_MOST:en.AtMost,NODE_TYPE_DEFAULT:ko.Default,NODE_TYPE_TEXT:ko.Text,OVERFLOW_VISIBLE:tn.Visible,OVERFLOW_HIDDEN:tn.Hidden,OVERFLOW_SCROLL:tn.Scroll,POSITION_TYPE_STATIC:sn.Static,POSITION_TYPE_RELATIVE:sn.Relative,POSITION_TYPE_ABSOLUTE:sn.Absolute,PRINT_OPTIONS_LAYOUT:rn.Layout,PRINT_OPTIONS_STYLE:rn.Style,PRINT_OPTIONS_CHILDREN:rn.Children,UNIT_UNDEFINED:sr.Undefined,UNIT_POINT:sr.Point,UNIT_PERCENT:sr.Percent,UNIT_AUTO:sr.Auto,WRAP_NO_WRAP:nn.NoWrap,WRAP_WRAP:nn.Wrap,WRAP_WRAP_REVERSE:nn.WrapReverse};ye.default=bf,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.default=wf;var _i=Sf(ye);function Pl(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Pl=function(i){return i?t:e})(s)}function Sf(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=Pl(e);if(t&&t.has(s))return t.get(s);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in s)if(n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)){var o=r?Object.getOwnPropertyDescriptor(s,n):null;o&&(o.get||o.set)?Object.defineProperty(i,n,o):i[n]=s[n]}return i.default=s,t&&t.set(s,i),i}function wf(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[_i.Unit.Point]:s.Node.prototype[r],[_i.Unit.Percent]:s.Node.prototype[`${r}Percent`],[_i.Unit.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let h,u;if(c==="auto")h=_i.Unit.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?_i.Unit.Percent:_i.Unit.Point,u=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(u))throw new Error(`Invalid value ${c} for ${r}`);if(!n[h])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return u!==void 0?n[h].call(this,...A,u):n[h].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_i.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,..._i.default}}var Ul={exports:{}};(function(s,e){var t=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(r){r=r||{};var n;n||(n=typeof r<"u"?r:{});var o,a;n.ready=new Promise(function(I,m){o=I,a=m});var A=Object.assign({},n),l="";typeof document<"u"&&document.currentScript&&(l=document.currentScript.src),i&&(l=i),l.indexOf("blob:")!==0?l=l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):l="";var c=n.print||console.log.bind(console),h=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var u;n.wasmBinary&&(u=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&U("no native wasm support detected");var d,g=!1;function f(I,m,x){x=m+x;for(var _="";!(m>=x);){var M=I[m++];if(!M)break;if(M&128){var V=I[m++]&63;if((M&224)==192)_+=String.fromCharCode((M&31)<<6|V);else{var j=I[m++]&63;M=(M&240)==224?(M&15)<<12|V<<6|j:(M&7)<<18|V<<12|j<<6|I[m++]&63,65536>M?_+=String.fromCharCode(M):(M-=65536,_+=String.fromCharCode(55296|M>>10,56320|M&1023))}}else _+=String.fromCharCode(M)}return _}var p,y,v,Q,C,T,b,L,R;function P(){var I=d.buffer;p=I,n.HEAP8=y=new Int8Array(I),n.HEAP16=Q=new Int16Array(I),n.HEAP32=T=new Int32Array(I),n.HEAPU8=v=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=b=new Uint32Array(I),n.HEAPF32=L=new Float32Array(I),n.HEAPF64=R=new Float64Array(I)}var k,q=[],$=[],te=[];function ee(){var I=n.preRun.shift();q.unshift(I)}var S=0,D=null;function U(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",h(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function B(I){return I.startsWith("data:application/octet-stream;base64,")}var w;if(w="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gAABgA39/fABgAX8BfGADf399AX1gBX9/f39/AX9gAn9/AXxgAAF/YAZ/f31/fX8AYAR/f39/AX9gAn9/AX1gBn9/f39/fwF/YAV/f39/fwBgBH9/f38AYAN/fn8BfmAHf39/f39/fwBgBn9/f39/fwBgAn19AX1gAX0Bf2ABfwF9YAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA5/fX1/f399fX9/f39/fwF/YAZ/f319f38AYAJ+fwF/YAR/fX1/AX1gA399fQF9YAF8AXxgBH98fHwAYAV/f319fQF9YA5/fX1/f399fX9/f39/fwBgB39/fX99f38AYA1/fX99f31/fX19fX1/AX9gBX9/fX19AGAEf39+fgBgB39/f39/f38Bf2ACfH8BfGAFf398fH8AYAN/f38BfWADf39/AXxgBH9/f3wAYAN/f30AYAZ/f31/fX8BfwKvAR0BYQFhAB0BYQFiAAMBYQFjABUBYQFkABIBYQFlAAcBYQFmAB4BYQFnAAABYQFoAB8BYQFpAAMBYQFqAAABYQFrABYBYQFsAAUBYQFtAAMBYQFuAAEBYQFvABYBYQFwAAYBYQFxAAABYQFyAAABYQFzACABYQF0ABMBYQF1AAsBYQF2ABUBYQF3AAIBYQF4AAMBYQF5AA8BYQF6AAIBYQFBAAEBYQFCABIBYQFDAAEDgwKBAgIXChAQCgoKIQIDEgAGBgcBBRgiGAYPCgMGIwMDBSQDGSUBDwoZAwMKAgUAAAIDAQMGAgcBCAwAFygHAAUAKQIBKistAwMGAgECAAEuCgUKLw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GAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBAXI2AgAgAgJ/IAIoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFBHSABZyIAa3ZBBHMgAEECdGtB7gBqIAFB/x9NDQAaQT8gAUEeIABrdkECcyAAQQF0a0HHAGoiACAAQT9PGwsiAUEEdCIAQdAuajYCBCACIABB2C5qIgAoAgA2AgggACACNgIAIAIoAgggAjYCBEHYNkHYNikDAEIBIAGthoQ3AwALC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsOAEHILigCABEHABBQAAuXAgEDfyMAQRBrIgQkACAEIAE2AgwCQAJAIABFBEAgBCgCDCEBDAELIAQoAgwhASAAKAK4BCICRQ0AIAIoAg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QQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBGRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBGRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBACETDAMLIAIgAigCACIBQQRqNgIAQQAhFSABKAIACyETIAggCTYCTCATQQBODQFBACATayETIAxBgMAAciEMDAELIAhBzABqEHEiE0EASA0IIAgoAkwhCQtBACEHQX8hCwJ/IAktAABBLkcEQCAJIQFBAAwBCyAJLQABQSpGBEACfwJAIAksAAIiARBGRQ0AIAktAANBJEcNACABQQJ0IARqQcABa0EKNgIAIAlBB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EEcQRAIAIgAyAEIAUgABEPAAwBCyACIAMgBCAAEQYACyIFDQELQcwEEB0iBSACQagEECsiAUEANgK0BCABQgA3AqwEIAIoArAEIgMgAigCrAQiBEcEQCADIARrIgZBAEgNAiABIAYQHSIANgKsBCABIAAgBmo2ArQEA0AgACAEKAIANgIAIABBBGohACAEQQRqIgQgA0cNAAsgASAANgKwBAsgASACKQK4BDcCuAQgASACKALIBDYCyAQgASACKQLABDcCwAQgAUEANgKoBAsgBQ8LEAQAC3EBAX8CQCAAKAIAIgAoAhgiAkECdkEDcSABRg0AIAAgAkFzcSABQQJ0QQxxcjYCGANAIAAtAAQiAUEEcQ0BIAAgAUEEcjoABCAAKAIUIgEEQCAAIAERAAALIABBgICA/gc2ArQCIAAoAqgEIgANAAsLCw0AIAAoAgBBByABEE0LDQAgACgCAEEGIAEQTQsNACAAKAIAQQUgARBNCxAAIAAoAgAgASACthAxEGILEAAgACgCACABIAK2EC8QYgt1AQF/AkAgACgCACIAKAIYIgJBEHZBA3EgAUYNACAAIAJB//9zcSABQRB0QYCADHFyNgIYA0AgAC0ABCIBQQRxDQEgACABQQRyOgAEIAAoAhQiAQRAIAAgAREAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLxwkCBn8DfQJAAkAgASgCACIFKAIYIAAoAgAiASgCGHNB////A3ENACAFKAIoIQACfwJAIAEoAigiAkHw4YP8B0cEQEMAAMB/IQhBAyACQarVqv0HRg0CGiACQY+evPwHRw0BQwAAAAAhCEEBDAILQQIMAQtBACACviIJIAlcDQAaIAJB/////3txQYCAgIACar4hCEECQQEgAkGAgICABHEbCyEDAn8CQCAAQfDhg/wHRwRAQwAAwH8hCUEDIABBqtWq/QdGDQIaIABBj568/AdHDQFDAAAAACEJQQEMAgtDAAAAACEJQQIMAQtBACAAviIKIApcDQAaIABB/////3txQYCAgIACar4hCUECQQEgAEGAgICABHEbCyADRyADRSAIIAhcIAkgCVxxciAIIAmTi0MXt9E4XXJFcg0AIAFBLGoiAygCAC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gACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQC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ANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJAAkACQCABQQRrDgIAAQILIABBpAJqIAAtAKwCQQNxQQJGDQIaIABBnAJqDAILIABBnAJqIAAtAKwCQQNxQQJGDQEaIABBpAJqDAELIAAgAUECdGpBnAJqCyoCACEDIAJBEGokACADuw8LIAJB0A42AgAgACACEC0QLAALmwECAX8BfSMAQRBrIgIkACAAKAIAIQAgAUEGSARAAn8CQAJAAkAgAUEEaw4CAAECCyAAQZQCaiAALQCsAkEDcUECRg0CGiAAQYwCagwCCyAAQY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ID+BzYCtAIgACgCqAQiAA0ACwsLcgICfQF/AkAgACgCACIAKgLgASIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOALgAQNAIAAtAAQiBEEEcQ0BIAAgBEEEcjoABCAAKAIUIgQEQCAAIAQRAAALIABBgICA/gc2ArQCIAAoAqgEIgANAAsLCxAAIAAoAgBBASABthAxEEMLEAAgACgCAEEBIAG2EC8QQwsQACAAKAIAQQAgAbYQMRBDCxAAIAAoAgBBACABthAvEEMLEAAgACgCAEEBIAG2EDEQRAsQACAAKAIAQQEgAbYQLxBECxAAIAAoAgBBACABthAxEEQLEAAgACgCAEEAIAG2EC8QRAsRACAAKAIAQQFBqtWq/QcQPAsQACAAKAIAQQEgAbYQMRA8CxAAIAAoAgBBASABthAvEDwLEQAgACgCAEEAQarVqv0HEDwLEAAgACgCAEEAIAG2EDEQPAsQACAAKAIAQQAgAbYQLxA8C3ACAn0BfwJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBB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AEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!B(w)){var N=w;w=n.locateFile?n.locateFile(N,l):l+N}function H(){var I=w;try{if(I==w&&u)return new Uint8Array(u);if(B(I))try{var m=qy(I.slice(37)),x=new Uint8Array(m.length);for(I=0;I<m.length;++I)x[I]=m.charCodeAt(I);var _=x}catch{throw Error("Converting base64 string to bytes failed.")}else _=void 0;var M=_;if(M)return M;throw"both async and sync fetching of the wasm failed"}catch(V){U(V)}}function K(){return u||typeof fetch!="function"?Promise.resolve().then(function(){return H()}):fetch(w,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+w+"'";return I.arrayBuffer()}).catch(function(){return H()})}function X(I){for(;0<I.length;)I.shift()(n)}function se(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function ue(I,m){return I=se(I),function(){return m.apply(this,arguments)}}var Ae=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Ce=[];function be(I){var m=Error,x=ue(I,function(_){this.name=I,this.message=_,_=Error(_).stack,_!==void 0&&(this.stack=this.toString()+`
89
- `+_.replace(/^Error(:[^\n]*)?\n/,""))});return x.prototype=Object.create(m.prototype),x.prototype.constructor=x,x.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},x}var Re=void 0;function ne(I){throw new Re(I)}var Ie=I=>(I||ne("Cannot use deleted val. handle = "+I),Ae[I].value),Be=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=Ce.length?Ce.pop():Ae.length;return Ae[m]={fa:1,value:I},m}},he=void 0,le=void 0;function oe(I){for(var m="";v[I];)m+=le[v[I++]];return m}var we=[];function Oe(){for(;we.length;){var I=we.pop();I.L.Z=!1,I.delete()}}var Le=void 0,Me={};function Pe(I,m){for(m===void 0&&ne("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var xe={};function ve(I){I=nd(I);var m=oe(I);return vi(I),m}function He(I,m){var x=xe[I];return x===void 0&&ne(m+" has unknown type "+ve(I)),x}function We(){}var at=!1;function Xe(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function It(I,m,x){return m===x?I:x.P===void 0?null:(I=It(I,m,x.P),I===null?null:x.ma(I))}var Ci={};function mt(I,m){return m=Pe(I,m),Me[m]}var oi=void 0;function ai(I){throw new oi(I)}function Ai(I,m){return m.O&&m.N||ai("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&ai("Both smartPtrType and smartPtr must be specified"),m.count={value:1},gt(Object.create(I,{L:{value:m}}))}function gt(I){return typeof FinalizationRegistry>"u"?(gt=m=>m,I):(at=new FinalizationRegistry(m=>{Xe(m.L)}),gt=m=>{var x=m.L;return x.S&&at.register(m,{L:x},m),m},We=m=>{at.unregister(m)},gt(I))}var G={};function ae(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function de(I){return this.fromWireType(T[I>>2])}var Se={},Qe={};function $e(I,m,x){function _(z){z=x(z),z.length!==I.length&&ai("Mismatched type converter count");for(var ie=0;ie<I.length;++ie)yt(I[ie],z[ie])}I.forEach(function(z){Qe[z]=m});var M=Array(m.length),V=[],j=0;m.forEach((z,ie)=>{xe.hasOwnProperty(z)?M[ie]=xe[z]:(V.push(z),Se.hasOwnProperty(z)||(Se[z]=[]),Se[z].push(()=>{M[ie]=xe[z],++j,j===V.length&&_(M)}))}),V.length===0&&_(M)}function Ct(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function yt(I,m,x={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var _=m.name;if(I||ne('type "'+_+'" must have a positive integer typeid pointer'),xe.hasOwnProperty(I)){if(x.ta)return;ne("Cannot register type '"+_+"' twice")}xe[I]=m,delete Qe[I],Se.hasOwnProperty(I)&&(m=Se[I],delete Se[I],m.forEach(M=>M()))}function Ds(I){ne(I.L.O.M.name+" instance already deleted")}function vt(){}function ls(I,m,x){if(I[m].R===void 0){var _=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||ne("Function '"+x+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[_.Y]=_}}function Rs(I,m){n.hasOwnProperty(I)?(ne("Cannot register public name '"+I+"' twice"),ls(n,I,I),n.hasOwnProperty(void 0)&&ne("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function Gi(I,m,x,_,M,V,j,z){this.name=I,this.constructor=m,this.W=x,this.V=_,this.P=M,this.oa=V,this.aa=j,this.ma=z,this.ia=[]}function xr(I,m,x){for(;m!==x;)m.aa||ne("Expected null or instance of "+x.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function Dr(I,m){return m===null?(this.da&&ne("null is not a valid "+this.name),0):(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),xr(m.L.N,m.L.O.M,this.M))}function Ls(I,m){if(m===null){if(this.da&&ne("null is not a valid "+this.name),this.ca){var x=this.ea();return I!==null&&I.push(this.V,x),x}return 0}if(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&ne("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),x=xr(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&ne("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?x=m.L.S:ne("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:x=m.L.S;break;case 2:if(m.L.T===this)x=m.L.S;else{var _=m.clone();x=this.wa(x,Be(function(){_.delete()})),I!==null&&I.push(this.V,x)}break;default:ne("Unsupporting sharing policy")}return x}function ky(I,m){return m===null?(this.da&&ne("null is not a valid "+this.name),0):(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&ne("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),xr(m.L.N,m.L.O.M,this.M))}function yi(I,m,x,_){this.name=I,this.M=m,this.da=x,this.ba=_,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=Ls:(this.toWireType=_?Dr:ky,this.U=null)}function Fy(I,m){n.hasOwnProperty(I)||ai("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function Ny(I,m){var x=[];return function(){if(x.length=0,Object.assign(x,arguments),I.includes("j")){var _=n["dynCall_"+I];_=x&&x.length?_.apply(null,[m].concat(x)):_.call(null,m)}else _=k.get(m).apply(null,x);return _}}function Jt(I,m){I=oe(I);var x=I.includes("j")?Ny(I,m):k.get(m);return typeof x!="function"&&ne("unknown function pointer with signature "+I+": "+m),x}var td=void 0;function Vn(I,m){function x(V){M[V]||xe[V]||(Qe[V]?Qe[V].forEach(x):(_.push(V),M[V]=!0))}var _=[],M={};throw m.forEach(x),new td(I+": "+_.map(ve).join([", "]))}function gA(I,m,x,_,M){var V=m.length;2>V&&ne("argTypes array size mismatch! Must at least get return value and 'this' types!");var j=m[1]!==null&&x!==null,z=!1;for(x=1;x<m.length;++x)if(m[x]!==null&&m[x].U===void 0){z=!0;break}var ie=m[0].name!=="void",Z=V-2,re=Array(Z),pe=[],_e=[];return function(){if(arguments.length!==Z&&ne("function "+I+" called with "+arguments.length+" arguments, expected "+Z+" args!"),_e.length=0,pe.length=j?2:1,pe[0]=M,j){var ze=m[1].toWireType(_e,this);pe[1]=ze}for(var Fe=0;Fe<Z;++Fe)re[Fe]=m[Fe+2].toWireType(_e,arguments[Fe]),pe.push(re[Fe]);if(Fe=_.apply(null,pe),z)ae(_e);else for(var Ft=j?1:2;Ft<m.length;Ft++){var Wt=Ft===1?ze:re[Ft-2];m[Ft].U!==null&&m[Ft].U(Wt)}return ze=ie?m[0].fromWireType(Fe):void 0,ze}}function fA(I,m){for(var x=[],_=0;_<I;_++)x.push(b[m+4*_>>2]);return x}function pA(I){4<I&&--Ae[I].fa===0&&(Ae[I]=void 0,Ce.push(I))}function EA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function My(I,m){switch(m){case 2:return function(x){return this.fromWireType(L[x>>2])};case 3:return function(x){return this.fromWireType(R[x>>3])};default:throw new TypeError("Unknown float type: "+I)}}function Oy(I,m,x){switch(m){case 0:return x?function(_){return y[_]}:function(_){return v[_]};case 1:return x?function(_){return Q[_>>1]}:function(_){return C[_>>1]};case 2:return x?function(_){return T[_>>2]}:function(_){return b[_>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function Py(I,m){for(var x="",_=0;!(_>=m/2);++_){var M=Q[I+2*_>>1];if(M==0)break;x+=String.fromCharCode(M)}return x}function Uy(I,m,x){if(x===void 0&&(x=2147483647),2>x)return 0;x-=2;var _=m;x=x<2*I.length?x/2:I.length;for(var M=0;M<x;++M)Q[m>>1]=I.charCodeAt(M),m+=2;return Q[m>>1]=0,m-_}function Gy(I){return 2*I.length}function Hy(I,m){for(var x=0,_="";!(x>=m/4);){var M=T[I+4*x>>2];if(M==0)break;++x,65536<=M?(M-=65536,_+=String.fromCharCode(55296|M>>10,56320|M&1023)):_+=String.fromCharCode(M)}return _}function $y(I,m,x){if(x===void 0&&(x=2147483647),4>x)return 0;var _=m;x=_+x-4;for(var M=0;M<I.length;++M){var V=I.charCodeAt(M);if(55296<=V&&57343>=V){var j=I.charCodeAt(++M);V=65536+((V&1023)<<10)|j&1023}if(T[m>>2]=V,m+=4,m+4>x)break}return T[m>>2]=0,m-_}function Yy(I){for(var m=0,x=0;x<I.length;++x){var _=I.charCodeAt(x);55296<=_&&57343>=_&&++x,m+=4}return m}var Ky={};function id(I){var m=Ky[I];return m===void 0?oe(I):m}var Jn=[];function Vy(I){var m=Jn.length;return Jn.push(I),m}function Jy(I,m){for(var x=Array(I),_=0;_<I;++_)x[_]=He(b[m+4*_>>2],"parameter "+_);return x}var sd=[],Wy=[null,[],[]];Re=n.BindingError=be("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<Ae.length;++m)Ae[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<Ae.length;++I)if(Ae[I]!==void 0)return Ae[I];return null},he=n.PureVirtualError=be("PureVirtualError");for(var rd=Array(256),Wn=0;256>Wn;++Wn)rd[Wn]=String.fromCharCode(Wn);le=rd,n.getInheritedInstanceCount=function(){return Object.keys(Me).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in Me)Me.hasOwnProperty(m)&&I.push(Me[m]);return I},n.flushPendingDeletes=Oe,n.setDelayFunction=function(I){Le=I,we.length&&Le&&Le(Oe)},oi=n.InternalError=be("InternalError"),vt.prototype.isAliasOf=function(I){if(!(this instanceof vt&&I instanceof vt))return!1;var m=this.L.O.M,x=this.L.N,_=I.L.O.M;for(I=I.L.N;m.P;)x=m.aa(x),m=m.P;for(;_.P;)I=_.aa(I),_=_.P;return m===_&&x===I},vt.prototype.clone=function(){if(this.L.N||Ds(this),this.L.$)return this.L.count.value+=1,this;var I=gt,m=Object,x=m.create,_=Object.getPrototypeOf(this),M=this.L;return I=I(x.call(m,_,{L:{value:{count:M.count,Z:M.Z,$:M.$,N:M.N,O:M.O,S:M.S,T:M.T}}})),I.L.count.value+=1,I.L.Z=!1,I},vt.prototype.delete=function(){this.L.N||Ds(this),this.L.Z&&!this.L.$&&ne("Object already scheduled for deletion"),We(this),Xe(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},vt.prototype.isDeleted=function(){return!this.L.N},vt.prototype.deleteLater=function(){return this.L.N||Ds(this),this.L.Z&&!this.L.$&&ne("Object already scheduled for deletion"),we.push(this),we.length===1&&Le&&Le(Oe),this.L.Z=!0,this},yi.prototype.pa=function(I){return this.ja&&(I=this.ja(I)),I},yi.prototype.ga=function(I){this.V&&this.V(I)},yi.prototype.argPackAdvance=8,yi.prototype.readValueFromPointer=de,yi.prototype.deleteObject=function(I){I!==null&&I.delete()},yi.prototype.fromWireType=function(I){function m(){return this.ca?Ai(this.M.W,{O:this.va,N:x,T:this,S:I}):Ai(this.M.W,{O:this,N:I})}var x=this.pa(I);if(!x)return this.ga(I),null;var _=mt(this.M,x);if(_!==void 0)return _.L.count.value===0?(_.L.N=x,_.L.S=I,_.clone()):(_=_.clone(),this.ga(I),_);if(_=this.M.oa(x),_=Ci[_],!_)return m.call(this);_=this.ba?_.ka:_.pointerType;var M=It(x,this.M,_.M);return M===null?m.call(this):this.ca?Ai(_.M.W,{O:_,N:M,T:this,S:I}):Ai(_.M.W,{O:_,N:M})},td=n.UnboundTypeError=be("UnboundTypeError");var qy=typeof atob=="function"?atob:function(I){var m="",x=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++));_=_<<2|M>>4,M=(M&15)<<4|V>>2;var z=(V&3)<<6|j;m+=String.fromCharCode(_),V!==64&&(m+=String.fromCharCode(M)),j!==64&&(m+=String.fromCharCode(z))}while(x<I.length);return m},jy={p:function(I,m,x){I=oe(I),m=He(m,"wrapper"),x=Ie(x);var _=[].slice,M=m.M,V=M.W,j=M.P.W,z=M.P.constructor;I=ue(I,function(){M.P.ia.forEach((function(Z){if(this[Z]===j[Z])throw new he("Pure virtual function "+Z+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:V}),this.__construct.apply(this,_.call(arguments))}),V.__construct=function(){this===V&&ne("Pass correct 'this' to __construct");var Z=z.implement.apply(void 0,[this].concat(_.call(arguments)));We(Z);var re=Z.L;Z.notifyOnDestruction(),re.$=!0,Object.defineProperties(this,{L:{value:re}}),gt(this),Z=re.N,Z=Pe(M,Z),Me.hasOwnProperty(Z)?ne("Tried to register registered instance: "+Z):Me[Z]=this},V.__destruct=function(){this===V&&ne("Pass correct 'this' to __destruct"),We(this);var Z=this.L.N;Z=Pe(M,Z),Me.hasOwnProperty(Z)?delete Me[Z]:ne("Tried to unregister unregistered instance: "+Z)},I.prototype=Object.create(V);for(var ie in x)I.prototype[ie]=x[ie];return Be(I)},j:function(I){var m=G[I];delete G[I];var x=m.ea,_=m.V,M=m.ha,V=M.map(j=>j.sa).concat(M.map(j=>j.ya));$e([I],V,j=>{var z={};return M.forEach((ie,Z)=>{var re=j[Z],pe=ie.qa,_e=ie.ra,ze=j[Z+M.length],Fe=ie.xa,Ft=ie.za;z[ie.na]={read:Wt=>re.fromWireType(pe(_e,Wt)),write:(Wt,Rr)=>{var Bi=[];Fe(Ft,Wt,ze.toWireType(Bi,Rr)),ae(Bi)}}}),[{name:m.name,fromWireType:function(ie){var Z={},re;for(re in z)Z[re]=z[re].read(ie);return _(ie),Z},toWireType:function(ie,Z){for(var re in z)if(!(re in Z))throw new TypeError('Missing field: "'+re+'"');var pe=x();for(re in z)z[re].write(pe,Z[re]);return ie!==null&&ie.push(_,pe),pe},argPackAdvance:8,readValueFromPointer:de,U:_}]})},v:function(){},B:function(I,m,x,_,M){var V=Ct(x);m=oe(m),yt(I,{name:m,fromWireType:function(j){return!!j},toWireType:function(j,z){return z?_:M},argPackAdvance:8,readValueFromPointer:function(j){if(x===1)var z=y;else if(x===2)z=Q;else if(x===4)z=T;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(z[j>>V])},U:null})},f:function(I,m,x,_,M,V,j,z,ie,Z,re,pe,_e){re=oe(re),V=Jt(M,V),z&&(z=Jt(j,z)),Z&&(Z=Jt(ie,Z)),_e=Jt(pe,_e);var ze=se(re);Rs(ze,function(){Vn("Cannot construct "+re+" due to unbound types",[_])}),$e([I,m,x],_?[_]:[],function(Fe){if(Fe=Fe[0],_)var Ft=Fe.M,Wt=Ft.W;else Wt=vt.prototype;Fe=ue(ze,function(){if(Object.getPrototypeOf(this)!==Rr)throw new Re("Use 'new' to construct "+re);if(Bi.X===void 0)throw new Re(re+" has no accessible constructor");var Ad=Bi.X[arguments.length];if(Ad===void 0)throw new Re("Tried to invoke ctor of "+re+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Bi.X).toString()+") parameters instead!");return Ad.apply(this,arguments)});var Rr=Object.create(Wt,{constructor:{value:Fe}});Fe.prototype=Rr;var Bi=new Gi(re,Fe,Rr,_e,Ft,V,z,Z);Ft=new yi(re,Bi,!0,!1),Wt=new yi(re+"*",Bi,!1,!1);var ad=new yi(re+" const*",Bi,!1,!0);return Ci[I]={pointerType:Wt,ka:ad},Fy(ze,Fe),[Ft,Wt,ad]})},c:function(I,m,x,_,M,V,j){var z=fA(x,_);m=oe(m),V=Jt(M,V),$e([],[I],function(ie){function Z(){Vn("Cannot call "+re+" due to unbound types",z)}ie=ie[0];var re=ie.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var pe=ie.M.constructor;return pe[m]===void 0?(Z.Y=x-1,pe[m]=Z):(ls(pe,m,re),pe[m].R[x-1]=Z),$e([],z,function(_e){return _e=gA(re,[_e[0],null].concat(_e.slice(1)),null,V,j),pe[m].R===void 0?(_e.Y=x-1,pe[m]=_e):pe[m].R[x-1]=_e,[]}),[]})},o:function(I,m,x,_,M,V){0<m||U();var j=fA(m,x);M=Jt(_,M),$e([],[I],function(z){z=z[0];var ie="constructor "+z.name;if(z.M.X===void 0&&(z.M.X=[]),z.M.X[m-1]!==void 0)throw new Re("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+z.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return z.M.X[m-1]=()=>{Vn("Cannot construct "+z.name+" due to unbound types",j)},$e([],j,function(Z){return Z.splice(1,0,null),z.M.X[m-1]=gA(ie,Z,null,M,V),[]}),[]})},a:function(I,m,x,_,M,V,j,z){var ie=fA(x,_);m=oe(m),V=Jt(M,V),$e([],[I],function(Z){function re(){Vn("Cannot call "+pe+" due to unbound types",ie)}Z=Z[0];var pe=Z.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),z&&Z.M.ia.push(m);var _e=Z.M.W,ze=_e[m];return ze===void 0||ze.R===void 0&&ze.className!==Z.name&&ze.Y===x-2?(re.Y=x-2,re.className=Z.name,_e[m]=re):(ls(_e,m,pe),_e[m].R[x-2]=re),$e([],ie,function(Fe){return Fe=gA(pe,Fe,Z,V,j),_e[m].R===void 0?(Fe.Y=x-2,_e[m]=Fe):_e[m].R[x-2]=Fe,[]}),[]})},A:function(I,m){m=oe(m),yt(I,{name:m,fromWireType:function(x){var _=Ie(x);return pA(x),_},toWireType:function(x,_){return Be(_)},argPackAdvance:8,readValueFromPointer:de,U:null})},m:function(I,m,x){x=Ct(x),m=oe(m),yt(I,{name:m,fromWireType:function(_){return _},toWireType:function(_,M){return M},argPackAdvance:8,readValueFromPointer:My(m,x),U:null})},d:function(I,m,x,_,M){m=oe(m),M===-1&&(M=4294967295),M=Ct(x);var V=z=>z;if(_===0){var j=32-8*x;V=z=>z<<j>>>j}x=m.includes("unsigned")?function(z,ie){return ie>>>0}:function(z,ie){return ie},yt(I,{name:m,fromWireType:V,toWireType:x,argPackAdvance:8,readValueFromPointer:Oy(m,M,_!==0),U:null})},b:function(I,m,x){function _(V){V>>=2;var j=b;return new M(p,j[V+1],j[V])}var M=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];x=oe(x),yt(I,{name:x,fromWireType:_,argPackAdvance:8,readValueFromPointer:_},{ta:!0})},n:function(I,m){m=oe(m);var x=m==="std::string";yt(I,{name:m,fromWireType:function(_){var M=b[_>>2],V=_+4;if(x)for(var j=V,z=0;z<=M;++z){var ie=V+z;if(z==M||v[ie]==0){if(j=j?f(v,j,ie-j):"",Z===void 0)var Z=j;else Z+=String.fromCharCode(0),Z+=j;j=ie+1}}else{for(Z=Array(M),z=0;z<M;++z)Z[z]=String.fromCharCode(v[V+z]);Z=Z.join("")}return vi(_),Z},toWireType:function(_,M){M instanceof ArrayBuffer&&(M=new Uint8Array(M));var V,j=typeof M=="string";if(j||M instanceof Uint8Array||M instanceof Uint8ClampedArray||M instanceof Int8Array||ne("Cannot pass non-string to std::string"),x&&j){var z=0;for(V=0;V<M.length;++V){var ie=M.charCodeAt(V);127>=ie?z++:2047>=ie?z+=2:55296<=ie&&57343>=ie?(z+=4,++V):z+=3}V=z}else V=M.length;if(z=IA(4+V+1),ie=z+4,b[z>>2]=V,x&&j){if(j=ie,ie=V+1,V=v,0<ie){ie=j+ie-1;for(var Z=0;Z<M.length;++Z){var re=M.charCodeAt(Z);if(55296<=re&&57343>=re){var pe=M.charCodeAt(++Z);re=65536+((re&1023)<<10)|pe&1023}if(127>=re){if(j>=ie)break;V[j++]=re}else{if(2047>=re){if(j+1>=ie)break;V[j++]=192|re>>6}else{if(65535>=re){if(j+2>=ie)break;V[j++]=224|re>>12}else{if(j+3>=ie)break;V[j++]=240|re>>18,V[j++]=128|re>>12&63}V[j++]=128|re>>6&63}V[j++]=128|re&63}}V[j]=0}}else if(j)for(j=0;j<V;++j)Z=M.charCodeAt(j),255<Z&&(vi(ie),ne("String has UTF-16 code units that do not fit in 8 bits")),v[ie+j]=Z;else for(j=0;j<V;++j)v[ie+j]=M[j];return _!==null&&_.push(vi,z),z},argPackAdvance:8,readValueFromPointer:de,U:function(_){vi(_)}})},i:function(I,m,x){if(x=oe(x),m===2)var _=Py,M=Uy,V=Gy,j=()=>C,z=1;else m===4&&(_=Hy,M=$y,V=Yy,j=()=>b,z=2);yt(I,{name:x,fromWireType:function(ie){for(var Z=b[ie>>2],re=j(),pe,_e=ie+4,ze=0;ze<=Z;++ze){var Fe=ie+4+ze*m;(ze==Z||re[Fe>>z]==0)&&(_e=_(_e,Fe-_e),pe===void 0?pe=_e:(pe+=String.fromCharCode(0),pe+=_e),_e=Fe+m)}return vi(ie),pe},toWireType:function(ie,Z){typeof Z!="string"&&ne("Cannot pass non-string to C++ string type "+x);var re=V(Z),pe=IA(4+re+m);return b[pe>>2]=re>>z,M(Z,pe+4,re+m),ie!==null&&ie.push(vi,pe),pe},argPackAdvance:8,readValueFromPointer:de,U:function(ie){vi(ie)}})},k:function(I,m,x,_,M,V){G[I]={name:oe(m),ea:Jt(x,_),V:Jt(M,V),ha:[]}},h:function(I,m,x,_,M,V,j,z,ie,Z){G[I].ha.push({na:oe(m),sa:x,qa:Jt(_,M),ra:V,ya:j,xa:Jt(z,ie),za:Z})},C:function(I,m){m=oe(m),yt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,x,_,M){I=Jn[I],m=Ie(m),x=id(x);var V=[];return b[_>>2]=Be(V),I(m,x,V,M)},t:function(I,m,x,_){I=Jn[I],m=Ie(m),x=id(x),I(m,x,null,_)},g:pA,l:function(I,m){var x=Jy(I,m),_=x[0];m=_.name+"_$"+x.slice(1).map(function(j){return j.name}).join("_")+"$";var M=sd[m];if(M!==void 0)return M;var V=Array(I-1);return M=Vy((j,z,ie,Z)=>{for(var re=0,pe=0;pe<I-1;++pe)V[pe]=x[pe+1].readValueFromPointer(Z+re),re+=x[pe+1].argPackAdvance;for(j=j[z].apply(j,V),pe=0;pe<I-1;++pe)x[pe+1].la&&x[pe+1].la(V[pe]);if(!_.ua)return _.toWireType(ie,j)}),sd[m]=M},q:function(I){4<I&&(Ae[I].fa+=1)},r:function(I){var m=Ie(I);ae(m),pA(I)},e:function(){U("")},x:function(I,m,x){v.copyWithin(I,m,m+x)},w:function(I){var m=v.length;if(I>>>=0,2147483648<I)return!1;for(var x=1;4>=x;x*=2){var _=m*(1+.2/x);_=Math.min(_,I+100663296);var M=Math;_=Math.max(I,_),M=M.min.call(M,2147483648,_+(65536-_%65536)%65536);e:{try{d.grow(M-p.byteLength+65535>>>16),P();var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,m,x,_){for(var M=0,V=0;V<x;V++){var j=b[m>>2],z=b[m+4>>2];m+=8;for(var ie=0;ie<z;ie++){var Z=v[j+ie],re=Wy[I];Z===0||Z===10?((I===1?c:h)(f(re,0)),re.length=0):re.push(Z)}M+=z}return b[_>>2]=M,0}};(function(){function I(M){n.asm=M.exports,d=n.asm.D,P(),k=n.asm.I,$.unshift(n.asm.E),S--,n.monitorRunDependencies&&n.monitorRunDependencies(S),S==0&&D&&(M=D,D=null,M())}function m(M){I(M.instance)}function x(M){return K().then(function(V){return WebAssembly.instantiate(V,_)}).then(function(V){return V}).then(M,function(V){h("failed to asynchronously prepare wasm: "+V),U(V)})}var _={a:jy};if(S++,n.monitorRunDependencies&&n.monitorRunDependencies(S),n.instantiateWasm)try{return n.instantiateWasm(_,I)}catch(M){h("Module.instantiateWasm callback failed with error: "+M),a(M)}return function(){return u||typeof WebAssembly.instantiateStreaming!="function"||B(w)||typeof fetch!="function"?x(m):fetch(w,{credentials:"same-origin"}).then(function(M){return WebAssembly.instantiateStreaming(M,_).then(m,function(V){return h("wasm streaming compile failed: "+V),h("falling back to ArrayBuffer instantiation"),x(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var nd=n.___getTypeName=function(){return(nd=n.___getTypeName=n.asm.F).apply(null,arguments)};n.__embind_initialize_bindings=function(){return(n.__embind_initialize_bindings=n.asm.G).apply(null,arguments)};var IA=n._malloc=function(){return(IA=n._malloc=n.asm.H).apply(null,arguments)},vi=n._free=function(){return(vi=n._free=n.asm.J).apply(null,arguments)};n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.K).apply(null,arguments)};var qn;D=function I(){qn||od(),qn||(D=I)};function od(){function I(){if(!qn&&(qn=!0,n.calledRun=!0,!g)){if(X($),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();te.unshift(m)}X(te)}}if(!(0<S)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)ee();X(q),0<S||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),I()},1)):I())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();return od(),r.ready}})();s.exports=t})(Ul);var Tf=Ul.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(Ro),i=ye;Object.keys(i).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in s&&s[a]===i[a]||Object.defineProperty(s,a,{enumerable:!0,get:function(){return i[a]}})});function r(a){return a&&a.__esModule?a:{default:a}}const n=Tf;async function o(){return(0,t.default)(await n())}})(Ol);var Fo={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qr<"u"&&qr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(S){return S&&DataView.prototype.isPrototypeOf(S)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(S){return S&&c.indexOf(Object.prototype.toString.call(S))>-1};function u(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function d(S){return typeof S!="string"&&(S=String(S)),S}function g(S){var D={next:function(){var U=S.shift();return{done:U===void 0,value:U}}};return A.iterable&&(D[Symbol.iterator]=function(){return D}),D}function f(S){this.map={},S instanceof f?S.forEach(function(D,U){this.append(U,D)},this):Array.isArray(S)?S.forEach(function(D){this.append(D[0],D[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(D){this.append(D,S[D])},this)}f.prototype.append=function(S,D){S=u(S),D=d(D);var U=this.map[S];this.map[S]=U?U+", "+D:D},f.prototype.delete=function(S){delete this.map[u(S)]},f.prototype.get=function(S){return S=u(S),this.has(S)?this.map[S]:null},f.prototype.has=function(S){return this.map.hasOwnProperty(u(S))},f.prototype.set=function(S,D){this.map[u(S)]=d(D)},f.prototype.forEach=function(S,D){for(var U in this.map)this.map.hasOwnProperty(U)&&S.call(D,this.map[U],U,this)},f.prototype.keys=function(){var S=[];return this.forEach(function(D,U){S.push(U)}),g(S)},f.prototype.values=function(){var S=[];return this.forEach(function(D){S.push(D)}),g(S)},f.prototype.entries=function(){var S=[];return this.forEach(function(D,U){S.push([U,D])}),g(S)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(S){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}function y(S){return new Promise(function(D,U){S.onload=function(){D(S.result)},S.onerror=function(){U(S.error)}})}function v(S){var D=new FileReader,U=y(D);return D.readAsArrayBuffer(S),U}function Q(S){var D=new FileReader,U=y(D);return D.readAsText(S),U}function C(S){for(var D=new Uint8Array(S),U=new Array(D.length),B=0;B<D.length;B++)U[B]=String.fromCharCode(D[B]);return U.join("")}function T(S){if(S.slice)return S.slice(0);var D=new Uint8Array(S.byteLength);return D.set(new Uint8Array(S)),D.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:A.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:A.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():A.arrayBuffer&&A.blob&&l(S)?(this._bodyArrayBuffer=T(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||h(S))?this._bodyArrayBuffer=T(S):this._bodyText=S=Object.prototype.toString.call(S):this._bodyText="",this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var S=p(this);if(S)return S;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 S=p(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var S=p(this);if(S)return S;if(this._bodyBlob)return Q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(S){var D=S.toUpperCase();return L.indexOf(D)>-1?D:S}function P(S,D){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var U=D.body;if(S instanceof P){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,D.headers||(this.headers=new f(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!U&&S._bodyInit!=null&&(U=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new f(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&U)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(U),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var B=/([?&])_=[^&]*/;if(B.test(this.url))this.url=this.url.replace(B,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function k(S){var D=new FormData;return S.trim().split("&").forEach(function(U){if(U){var B=U.split("="),w=B.shift().replace(/\+/g," "),N=B.join("=").replace(/\+/g," ");D.append(decodeURIComponent(w),decodeURIComponent(N))}}),D}function q(S){var D=new f,U=S.replace(/\r?\n[\t ]+/g," ");return U.split("\r").map(function(B){return B.indexOf(`
90
- `)===0?B.substr(1,B.length):B}).forEach(function(B){var w=B.split(":"),N=w.shift().trim();if(N){var H=w.join(":").trim();D.append(N,H)}}),D}b.call(P.prototype);function $(S,D){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D||(D={}),this.type="default",this.status=D.status===void 0?200:D.status,this.ok=this.status>=200&&this.status<300,this.statusText=D.statusText===void 0?"":""+D.statusText,this.headers=new f(D.headers),this.url=D.url||"",this._initBody(S)}b.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},$.error=function(){var S=new $(null,{status:0,statusText:""});return S.type="error",S};var te=[301,302,303,307,308];$.redirect=function(S,D){if(te.indexOf(D)===-1)throw new RangeError("Invalid status code");return new $(null,{status:D,headers:{location:S}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(D,U){this.message=D,this.name=U;var B=Error(D);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function ee(S,D){return new Promise(function(U,B){var w=new P(S,D);if(w.signal&&w.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function H(){N.abort()}N.onload=function(){var X={status:N.status,statusText:N.statusText,headers:q(N.getAllResponseHeaders()||"")};X.url="responseURL"in N?N.responseURL:X.headers.get("X-Request-URL");var se="response"in N?N.response:N.responseText;setTimeout(function(){U(new $(se,X))},0)},N.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},N.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},N.onabort=function(){setTimeout(function(){B(new o.DOMException("Aborted","AbortError"))},0)};function K(X){try{return X===""&&a.location.href?a.location.href:X}catch{return X}}N.open(w.method,K(w.url),!0),w.credentials==="include"?N.withCredentials=!0:w.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&(A.blob?N.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(N.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof f)?Object.getOwnPropertyNames(D.headers).forEach(function(X){N.setRequestHeader(X,d(D.headers[X]))}):w.headers.forEach(function(X,se){N.setRequestHeader(se,X)}),w.signal&&(w.signal.addEventListener("abort",H),N.onreadystatechange=function(){N.readyState===4&&w.signal.removeEventListener("abort",H)}),N.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return ee.polyfill=!0,a.fetch||(a.fetch=ee,a.Headers=f,a.Request=P,a.Response=$),o.Headers=f,o.Request=P,o.Response=$,o.fetch=ee,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(Fo,Fo.exports);var xf=Fo.exports;const Df=xo(xf);function No({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const u=a+A,d=a===0,g=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=u-n&&t<=u&&(r.globalAlpha=Math.max(0,Math.min(1,(u-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Rf(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Lf(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function Mo({resolution:s,aspectRatio:e}){const t=Rf(s),i=Lf(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function _f({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=Mo({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,h=o/l,u=(i-c)/2,d=(r-h)/2;return{sx:u,sy:d,sWidth:c,sHeight:h,scale:l}}function rr({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const h=Math.max(e,0),u=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,p=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(u-h)*f,(g-d)*p]}function Gl({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:h}){const{x:u,y:d,width:g,height:f}=t??{},p=A*(u??0),y=l*(d??0),v=A*Math.min(1-(u??0),g??1),Q=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=v,c.height=Q;const D=rr({source:e,sx:p,sy:y,sw:v,sh:Q,dx:0,dy:0,dw:v,dh:Q});C.drawImage(...D)}const T=v/Q,{sx:b,sy:L,sWidth:R,sHeight:P,scale:k}=_f({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:v,sourceHeight:Q}),q=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!q){if(b<0){const D=Math.abs(b)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,D,a),s.rect(r+o-D,n,D,a),s.fill(),s.closePath()}if(L<0){const D=Math.abs(L)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,D),s.rect(r,n+a-D,o,D),s.fill(),s.closePath()}}if(i==="letterbox-video"&&q){const D=h.getContext("2d");if(D){h.width=v,h.height=Q,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const U=rr({source:c,sx:b,sy:L,sw:R,sh:P,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...U),D.save();const B=1.2,w=-(v*B-v)/2,N=-(Q*B-Q)/2,H=Math.min(v/20,Q/20);if(D.filter=`blur(${H}px) brightness(20%)`,D.translate(w,N),D.scale(B,B),D.drawImage(c,0,0,v,Q),D.restore(),s.globalCompositeOperation="destination-over",b<0){const K=o/T,X=a/K,se=rr({source:h,sy:(1-X)*Q/2,sh:X*Q,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}if(L<0){const K=a*T,X=o/K,se=rr({source:h,sx:(1-X)*v/2,sw:X*v,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}s.restore()}}else{const D=rr({source:c,sx:b,sy:L,sw:R,sh:P,dx:r,dy:n,dw:o,dh:a});s.drawImage(...D)}const $=b*-1*k,te=L*-1*k,ee=o-$*2,S=a-te*2;return{dx:$,dy:te,dw:ee,dh:S}}function Hl({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const $l=mo(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let u=0;for(;a*e>c+1;){c+=1;const d=ln({context:t,font:s,fontSize:c,text:n,maxW:i});if(u=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),u>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(An))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`});function kf(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function Yl(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function Kl(s,e,{layout:t,scale:i=1}){const{position:r="static",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:h,flex:u,gap:d,margin:g,padding:f,direction:p="column",align:y="start",alignSelf:v,justify:Q="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:R,right:P,bottom:k,left:q}=kf(n,i);R&&e.setPosition(s.EDGE_TOP,R),P&&e.setPosition(s.EDGE_RIGHT,P),k&&e.setPosition(s.EDGE_BOTTOM,k),q&&e.setPosition(s.EDGE_LEFT,q)}const T={row:s.FLEX_DIRECTION_ROW,column:s.FLEX_DIRECTION_COLUMN,"row-reverse":s.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(T[p]);const b={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(b[y]),v&&e.setAlignSelf(b[v]);const L={start:s.JUSTIFY_FLEX_START,end:s.JUSTIFY_FLEX_END,center:s.JUSTIFY_CENTER,"space-between":s.JUSTIFY_SPACE_BETWEEN,"space-around":s.JUSTIFY_SPACE_AROUND,"space-evenly":s.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(L[Q]),g){const{top:R,right:P,bottom:k,left:q}=Yl(g,i);e.setMargin(s.EDGE_TOP,R),e.setMargin(s.EDGE_RIGHT,P),e.setMargin(s.EDGE_BOTTOM,k),e.setMargin(s.EDGE_LEFT,q)}if(f){const{top:R,right:P,bottom:k,left:q}=Yl(f,i);e.setPadding(s.EDGE_TOP,R),e.setPadding(s.EDGE_RIGHT,P),e.setPadding(s.EDGE_BOTTOM,k),e.setPadding(s.EDGE_LEFT,q)}u&&e.setFlex(u),e.setGap(s.GUTTER_ALL,(d??0)*i),o&&e.setWidth(typeof o=="number"?o*i:o),a&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*i:a)),A&&e.setMinWidth(typeof A=="number"?A*i:A),l&&e.setMinHeight(typeof l=="number"?l*i:l),c&&e.setMaxWidth(typeof c=="number"?c*i:c),h&&e.setMaxHeight(typeof h=="number"?h*i:h)}function Vl({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:h}=l;h&&(c.save(),h({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),Vl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function Jl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...h}=n;return Kl(s,a,{layout:h,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:Jl(s,a,l,i)}});return e.calculateLayout(),r}function Wl(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:h,height:u}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:h,height:u,element:a,childNodes:Wl(s,A,d,g)}})}function ql(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}ql(r,e)})}function Ff({yoga:s,canvas:e,origin:t,elements:i,...r}){const n={inset:{top:0,left:0},width:e.width,height:e.height,...t},o=s.Node.create();Kl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=Jl(s,o,i,l);ql(c,l),o.calculateLayout();const h=Wl(o,c);return Vl({...r,scale:l,canvas:e,position:h})}const Nf={linear:rf,easeIn:wo,easeInOut:of,easeOut:nf,circIn:Nl,circInOut:af,circOut:Ml,backIn:To,backInOut:lf,backOut:Af,anticipate:cf,bounceIn:gf,bounceInOut:ff,bounceOut:Wr},on=mo((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>Xg(s,e,{...r,clamp:t,ease:Nf[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),jl=[{family:"Noto Arabic",regex:/\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:/\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:/\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:/\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:/\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:/\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:/\p{Extended_Pictographic}/u,url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function an({text:s,font:e}){let t=e;return jl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const di=1.8,An=/(?<value>\d+\.?\d*)(?=px)/;function Mf(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function Xl(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>Xl(r)))}function zl({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}){return o.map(d=>{var g,f,p,y,v,Q,C,T;const{node:b,transient:L=[{from:0,duration:1/0}]}=d,R=t.getContext("2d"),P={total:a,content:A,scene:l},k={total:c,content:h,scene:u},q=L.reduce(($,{type:te="scene",from:ee,duration:S,animation:D})=>{const U=ee<0?k[te]+ee:ee;return P[te]>=U&&P[te]<=U+S&&$.push({type:te,animation:D,duration:S,from:U}),$},[]);if(R&&q.length>0&&Xl(d)){let $=d.width,te=d.height;if((b==null?void 0:b.type)==="text"&&b.value){const{align:ee="left"}=b,S=an({text:b.value,font:b.font});R.save(),R.font=S,R.textBaseline="top",R.textAlign=ee,b.wrap?te=({width:D,maxHeight:U,scale:B})=>{var w,N;const H=$l({font:S,scale:B,context:R,maxW:D,maxH:U,text:b.value??"",minSize:(w=b.fill)==null?void 0:w.minSize,maxSize:(N=b.fill)==null?void 0:N.maxSize});return ln({context:R,font:S,fontSize:H,text:b.value??"",maxW:D}).length*H}:($=R.measureText(b.value).width,te=parseFloat(((f=(g=S.match(An))==null?void 0:g.groups)==null?void 0:f.value)??"0")),R.restore()}if((b==null?void 0:b.type)==="image"&&b.image&&b.size){const ee=((p=b.image)==null?void 0:p.naturalWidth)??((y=b.image)==null?void 0:y.width),S=((v=b.image)==null?void 0:v.naturalHeight)??((Q=b.image)==null?void 0:Q.height),D=ee/S,U=(C=b.size)==null?void 0:C.width,B=(T=b.size)==null?void 0:T.height;$=U??(D>=1?(B??0)*D:(B??0)/D),te=B??(D<1?(U??0)*D:(U??0)/D)}return{...d,width:$,height:te,elements:zl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}),draw:({dx:ee,dy:S,dw:D,dh:U,scale:B})=>{var w,N,H,K,X,se,ue,Ae,Ce,be,Re,ne,Ie;if(q.forEach(Be=>{const{type:he="scene",from:le,duration:oe,animation:we={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=Be;if(we){const{type:Oe,duration:Le,easing:{in:Me="easeOut",out:Pe="easeOut"}={}}=we;if(le>0&&P[he]<=le+Le)switch(Oe){case"fade":{const xe=on([le,le+Le],[0,1],{ease:Me});R.globalAlpha=xe(P[he]);break}case"slide":{const{options:xe}=we,ve={up:[{x:0,y:U},{x:0,y:0}],right:[{x:D,y:0},{x:0,y:0}],down:[{x:0,y:-U},{x:0,y:0}],left:[{x:-D,y:0},{x:0,y:0}]},He=on([le,le+Le],ve[xe.direction.in],{ease:Me}),{x:We,y:at}=He(P[he]);R.translate(We,at);break}}if(le+oe<k[he]&&le+oe-Le<=P[he])switch(Oe){case"fade":{const xe=on([le+oe-Le,le+oe],[1,0],{ease:Pe});R.globalAlpha=xe(P[he]);break}case"slide":{const{options:xe}=we,ve={up:[{x:0,y:0},{x:0,y:-U}],right:[{x:0,y:0},{x:D,y:0}],down:[{x:0,y:0},{x:0,y:U}],left:[{x:0,y:0},{x:-D,y:0}]},He=on([le+oe-Le,le+oe],ve[xe.direction.out],{ease:Pe}),{x:We,y:at}=He(P[he]);R.translate(We,at);break}}}}),b){const{type:Be}=b;if(d.radius){const{topLeft:he,topRight:le,bottomRight:oe,bottomLeft:we}=Mf(d.radius,B);R.beginPath(),R.moveTo(ee+Math.min(U/di,he),S),R.lineTo(ee+D-Math.min(U/di,le),S),R.quadraticCurveTo(ee+D,S,ee+D,S+Math.min(U/di,le)),R.lineTo(ee+D,S+U-Math.min(U/di,oe)),R.quadraticCurveTo(ee+D,S+U,ee+D-Math.min(U/di,oe),S+U),R.lineTo(ee+Math.min(U/di,we),S+U),R.quadraticCurveTo(ee,S+U,ee,S+U-Math.min(U/di,we)),R.lineTo(ee,S+Math.min(U/di,he)),R.quadraticCurveTo(ee,S,ee+Math.min(U/di,he),S),R.closePath(),e&&(R.strokeStyle="blue",R.stroke()),R.clip()}if(Be==="box"&&(R.fillStyle=b.background,R.fillRect(ee,S,D,U)),Be==="text"&&b.value){const{align:he="left"}=b,le=an({text:b.value,font:b.font}),oe=$l({font:le,scale:B,context:R,maxW:D,maxH:U,text:b.value??"",minSize:(w=b.fill)==null?void 0:w.minSize,maxSize:(N=b.fill)==null?void 0:N.maxSize});R.font=le.replace(An,oe.toString()),R.textBaseline="top",R.fillStyle=b.color,R.textAlign=he;const we={left:ee,center:ee+D/2,right:ee+D};b.wrap?ln({context:R,font:le,fontSize:oe,text:b.value,maxW:D}).forEach((Le,Me)=>{R.fillText(Le.text,we[he],S+oe*Me)}):R.fillText(b.value,we[he],S)}if(Be==="image"&&b.image&&R.drawImage(b.image,ee,S,D,U),Be==="video"&&((H=b.video)!=null&&H.node||(K=b.video)!=null&&K.getSource)){const he=b.format??"letterbox",le=((se=(X=b.video)==null?void 0:X.getSource)==null?void 0:se.call(X,l))??b.video.node,oe=(le==null?void 0:le.videoWidth)??(le==null?void 0:le.naturalWidth)??(le==null?void 0:le.width),we=(le==null?void 0:le.videoHeight)??(le==null?void 0:le.naturalHeight)??(le==null?void 0:le.height);if(oe&&we){const{dx:Le,dy:Me,dw:Pe,dh:xe}=Gl({context:R,cropCanvas:i,letterboxCanvas:n,source:le,format:he,crop:(ue=b==null?void 0:b.value)==null?void 0:ue.crop,sourceWidth:oe,sourceHeight:we,posX:ee,posY:S,drawAreaWidth:D,drawAreaHeight:U});b.elements&&Oo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:b.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(S,S+Me),left:Math.max(ee,ee+Le)},width:Math.min(D,Pe),height:Math.min(U,xe)}})}const Oe=1/3;if(b.poster&&a>=0&&a<=Oe){R.save(),R.globalAlpha=1-a/Oe;const Le=((Ae=b.poster)==null?void 0:Ae.naturalWidth)??((Ce=b.poster)==null?void 0:Ce.width),Me=((be=b.poster)==null?void 0:be.naturalHeight)??((Re=b.poster)==null?void 0:Re.height);r.width=r.height=0,r.width=D,r.height=U;const Pe=r.getContext("2d");if(Pe&&Le&&Me){const{dx:xe,dy:ve,dw:He,dh:We}=Gl({context:Pe,cropCanvas:i,letterboxCanvas:n,source:b.poster,format:he,crop:(ne=b==null?void 0:b.value)==null?void 0:ne.crop,sourceWidth:Le,sourceHeight:Me,posX:0,posY:0,drawAreaWidth:D,drawAreaHeight:U});b.elements&&Oo({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:b.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(0,ve),left:Math.max(0,xe)},width:Math.min(D,He),height:Math.min(U,We)}}),R.drawImage(r,ee,S,D,U),R.restore()}}}if(Be==="gradient"&&b.value){const he=R.createLinearGradient(ee+D,S,ee+D,S+U);(Ie=b.value)==null||Ie.forEach(le=>{he.addColorStop(le.percent,le.color)}),R.fillStyle=he,R.fillRect(ee,S,D,U)}}}}}}).filter(Boolean)}function Oo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,...d}){return Ff({...d,yoga:s,debug:e,canvas:t,elements:zl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u})})}const ln=mo(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(An,t.toString()),i.split(`
91
- `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...Hl({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},Hl({context:s,word:a[0],maxW:r})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{font:s,fontSize:e,text:t,maxW:i}])=>`${s}_${e}_${t}_${i}`}),Of=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,Pf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function Zl(s){if(!s)return[];const e=s.match(Of);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
88
+ `+p(B,N)):K}}function U(B,w){var N;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(N=typeof B=="function"?B:D(B,w),w.cache&&w.name&&w.storage.templates.define(w.name,N),N)}Z.l.bind(Z),t.compile=D,t.compileScope=T,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=Z,t.filters=te,t.getConfig=S,t.helpers=q,t.nativeHelpers=$,t.parse=f,t.render=function(B,w,N,H){var K=S(N||{});if(!K.async)return U(B,K)(w,K);if(!H){if(typeof n=="function")return new n(function(X,se){try{X(U(B,K)(w,K))}catch(ue){se(ue)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{U(B,K)(w,K,H)}catch(X){return H(X)}},t.templates=k,Object.defineProperty(t,"__esModule",{value:!0})})})(Do,Do.exports);var jr=Do.exports,Ro={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof qr<"u"&&qr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(S){return S&&DataView.prototype.isPrototypeOf(S)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(S){return S&&c.indexOf(Object.prototype.toString.call(S))>-1};function u(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function d(S){return typeof S!="string"&&(S=String(S)),S}function g(S){var D={next:function(){var U=S.shift();return{done:U===void 0,value:U}}};return A.iterable&&(D[Symbol.iterator]=function(){return D}),D}function f(S){this.map={},S instanceof f?S.forEach(function(D,U){this.append(U,D)},this):Array.isArray(S)?S.forEach(function(D){this.append(D[0],D[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(D){this.append(D,S[D])},this)}f.prototype.append=function(S,D){S=u(S),D=d(D);var U=this.map[S];this.map[S]=U?U+", "+D:D},f.prototype.delete=function(S){delete this.map[u(S)]},f.prototype.get=function(S){return S=u(S),this.has(S)?this.map[S]:null},f.prototype.has=function(S){return this.map.hasOwnProperty(u(S))},f.prototype.set=function(S,D){this.map[u(S)]=d(D)},f.prototype.forEach=function(S,D){for(var U in this.map)this.map.hasOwnProperty(U)&&S.call(D,this.map[U],U,this)},f.prototype.keys=function(){var S=[];return this.forEach(function(D,U){S.push(U)}),g(S)},f.prototype.values=function(){var S=[];return this.forEach(function(D){S.push(D)}),g(S)},f.prototype.entries=function(){var S=[];return this.forEach(function(D,U){S.push([U,D])}),g(S)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(S){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}function y(S){return new Promise(function(D,U){S.onload=function(){D(S.result)},S.onerror=function(){U(S.error)}})}function v(S){var D=new FileReader,U=y(D);return D.readAsArrayBuffer(S),U}function Q(S){var D=new FileReader,U=y(D);return D.readAsText(S),U}function C(S){for(var D=new Uint8Array(S),U=new Array(D.length),B=0;B<D.length;B++)U[B]=String.fromCharCode(D[B]);return U.join("")}function T(S){if(S.slice)return S.slice(0);var D=new Uint8Array(S.byteLength);return D.set(new Uint8Array(S)),D.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:A.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:A.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():A.arrayBuffer&&A.blob&&l(S)?(this._bodyArrayBuffer=T(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||h(S))?this._bodyArrayBuffer=T(S):this._bodyText=S=Object.prototype.toString.call(S):this._bodyText="",this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var S=p(this);if(S)return S;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 S=p(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var S=p(this);if(S)return S;if(this._bodyBlob)return Q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(S){var D=S.toUpperCase();return L.indexOf(D)>-1?D:S}function P(S,D){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var U=D.body;if(S instanceof P){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,D.headers||(this.headers=new f(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!U&&S._bodyInit!=null&&(U=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new f(D.headers)),this.method=R(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&U)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(U),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var B=/([?&])_=[^&]*/;if(B.test(this.url))this.url=this.url.replace(B,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function k(S){var D=new FormData;return S.trim().split("&").forEach(function(U){if(U){var B=U.split("="),w=B.shift().replace(/\+/g," "),N=B.join("=").replace(/\+/g," ");D.append(decodeURIComponent(w),decodeURIComponent(N))}}),D}function q(S){var D=new f,U=S.replace(/\r?\n[\t ]+/g," ");return U.split("\r").map(function(B){return B.indexOf(`
89
+ `)===0?B.substr(1,B.length):B}).forEach(function(B){var w=B.split(":"),N=w.shift().trim();if(N){var H=w.join(":").trim();D.append(N,H)}}),D}b.call(P.prototype);function $(S,D){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D||(D={}),this.type="default",this.status=D.status===void 0?200:D.status,this.ok=this.status>=200&&this.status<300,this.statusText=D.statusText===void 0?"":""+D.statusText,this.headers=new f(D.headers),this.url=D.url||"",this._initBody(S)}b.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},$.error=function(){var S=new $(null,{status:0,statusText:""});return S.type="error",S};var te=[301,302,303,307,308];$.redirect=function(S,D){if(te.indexOf(D)===-1)throw new RangeError("Invalid status code");return new $(null,{status:D,headers:{location:S}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(D,U){this.message=D,this.name=U;var B=Error(D);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Z(S,D){return new Promise(function(U,B){var w=new P(S,D);if(w.signal&&w.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var N=new XMLHttpRequest;function H(){N.abort()}N.onload=function(){var X={status:N.status,statusText:N.statusText,headers:q(N.getAllResponseHeaders()||"")};X.url="responseURL"in N?N.responseURL:X.headers.get("X-Request-URL");var se="response"in N?N.response:N.responseText;setTimeout(function(){U(new $(se,X))},0)},N.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},N.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},N.onabort=function(){setTimeout(function(){B(new o.DOMException("Aborted","AbortError"))},0)};function K(X){try{return X===""&&a.location.href?a.location.href:X}catch{return X}}N.open(w.method,K(w.url),!0),w.credentials==="include"?N.withCredentials=!0:w.credentials==="omit"&&(N.withCredentials=!1),"responseType"in N&&(A.blob?N.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(N.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof f)?Object.getOwnPropertyNames(D.headers).forEach(function(X){N.setRequestHeader(X,d(D.headers[X]))}):w.headers.forEach(function(X,se){N.setRequestHeader(se,X)}),w.signal&&(w.signal.addEventListener("abort",H),N.onreadystatechange=function(){N.readyState===4&&w.signal.removeEventListener("abort",H)}),N.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return Z.polyfill=!0,a.fetch||(a.fetch=Z,a.Headers=f,a.Request=P,a.Response=$),o.Headers=f,o.Request=P,o.Response=$,o.fetch=Z,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(Ro,Ro.exports);var Sf=Ro.exports;const wf=xo(Sf);var Ol={},Lo={},ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.default=ye.Wrap=ye.Unit=ye.PrintOptions=ye.PositionType=ye.Overflow=ye.NodeType=ye.MeasureMode=ye.LogLevel=ye.Justify=ye.Gutter=ye.FlexDirection=ye.ExperimentalFeature=ye.Errata=ye.Edge=ye.Display=ye.Direction=ye.Dimension=ye.Align=void 0;let di=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s}({});ye.Align=di;let _o=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});ye.Dimension=_o;let Xr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});ye.Direction=Xr;let ko=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});ye.Display=ko;let jt=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({});ye.Edge=jt;let tr=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({});ye.Errata=tr;let zr=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});ye.ExperimentalFeature=zr;let ir=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});ye.FlexDirection=ir;let Zr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});ye.Gutter=Zr;let Xi=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({});ye.Justify=Xi;let zi=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({});ye.LogLevel=zi;let en=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});ye.MeasureMode=en;let Fo=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});ye.NodeType=Fo;let tn=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});ye.Overflow=tn;let sn=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});ye.PositionType=sn;let rn=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});ye.PrintOptions=rn;let sr=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});ye.Unit=sr;let nn=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});ye.Wrap=nn;var Tf={ALIGN_AUTO:di.Auto,ALIGN_FLEX_START:di.FlexStart,ALIGN_CENTER:di.Center,ALIGN_FLEX_END:di.FlexEnd,ALIGN_STRETCH:di.Stretch,ALIGN_BASELINE:di.Baseline,ALIGN_SPACE_BETWEEN:di.SpaceBetween,ALIGN_SPACE_AROUND:di.SpaceAround,DIMENSION_WIDTH:_o.Width,DIMENSION_HEIGHT:_o.Height,DIRECTION_INHERIT:Xr.Inherit,DIRECTION_LTR:Xr.LTR,DIRECTION_RTL:Xr.RTL,DISPLAY_FLEX:ko.Flex,DISPLAY_NONE:ko.None,EDGE_LEFT:jt.Left,EDGE_TOP:jt.Top,EDGE_RIGHT:jt.Right,EDGE_BOTTOM:jt.Bottom,EDGE_START:jt.Start,EDGE_END:jt.End,EDGE_HORIZONTAL:jt.Horizontal,EDGE_VERTICAL:jt.Vertical,EDGE_ALL:jt.All,ERRATA_NONE:tr.None,ERRATA_STRETCH_FLEX_BASIS:tr.StretchFlexBasis,ERRATA_ALL:tr.All,ERRATA_CLASSIC:tr.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:zr.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:zr.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:zr.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ir.Column,FLEX_DIRECTION_COLUMN_REVERSE:ir.ColumnReverse,FLEX_DIRECTION_ROW:ir.Row,FLEX_DIRECTION_ROW_REVERSE:ir.RowReverse,GUTTER_COLUMN:Zr.Column,GUTTER_ROW:Zr.Row,GUTTER_ALL:Zr.All,JUSTIFY_FLEX_START:Xi.FlexStart,JUSTIFY_CENTER:Xi.Center,JUSTIFY_FLEX_END:Xi.FlexEnd,JUSTIFY_SPACE_BETWEEN:Xi.SpaceBetween,JUSTIFY_SPACE_AROUND:Xi.SpaceAround,JUSTIFY_SPACE_EVENLY:Xi.SpaceEvenly,LOG_LEVEL_ERROR:zi.Error,LOG_LEVEL_WARN:zi.Warn,LOG_LEVEL_INFO:zi.Info,LOG_LEVEL_DEBUG:zi.Debug,LOG_LEVEL_VERBOSE:zi.Verbose,LOG_LEVEL_FATAL:zi.Fatal,MEASURE_MODE_UNDEFINED:en.Undefined,MEASURE_MODE_EXACTLY:en.Exactly,MEASURE_MODE_AT_MOST:en.AtMost,NODE_TYPE_DEFAULT:Fo.Default,NODE_TYPE_TEXT:Fo.Text,OVERFLOW_VISIBLE:tn.Visible,OVERFLOW_HIDDEN:tn.Hidden,OVERFLOW_SCROLL:tn.Scroll,POSITION_TYPE_STATIC:sn.Static,POSITION_TYPE_RELATIVE:sn.Relative,POSITION_TYPE_ABSOLUTE:sn.Absolute,PRINT_OPTIONS_LAYOUT:rn.Layout,PRINT_OPTIONS_STYLE:rn.Style,PRINT_OPTIONS_CHILDREN:rn.Children,UNIT_UNDEFINED:sr.Undefined,UNIT_POINT:sr.Point,UNIT_PERCENT:sr.Percent,UNIT_AUTO:sr.Auto,WRAP_NO_WRAP:nn.NoWrap,WRAP_WRAP:nn.Wrap,WRAP_WRAP_REVERSE:nn.WrapReverse};ye.default=Tf,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=Df;var _i=xf(ye);function Pl(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Pl=function(i){return i?t:e})(s)}function xf(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=Pl(e);if(t&&t.has(s))return t.get(s);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in s)if(n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)){var o=r?Object.getOwnPropertyDescriptor(s,n):null;o&&(o.get||o.set)?Object.defineProperty(i,n,o):i[n]=s[n]}return i.default=s,t&&t.set(s,i),i}function Df(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[_i.Unit.Point]:s.Node.prototype[r],[_i.Unit.Percent]:s.Node.prototype[`${r}Percent`],[_i.Unit.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let h,u;if(c==="auto")h=_i.Unit.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?_i.Unit.Percent:_i.Unit.Point,u=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(u))throw new Error(`Invalid value ${c} for ${r}`);if(!n[h])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return u!==void 0?n[h].call(this,...A,u):n[h].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:_i.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,..._i.default}}var Ul={exports:{}};(function(s,e){var t=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(r){r=r||{};var n;n||(n=typeof r<"u"?r:{});var o,a;n.ready=new Promise(function(I,m){o=I,a=m});var A=Object.assign({},n),l="";typeof document<"u"&&document.currentScript&&(l=document.currentScript.src),i&&(l=i),l.indexOf("blob:")!==0?l=l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):l="";var c=n.print||console.log.bind(console),h=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var u;n.wasmBinary&&(u=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&U("no native wasm support detected");var d,g=!1;function f(I,m,x){x=m+x;for(var _="";!(m>=x);){var M=I[m++];if(!M)break;if(M&128){var V=I[m++]&63;if((M&224)==192)_+=String.fromCharCode((M&31)<<6|V);else{var j=I[m++]&63;M=(M&240)==224?(M&15)<<12|V<<6|j:(M&7)<<18|V<<12|j<<6|I[m++]&63,65536>M?_+=String.fromCharCode(M):(M-=65536,_+=String.fromCharCode(55296|M>>10,56320|M&1023))}}else _+=String.fromCharCode(M)}return _}var p,y,v,Q,C,T,b,L,R;function P(){var I=d.buffer;p=I,n.HEAP8=y=new Int8Array(I),n.HEAP16=Q=new Int16Array(I),n.HEAP32=T=new Int32Array(I),n.HEAPU8=v=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=b=new Uint32Array(I),n.HEAPF32=L=new Float32Array(I),n.HEAPF64=R=new Float64Array(I)}var k,q=[],$=[],te=[];function Z(){var I=n.preRun.shift();q.unshift(I)}var S=0,D=null;function U(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",h(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function B(I){return I.startsWith("data:application/octet-stream;base64,")}var w;if(w="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9g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ACgCGEEKdkEHcQtBBUYEQCAALQAYQQhxDQULIAEtAARBAnENBCACIAEgAhshAgsgBEEBaiIEIAdHDQELCyACDQILIAAqAogEIQgMAgsgASECCyACEEIgAioC6AGSIQgLIANBEGokACAIC28BAX8CQCAAQRhqIgMQJiABQQJ0aigCwAEgAkYNACADECYgAUECdGogAjYCwAEDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwtvAQF/AkAgAEEYaiIDECYgAUECdGooArgBIAJGDQAgAxAmIAFBAnRqIAI2ArgBA0AgAC0ABCIBQQRxDQEgACABQQRyOgAEIAAoAhQiAQRAIAAgAREAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsL7wIBAn0CQAJAAkAgAUF+cUECRgRAIAAoArwBIgFB8OGD/AdGIAFBj568/AdGciABQarVqv0HRnINASABviIDIANbDQEgACgCxAEiAUHw4YP8B0YgAUGPnrz8B0ZyIAFBqtWq/QdGcg0BIAG+IgMgA1sNAQwCCyAAKALAASIBQfDhg/wHRiABQY+evPwHRnIgAUGq1ar9B0ZyDQAgAb4iAyADWw0AIAAoAsQBIgFB8OGD/AdGIAFBj568/AdGciABQarVqv0HRnINACABviIDIANcDQELQwAAAAAhAwJAAkAgAUHw4YP8B0YNACABQY+evPwHRg0DQfAhIQACQCABQarVqv0HRwRAIAG+IgMgA1sNAUH4ISEACyAAKgIAIQNDAADAfyEEIAAoAgRBAWsOAgQBAgsgAUH/////e3FBgICAgAJqviEDIAFBgICAgARxRQ0DCyADIAKUQwrXIzyUIQQLIAQPC0MAAAAAIQMLIAMLCgAgAEEwa0EKSQt3AgF/AX0gAEHQAGohACABQQJ0QdAhaigCACECAn8gAUF+cUECRgRAIABBBSACQYCAgP4HEDMMAQsgACACQYCAgP4HEDILIQFBASEAIAFB8OGD/AdGIAFBj568/AdGciABQarVqv0HRnIEfyAABSABviIDIANbCwsUACAABEAgACAAKAIAKAIEEQAACw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AAgD9dRXJFBEAgDkGAgID8AzYCIEMAAIA/IToLIA4qAiQiP0MAAAAAXkUgP0MAAIA/XUVyRQRAIA5BgICA/AM2AiRDAACAPyE/CyAOIBA2AiggDioCHCEzIA4oAhghICAYBEAgGBApCyAOKgI4ITUgDigCMCEhIA4oAiwhGAJAAkACQAJAICdBAUYNAEMAAAAAIQICQAJAAkAgJCgCACIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iASABWw0BQfghIQULIAUqAgAhAkMAAMB/IQEgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhAQwBCyACIQELQwAAAAAhAgJAAkACQCAAKALYASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITcgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgBpRDCtcjPJQhNwwBCyACITcLQwAAAAAhAgJAAkACQCAAKALUASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITQgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhNAwBCyACITQLQwAAAAAhAgJAAkACQCAAKALcASIDQfDhg/wHRg0AIANBj568/AdGDQFB8CEhBQJAIANBqtWq/QdHBEAgA74iAiACWw0BQfghIQULIAUqAgAhAkMAAMB/ITkgBSgCBEEBaw4CAgEDCyADQf////97cUGAgICAAmq+IQIgA0GAgICABHFFDQELIAIgB5RDCtcjPJQhOQwBCyACITkLIAEgNCATQQFLIgMbIEGTIgIgAlsgAiAzXnENASA3IDkgAxsgQZMiAiACWyACIDNdcQ0BIAAoArgELQAQQQFxDQAgMyECIDpDAAAAAFsNAiAAKAKoB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gAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBGRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBGRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBACETDAMLIAIgAigCACIBQQRqNgIAQQAhFSABKAIACyETIAggCTYCTCATQQBODQFBACATayETIAxBgMAAciEMDAELIAhBzABqEHEiE0EASA0IIAgoAkwhCQtBACEHQX8hCwJ/IAktAABBLkcEQCAJIQFBAAwBCyAJLQABQSpGBEACfwJAIAksAAIiARBGRQ0AIAktAANBJEcNACABQQJ0IARqQcABa0EKNgIAIAlBBGohASAJLAACQQN0IANqQYADaygCAAwBCyAVDQYgCUECaiEBQQAgAEUNABogAiACKAIAIgpBBGo2AgAgCigCAAshCyAIIAE2AkwgC0F/c0EfdgwBCyAIIAlBAWo2AkwgCEHMAGoQcSELIAgoAkwhAUEBCyEPA0AgByERQRwhCiABIhAsAAAiB0H7AGtB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ATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBC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kLDAAgACgCCEHdGRBRCwgAIAAQeRApC1UBAn8jAEEwayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBMBAdIAJBMBArIQAgAkEwaiQAIAALOwEBfyABIAAoAgQiBUEBdWohASAAKAIAIQAgASACIAMgBCAFQQFxBH8gASgCACAAaigCAAUgAAsRHAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEQAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEQwACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQkAC2EBAn8jAEEQayICJAAgASAAKAIEIgNBAXVqIQEgACgCACEAIAIgASADQQFxBH8gASgCACAAaigCAAUgAAsRAQBBEBAdIgAgAikDCDcDCCAAIAIpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJAAkACQCABQQRrDgIAAQILIABBpAJqIAAtAKwCQQNxQQJGDQIaIABBnAJqDAILIABBnAJqIAAtAKwCQQNxQQJGDQEaIABBpAJqDAELIAAgAUECdGpBnAJqCyoCACEDIAJBEGokACADuw8LIAJB0A42AgAgACACEC0QLAALmwECAX8BfSMAQRBrIgIkACAAKAIAIQAgAUEGSARAAn8CQAJAAkAgAUEEaw4CAAECCyAAQZQCaiAALQCsAkEDcUECRg0CGiAAQYwCagwCCyAAQYwCaiAALQCsAkEDcUECRg0BGiAAQZQCagwBCyAAIAFBAnRqQYwCagsqAgAhAyACQRBqJAAgA7sPCyACQdAONgIAIAAgAhAtECwAC5sBAgF/AX0jAEEQayICJAAgACgCACEAIAFBBkgEQAJ/AkACQAJAIAFBBGsOAgABAgsgAEGEAmogAC0ArAJBA3F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1ar9B0YiASABcg0BIAC+IgMgA1wNASAAQfDhg/wHRg0AIABB/////3txQYCAgIACar4PC0MAAAAAIQILIAILqgEDAX8BfAF9QQIhAwJAAkAgASgCACACQQJ0aigCdCIBQfDhg/wHRwRARAAAAAAAAPh/IQQgAUGq1ar9B0YEQEEDIQMMAwsgAUGPnrz8B0cNAUQAAAAAAAAAACEEQQEhAwwCCwwBCyABviIFIAVcBEBBACEDDAELQQJBASABQYCAgIAEcRshAyABQf////97cUGAgICAAmq+uyEECyAAIAQ5AwggACADNgIAC4ABAgF8AX0CQAJAIAAoAgAgAUECdGooApgBIgBB8OGD/AdGIABBj568/AdGcg0ARAAAAAAAAPh/IQIgAEGq1ar9B0YiASABcg0BIAC+IgMgA1wNASAAQfDhg/wHRg0AIABB/////3txQYCAgIACar67DwtEAAAAAAAAAAAhAgsgAgsbAQF9QwAAwH8gACgCACoC4AEiASABIAFcG7sLlwECAXwBfQJ/AkAgASgCACgC3AEiAUHw4YP8B0cEQEQAAAAAAAD4fyECQQMgAUGq1ar9B0YNAhogAUGPnrz8B0cNAUQAAAAAAAAAACECQQEMAgtBAgwBC0EAIAG+IgMgA1wNABogAUH/////e3FBgICAgAJqvrshAkECQQEgAUGAgICABHEbCyEBIAAgAjkDCCAAIAE2AgALlwECAXwBfQJ/AkAgASgCACgC2AEiAUHw4YP8B0cEQEQAAAAAAAD4fyECQQMgAUGq1ar9B0YNAhogAUGPnrz8B0cNAUQAAAAAAAAAACECQQEMAgtBAgwBC0EAIAG+IgMgA1wNABogAUH/////e3FBgICAgAJqvrshAkECQQEgAUGAgICABHEbCyEBIAAgAjkDCCAAIAE2AgALlwECAXwBfQJ/AkAgASgCACgC1AEiAUHw4YP8B0cEQEQAAAAAAAD4fyECQQMgAUGq1ar9B0YNAhogAUGPnrz8B0cNAUQAAAAAAAAAACECQQEMAgtBAgwBC0EAIAG+IgMgA1wNABogAUH/////e3FBgICAgAJqvrshAkECQQEgAUGAgICABHEbCyEBIAAgAjkDCCAA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AoAgBBASABthAxEEMLEAAgACgCAEEBIAG2EC8QQwsQACAAKAIAQQAgAbYQMRBDCxAAIAAoAgBBACABthAvEEMLEAAgACgCAEEBIAG2EDEQRAsQACAAKAIAQQEgAbYQLxBECxAAIAAoAgBBACABthAxEEQLEAAgACgCAEEAIAG2EC8QRAsRACAAKAIAQQFBqtWq/QcQPAsQACAAKAIAQQEgAbYQMRA8CxAAIAAoAgBBASABthAvEDwLEQAgACgCAEEAQarVqv0HEDwLEAAgACgCAEEAIAG2EDEQPAsQACAAKAIAQQAgAbYQLxA8C3ACAn0BfwJAIAAoAgAiACoCJCIDIAG2IgJbIAIgAlwgAyADXHFyDQAgACACOAIkA0AgAC0ABCIEQQRxDQEgACAEQQRyOgAEIAAoAhQiBARAIAAgBBEAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLcAICfQF/AkAgACgCACIAKgIgIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AiADQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwsPACAAKAIAQarVqv0HEEwLDgAgACgCACABthAxEEwLDgAgACgCACABthAvEEwLcAICfQF/AkAgACgCACIAKgIcIgMgAbYiAlsgAiACXCADIANccXINACAAIAI4AhwDQCAALQAEIgRBBHENASAAIARBBHI6AAQgACgCFCIEBEAgACAEEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFnZBAXEgAUYNACAAIAJB////fXEgAUEWdEGAgIACcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0AiAAKAKoBCIADQALCwt3AQF/AkAgACgCACIAKAIYIgJBFHZBA3EgAUYNACAAIAJB//+/fnEgAUEUdEGAgMABcXI2AhgDQCAALQAEIgFBBHENASAAIAFBBHI6AAQgACgCFCIBBEAgACABEQAACyAAQYCAgP4HNgK0A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sbAACsGwAAnBsAALMbAACsGwAAnBsAALMbAAC6GwAAdmlpaWQAAACsGwAAnBsAALobAACzGwAAnRsAAJobAACdGwAAsxsAAJobAACdGwAAuhsAAJ0bAAC6GwAAnRsAALMbAABkaWlpAAAAALkbAACcGwAAsxsAAGZpaWkAAAAArBsAAJwbAACcGwAAtBsAAKwbAACcGwAAnBsAALQbAACdGwAAnBsAAJwbAACcGwAAnBsAALQbAACtGwAAnBsAAKwbAACcGwAArRsAAKwbAACcGwAAeRsAAKwbAACcGwAAkRsAAK0bAACdGwAAAAAAAKwbAACcGwAAuhsAALobAACzGwAAdmlpZGRpAACZGwAAnRsAQbAnC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBgSgLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBBuygLAQwAQccoCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!B(w)){var N=w;w=n.locateFile?n.locateFile(N,l):l+N}function H(){var I=w;try{if(I==w&&u)return new Uint8Array(u);if(B(I))try{var m=jy(I.slice(37)),x=new Uint8Array(m.length);for(I=0;I<m.length;++I)x[I]=m.charCodeAt(I);var _=x}catch{throw Error("Converting base64 string to bytes failed.")}else _=void 0;var M=_;if(M)return M;throw"both async and sync fetching of the wasm failed"}catch(V){U(V)}}function K(){return u||typeof fetch!="function"?Promise.resolve().then(function(){return H()}):fetch(w,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+w+"'";return I.arrayBuffer()}).catch(function(){return H()})}function X(I){for(;0<I.length;)I.shift()(n)}function se(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function ue(I,m){return I=se(I),function(){return m.apply(this,arguments)}}var le=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Ce=[];function Se(I){var m=Error,x=ue(I,function(_){this.name=I,this.message=_,_=Error(_).stack,_!==void 0&&(this.stack=this.toString()+`
90
+ `+_.replace(/^Error(:[^\n]*)?\n/,""))});return x.prototype=Object.create(m.prototype),x.prototype.constructor=x,x.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},x}var Le=void 0;function oe(I){throw new Le(I)}var Ie=I=>(I||oe("Cannot use deleted val. handle = "+I),le[I].value),ve=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=Ce.length?Ce.pop():le.length;return le[m]={fa:1,value:I},m}},ce=void 0,Ae=void 0;function ne(I){for(var m="";v[I];)m+=Ae[v[I++]];return m}var be=[];function Oe(){for(;be.length;){var I=be.pop();I.L.Z=!1,I.delete()}}var Te=void 0,ke={};function Pe(I,m){for(m===void 0&&oe("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var De={};function Be(I){I=od(I);var m=ne(I);return Bi(I),m}function He(I,m){var x=De[I];return x===void 0&&oe(m+" has unknown type "+Be(I)),x}function We(){}var at=!1;function Xe(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function It(I,m,x){return m===x?I:x.P===void 0?null:(I=It(I,m,x.P),I===null?null:x.ma(I))}var yi={};function mt(I,m){return m=Pe(I,m),ke[m]}var oi=void 0;function ai(I){throw new oi(I)}function Ai(I,m){return m.O&&m.N||ai("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&ai("Both smartPtrType and smartPtr must be specified"),m.count={value:1},gt(Object.create(I,{L:{value:m}}))}function gt(I){return typeof FinalizationRegistry>"u"?(gt=m=>m,I):(at=new FinalizationRegistry(m=>{Xe(m.L)}),gt=m=>{var x=m.L;return x.S&&at.register(m,{L:x},m),m},We=m=>{at.unregister(m)},gt(I))}var G={};function ae(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function de(I){return this.fromWireType(T[I>>2])}var we={},Qe={};function $e(I,m,x){function _(z){z=x(z),z.length!==I.length&&ai("Mismatched type converter count");for(var ie=0;ie<I.length;++ie)yt(I[ie],z[ie])}I.forEach(function(z){Qe[z]=m});var M=Array(m.length),V=[],j=0;m.forEach((z,ie)=>{De.hasOwnProperty(z)?M[ie]=De[z]:(V.push(z),we.hasOwnProperty(z)||(we[z]=[]),we[z].push(()=>{M[ie]=De[z],++j,j===V.length&&_(M)}))}),V.length===0&&_(M)}function Ct(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function yt(I,m,x={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var _=m.name;if(I||oe('type "'+_+'" must have a positive integer typeid pointer'),De.hasOwnProperty(I)){if(x.ta)return;oe("Cannot register type '"+_+"' twice")}De[I]=m,delete Qe[I],we.hasOwnProperty(I)&&(m=we[I],delete we[I],m.forEach(M=>M()))}function Ds(I){oe(I.L.O.M.name+" instance already deleted")}function vt(){}function ls(I,m,x){if(I[m].R===void 0){var _=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||oe("Function '"+x+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[_.Y]=_}}function Rs(I,m){n.hasOwnProperty(I)?(oe("Cannot register public name '"+I+"' twice"),ls(n,I,I),n.hasOwnProperty(void 0)&&oe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function Gi(I,m,x,_,M,V,j,z){this.name=I,this.constructor=m,this.W=x,this.V=_,this.P=M,this.oa=V,this.aa=j,this.ma=z,this.ia=[]}function xr(I,m,x){for(;m!==x;)m.aa||oe("Expected null or instance of "+x.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function Dr(I,m){return m===null?(this.da&&oe("null is not a valid "+this.name),0):(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),xr(m.L.N,m.L.O.M,this.M))}function Ls(I,m){if(m===null){if(this.da&&oe("null is not a valid "+this.name),this.ca){var x=this.ea();return I!==null&&I.push(this.V,x),x}return 0}if(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&oe("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),x=xr(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&oe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?x=m.L.S:oe("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:x=m.L.S;break;case 2:if(m.L.T===this)x=m.L.S;else{var _=m.clone();x=this.wa(x,ve(function(){_.delete()})),I!==null&&I.push(this.V,x)}break;default:oe("Unsupporting sharing policy")}return x}function Fy(I,m){return m===null?(this.da&&oe("null is not a valid "+this.name),0):(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&oe("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),xr(m.L.N,m.L.O.M,this.M))}function vi(I,m,x,_){this.name=I,this.M=m,this.da=x,this.ba=_,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=Ls:(this.toWireType=_?Dr:Fy,this.U=null)}function Ny(I,m){n.hasOwnProperty(I)||ai("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function My(I,m){var x=[];return function(){if(x.length=0,Object.assign(x,arguments),I.includes("j")){var _=n["dynCall_"+I];_=x&&x.length?_.apply(null,[m].concat(x)):_.call(null,m)}else _=k.get(m).apply(null,x);return _}}function Jt(I,m){I=ne(I);var x=I.includes("j")?My(I,m):k.get(m);return typeof x!="function"&&oe("unknown function pointer with signature "+I+": "+m),x}var id=void 0;function Vn(I,m){function x(V){M[V]||De[V]||(Qe[V]?Qe[V].forEach(x):(_.push(V),M[V]=!0))}var _=[],M={};throw m.forEach(x),new id(I+": "+_.map(Be).join([", "]))}function gA(I,m,x,_,M){var V=m.length;2>V&&oe("argTypes array size mismatch! Must at least get return value and 'this' types!");var j=m[1]!==null&&x!==null,z=!1;for(x=1;x<m.length;++x)if(m[x]!==null&&m[x].U===void 0){z=!0;break}var ie=m[0].name!=="void",ee=V-2,re=Array(ee),pe=[],_e=[];return function(){if(arguments.length!==ee&&oe("function "+I+" called with "+arguments.length+" arguments, expected "+ee+" args!"),_e.length=0,pe.length=j?2:1,pe[0]=M,j){var ze=m[1].toWireType(_e,this);pe[1]=ze}for(var Ne=0;Ne<ee;++Ne)re[Ne]=m[Ne+2].toWireType(_e,arguments[Ne]),pe.push(re[Ne]);if(Ne=_.apply(null,pe),z)ae(_e);else for(var Ft=j?1:2;Ft<m.length;Ft++){var Wt=Ft===1?ze:re[Ft-2];m[Ft].U!==null&&m[Ft].U(Wt)}return ze=ie?m[0].fromWireType(Ne):void 0,ze}}function fA(I,m){for(var x=[],_=0;_<I;_++)x.push(b[m+4*_>>2]);return x}function pA(I){4<I&&--le[I].fa===0&&(le[I]=void 0,Ce.push(I))}function EA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function Oy(I,m){switch(m){case 2:return function(x){return this.fromWireType(L[x>>2])};case 3:return function(x){return this.fromWireType(R[x>>3])};default:throw new TypeError("Unknown float type: "+I)}}function Py(I,m,x){switch(m){case 0:return x?function(_){return y[_]}:function(_){return v[_]};case 1:return x?function(_){return Q[_>>1]}:function(_){return C[_>>1]};case 2:return x?function(_){return T[_>>2]}:function(_){return b[_>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function Uy(I,m){for(var x="",_=0;!(_>=m/2);++_){var M=Q[I+2*_>>1];if(M==0)break;x+=String.fromCharCode(M)}return x}function Gy(I,m,x){if(x===void 0&&(x=2147483647),2>x)return 0;x-=2;var _=m;x=x<2*I.length?x/2:I.length;for(var M=0;M<x;++M)Q[m>>1]=I.charCodeAt(M),m+=2;return Q[m>>1]=0,m-_}function Hy(I){return 2*I.length}function $y(I,m){for(var x=0,_="";!(x>=m/4);){var M=T[I+4*x>>2];if(M==0)break;++x,65536<=M?(M-=65536,_+=String.fromCharCode(55296|M>>10,56320|M&1023)):_+=String.fromCharCode(M)}return _}function Yy(I,m,x){if(x===void 0&&(x=2147483647),4>x)return 0;var _=m;x=_+x-4;for(var M=0;M<I.length;++M){var V=I.charCodeAt(M);if(55296<=V&&57343>=V){var j=I.charCodeAt(++M);V=65536+((V&1023)<<10)|j&1023}if(T[m>>2]=V,m+=4,m+4>x)break}return T[m>>2]=0,m-_}function Ky(I){for(var m=0,x=0;x<I.length;++x){var _=I.charCodeAt(x);55296<=_&&57343>=_&&++x,m+=4}return m}var Vy={};function sd(I){var m=Vy[I];return m===void 0?ne(I):m}var Jn=[];function Jy(I){var m=Jn.length;return Jn.push(I),m}function Wy(I,m){for(var x=Array(I),_=0;_<I;++_)x[_]=He(b[m+4*_>>2],"parameter "+_);return x}var rd=[],qy=[null,[],[]];Le=n.BindingError=Se("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<le.length;++m)le[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<le.length;++I)if(le[I]!==void 0)return le[I];return null},ce=n.PureVirtualError=Se("PureVirtualError");for(var nd=Array(256),Wn=0;256>Wn;++Wn)nd[Wn]=String.fromCharCode(Wn);Ae=nd,n.getInheritedInstanceCount=function(){return Object.keys(ke).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in ke)ke.hasOwnProperty(m)&&I.push(ke[m]);return I},n.flushPendingDeletes=Oe,n.setDelayFunction=function(I){Te=I,be.length&&Te&&Te(Oe)},oi=n.InternalError=Se("InternalError"),vt.prototype.isAliasOf=function(I){if(!(this instanceof vt&&I instanceof vt))return!1;var m=this.L.O.M,x=this.L.N,_=I.L.O.M;for(I=I.L.N;m.P;)x=m.aa(x),m=m.P;for(;_.P;)I=_.aa(I),_=_.P;return m===_&&x===I},vt.prototype.clone=function(){if(this.L.N||Ds(this),this.L.$)return this.L.count.value+=1,this;var I=gt,m=Object,x=m.create,_=Object.getPrototypeOf(this),M=this.L;return I=I(x.call(m,_,{L:{value:{count:M.count,Z:M.Z,$:M.$,N:M.N,O:M.O,S:M.S,T:M.T}}})),I.L.count.value+=1,I.L.Z=!1,I},vt.prototype.delete=function(){this.L.N||Ds(this),this.L.Z&&!this.L.$&&oe("Object already scheduled for deletion"),We(this),Xe(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},vt.prototype.isDeleted=function(){return!this.L.N},vt.prototype.deleteLater=function(){return this.L.N||Ds(this),this.L.Z&&!this.L.$&&oe("Object already scheduled for deletion"),be.push(this),be.length===1&&Te&&Te(Oe),this.L.Z=!0,this},vi.prototype.pa=function(I){return this.ja&&(I=this.ja(I)),I},vi.prototype.ga=function(I){this.V&&this.V(I)},vi.prototype.argPackAdvance=8,vi.prototype.readValueFromPointer=de,vi.prototype.deleteObject=function(I){I!==null&&I.delete()},vi.prototype.fromWireType=function(I){function m(){return this.ca?Ai(this.M.W,{O:this.va,N:x,T:this,S:I}):Ai(this.M.W,{O:this,N:I})}var x=this.pa(I);if(!x)return this.ga(I),null;var _=mt(this.M,x);if(_!==void 0)return _.L.count.value===0?(_.L.N=x,_.L.S=I,_.clone()):(_=_.clone(),this.ga(I),_);if(_=this.M.oa(x),_=yi[_],!_)return m.call(this);_=this.ba?_.ka:_.pointerType;var M=It(x,this.M,_.M);return M===null?m.call(this):this.ca?Ai(_.M.W,{O:_,N:M,T:this,S:I}):Ai(_.M.W,{O:_,N:M})},id=n.UnboundTypeError=Se("UnboundTypeError");var jy=typeof atob=="function"?atob:function(I){var m="",x=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++));_=_<<2|M>>4,M=(M&15)<<4|V>>2;var z=(V&3)<<6|j;m+=String.fromCharCode(_),V!==64&&(m+=String.fromCharCode(M)),j!==64&&(m+=String.fromCharCode(z))}while(x<I.length);return m},Xy={p:function(I,m,x){I=ne(I),m=He(m,"wrapper"),x=Ie(x);var _=[].slice,M=m.M,V=M.W,j=M.P.W,z=M.P.constructor;I=ue(I,function(){M.P.ia.forEach((function(ee){if(this[ee]===j[ee])throw new ce("Pure virtual function "+ee+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:V}),this.__construct.apply(this,_.call(arguments))}),V.__construct=function(){this===V&&oe("Pass correct 'this' to __construct");var ee=z.implement.apply(void 0,[this].concat(_.call(arguments)));We(ee);var re=ee.L;ee.notifyOnDestruction(),re.$=!0,Object.defineProperties(this,{L:{value:re}}),gt(this),ee=re.N,ee=Pe(M,ee),ke.hasOwnProperty(ee)?oe("Tried to register registered instance: "+ee):ke[ee]=this},V.__destruct=function(){this===V&&oe("Pass correct 'this' to __destruct"),We(this);var ee=this.L.N;ee=Pe(M,ee),ke.hasOwnProperty(ee)?delete ke[ee]:oe("Tried to unregister unregistered instance: "+ee)},I.prototype=Object.create(V);for(var ie in x)I.prototype[ie]=x[ie];return ve(I)},j:function(I){var m=G[I];delete G[I];var x=m.ea,_=m.V,M=m.ha,V=M.map(j=>j.sa).concat(M.map(j=>j.ya));$e([I],V,j=>{var z={};return M.forEach((ie,ee)=>{var re=j[ee],pe=ie.qa,_e=ie.ra,ze=j[ee+M.length],Ne=ie.xa,Ft=ie.za;z[ie.na]={read:Wt=>re.fromWireType(pe(_e,Wt)),write:(Wt,Rr)=>{var Qi=[];Ne(Ft,Wt,ze.toWireType(Qi,Rr)),ae(Qi)}}}),[{name:m.name,fromWireType:function(ie){var ee={},re;for(re in z)ee[re]=z[re].read(ie);return _(ie),ee},toWireType:function(ie,ee){for(var re in z)if(!(re in ee))throw new TypeError('Missing field: "'+re+'"');var pe=x();for(re in z)z[re].write(pe,ee[re]);return ie!==null&&ie.push(_,pe),pe},argPackAdvance:8,readValueFromPointer:de,U:_}]})},v:function(){},B:function(I,m,x,_,M){var V=Ct(x);m=ne(m),yt(I,{name:m,fromWireType:function(j){return!!j},toWireType:function(j,z){return z?_:M},argPackAdvance:8,readValueFromPointer:function(j){if(x===1)var z=y;else if(x===2)z=Q;else if(x===4)z=T;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(z[j>>V])},U:null})},f:function(I,m,x,_,M,V,j,z,ie,ee,re,pe,_e){re=ne(re),V=Jt(M,V),z&&(z=Jt(j,z)),ee&&(ee=Jt(ie,ee)),_e=Jt(pe,_e);var ze=se(re);Rs(ze,function(){Vn("Cannot construct "+re+" due to unbound types",[_])}),$e([I,m,x],_?[_]:[],function(Ne){if(Ne=Ne[0],_)var Ft=Ne.M,Wt=Ft.W;else Wt=vt.prototype;Ne=ue(ze,function(){if(Object.getPrototypeOf(this)!==Rr)throw new Le("Use 'new' to construct "+re);if(Qi.X===void 0)throw new Le(re+" has no accessible constructor");var ld=Qi.X[arguments.length];if(ld===void 0)throw new Le("Tried to invoke ctor of "+re+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Qi.X).toString()+") parameters instead!");return ld.apply(this,arguments)});var Rr=Object.create(Wt,{constructor:{value:Ne}});Ne.prototype=Rr;var Qi=new Gi(re,Ne,Rr,_e,Ft,V,z,ee);Ft=new vi(re,Qi,!0,!1),Wt=new vi(re+"*",Qi,!1,!1);var Ad=new vi(re+" const*",Qi,!1,!0);return yi[I]={pointerType:Wt,ka:Ad},Ny(ze,Ne),[Ft,Wt,Ad]})},c:function(I,m,x,_,M,V,j){var z=fA(x,_);m=ne(m),V=Jt(M,V),$e([],[I],function(ie){function ee(){Vn("Cannot call "+re+" due to unbound types",z)}ie=ie[0];var re=ie.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var pe=ie.M.constructor;return pe[m]===void 0?(ee.Y=x-1,pe[m]=ee):(ls(pe,m,re),pe[m].R[x-1]=ee),$e([],z,function(_e){return _e=gA(re,[_e[0],null].concat(_e.slice(1)),null,V,j),pe[m].R===void 0?(_e.Y=x-1,pe[m]=_e):pe[m].R[x-1]=_e,[]}),[]})},o:function(I,m,x,_,M,V){0<m||U();var j=fA(m,x);M=Jt(_,M),$e([],[I],function(z){z=z[0];var ie="constructor "+z.name;if(z.M.X===void 0&&(z.M.X=[]),z.M.X[m-1]!==void 0)throw new Le("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+z.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return z.M.X[m-1]=()=>{Vn("Cannot construct "+z.name+" due to unbound types",j)},$e([],j,function(ee){return ee.splice(1,0,null),z.M.X[m-1]=gA(ie,ee,null,M,V),[]}),[]})},a:function(I,m,x,_,M,V,j,z){var ie=fA(x,_);m=ne(m),V=Jt(M,V),$e([],[I],function(ee){function re(){Vn("Cannot call "+pe+" due to unbound types",ie)}ee=ee[0];var pe=ee.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),z&&ee.M.ia.push(m);var _e=ee.M.W,ze=_e[m];return ze===void 0||ze.R===void 0&&ze.className!==ee.name&&ze.Y===x-2?(re.Y=x-2,re.className=ee.name,_e[m]=re):(ls(_e,m,pe),_e[m].R[x-2]=re),$e([],ie,function(Ne){return Ne=gA(pe,Ne,ee,V,j),_e[m].R===void 0?(Ne.Y=x-2,_e[m]=Ne):_e[m].R[x-2]=Ne,[]}),[]})},A:function(I,m){m=ne(m),yt(I,{name:m,fromWireType:function(x){var _=Ie(x);return pA(x),_},toWireType:function(x,_){return ve(_)},argPackAdvance:8,readValueFromPointer:de,U:null})},m:function(I,m,x){x=Ct(x),m=ne(m),yt(I,{name:m,fromWireType:function(_){return _},toWireType:function(_,M){return M},argPackAdvance:8,readValueFromPointer:Oy(m,x),U:null})},d:function(I,m,x,_,M){m=ne(m),M===-1&&(M=4294967295),M=Ct(x);var V=z=>z;if(_===0){var j=32-8*x;V=z=>z<<j>>>j}x=m.includes("unsigned")?function(z,ie){return ie>>>0}:function(z,ie){return ie},yt(I,{name:m,fromWireType:V,toWireType:x,argPackAdvance:8,readValueFromPointer:Py(m,M,_!==0),U:null})},b:function(I,m,x){function _(V){V>>=2;var j=b;return new M(p,j[V+1],j[V])}var M=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];x=ne(x),yt(I,{name:x,fromWireType:_,argPackAdvance:8,readValueFromPointer:_},{ta:!0})},n:function(I,m){m=ne(m);var x=m==="std::string";yt(I,{name:m,fromWireType:function(_){var M=b[_>>2],V=_+4;if(x)for(var j=V,z=0;z<=M;++z){var ie=V+z;if(z==M||v[ie]==0){if(j=j?f(v,j,ie-j):"",ee===void 0)var ee=j;else ee+=String.fromCharCode(0),ee+=j;j=ie+1}}else{for(ee=Array(M),z=0;z<M;++z)ee[z]=String.fromCharCode(v[V+z]);ee=ee.join("")}return Bi(_),ee},toWireType:function(_,M){M instanceof ArrayBuffer&&(M=new Uint8Array(M));var V,j=typeof M=="string";if(j||M instanceof Uint8Array||M instanceof Uint8ClampedArray||M instanceof Int8Array||oe("Cannot pass non-string to std::string"),x&&j){var z=0;for(V=0;V<M.length;++V){var ie=M.charCodeAt(V);127>=ie?z++:2047>=ie?z+=2:55296<=ie&&57343>=ie?(z+=4,++V):z+=3}V=z}else V=M.length;if(z=IA(4+V+1),ie=z+4,b[z>>2]=V,x&&j){if(j=ie,ie=V+1,V=v,0<ie){ie=j+ie-1;for(var ee=0;ee<M.length;++ee){var re=M.charCodeAt(ee);if(55296<=re&&57343>=re){var pe=M.charCodeAt(++ee);re=65536+((re&1023)<<10)|pe&1023}if(127>=re){if(j>=ie)break;V[j++]=re}else{if(2047>=re){if(j+1>=ie)break;V[j++]=192|re>>6}else{if(65535>=re){if(j+2>=ie)break;V[j++]=224|re>>12}else{if(j+3>=ie)break;V[j++]=240|re>>18,V[j++]=128|re>>12&63}V[j++]=128|re>>6&63}V[j++]=128|re&63}}V[j]=0}}else if(j)for(j=0;j<V;++j)ee=M.charCodeAt(j),255<ee&&(Bi(ie),oe("String has UTF-16 code units that do not fit in 8 bits")),v[ie+j]=ee;else for(j=0;j<V;++j)v[ie+j]=M[j];return _!==null&&_.push(Bi,z),z},argPackAdvance:8,readValueFromPointer:de,U:function(_){Bi(_)}})},i:function(I,m,x){if(x=ne(x),m===2)var _=Uy,M=Gy,V=Hy,j=()=>C,z=1;else m===4&&(_=$y,M=Yy,V=Ky,j=()=>b,z=2);yt(I,{name:x,fromWireType:function(ie){for(var ee=b[ie>>2],re=j(),pe,_e=ie+4,ze=0;ze<=ee;++ze){var Ne=ie+4+ze*m;(ze==ee||re[Ne>>z]==0)&&(_e=_(_e,Ne-_e),pe===void 0?pe=_e:(pe+=String.fromCharCode(0),pe+=_e),_e=Ne+m)}return Bi(ie),pe},toWireType:function(ie,ee){typeof ee!="string"&&oe("Cannot pass non-string to C++ string type "+x);var re=V(ee),pe=IA(4+re+m);return b[pe>>2]=re>>z,M(ee,pe+4,re+m),ie!==null&&ie.push(Bi,pe),pe},argPackAdvance:8,readValueFromPointer:de,U:function(ie){Bi(ie)}})},k:function(I,m,x,_,M,V){G[I]={name:ne(m),ea:Jt(x,_),V:Jt(M,V),ha:[]}},h:function(I,m,x,_,M,V,j,z,ie,ee){G[I].ha.push({na:ne(m),sa:x,qa:Jt(_,M),ra:V,ya:j,xa:Jt(z,ie),za:ee})},C:function(I,m){m=ne(m),yt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,x,_,M){I=Jn[I],m=Ie(m),x=sd(x);var V=[];return b[_>>2]=ve(V),I(m,x,V,M)},t:function(I,m,x,_){I=Jn[I],m=Ie(m),x=sd(x),I(m,x,null,_)},g:pA,l:function(I,m){var x=Wy(I,m),_=x[0];m=_.name+"_$"+x.slice(1).map(function(j){return j.name}).join("_")+"$";var M=rd[m];if(M!==void 0)return M;var V=Array(I-1);return M=Jy((j,z,ie,ee)=>{for(var re=0,pe=0;pe<I-1;++pe)V[pe]=x[pe+1].readValueFromPointer(ee+re),re+=x[pe+1].argPackAdvance;for(j=j[z].apply(j,V),pe=0;pe<I-1;++pe)x[pe+1].la&&x[pe+1].la(V[pe]);if(!_.ua)return _.toWireType(ie,j)}),rd[m]=M},q:function(I){4<I&&(le[I].fa+=1)},r:function(I){var m=Ie(I);ae(m),pA(I)},e:function(){U("")},x:function(I,m,x){v.copyWithin(I,m,m+x)},w:function(I){var m=v.length;if(I>>>=0,2147483648<I)return!1;for(var x=1;4>=x;x*=2){var _=m*(1+.2/x);_=Math.min(_,I+100663296);var M=Math;_=Math.max(I,_),M=M.min.call(M,2147483648,_+(65536-_%65536)%65536);e:{try{d.grow(M-p.byteLength+65535>>>16),P();var V=1;break e}catch{}V=void 0}if(V)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,m,x,_){for(var M=0,V=0;V<x;V++){var j=b[m>>2],z=b[m+4>>2];m+=8;for(var ie=0;ie<z;ie++){var ee=v[j+ie],re=qy[I];ee===0||ee===10?((I===1?c:h)(f(re,0)),re.length=0):re.push(ee)}M+=z}return b[_>>2]=M,0}};(function(){function I(M){n.asm=M.exports,d=n.asm.D,P(),k=n.asm.I,$.unshift(n.asm.E),S--,n.monitorRunDependencies&&n.monitorRunDependencies(S),S==0&&D&&(M=D,D=null,M())}function m(M){I(M.instance)}function x(M){return K().then(function(V){return WebAssembly.instantiate(V,_)}).then(function(V){return V}).then(M,function(V){h("failed to asynchronously prepare wasm: "+V),U(V)})}var _={a:Xy};if(S++,n.monitorRunDependencies&&n.monitorRunDependencies(S),n.instantiateWasm)try{return n.instantiateWasm(_,I)}catch(M){h("Module.instantiateWasm callback failed with error: "+M),a(M)}return function(){return u||typeof WebAssembly.instantiateStreaming!="function"||B(w)||typeof fetch!="function"?x(m):fetch(w,{credentials:"same-origin"}).then(function(M){return WebAssembly.instantiateStreaming(M,_).then(m,function(V){return h("wasm streaming compile failed: "+V),h("falling back to ArrayBuffer instantiation"),x(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var od=n.___getTypeName=function(){return(od=n.___getTypeName=n.asm.F).apply(null,arguments)};n.__embind_initialize_bindings=function(){return(n.__embind_initialize_bindings=n.asm.G).apply(null,arguments)};var IA=n._malloc=function(){return(IA=n._malloc=n.asm.H).apply(null,arguments)},Bi=n._free=function(){return(Bi=n._free=n.asm.J).apply(null,arguments)};n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.K).apply(null,arguments)};var qn;D=function I(){qn||ad(),qn||(D=I)};function ad(){function I(){if(!qn&&(qn=!0,n.calledRun=!0,!g)){if(X($),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();te.unshift(m)}X(te)}}if(!(0<S)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Z();X(q),0<S||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),I()},1)):I())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();return ad(),r.ready}})();s.exports=t})(Ul);var Rf=Ul.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(Lo),i=ye;Object.keys(i).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in s&&s[a]===i[a]||Object.defineProperty(s,a,{enumerable:!0,get:function(){return i[a]}})});function r(a){return a&&a.__esModule?a:{default:a}}const n=Rf;async function o(){return(0,t.default)(await n())}})(Ol);function No({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const u=a+A,d=a===0,g=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=u-n&&t<=u&&(r.globalAlpha=Math.max(0,Math.min(1,(u-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Lf(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function _f(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function Mo({resolution:s,aspectRatio:e}){const t=Lf(s),i=_f(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function kf({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=Mo({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,h=o/l,u=(i-c)/2,d=(r-h)/2;return{sx:u,sy:d,sWidth:c,sHeight:h,scale:l}}function rr({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const h=Math.max(e,0),u=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,p=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(u-h)*f,(g-d)*p]}function Gl({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:h}){const{x:u,y:d,width:g,height:f}=t??{},p=A*(u??0),y=l*(d??0),v=A*Math.min(1-(u??0),g??1),Q=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=v,c.height=Q;const D=rr({source:e,sx:p,sy:y,sw:v,sh:Q,dx:0,dy:0,dw:v,dh:Q});C.drawImage(...D)}const T=v/Q,{sx:b,sy:L,sWidth:R,sHeight:P,scale:k}=kf({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:v,sourceHeight:Q}),q=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!q){if(b<0){const D=Math.abs(b)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,D,a),s.rect(r+o-D,n,D,a),s.fill(),s.closePath()}if(L<0){const D=Math.abs(L)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,D),s.rect(r,n+a-D,o,D),s.fill(),s.closePath()}}if(i==="letterbox-video"&&q){const D=h.getContext("2d");if(D){h.width=v,h.height=Q,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const U=rr({source:c,sx:b,sy:L,sw:R,sh:P,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...U),D.save();const B=1.2,w=-(v*B-v)/2,N=-(Q*B-Q)/2,H=Math.min(v/20,Q/20);if(D.filter=`blur(${H}px) brightness(20%)`,D.translate(w,N),D.scale(B,B),D.drawImage(c,0,0,v,Q),D.restore(),s.globalCompositeOperation="destination-over",b<0){const K=o/T,X=a/K,se=rr({source:h,sy:(1-X)*Q/2,sh:X*Q,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}if(L<0){const K=a*T,X=o/K,se=rr({source:h,sx:(1-X)*v/2,sw:X*v,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}s.restore()}}else{const D=rr({source:c,sx:b,sy:L,sw:R,sh:P,dx:r,dy:n,dw:o,dh:a});s.drawImage(...D)}const $=b*-1*k,te=L*-1*k,Z=o-$*2,S=a-te*2;return{dx:$,dy:te,dw:Z,dh:S}}function Hl({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const $l=mo(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let u=0;for(;a*e>c+1;){c+=1;const d=ln({context:t,font:s,fontSize:c,text:n,maxW:i});if(u=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),u>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(An))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`});function Ff(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function Yl(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function Kl(s,e,{layout:t,scale:i=1}){const{position:r="static",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:h,flex:u,gap:d,margin:g,padding:f,direction:p="column",align:y="start",alignSelf:v,justify:Q="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:R,right:P,bottom:k,left:q}=Ff(n,i);R&&e.setPosition(s.EDGE_TOP,R),P&&e.setPosition(s.EDGE_RIGHT,P),k&&e.setPosition(s.EDGE_BOTTOM,k),q&&e.setPosition(s.EDGE_LEFT,q)}const T={row:s.FLEX_DIRECTION_ROW,column:s.FLEX_DIRECTION_COLUMN,"row-reverse":s.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(T[p]);const b={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(b[y]),v&&e.setAlignSelf(b[v]);const L={start:s.JUSTIFY_FLEX_START,end:s.JUSTIFY_FLEX_END,center:s.JUSTIFY_CENTER,"space-between":s.JUSTIFY_SPACE_BETWEEN,"space-around":s.JUSTIFY_SPACE_AROUND,"space-evenly":s.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(L[Q]),g){const{top:R,right:P,bottom:k,left:q}=Yl(g,i);e.setMargin(s.EDGE_TOP,R),e.setMargin(s.EDGE_RIGHT,P),e.setMargin(s.EDGE_BOTTOM,k),e.setMargin(s.EDGE_LEFT,q)}if(f){const{top:R,right:P,bottom:k,left:q}=Yl(f,i);e.setPadding(s.EDGE_TOP,R),e.setPadding(s.EDGE_RIGHT,P),e.setPadding(s.EDGE_BOTTOM,k),e.setPadding(s.EDGE_LEFT,q)}u&&e.setFlex(u),e.setGap(s.GUTTER_ALL,(d??0)*i),o&&e.setWidth(typeof o=="number"?o*i:o),a&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*i:a)),A&&e.setMinWidth(typeof A=="number"?A*i:A),l&&e.setMinHeight(typeof l=="number"?l*i:l),c&&e.setMaxWidth(typeof c=="number"?c*i:c),h&&e.setMaxHeight(typeof h=="number"?h*i:h)}function Vl({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:h}=l;h&&(c.save(),h({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),Vl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function Jl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...h}=n;return Kl(s,a,{layout:h,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:Jl(s,a,l,i)}});return e.calculateLayout(),r}function Wl(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:h,height:u}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:h,height:u,element:a,childNodes:Wl(s,A,d,g)}})}function ql(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}ql(r,e)})}function Nf({yoga:s,canvas:e,origin:t,elements:i,...r}){const n={inset:{top:0,left:0},width:e.width,height:e.height,...t},o=s.Node.create();Kl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=Jl(s,o,i,l);ql(c,l),o.calculateLayout();const h=Wl(o,c);return Vl({...r,scale:l,canvas:e,position:h})}const Mf={linear:nf,easeIn:wo,easeInOut:af,easeOut:of,circIn:Nl,circInOut:Af,circOut:Ml,backIn:To,backInOut:cf,backOut:lf,anticipate:hf,bounceIn:ff,bounceInOut:pf,bounceOut:Wr},on=mo((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>zg(s,e,{...r,clamp:t,ease:Mf[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),jl=[{family:"Noto Arabic",regex:/\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:/\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:/\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:/\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:/\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:/\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:/\p{Extended_Pictographic}/u,url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function an({text:s,font:e}){let t=e;return jl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const gi=1.8,An=/(?<value>\d+\.?\d*)(?=px)/;function Xl(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function zl(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>zl(r)))}function Zl({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}){return o.map(d=>{var g,f,p,y,v,Q,C,T;const{node:b,transient:L=[{from:0,duration:1/0}]}=d,R=t.getContext("2d"),P={total:a,content:A,scene:l},k={total:c,content:h,scene:u},q=L.reduce(($,{type:te="scene",from:Z,duration:S,animation:D})=>{const U=Z<0?k[te]+Z:Z;return P[te]>=U&&P[te]<=U+S&&$.push({type:te,animation:D,duration:S,from:U}),$},[]);if(R&&q.length>0&&zl(d)){let $=d.width,te=d.height;if((b==null?void 0:b.type)==="text"&&b.value){const{align:Z="left"}=b,S=an({text:b.value,font:b.font});R.save(),R.font=S,R.textBaseline="top",R.textAlign=Z,b.wrap?te=({width:D,maxHeight:U,scale:B})=>{var w,N;const H=$l({font:S,scale:B,context:R,maxW:D,maxH:U,text:b.value??"",minSize:(w=b.fill)==null?void 0:w.minSize,maxSize:(N=b.fill)==null?void 0:N.maxSize});return ln({context:R,font:S,fontSize:H,text:b.value??"",maxW:D}).length*H}:($=R.measureText(b.value).width,te=parseFloat(((f=(g=S.match(An))==null?void 0:g.groups)==null?void 0:f.value)??"0")),R.restore()}if((b==null?void 0:b.type)==="image"&&b.image&&b.size){const Z=((p=b.image)==null?void 0:p.naturalWidth)??((y=b.image)==null?void 0:y.width),S=((v=b.image)==null?void 0:v.naturalHeight)??((Q=b.image)==null?void 0:Q.height),D=Z/S,U=(C=b.size)==null?void 0:C.width,B=(T=b.size)==null?void 0:T.height;$=U??(D>=1?(B??0)*D:(B??0)/D),te=B??(D<1?(U??0)*D:(U??0)/D)}return{...d,width:$,height:te,elements:Zl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}),draw:({dx:Z,dy:S,dw:D,dh:U,scale:B})=>{var w,N,H,K,X,se,ue,le,Ce,Se,Le,oe,Ie;if(q.forEach(ve=>{const{type:ce="scene",from:Ae,duration:ne,animation:be={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=ve;if(be){const{type:Oe,duration:Te,easing:{in:ke="easeOut",out:Pe="easeOut"}={}}=be;if(Ae>0&&P[ce]<=Ae+Te)switch(Oe){case"fade":{const De=on([Ae,Ae+Te],[0,1],{ease:ke});R.globalAlpha=De(P[ce]);break}case"slide":{const{options:De}=be,Be={up:[{x:0,y:U},{x:0,y:0}],right:[{x:D,y:0},{x:0,y:0}],down:[{x:0,y:-U},{x:0,y:0}],left:[{x:-D,y:0},{x:0,y:0}]},He=on([Ae,Ae+Te],Be[De.direction.in],{ease:ke}),{x:We,y:at}=He(P[ce]);R.translate(We,at);break}}if(Ae+ne<k[ce]&&Ae+ne-Te<=P[ce])switch(Oe){case"fade":{const De=on([Ae+ne-Te,Ae+ne],[1,0],{ease:Pe});R.globalAlpha=De(P[ce]);break}case"slide":{const{options:De}=be,Be={up:[{x:0,y:0},{x:0,y:-U}],right:[{x:0,y:0},{x:D,y:0}],down:[{x:0,y:0},{x:0,y:U}],left:[{x:0,y:0},{x:-D,y:0}]},He=on([Ae+ne-Te,Ae+ne],Be[De.direction.out],{ease:Pe}),{x:We,y:at}=He(P[ce]);R.translate(We,at);break}}}}),b){const{type:ve}=b;if(ve==="box"){const{shadow:{color:ce="rgba(0, 0, 0, 0.5)",blur:Ae=0,offset:{x:ne=0,y:be=0}={}}={}}=b;if(R.save(),R.fillStyle=ce,R.shadowColor=ce,R.shadowBlur=Ae,R.shadowOffsetX=ne+D+t.width,R.shadowOffsetY=be+U+t.height,R.beginPath(),!d.radius)R.rect(Z-D-t.width,S-U-t.height,D,U);else{const{topLeft:Oe,topRight:Te,bottomRight:ke,bottomLeft:Pe}=Xl(d.radius,B);R.roundRect(Z-D-t.width,S-U-t.height,D,U,[Oe,Te,ke,Pe])}R.fill(),R.closePath(),R.restore()}if(d.radius){const{topLeft:ce,topRight:Ae,bottomRight:ne,bottomLeft:be}=Xl(d.radius,B);R.beginPath(),R.moveTo(Z+Math.min(U/gi,ce),S),R.lineTo(Z+D-Math.min(U/gi,Ae),S),R.quadraticCurveTo(Z+D,S,Z+D,S+Math.min(U/gi,Ae)),R.lineTo(Z+D,S+U-Math.min(U/gi,ne)),R.quadraticCurveTo(Z+D,S+U,Z+D-Math.min(U/gi,ne),S+U),R.lineTo(Z+Math.min(U/gi,be),S+U),R.quadraticCurveTo(Z,S+U,Z,S+U-Math.min(U/gi,be)),R.lineTo(Z,S+Math.min(U/gi,ce)),R.quadraticCurveTo(Z,S,Z+Math.min(U/gi,ce),S),R.closePath(),e&&(R.strokeStyle="blue",R.stroke()),R.clip()}if(ve==="box"&&(R.save(),R.fillStyle=b.background,R.fillRect(Z,S,D,U),R.restore()),ve==="text"&&b.value){const{align:ce="left"}=b,Ae=an({text:b.value,font:b.font}),ne=$l({font:Ae,scale:B,context:R,maxW:D,maxH:U,text:b.value??"",minSize:(w=b.fill)==null?void 0:w.minSize,maxSize:(N=b.fill)==null?void 0:N.maxSize});R.font=Ae.replace(An,ne.toString()),R.textBaseline="top",R.fillStyle=b.color,R.textAlign=ce;const be={left:Z,center:Z+D/2,right:Z+D};b.wrap?ln({context:R,font:Ae,fontSize:ne,text:b.value,maxW:D}).forEach((Te,ke)=>{R.fillText(Te.text,be[ce],S+ne*ke)}):R.fillText(b.value,be[ce],S)}if(ve==="image"&&b.image&&R.drawImage(b.image,Z,S,D,U),ve==="video"&&((H=b.video)!=null&&H.node||(K=b.video)!=null&&K.getSource)){const ce=b.format??"letterbox",Ae=((se=(X=b.video)==null?void 0:X.getSource)==null?void 0:se.call(X,l))??b.video.node,ne=(Ae==null?void 0:Ae.videoWidth)??(Ae==null?void 0:Ae.naturalWidth)??(Ae==null?void 0:Ae.width),be=(Ae==null?void 0:Ae.videoHeight)??(Ae==null?void 0:Ae.naturalHeight)??(Ae==null?void 0:Ae.height);if(ne&&be){const{dx:Te,dy:ke,dw:Pe,dh:De}=Gl({context:R,cropCanvas:i,letterboxCanvas:n,source:Ae,format:ce,crop:(ue=b==null?void 0:b.value)==null?void 0:ue.crop,sourceWidth:ne,sourceHeight:be,posX:Z,posY:S,drawAreaWidth:D,drawAreaHeight:U});b.elements&&Oo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:b.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(S,S+ke),left:Math.max(Z,Z+Te)},width:Math.min(D,Pe),height:Math.min(U,De)}})}const Oe=1/3;if(b.poster&&a>=0&&a<=Oe){R.save(),R.globalAlpha=1-a/Oe;const Te=((le=b.poster)==null?void 0:le.naturalWidth)??((Ce=b.poster)==null?void 0:Ce.width),ke=((Se=b.poster)==null?void 0:Se.naturalHeight)??((Le=b.poster)==null?void 0:Le.height);r.width=r.height=0,r.width=D,r.height=U;const Pe=r.getContext("2d");if(Pe&&Te&&ke){const{dx:De,dy:Be,dw:He,dh:We}=Gl({context:Pe,cropCanvas:i,letterboxCanvas:n,source:b.poster,format:ce,crop:(oe=b==null?void 0:b.value)==null?void 0:oe.crop,sourceWidth:Te,sourceHeight:ke,posX:0,posY:0,drawAreaWidth:D,drawAreaHeight:U});b.elements&&Oo({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:b.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(0,Be),left:Math.max(0,De)},width:Math.min(D,He),height:Math.min(U,We)}}),R.drawImage(r,Z,S,D,U),R.restore()}}}if(ve==="gradient"&&b.value){const ce=R.createLinearGradient(Z+D,S,Z+D,S+U);(Ie=b.value)==null||Ie.forEach(Ae=>{ce.addColorStop(Ae.percent,Ae.color)}),R.fillStyle=ce,R.fillRect(Z,S,D,U)}}}}}}).filter(Boolean)}function Oo({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,...d}){return Nf({...d,yoga:s,debug:e,canvas:t,elements:Zl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u})})}const ln=mo(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(An,t.toString()),i.split(`
91
+ `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...Hl({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},Hl({context:s,word:a[0],maxW:r})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{font:s,fontSize:e,text:t,maxW:i}])=>`${s}_${e}_${t}_${i}`}),Of=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,Pf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function ec(s){if(!s)return[];const e=s.match(Of);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
92
92
  `,`
93
93
  `).split(`
94
- `),[n,o]=i.match(Pf)||[];return{start:n,end:o,text:r}}):[]}function cn(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Uf({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){if(o){const A=Zl(o).find(({start:l,end:c})=>l&&c&&n>=cn(l)&&n<cn(c));if(A){const l=s.getContext("2d");if(l){const c=Math.min(i,r),h=c*.04,u=an({text:o,font:`400 ${h}px Roobert Captions`});l.font=u,l.textBaseline="middle";const d=i*.9,g=ln({context:l,font:u,fontSize:h,text:A.text,maxW:d});g.forEach(({text:f,metrics:p},y)=>{const v=e+(i-p.width)/2,Q=t+(r*.85-(h+c*.03)*(g.length-1-y)),C=h*.8,T=h/1.5,b=e+(i-p.width-T)/2,L=Q-C,R=p.width+T,P=C*2,k=l.globalAlpha;l.save(),l.globalAlpha=.8*k,l.fillStyle="#000000",l.beginPath(),l.roundRect(b,L,R,P,c*.01),l.fill(),l.closePath(),l.globalAlpha=k,l.fillStyle="#FFFFFF",l.fillText(f,v,Q),l.restore()})}}}}const Gf={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"2",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
94
+ `),[n,o]=i.match(Pf)||[];return{start:n,end:o,text:r}}):[]}function cn(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Uf({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){if(o){const A=ec(o).find(({start:l,end:c})=>l&&c&&n>=cn(l)&&n<cn(c));if(A){const l=s.getContext("2d");if(l){const c=Math.min(i,r),h=c*.04,u=an({text:o,font:`400 ${h}px Roobert Captions`});l.font=u,l.textBaseline="middle";const d=i*.9,g=ln({context:l,font:u,fontSize:h,text:A.text,maxW:d});g.forEach(({text:f,metrics:p},y)=>{const v=e+(i-p.width)/2,Q=t+(r*.85-(h+c*.03)*(g.length-1-y)),C=h*.8,T=h/1.5,b=e+(i-p.width-T)/2,L=Q-C,R=p.width+T,P=C*2,k=l.globalAlpha;l.save(),l.globalAlpha=.8*k,l.fillStyle="#000000",l.beginPath(),l.roundRect(b,L,R,P,c*.01),l.fill(),l.closePath(),l.globalAlpha=k,l.fillStyle="#FFFFFF",l.fillText(f,v,Q),l.restore()})}}}}const Gf={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"2",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
95
95
  {
96
96
  "width": "100%",
97
97
  "height": "100%",
@@ -168,44 +168,44 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
168
168
  "width": {{ it.root?.answer?.settings?.crop?.width }},
169
169
  "height": {{ it.root?.answer?.settings?.crop?.height }}
170
170
  }
171
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},system:!0,default:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};async function Hf(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Zu);return new s.Image}return new Image}const ec=Li(async function(e){return e?new Promise((t,i)=>{Hf().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Po({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await ec(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await ec(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Po({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Po({element:l,meta:e},t,i)))),a}async function hn(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Zu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}async function $f(s){var e;try{if((e=await Df(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Yf({sources:s}){let e=null;if(s){const t=s.filter(Boolean).map(i=>$f(i));e=(await Promise.all(t)).find(Boolean)}return e}function nr(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=nr(t==null?void 0:t.elements);if(i)return i}}function Kf(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function Vf(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Jf(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function un(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}jr.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Jf(s)}"`:Vf(s)||Array.isArray(s)?JSON.stringify(s):s),jr.helpers.define("resolve-source",Li(async s=>{const{sources:e}=s.params[0]??{},t=e==null?void 0:e.filter(Boolean),i=t==null?void 0:t.find(o=>o.includes("blob:")),r=t==null?void 0:t.find(o=>!o.includes("http")),n=i??r??await Yf({sources:e});return n?`"${n}"`:"null"},{cacheKey:([s])=>JSON.stringify(s.params[0]??{})}));const or=(s,e,t)=>jr.render(s,e,jr.getConfig({autoEscape:!1,defaultFilter:"parse",async:!0,asyncHelpers:["resolve-source"],...t}));async function gs({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n){var o,a,A,l;const c=await Ol.loadYoga(),h=e??Gf;if(!((o=h.templates)!=null&&o.length))throw new Error(`No templates found for template instance: ${h.id}`);let u=h.templates.find(({version:L})=>L===Uo);if(!u){const L=h.templates.map(({version:R})=>`"${R}"`).join(", ");console.warn(`Template renderer expects template version "${Uo}" but got ${L}`),u=h.templates[h.templates.length-1]}const d=await Promise.all(u.content.map(async({scenes:L,root:R})=>{const P={...h.options,...s,intro:h.intro,outro:h.outro};async function k(q,$){return Promise.all(L.map(async({layout:te,duration:ee,data:S,options:D})=>{var U,B,w;const N={...P,index:$,root:q},H=S?JSON.parse(await or(S,N)):{},K=D?JSON.parse(await or(D,N)):{},X=ee?parseFloat(await or(ee,N)):NaN,se=(U=u.layouts.find(Re=>Re.name===te))==null?void 0:U.tree;if(!se)throw new Error(`Layout tree "${te}" not found in template "${u.id}" layouts.`);const ue=JSON.parse(await or(se,{...H,...K})),Ae=await Promise.all(ue.flatMap(Re=>Po({element:Re,meta:h.meta},r,n))),Ce=nr(Ae);return{duration:(isNaN(X)?null:X)??((B=Ce==null?void 0:Ce.meta)==null?void 0:B.duration)??0,captions:(w=Ce==null?void 0:Ce.meta)==null?void 0:w.captions,elements:Ae}}))}if(R){const q=JSON.parse(await or(R,P));return Array.isArray(q)?(await Promise.all(q.map(async($,te)=>k($,te)))).flatMap($=>$):k(q,null)}return k(s,null)}));if(d.every(L=>L.every(R=>{const P=nr(R.elements);return!(P!=null&&P.value.src)&&!(P!=null&&P.value.playlist)}))){const L=d.flatMap(R=>R.map(P=>{const k=nr(P.elements);return!(k!=null&&k.value.src)&&!(k!=null&&k.value.playlist)&&(k==null?void 0:k.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${L} failed to load, video can not be processed`)}if(d.every(L=>L.every(R=>R.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const p=d.reduce((L,R)=>{const P=R.filter(k=>k.duration>0);return P.length>0&&(L=[...L,P]),L},[]),y=((a=h.meta)==null?void 0:a.frameRate)??30,v=((A=h.meta)==null?void 0:A.resolution)??720,Q=((l=h.meta)==null?void 0:l.transitionDuration)??1/3,C=Kf(p,Q),T=un(C);return{scenes:(await Promise.all(p.map((L,R)=>{const P=un(C[R]),k=un(C.slice(0,R));return Promise.all(L.map(async({duration:q,captions:$,elements:te},ee)=>{var S,D;const U=await hn(),B=await hn(),w=await hn(),N=await hn(),H=nr(te),K=un([...C.slice(0,R),...C[R].slice(0,ee)]);return{draw:({canvas:se,currentTime:ue})=>{const Ae=Math.max(0,ue-k),Ce=Math.max(0,ue-K);Oo({yoga:c,debug:i,canvas:se,cropCanvas:U,posterCanvas:N,letterboxCanvas:B,elements:te,currentTime:ue,contentTime:Ae,sceneTime:Ce,totalDuration:T,contentDuration:P,sceneDuration:q}),$&&t&&Uf({canvas:se,dx:0,dy:0,dw:se.width,dh:se.height,vttCaptions:$,sceneTime:Ce+((H==null?void 0:H.meta.start)??0)})},duration:q,transitionCanvas:w,start:K,video:H==null?void 0:H.video,videoMeta:H==null?void 0:H.meta,audio:{duration:q,src:(S=H==null?void 0:H.value)==null?void 0:S.src,start:(D=H==null?void 0:H.meta)==null?void 0:D.start}}}))}))).flatMap(L=>L),frameRate:y,resolution:v,transitionDuration:Q,fonts:u.fonts??[],duration:T}}const Uo="2",Wf={name:"@vouchfor/embeds",version:"1.3.2",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/media-player":"^2.2.2",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.0"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^3.2.0","@storybook/addon-essentials":"^7.4.5","@storybook/addon-links":"^7.4.5","@storybook/blocks":"^7.4.5","@storybook/web-components":"^7.4.5","@storybook/web-components-vite":"^7.4.5","@types/mocha":"^10.0.1","@vouchfor/eslint-config":"^1.0.0","@vouchfor/prettier-config":"^1.0.0","@web/dev-server-esbuild":"^0.4.1","@web/test-runner":"^0.17.1","@web/test-runner-browserstack":"^0.6.1","@web/test-runner-mocha":"^0.8.1","@web/test-runner-playwright":"^0.10.1",dotenv:"^16.3.1",eslint:"^8.50.0","eslint-plugin-import":"^2.28.1",glob:"^10.3.10","lint-staged":"^14.0.1",lit:"^3.1.0",lodash:"^4.17.21",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-internal":"^1.0.4",sinon:"^17.0.1",storybook:"^7.4.5",typescript:"^5.1.3",vite:"^4.4.9","vite-plugin-commonjs":"^0.10.0","vite-plugin-dts":"^3.6.0","web-component-analyzer":"^1.1.7"}};function qf(s){const{publicApiUrl:e}=$r(s),t=xi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function jf(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:xi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=xi();return e||(e=qf(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=xi(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=xi(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function Xf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function zf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:Wf.version,templateVersion:Uo,...i}}const tc=1;class Zf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Xf(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=$r(this.host.env),{client:i,tab:r,request:n,visitor:o}=jf(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":zf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+tc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+tc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}/**
171
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},system:!0,default:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};async function Hf(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>ed);return new s.Image}return new Image}const tc=ui(async function(e){return e?new Promise((t,i)=>{Hf().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Po({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await tc(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await tc(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Po({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Po({element:l,meta:e},t,i)))),a}async function hn(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>ed),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}async function $f(s){var e;try{if((e=await wf(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Yf({sources:s}){let e=null;if(s){const t=s.filter(Boolean).map(i=>$f(i));e=(await Promise.all(t)).find(Boolean)}return e}function nr(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=nr(t==null?void 0:t.elements);if(i)return i}}function Kf(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function Vf(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Jf(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function un(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}const Wf=ui(()=>Ol.loadYoga());jr.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Jf(s)}"`:Vf(s)||Array.isArray(s)?JSON.stringify(s):s),jr.helpers.define("resolve-source",ui(async s=>{const{sources:e}=s.params[0]??{},t=e==null?void 0:e.filter(Boolean),i=t==null?void 0:t.find(o=>o.includes("blob:")),r=t==null?void 0:t.find(o=>!o.includes("http")),n=i??r??await Yf({sources:e});return n?`"${n}"`:"null"},{cacheKey:([s])=>JSON.stringify(s.params[0]??{})}));const or=(s,e,t)=>jr.render(s,e,jr.getConfig({autoEscape:!1,defaultFilter:"parse",async:!0,asyncHelpers:["resolve-source"],...t}));async function gs({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n){var o,a,A,l;const c=await Wf(),h=e??Gf;if(!((o=h.templates)!=null&&o.length))throw new Error(`No templates found for template instance: ${h.id}`);let u=h.templates.find(({version:L})=>L===Uo);if(!u){const L=h.templates.map(({version:R})=>`"${R}"`).join(", ");console.warn(`Template renderer expects template version "${Uo}" but got ${L}`),u=h.templates[h.templates.length-1]}const d=await Promise.all(u.content.map(async({scenes:L,root:R})=>{const P={...h.options,...s,intro:h.intro,outro:h.outro};async function k(q,$){return Promise.all(L.map(async({layout:te,duration:Z,data:S,options:D})=>{var U,B,w;const N={...P,index:$,root:q},H=S?JSON.parse(await or(S,N)):{},K=D?JSON.parse(await or(D,N)):{},X=Z?parseFloat(await or(Z,N)):NaN,se=(U=u.layouts.find(Le=>Le.name===te))==null?void 0:U.tree;if(!se)throw new Error(`Layout tree "${te}" not found in template "${u.id}" layouts.`);const ue=JSON.parse(await or(se,{...H,...K})),le=await Promise.all(ue.flatMap(Le=>Po({element:Le,meta:h.meta},r,n))),Ce=nr(le);return{duration:(isNaN(X)?null:X)??((B=Ce==null?void 0:Ce.meta)==null?void 0:B.duration)??0,captions:(w=Ce==null?void 0:Ce.meta)==null?void 0:w.captions,elements:le}}))}if(R){const q=JSON.parse(await or(R,P));return Array.isArray(q)?(await Promise.all(q.map(async($,te)=>k($,te)))).flatMap($=>$):k(q,null)}return k(s,null)}));if(d.every(L=>L.every(R=>{const P=nr(R.elements);return!(P!=null&&P.value.src)&&!(P!=null&&P.value.playlist)}))){const L=d.flatMap(R=>R.map(P=>{const k=nr(P.elements);return!(k!=null&&k.value.src)&&!(k!=null&&k.value.playlist)&&(k==null?void 0:k.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${L} failed to load, video can not be processed`)}if(d.every(L=>L.every(R=>R.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const p=d.reduce((L,R)=>{const P=R.filter(k=>k.duration>0);return P.length>0&&(L=[...L,P]),L},[]),y=((a=h.meta)==null?void 0:a.frameRate)??30,v=((A=h.meta)==null?void 0:A.resolution)??720,Q=((l=h.meta)==null?void 0:l.transitionDuration)??1/3,C=Kf(p,Q),T=un(C);return{scenes:(await Promise.all(p.map((L,R)=>{const P=un(C[R]),k=un(C.slice(0,R));return Promise.all(L.map(async({duration:q,captions:$,elements:te},Z)=>{var S,D;const U=await hn(),B=await hn(),w=await hn(),N=await hn(),H=nr(te),K=un([...C.slice(0,R),...C[R].slice(0,Z)]);return{draw:({canvas:se,currentTime:ue})=>{const le=Math.max(0,ue-k),Ce=Math.max(0,ue-K);Oo({yoga:c,debug:i,canvas:se,cropCanvas:U,posterCanvas:N,letterboxCanvas:B,elements:te,currentTime:ue,contentTime:le,sceneTime:Ce,totalDuration:T,contentDuration:P,sceneDuration:q}),$&&t&&Uf({canvas:se,dx:0,dy:0,dw:se.width,dh:se.height,vttCaptions:$,sceneTime:Ce+((H==null?void 0:H.meta.start)??0)})},duration:q,transitionCanvas:w,start:K,video:H==null?void 0:H.video,videoMeta:H==null?void 0:H.meta,audio:{duration:q,src:(S=H==null?void 0:H.value)==null?void 0:S.src,start:(D=H==null?void 0:H.meta)==null?void 0:D.start}}}))}))).flatMap(L=>L),frameRate:y,resolution:v,transitionDuration:Q,fonts:u.fonts??[],duration:T}}const Uo="2",qf={name:"@vouchfor/embeds",version:"1.4.0",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"latest",access:"public"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/media-player":"^2.3.0",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.0"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^3.2.0","@storybook/addon-essentials":"^7.4.5","@storybook/addon-links":"^7.4.5","@storybook/blocks":"^7.4.5","@storybook/web-components":"^7.4.5","@storybook/web-components-vite":"^7.4.5","@types/mocha":"^10.0.1","@vouchfor/eslint-config":"^1.0.0","@vouchfor/prettier-config":"^1.0.0","@web/dev-server-esbuild":"^0.4.1","@web/test-runner":"^0.17.1","@web/test-runner-browserstack":"^0.6.1","@web/test-runner-mocha":"^0.8.1","@web/test-runner-playwright":"^0.10.1",dotenv:"^16.3.1",eslint:"^8.50.0","eslint-plugin-import":"^2.28.1",glob:"^10.3.10","lint-staged":"^14.0.1",lit:"^3.1.0",lodash:"^4.17.21",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-internal":"^1.0.4",sinon:"^17.0.1",storybook:"^7.4.5",typescript:"^5.1.3",vite:"^4.4.9","vite-plugin-commonjs":"^0.10.0","vite-plugin-dts":"^3.6.0","web-component-analyzer":"^1.1.7"}};function jf(s){const{publicApiUrl:e}=$r(s),t=Di();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Xf(s){var n,o,a,A,l,c,h,u,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:Di()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=Di();return e||(e=jf(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=Di(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=Di(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function zf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function Zf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:qf.version,templateVersion:Uo,...i}}const ic=1;class e0{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=zf(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=$r(this.host.env),{client:i,tab:r,request:n,visitor:o}=Xf(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":Zf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+ic&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+ic&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}/**
172
172
  * @license
173
173
  * Copyright 2018 Google LLC
174
174
  * SPDX-License-Identifier: BSD-3-Clause
175
- */const Ue=ds(class extends Ws{constructor(s){var e;if(super(s),s.type!==us.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.it===void 0){this.it=new Set,s.strings!==void 0&&(this.st=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.st)!=null&&i.has(n))&&this.it.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.it)n in e||(t.remove(n),this.it.delete(n));for(const n in e){const o=!!e[n];o===this.it.has(n)||(r=this.st)!=null&&r.has(n)||(o?(t.add(n),this.it.add(n)):(t.remove(n),this.it.delete(n)))}return bi}});/**
175
+ */const Ue=ds(class extends Ws{constructor(s){var e;if(super(s),s.type!==us.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.it===void 0){this.it=new Set,s.strings!==void 0&&(this.st=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.st)!=null&&i.has(n))&&this.it.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.it)n in e||(t.remove(n),this.it.delete(n));for(const n in e){const o=!!e[n];o===this.it.has(n)||(r=this.st)!=null&&r.has(n)||(o?(t.add(n),this.it.add(n)):(t.remove(n),this.it.delete(n)))}return Si}});/**
176
176
  * @license
177
177
  * Copyright 2018 Google LLC
178
178
  * SPDX-License-Identifier: BSD-3-Clause
179
- */const ic="important",e0=" !"+ic,ar=ds(class extends Ws{constructor(s){var e;if(super(s),s.type!==us.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ut===void 0)return this.ut=new Set(Object.keys(e)),this.render(e);for(const i of this.ut)e[i]==null&&(this.ut.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ut.add(i);const n=typeof r=="string"&&r.endsWith(e0);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?ic:""):t[i]=r}}return bi}});function t0(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var sc={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse base URL.");return h.path=a.normalizePath(h.path),a.buildURLFromParts(h)}var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=a.normalizePath(u.path),a.buildURLFromParts(u)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(f.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)f.path=d.path,u.params||(f.params=d.params,u.query||(f.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(y)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(sc);var Go=sc.exports;function rc(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function bt(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rc(Object(t),!0).forEach(function(i){i0(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):rc(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function i0(s,e,t){return e=r0(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function tt(){return tt=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},tt.apply(this,arguments)}function s0(s,e){if(typeof s!="object"||s===null)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function r0(s){var e=s0(s,"string");return typeof e=="symbol"?e:String(e)}const ce=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)};let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s}({}),fe=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),Y=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const Zi=function(){},Ho={trace:Zi,debug:Zi,log:Zi,warn:Zi,info:Zi,error:Zi};let Ar=Ho;function n0(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Zi}function o0(s,...e){e.forEach(function(t){Ar[t]=s[t]?s[t].bind(s):n0(t)})}function a0(s,e){if(self.console&&s===!0||typeof s=="object"){o0(s,"debug","log","info","warn","error");try{Ar.log(`Debug logs enabled for "${e}" in hls.js version 1.4.12`)}catch{Ar=Ho}}else Ar=Ho}const F=Ar,A0=/^(\d+)x(\d+)$/,nc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ke{constructor(e){typeof e=="string"&&(e=Ke.parseAttrList(e));for(const t in e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=A0.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(nc.lastIndex=0;(t=nc.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function l0(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function c0(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class oc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){F.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=tt(new Ke({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);ce(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(ce(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&&ce(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class dn{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 Ne={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class ac{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Ne.AUDIO]:null,[Ne.VIDEO]:null,[Ne.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2),r=[];i.length===1?r[0]=t?t.byteRangeEndOffset:0:r[0]=parseInt(i[1]),r[1]=parseInt(i[0])+r[0],this._byteRange=r}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Go.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class $o extends ac{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 dn,this.urlId=0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!ce(this.programDateTime))return null;const e=ce(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Ne.AUDIO]=null,e[Ne.VIDEO]=null,e[Ne.AUDIOVIDEO]=null}}class h0 extends ac{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new dn,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const u0=10;class d0{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?ce(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||u0}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 Yo(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function g0(s){const e=Ac(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function f0(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function p0(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=Yo(o)):t=g0(o)}}return t}function Ac(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}var Ve={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},St={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function lc(s){switch(s){case St.FAIRPLAY:return Ve.FAIRPLAY;case St.PLAYREADY:return Ve.PLAYREADY;case St.WIDEVINE:return Ve.WIDEVINE;case St.CLEARKEY:return Ve.CLEARKEY}}var cc={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function E0(s){if(s===cc.WIDEVINE)return Ve.WIDEVINE}function hc(s){switch(s){case Ve.FAIRPLAY:return St.FAIRPLAY;case Ve.PLAYREADY:return St.PLAYREADY;case Ve.WIDEVINE:return St.WIDEVINE;case Ve.CLEARKEY:return St.CLEARKEY}}function Ko(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ve.FAIRPLAY,Ve.WIDEVINE,Ve.PLAYREADY,Ve.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ve.WIDEVINE]&&t&&i.push(Ve.WIDEVINE),i}const uc=function(){return typeof self<"u"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function I0(s,e,t,i){let r;switch(s){case Ve.FAIRPLAY:r=["cenc","sinf"];break;case Ve.WIDEVINE:case Ve.PLAYREADY:r=["cenc"];break;case Ve.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return m0(r,e,t,i)}function m0(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function es(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const Vo=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,dc=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,gn=(s,e)=>{const t=e;let i=0;for(;Vo(s,e);){i+=10;const r=fn(s,e+6);i+=r,dc(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},fn=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},C0=(s,e)=>Vo(s,e)&&fn(s,e+6)+10<=s.length-e,y0=s=>{const e=fc(s);for(let t=0;t<e.length;t++){const i=e[t];if(gc(i))return w0(i)}},gc=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",v0=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=fn(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},fc=s=>{let e=0;const t=[];for(;Vo(s,e);){const i=fn(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=v0(s.subarray(e)),o=B0(n);o&&t.push(o),e+=n.size+10}dc(s,e)&&(e+=10)}return t},B0=s=>s.type==="PRIV"?Q0(s):s.type[0]==="W"?S0(s):b0(s),Q0=s=>{if(s.size<2)return;const e=Xt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},b0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Xt(s.data.subarray(t),!0);t+=i.length+1;const r=Xt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Xt(s.data.subarray(1));return{key:s.type,data:e}},S0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Xt(s.data.subarray(t),!0);t+=i.length+1;const r=Xt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Xt(s.data);return{key:s.type,data:e}},w0=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},Xt=(s,e=!1)=>{const t=T0();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let Jo;function T0(){return!Jo&&typeof self.TextDecoder<"u"&&(Jo=new self.TextDecoder("utf-8")),Jo}const zt={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},pn=Math.pow(2,32)-1,x0=[].push,pc={video:1,audio:2,id3:3,text:4};function ht(s){return String.fromCharCode.apply(null,s)}function Ec(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function me(s,e){const t=Ic(s,e);return t<0?4294967296+t:t}function Ic(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Wo(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function Te(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=me(s,r),o=ht(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=Te(s.subarray(r+8,a),e.slice(1));A.length&&x0.apply(t,A)}r=a}return t}function D0(s){const e=[],t=s[0];let i=8;const r=me(s,i);i+=4;const n=0,o=0;t===0?i+=8:i+=16,i+=2;let a=s.length+o;const A=Ec(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=me(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return F.warn("SIDX has hierarchical references (not supported)"),null;const g=me(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+u-1}}),a+=u,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function mc(s){const e=[],t=Te(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=Te(n,["tkhd"])[0];if(o){let a=o[0],A=a===0?12:20;const l=me(o,A),c=Te(n,["mdia","mdhd"])[0];if(c){a=c[0],A=a===0?12:20;const h=me(c,A),u=Te(n,["mdia","hdlr"])[0];if(u){const d=ht(u.subarray(8,12)),g={soun:Ne.AUDIO,vide:Ne.VIDEO}[d];if(g){const f=Te(n,["mdia","minf","stbl","stsd"])[0];let p;f&&(p=ht(f.subarray(12,16))),e[l]={timescale:h,type:g},e[g]={timescale:h,id:l,codec:p}}}}}}return Te(s,["moov","mvex","trex"]).forEach(r=>{const n=me(r,4),o=e[n];o&&(o.default={duration:me(r,12),flags:me(r,20)})}),e}function R0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&Te(s,["moov","trak"]).forEach(r=>{const o=Te(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=Te(o,["enca"]);const A=a.length>0;A||(a=Te(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);Te(c,["sinf"]).forEach(u=>{const d=Cc(u);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(F.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${zt.hexDump(g)} -> ${zt.hexDump(t)}`),d.set(t,8))}})})}),s}function Cc(s){const e=Te(s,["schm"])[0];if(e){const t=ht(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Te(s,["schi","tenc"])[0]}return F.error("[eme] missing 'schm' box"),null}function L0(s,e){return Te(e,["moof","traf"]).reduce((t,i)=>{const r=Te(i,["tfdt"])[0],n=r[0],o=Te(i,["tfhd"]).reduce((a,A)=>{const l=me(A,4),c=s[l];if(c){let h=me(r,4);if(n===1){if(h===pn)return F.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=pn+1,h+=me(r,8)}const u=c.timescale||9e4,d=h/u;if(isFinite(d)&&(a===null||d<a))return d}return a},null);return o!==null&&isFinite(o)&&(t===null||o<t)?o:t},null)}function _0(s,e){let t=0,i=0,r=0;const n=Te(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=Te(a,["tfhd"])[0],l=me(A,4),c=e[l];if(!c)continue;const h=c.default,u=me(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=me(A,12):d=me(A,8));const g=c.timescale||9e4,f=Te(a,["trun"]);for(let p=0;p<f.length;p++){if(t=k0(f[p]),!t&&d){const y=me(f[p],4);t=d*y}c.type===Ne.VIDEO?i+=t/g:c.type===Ne.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=0;const a=Te(s,["sidx"]);for(let A=0;A<a.length;A++){const l=D0(a[A]);l!=null&&l.references&&(o+=l.references.reduce((c,h)=>c+h.info.duration||0,0))}return o}return i||r}function k0(s){const e=me(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=me(s,4);for(let n=0;n<r;n++){if(e&256){const o=me(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function F0(s,e,t){Te(e,["moof","traf"]).forEach(i=>{Te(i,["tfhd"]).forEach(r=>{const n=me(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;Te(i,["tfdt"]).forEach(A=>{const l=A[0];let c=me(A,4);if(l===0)c-=t*a,c=Math.max(c,0),Wo(A,4,c);else{c*=Math.pow(2,32),c+=me(A,8),c-=t*a,c=Math.max(c,0);const h=Math.floor(c/(pn+1)),u=Math.floor(c%(pn+1));Wo(A,4,h),Wo(A,8,u)}})})})}function N0(s){const e={valid:null,remainder:null},t=Te(s,["moof"]);if(t){if(t.length<2)return e.remainder=s,e}else return e;const i=t[t.length-1];return e.valid=es(s,0,i.byteOffset-8),e.remainder=es(s,i.byteOffset-8),e}function ts(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function yc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return Te(i,["moof"]).map(A=>{const l=A.byteOffset-8;Te(A,["traf"]).map(h=>{const u=Te(h,["tfdt"]).map(d=>{const g=d[0];let f=me(d,4);return g===1&&(f*=Math.pow(2,32),f+=me(d,8)),f/r})[0];return u!==void 0&&(s=u),Te(h,["tfhd"]).map(d=>{const g=me(d,4),f=me(d,0)&16777215,p=(f&1)!==0,y=(f&2)!==0,v=(f&8)!==0;let Q=0;const C=(f&16)!==0;let T=0;const b=(f&32)!==0;let L=8;g===n&&(p&&(L+=8),y&&(L+=4),v&&(Q=me(d,L),L+=4),C&&(T=me(d,L),L+=4),b&&(L+=4),e.type==="video"&&(o=M0(e.codec)),Te(h,["trun"]).map(R=>{const P=R[0],k=me(R,0)&16777215,q=(k&1)!==0;let $=0;const te=(k&4)!==0,ee=(k&256)!==0;let S=0;const D=(k&512)!==0;let U=0;const B=(k&1024)!==0,w=(k&2048)!==0;let N=0;const H=me(R,4);let K=8;q&&($=me(R,K),K+=4),te&&(K+=4);let X=$+l;for(let se=0;se<H;se++){if(ee?(S=me(R,K),K+=4):S=Q,D?(U=me(R,K),K+=4):U=T,B&&(K+=4),w&&(P===0?N=me(R,K):N=Ic(R,K),K+=4),e.type===Ne.VIDEO){let ue=0;for(;ue<U;){const Ae=me(i,X);if(X+=4,O0(o,i[X])){const Ce=i.subarray(X,X+Ae);vc(Ce,o?2:1,s+N/r,t)}X+=Ae,ue+=Ae+4}}s+=S/r}}))})})}),t}function M0(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function O0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function vc(s,e,t,i){const r=Bc(s);let n=0;n+=e;let o=0,a=0,A=!1,l=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(l===255);const c=r.length-n;if(!A&&o===4&&n<r.length){if(A=!0,r[n++]===181){const u=Ec(r,n);if(n+=2,u===49){const d=me(r,n);if(n+=4,d===1195456820){const g=r[n++];if(g===3){const f=r[n++],p=31&f,y=64&f,v=y?2+p*3:0,Q=new Uint8Array(v);if(y){Q[0]=f;for(let C=1;C<v;C++)Q[C]=r[n++]}i.push({type:g,payloadType:o,pts:t,bytes:Q})}}}}}else if(o===5&&a<c){if(A=!0,a>16){const h=[];for(let g=0;g<16;g++){const f=r[n++].toString(16);h.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let g=0;g<u;g++)d[g]=r[n++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Xt(d),userDataBytes:d})}}else if(a<c)n+=a;else if(a>c)break}}function Bc(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function P0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;ht(s.subarray(l,l+1))!=="\0";)t+=ht(s.subarray(l,l+1)),l+=1;for(t+=ht(s.subarray(l,l+1)),l+=1;ht(s.subarray(l,l+1))!=="\0";)i+=ht(s.subarray(l,l+1)),l+=1;i+=ht(s.subarray(l,l+1)),l+=1,r=me(s,12),n=me(s,16),a=me(s,20),A=me(s,24),l=28}else if(e===1){l+=4,r=me(s,l),l+=4;const h=me(s,l);l+=4;const u=me(s,l);for(l+=4,o=4294967296*h+u,Number.isSafeInteger(o)||(o=Number.MAX_SAFE_INTEGER,F.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(s,l),l+=4,A=me(s,l),l+=4;ht(s.subarray(l,l+1))!=="\0";)t+=ht(s.subarray(l,l+1)),l+=1;for(t+=ht(s.subarray(l,l+1)),l+=1;ht(s.subarray(l,l+1))!=="\0";)i+=ht(s.subarray(l,l+1)),l+=1;i+=ht(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function U0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function G0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),U0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function H0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=zt.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let En={};class lr{static clearKeyUriToKeyIdMap(){En={}}constructor(e,t,i,r=[1],n=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case St.FAIRPLAY:case St.WIDEVINE:case St.PLAYREADY:case St.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&F.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=$0(e);return new lr(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=p0(this.uri);if(t)switch(this.keyFormat){case St.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case St.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=G0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const h=Yo(c).subarray(0,16);f0(h),this.keyId=h}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=En[this.uri];if(!i){const r=Object.keys(En).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),En[this.uri]=i}this.keyId=i}return this}}function $0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Qc=/\{\$([a-zA-Z0-9-_]+)\}/g;function bc(s){return Qc.test(s)}function wt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=qo(s,n))}}function qo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Qc,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function Sc(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function Y0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function In(){if(!(typeof self>"u"))return self.MediaSource||self.WebKitMediaSource}const K0={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},wc=In();function V0(s,e){const t=K0[e];return!!t&&t[s.slice(0,4)]===!0}function jo(s,e){var t;return(t=wc==null?void 0:wc.isTypeSupported(`${e||"video"}/mp4;codecs="${s}"`))!=null?t:!1}const Tc=/#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,xc=/#EXT-X-MEDIA:(.*)/g,J0=/^#EXT(?:INF|-X-TARGETDURATION):/m,Dc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),W0=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)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class $t{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static convertAVC1ToAVCOTI(e){const t=e.split(".");if(t.length>2){let i=t.shift()+".";return i+=parseInt(t.shift()).toString(16),i+=("000"+parseInt(t.shift()).toString(16)).slice(-4),i}return e}static resolve(e,t){return Go.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return J0.test(e)}static parseMasterPlaylist(e,t){const i=bc(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];Tc.lastIndex=0;let o;for(;(o=Tc.exec(e))!=null;)if(o[1]){var a;const l=new Ke(o[1]);wt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=qo(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("AVERAGE-BANDWIDTH")||l.decimalInteger("BANDWIDTH"),name:l.NAME,url:$t.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),q0((l.CODECS||"").split(/[ ,]+/).filter(d=>d),h),h.videoCodec&&h.videoCodec.indexOf("avc1")!==-1&&(h.videoCodec=$t.convertAVC1ToAVCOTI(h.videoCodec)),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new Ke(c);wt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=Rc(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):F.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new Ke(c);wt(r,h,["NAME","VALUE","QUERYPARAM"]),Sc(r,h,t)}break}case"CONTENT-STEERING":{const h=new Ke(c);wt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:$t.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Lc(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(xc.lastIndex=0;(r=xc.exec(e))!==null;){const l=new Ke(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,wt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?$t.resolve(l.URI,t):""};if(h!=null&&h.length){const g=$t.findGroup(h,d.groupId)||h[0];_c(d,g,"audioCodec"),_c(d,g,"textCodec")}u.push(d)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new d0(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new $o(r,t),p,y,v,Q=-1,C=!1;for(Dc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=bc(e);(p=Dc.exec(e))!==null;){C&&(C=!1,f=new $o(r,t),f.start=u,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null));const R=p[1];if(R){f.duration=parseFloat(R);const P=(" "+p[2]).slice(1);f.title=P||null,f.tagList.push(P?["INF",R,P]:["INF",R])}else if(p[3]){if(ce(f.duration)){f.start=u,v&&Nc(f,v,a),f.sn=c,f.level=i,f.cc=d,f.urlId=n,A.push(f);const P=(" "+p[3]).slice(1);f.relurl=qo(a,P),kc(f,g),g=f,u+=f.duration,c++,h=0,C=!0}}else if(p[4]){const P=(" "+p[4]).slice(1);g?f.setByteRange(P,g):f.setByteRange(P)}else if(p[5])f.rawProgramDateTime=(" "+p[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),Q===-1&&(Q=A.length);else{if(p=p[0].match(W0),!p){F.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const P=(" "+p[y]).slice(1),k=(" "+p[y+1]).slice(1),q=p[y+2]?(" "+p[y+2]).slice(1):"";switch(P){case"PLAYLIST-TYPE":a.type=k.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(k);break;case"SKIP":{const $=new Ke(k);wt(a,$,["RECENTLY-REMOVED-DATERANGES"]);const te=$.decimalInteger("SKIPPED-SEGMENTS");if(ce(te)){a.skippedSegments=te;for(let S=te;S--;)A.unshift(null);c+=te}const ee=$.enumeratedString("RECENTLY-REMOVED-DATERANGES");ee&&(a.recentlyRemovedDateranges=ee.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(k),1);break;case"VERSION":a.version=parseInt(k);break;case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(k||q)&&f.tagList.push(q?[k,q]:[k]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([P]);break;case"BITRATE":f.tagList.push([P,k]);break;case"DATERANGE":{const $=new Ke(k);wt(a,$,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),wt(a,$,$.clientAttrs);const te=new oc($,a.dateRanges[$.ID]);te.isValid||a.skippedSegments?a.dateRanges[te.id]=te:F.warn(`Ignoring invalid DATERANGE tag: "${k}"`),f.tagList.push(["EXT-X-DATERANGE",k]);break}case"DEFINE":{{const $=new Ke(k);wt(a,$,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in $?Y0(a,$,o):Sc(a,$,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(k);break;case"KEY":{const $=Rc(k,t,a);if($.isSupported()){if($.method==="NONE"){v=void 0;break}v||(v={}),v[$.keyFormat]&&(v=tt({},v)),v[$.keyFormat]=$}else F.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${k}"`);break}case"START":a.startTimeOffset=Lc(k);break;case"MAP":{const $=new Ke(k);if(wt(a,$,["BYTERANGE","URI"]),f.duration){const te=new $o(r,t);Fc(te,$,i,v),l=te,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else Fc(f,$,i,v),l=f,C=!0;break}case"SERVER-CONTROL":{const $=new Ke(k);a.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),a.holdBack=$.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const $=new Ke(k);a.partTarget=$.decimalFloatingPoint("PART-TARGET");break}case"PART":{let $=a.partList;$||($=a.partList=[]);const te=h>0?$[$.length-1]:void 0,ee=h++,S=new Ke(k);wt(a,S,["BYTERANGE","URI"]);const D=new h0(S,f,t,ee,te);$.push(D),f.duration+=D.duration;break}case"PRELOAD-HINT":{const $=new Ke(k);wt(a,$,["URI"]),a.preloadHint=$;break}case"RENDITION-REPORT":{const $=new Ke(k);wt(a,$,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push($);break}default:F.warn(`line parsed but not handled: ${p}`);break}}}g&&!g.relurl?(A.pop(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(kc(f,g),f.cc=d,a.fragmentHint=f,v&&Nc(f,v,a));const T=A.length,b=A[0],L=A[T-1];if(u+=a.skippedSegments*a.targetduration,u>0&&T&&L){a.averagetargetduration=u/T;const R=L.sn;a.endSN=R!=="initSegment"?R:0,a.live||(L.endList=!0),b&&(a.startCC=b.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,Q>0&&j0(A,Q),a}}function Rc(s,e,t){var i,r;const n=new Ke(s);wt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&F.error(`Invalid IV: ${n.IV}`);const h=a?$t.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new lr(o,h,c,u,A)}function Lc(s){const t=new Ke(s).decimalFloatingPoint("TIME-OFFSET");return ce(t)?t:null}function q0(s,e){["video","audio","text"].forEach(t=>{const i=s.filter(r=>V0(r,t));if(i.length){const r=i.filter(n=>n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0);e[`${t}Codec`]=r.length>0?r[0]:i[0],s=s.filter(n=>i.indexOf(n)===-1)}}),e.unknownCodecs=s}function _c(s,e,t){const i=e[t];i&&(s[t]=i)}function j0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function kc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),ce(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Fc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function Nc(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var De={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Mc(s){const{type:e}=s;switch(e){case De.AUDIO_TRACK:return Ee.AUDIO;case De.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function Xo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class X0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:De.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,url:n,deliveryDirectives:o}=t;this.load({id:i,level:r,responseType:"text",type:De.LEVEL,url:n,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:De.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:De.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url){F.trace("[playlist-loader]: playlist request ongoing");return}F.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===De.MANIFEST?n=i.manifestLoadPolicy.default:n=tt({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part){let l;if(e.type===De.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===De.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===De.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,h=l.targetduration;if(c&&h){const u=Math.max(c*3,h*.8)*1e3;n=tt({},n,{maxTimeToFirstByteMs:Math.min(u,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,h,u)=>{const d=this.getInternalLoader(h);this.resetInternalLoader(h.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),$t.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,h,u||null,d):this.handleMasterPlaylist(l,c,h,u)},onError:(l,c,h,u)=>{this.handleNetworkError(c,h,!1,l,u)},onTimeout:(l,c,h)=>{this.handleNetworkError(c,h,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Xo(e,i),A=$t.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=$t.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(Q=>!Q.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(F.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ke({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:p,captions:y,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Xo(e,i),h=ce(a)?a:0,u=ce(A)?A:h,d=Mc(i),g=$t.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===De.MANIFEST){const f={attrs:new Ke({}),bitrate:0,details:g,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.MANIFEST_PARSING_ERROR,fatal:t.type===De.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===De.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===De.AUDIO_TRACK||e.type===De.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);F.warn(`[playlist-loader]: ${o}`);let A=Y.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case De.MANIFEST:A=i?Y.MANIFEST_LOAD_TIMEOUT:Y.MANIFEST_LOAD_ERROR,l=!0;break;case De.LEVEL:A=i?Y.LEVEL_LOAD_TIMEOUT:Y.LEVEL_LOAD_ERROR,l=!1;break;case De.AUDIO_TRACK:A=i?Y.AUDIO_TRACK_LOAD_TIMEOUT:Y.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case De.SUBTITLE_TRACK:A=i?Y.SUBTITLE_TRACK_LOAD_TIMEOUT:Y.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:fe.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=(t==null?void 0:t.url)||e.url;h.response=bt({url:u,data:void 0},r)}this.hls.trigger(E.ERROR,h)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:h,deliveryDirectives:u}=r,d=Xo(t,r),g=Mc(r),f=typeof r.level=="number"&&g===Ee.MAIN?l:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case De.MANIFEST:case De.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case De.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case De.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function Oc(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function Pc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){F.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){F.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function fs(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function zo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=Z0(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function z0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function Z0(s,e,t){const i=[],r=z0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}var Yt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const ep=.25;function Zo(){if(!(typeof self>"u"))return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}const mn=(()=>{const s=Zo();try{new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ea(s,e){return s.getTime()/1e3-e}function tp(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class ip{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(fs(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Oc(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Zo();for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Yt.emsg&&!i||!r)continue;const l=fc(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>mn&&(h=mn),h-c<=0&&(h=c+ep);for(let d=0;d<l.length;d++){const g=l[d];if(!gc(g)){this.updateId3CueEnds(c,A);const f=new o(c,h,"");f.value=g,A&&(f.type=A),this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===mn&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Yt.audioId3&&A:r==="video"?l=c=>c.type===Yt.emsg&&a:l=c=>c.type===Yt.audioId3&&A||c.type===Yt.emsg&&a,zo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!ce(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Zo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=i[h],g=(d==null?void 0:d.cues)||{};let f=(d==null?void 0:d.durationKnown)||!1;const p=ea(u.startDate,A);let y=mn;const v=u.endDate;if(v)y=ea(v,A),f=!0;else if(u.endOnNext&&!f){const C=o.reduce((T,b)=>{const L=n[b];return L.class===u.class&&L.id!==b&&L.startDate>u.startDate&&T.push(L),T},[]).sort((T,b)=>T.startDate.getTime()-b.startDate.getTime())[0];C&&(y=ea(C.startDate,A),f=!0)}const Q=Object.keys(u.attr);for(let C=0;C<Q.length;C++){const T=Q[C];if(!l0(T))continue;let b=g[T];if(b)f&&!d.durationKnown&&(b.endTime=y);else{let L=u.attr[T];b=new l(p,y,""),c0(T)&&(L=tp(L)),b.value={key:T,data:L},b.type=Yt.dateRange,b.id=h,this.id3Track.addCue(b),g[T]=b}}i[h]={cues:g,dateRange:u,durationKnown:f}}}}class sp{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r,h=1;return l+Math.min(this.stallCount*h,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===Y.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&F.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration),l=a<A;if(t.live&&l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ta=["NONE","TYPE-0","TYPE-1",null];var cr={No:"",Yes:"YES",v2:"v2"};function rp(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?cr.v2:cr.Yes:cr.No}class Uc{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class hr{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=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.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>t).join(",").replace(/\.[^.,]+/g,"")}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get attrs(){return this._attrs[this._urlId]}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get uri(){return this.url[this._urlId]||""}get urlId(){return this._urlId}set urlId(e){const t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}get audioGroupId(){var e;return(e=this.audioGroupIds)==null?void 0:e[this.urlId]}get textGroupId(){var e;return(e=this.textGroupIds)==null?void 0:e[this.urlId]}addFallback(e){this.url.push(e.url),this._attrs.push(e.attrs)}}function ia(s,e){const t=e.startPTS;if(ce(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function Gc(s,e,t,i,r,n){i-t<=0&&(F.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(ce(l)){const p=Math.abs(l-t);ce(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const h=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const u=e.sn;if(!s||u<s.startSN||u>s.endSN)return 0;let d;const g=u-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)ia(f[d],f[d-1]);for(d=g;d<f.length-1;d++)ia(f[d],f[d+1]);return s.fragmentHint&&ia(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function np(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(Ap(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),ce(A.startPTS)&&ce(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,l.urlId=A.urlId,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){F.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=op(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){F.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),ap(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?Gc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Hc(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function op(s,e,t){const i=tt({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new oc(e[r].attr,i[r]);n.isValid?i[r]=n:F.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function ap(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function Ap(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let h=a[l];i&&!h&&l<i&&(h=e.fragments[l]=c),c&&h&&t(c,h)}}function Hc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||sa(e,i[t].start)}function sa(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function lp(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments,r=4;if(i.length&&t*r>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function cp(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function $c(s,e,t){var i;return s!=null&&s.details?Yc((i=s.details)==null?void 0:i.partList,e,t):null}function Yc(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function Cn(s){switch(s.details){case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_TIMEOUT:case Y.LEVEL_LOAD_TIMEOUT:case Y.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Kc(s,e){const t=Cn(e);return s.default[`${t?"timeout":"error"}Retry`]}function ra(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Vc(s){return bt(bt({},s),{errorRetry:null,timeoutRetry:null})}function yn(s,e,t,i){return!!s&&e<s.maxNumRetry&&(hp(i)||!!t)}function hp(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Jc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function up(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!ce(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(dp(e,t,o))return o}return null}function ur(s,e,t=0,i=0){let r=null;if(s?r=e[s.sn-e[0].sn+1]||null:t===0&&e[0].start===0&&(r=e[0]),r&&na(t,i,r)===0)return r;const n=Jc.search(e,na.bind(null,t,i));return n&&(n!==s||!r)?n:r}function na(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function dp(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function gp(s,e){return Jc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}const fp=3e5;var ft={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Nt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class pp{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=F.log.bind(F,"[info]:"),this.warn=F.warn.bind(F,"[warning]:"),this.error=F.error.bind(F,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){this.playlistError=0}stopLoad(){}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 i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Y.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:ft.DoNothing,flags:Nt.None};return}case Y.FRAG_GAP:case Y.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ft.SendAlternateToPenaltyBox;return}case Y.LEVEL_EMPTY_ERROR:case Y.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===Ee.MAIN?t.level:n.loadLevel;t.details===Y.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(A=a.levelDetails)!=null&&A.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case Y.LEVEL_LOAD_ERROR:case Y.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case Y.AUDIO_TRACK_LOAD_ERROR:case Y.AUDIO_TRACK_LOAD_TIMEOUT:case Y.SUBTITLE_LOAD_ERROR:case Y.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===De.AUDIO_TRACK&&o.groupId===l.audioGroupId||o.type===De.SUBTITLE_TRACK&&o.groupId===l.textGroupId)){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ft.SendAlternateToPenaltyBox,t.errorAction.flags=Nt.MoveAllAlternatesMatchingHost;return}}return;case Y.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c&&(t.errorAction={action:ft.SendAlternateToPenaltyBox,flags:Nt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c})}return;case Y.BUFFER_ADD_CODEC_ERROR:case Y.REMUX_ALLOC_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case Y.INTERNAL_EXCEPTION:case Y.BUFFER_APPENDING_ERROR:case Y.BUFFER_APPEND_ERROR:case Y.BUFFER_FULL_ERROR:case Y.LEVEL_SWITCH_ERROR:case Y.BUFFER_STALLED_ERROR:case Y.BUFFER_SEEK_OVER_HOLE:case Y.BUFFER_NUDGE_ON_STALL:t.errorAction={action:ft.DoNothing,flags:Nt.None};return}if(t.type===fe.KEY_SYSTEM_ERROR){const l=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l);return}}getPlaylistRetryOrSwitchAction(e,t){var i;const r=this.hls,n=Kc(r.config.playlistLoadPolicy,e),o=this.playlistError++,a=(i=e.response)==null?void 0:i.code;if(yn(n,o,Cn(e),a))return{action:ft.RetryRequest,flags:Nt.None,retryConfig:n,retryCount:o};const l=this.getLevelSwitchAction(e,t);return n&&(l.retryConfig=n,l.retryCount=o),l}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=Kc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(r){var l;e.details!==Y.FRAG_GAP&&r.fragmentError++;const h=(l=e.response)==null?void 0:l.code;if(yn(a,A,Cn(e),h))return{action:ft.RetryRequest,flags:Nt.None,retryConfig:a,retryCount:A}}const c=this.getLevelSwitchAction(e,i);return a&&(c.retryConfig=a,c.retryCount=A),c}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){var n,o;let a=-1;const{levels:A,loadLevel:l,minAutoLevel:c,maxAutoLevel:h}=i,u=(n=e.frag)==null?void 0:n.type,{type:d,groupId:g}=(o=e.context)!=null?o:{};for(let f=A.length;f--;){const p=(f+l)%A.length;if(p!==l&&p>=c&&p<=h&&A[p].loadError===0){const y=A[p];if(e.details===Y.FRAG_GAP&&e.frag){const v=A[p].details;if(v){const Q=ur(e.frag,v.fragments,e.frag.start);if(Q!=null&&Q.gap)continue}}else{if(d===De.AUDIO_TRACK&&g===y.audioGroupId||d===De.SUBTITLE_TRACK&&g===y.textGroupId)continue;if(u===Ee.AUDIO&&r.audioGroupId===y.audioGroupId||u===Ee.SUBTITLE&&r.textGroupId===y.textGroupId)continue}a=p;break}}if(a>-1&&i.loadLevel!==a)return e.levelRetry=!0,this.playlistError=0,{action:ft.SendAlternateToPenaltyBox,flags:Nt.None,nextAutoLevel:a}}return{action:ft.SendAlternateToPenaltyBox,flags:Nt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ft.DoNothing:break;case ft.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Y.FRAG_GAP&&(t.fatal=!0);break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Nt.None:this.switchLevel(e,o);break;case Nt.MoveAllAlternatesMatchingHost:i.resolved||(i.resolved=this.redundantFailover(e));break;case Nt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=ta[ta.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}redundantFailover(e){const{hls:t,penalizedRenditions:i}=this,r=e.parent===Ee.MAIN?e.level:t.loadLevel,n=t.levels[r],o=n.url.length,a=e.frag?e.frag.urlId:n.urlId;n.urlId===a&&(!e.frag||n.details)&&this.penalizeRendition(n,e);for(let A=1;A<o;A++){const l=(a+A)%o,c=i[l];if(!c||Ep(c,e,i[a]))return this.warn(`Switching to Redundant Stream ${l+1}/${o}: "${n.url[l]}" after ${e.details}`),this.playlistError=0,t.levels.forEach(h=>{h.urlId=l}),t.nextLoadLevel=r,!0}return!1}penalizeRendition(e,t){const{penalizedRenditions:i}=this,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r}}function Ep(s,e,t){if(performance.now()-s.lastErrorPerfMs>fp)return!0;const i=s.details;if(e.details===Y.FRAG_GAP&&i&&e.frag){const r=e.frag.start,n=ur(null,i.fragments,r);if(n&&!n.gap)return!0}if(t&&s.errors.length<t.errors.length){const r=s.errors[s.errors.length-1];if(i&&r.frag&&e.frag&&Math.abs(r.frag.start-e.frag.start)>i.targetduration*3)return!0}return!1}class oa{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=F.log.bind(F,`${t}:`),this.warn=F.warn.bind(F,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){clearTimeout(this.timer),this.timer=-1}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const o=i[n];let a;try{a=new self.URL(o.URI,t.url).href}catch(A){F.warn(`Could not construct new URL for Rendition Report: ${A}`),a=o.URI||""}if(a===e){r=n;break}else a===e.substring(0,a.length)&&(r=n)}if(r!==-1){const n=i[r],o=parseInt(n["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let a=parseInt(n["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const A=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&A>t.partTarget&&(a+=1)}return new Uc(o,a>=0?a:void 0,cr.No)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&np(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const p=this.hls.config.lowLatencyMode,y=r.lastPartSn,v=r.endSN,Q=r.lastPartIndex,C=Q!==-1,T=y===v,b=p?0:Q;C?(l=T?v+1:y,c=T?b:Q+1):l=v+1;const L=r.age,R=L+r.ageHeader;let P=Math.min(R-r.partTarget,r.targetduration*1.5);if(P>0){if(i&&P>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${P} with playlist age: ${r.age}`),P=0;else{const k=Math.floor(P/r.targetduration);if(l+=k,c!==void 0){const q=Math.round(P%r.targetduration/r.partTarget);c+=q}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${L.toFixed(2)}s goal: ${P} skip sn ${k} to part ${c}`)}r.tuneInGoal=P}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!T){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const h=this.hls.mainForwardBufferInfo,u=h?h.end-h.len:0,d=(r.edge-u)*1e3,g=lp(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=rp(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=cr.No),new Uc(i,r,n)}checkRetry(e){const t=e.details,i=Cn(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===ft.RetryRequest||!r.resolved&&n===ft.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=ra(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}let aa;class Ip extends oa{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}startLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.startLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=[],r={};let n;t.levels.forEach(o=>{var a;const A=o.attrs;((a=o.audioCodec)==null?void 0:a.indexOf("mp4a.40.34"))!==-1&&(aa||(aa=/chrome|firefox/i.test(navigator.userAgent)),aa&&(o.audioCodec=void 0));const{AUDIO:l,CODECS:c,"FRAME-RATE":h,"PATHWAY-ID":u,RESOLUTION:d,SUBTITLES:g}=A,p=`${`${u||"."}-`}${o.bitrate}-${d}-${h}-${c}`;n=r[p],n?n.addFallback(o):(n=new hr(o),r[p]=n,i.push(n)),vn(n,"audio",l),vn(n,"text",g)}),this.filterAndSortMediaOptions(i,t)}filterAndSortMediaOptions(e,t){let i=[],r=[],n=!1,o=!1,a=!1,A=e.filter(({audioCodec:d,videoCodec:g,width:f,height:p,unknownCodecs:y})=>(n||(n=!!(f&&p)),o||(o=!!g),a||(a=!!d),!(y!=null&&y.length)&&(!d||jo(d,"audio"))&&(!g||jo(g,"video"))));if((n||o)&&a&&(A=A.filter(({videoCodec:d,width:g,height:f})=>!!d||!!(g&&f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){const d=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:d,reason:d.message})}});return}t.audioTracks&&(i=t.audioTracks.filter(d=>!d.audioCodec||jo(d.audioCodec,"audio")),Wc(i)),t.subtitles&&(r=t.subtitles,Wc(r));const l=A.slice(0);A.sort((d,g)=>d.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"]?(d.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1:d.bitrate!==g.bitrate?d.bitrate-g.bitrate:d.attrs["FRAME-RATE"]!==g.attrs["FRAME-RATE"]?d.attrs.decimalFloatingPoint("FRAME-RATE")-g.attrs.decimalFloatingPoint("FRAME-RATE"):d.attrs.SCORE!==g.attrs.SCORE?d.attrs.decimalFloatingPoint("SCORE")-g.attrs.decimalFloatingPoint("SCORE"):n&&d.height!==g.height?d.height-g.height:0);let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let d=0;d<l.length;d++)if(l[d].pathwayId===A[0].pathwayId){c=l[d];break}}this._levels=A;for(let d=0;d<A.length;d++)if(A[d]===c){this._firstLevel=d,this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${c.bitrate}`);break}const h=a&&!o,u={levels:A,audioTracks:i,subtitleTracks:r,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:o,altAudio:!h&&i.some(d=>!!d.url)};this.hls.trigger(E.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e}${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A=tt({},o,{level:e,maxBitrate:o.maxBitrate,attrs:o.attrs,uri:o.uri,urlId:o.urlId});delete A._attrs,delete A._urlId,this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this._firstLevel}else return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===De.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragLoaded(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const i=this._levels[t.level];i!==void 0&&(i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}onAudioTrackSwitched(e,t){const i=this.currentLevel;if(!i)return;const r=this.hls.audioTracks[t.id].groupId;if(i.audioGroupIds&&i.audioGroupId!==r){let n=-1;for(let o=0;o<i.audioGroupIds.length;o++)if(i.audioGroupIds[o]===r){n=o;break}n!==-1&&n!==i.urlId&&(i.urlId=n,this.canLoad&&this.startLoad())}}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){const r=i.urlId;let n=i.uri;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const o=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} URI ${r+1}/${i.url.length} ${n}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:n,level:t,id:r,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,t){const i=(n,o)=>o!==t,r=this._levels.filter((n,o)=>o!==e?!0:n.url.length>1&&t!==void 0?(n.url=n.url.filter(i),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(i)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(i)),n.urlId=0,!0):(this.steering&&this.steering.removeLevel(n),!1));this.hls.trigger(E.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){t.forEach((i,r)=>{const{details:n}=i;n!=null&&n.fragments&&n.fragments.forEach(o=>{o.level=r})}),this._levels=t}}function vn(s,e,t){t&&(e==="audio"?(s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds[s.url.length-1]=t):e==="text"&&(s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds[s.url.length-1]=t))}function Wc(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}var nt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class mp{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=ps(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],h=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,h,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Bn(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=ps(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h)n.partial=!0,n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});else if(a<=h)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&Bn(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Bn(t))}getState(e){const t=ps(e),i=this.fragments[t];return i?i.buffered?Bn(i)?nt.PARTIAL:nt.OK:nt.APPENDING:nt.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=ps(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ps(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=ps(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function Bn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function ps(s){return`${s.type}_${s.level}_${s.urlId}_${s.sn}`}const qc=Math.pow(2,17);class Cp{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new gi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(Xc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=jc(e),h=Vc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:qc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l);let y=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),a({frag:e,part:null,payload:y,networkDetails:p})},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:bt({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,p)=>{t&&t({frag:e,part:null,payload:f,networkDetails:p})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(Xc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=jc(e,t),h=Vc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:qc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};i(y),a(y)},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:bt({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new gi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),h=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function jc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(ce(r)&&ce(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Xc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:fe.MEDIA_ERROR,details:Y.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new gi(i)}class gi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class yp{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const t in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.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=Y.KEY_LOAD_ERROR,i,r,n){return new gi({type:fe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{const{frag:p,keyInfo:y,url:v}=g;if(!p.decryptdata||y!==this.keyUriToKeyInfo[v])return a(this.createKeyLoadError(p,Y.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));y.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,bt({url:A.url,data:void 0},u)))},onTimeout:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}class vp{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(){}}const Bp={length:0,start:()=>0,end:()=>0};class Ge{static isBuffered(e,t){try{if(e){const i=Ge.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=Ge.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const h=l.start-c.start;return h||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const h=r[c-1].end;e[l].start-h<i?e[l].end>h&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,h=r[l].end;if(t+i>=c&&t<h)a=c,A=h,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return F.log("failed to get media.buffered",t),Bp}}}class Aa{constructor(e,t,i,r=0,n=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Qn(),this.buffering={audio:Qn(),video:Qn(),audiovideo:Qn()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function Qn(){return{start:0,executeStart:0,executeEnd:0,end:0}}function zc(s,e){let t=null;for(let i=0,r=s.length;i<r;i++){const n=s[i];if(n&&n.cc===e){t=n;break}}return t}function Qp(s,e,t){return!!(e.details&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function bp(s,e,t=0){const i=s.fragments,r=e.fragments;if(!r.length||!i.length){F.log("No fragments to align");return}const n=zc(i,r[0].cc);if(!n||n&&!n.startPTS){F.log("No frag in previous level to align on");return}return n}function Zc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function la(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Zc(t[i],s);e.fragmentHint&&Zc(e.fragmentHint,s),e.alignedSliding=!0}function Sp(s,e,t){e&&(wp(s,t,e),!t.alignedSliding&&e.details&&Tp(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&Hc(e.details,t))}function wp(s,e,t){if(Qp(s,t,e)){const i=bp(t.details,e);i&&ce(i.start)&&(F.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),la(i.start,e))}}function Tp(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=e.fragments[0].programDateTime,i=s.fragments[0].programDateTime,r=(i-t)/1e3+e.fragments[0].start;r&&ce(r)&&(F.log(`Adjusting PTS using programDateTime delta ${i-t}ms, sliding:${r.toFixed(3)} ${s.url} `),la(r,s))}function eh(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;const r=Math.round(i.length/2)-1,n=i[r],o=zc(t,n.cc)||t[Math.round(t.length/2)-1],a=n.programDateTime,A=o.programDateTime;if(a===null||A===null)return;const l=(A-a)/1e3-(o.start-n.start);la(l,s)}class xp{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 Dp{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Rp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?es(s,0,e-t):s}class Lp{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],h=A[2],u=A[3],d=new Uint32Array(256);let g=0,f=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){let y=f^f<<1^f<<2^f<<3^f<<4;y=y>>>8^y&255^99,e[g]=y,t[y]=g;const v=d[g],Q=d[v],C=d[Q];let T=d[y]*257^y*16843008;r[g]=T<<24|T>>>8,n[g]=T<<16|T>>>16,o[g]=T<<8|T>>>24,a[g]=T,T=C*16843009^Q*65537^v*257^g*16843008,l[y]=T<<24|T>>>8,c[y]=T<<16|T>>>16,h[y]=T<<8|T>>>24,u[y]=T,g?(g=v^d[d[d[C^v]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],y=d[3];let v,Q;for(a=0;a<o;a++){if(a<n){v=l[a]=t[a];continue}Q=v,a%n===0?(Q=Q<<8|Q>>>24,Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255],Q^=u[a/n|0]<<24):n>6&&a%n===4&&(Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255]),l[a]=v=(l[a-n]^Q)>>>0}for(A=0;A<o;A++)a=o-A,A&3?Q=l[a]:Q=l[a-4],A<4||a<=4?c[A]=Q:c[A]=g[h[Q>>>24]]^f[h[Q>>>16&255]]^p[h[Q>>>8&255]]^y[h[Q&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],h=a[3],u=this.uint8ArrayToUint32Array_(i);let d=u[0],g=u[1],f=u[2],p=u[3];const y=new Int32Array(e),v=new Int32Array(y.length);let Q,C,T,b,L,R,P,k,q,$,te,ee,S,D;const U=this.networkToHostOrderSwap;for(;t<y.length;){for(q=U(y[t]),$=U(y[t+1]),te=U(y[t+2]),ee=U(y[t+3]),L=q^n[0],R=ee^n[1],P=te^n[2],k=$^n[3],S=4,D=1;D<r;D++)Q=A[L>>>24]^l[R>>16&255]^c[P>>8&255]^h[k&255]^n[S],C=A[R>>>24]^l[P>>16&255]^c[k>>8&255]^h[L&255]^n[S+1],T=A[P>>>24]^l[k>>16&255]^c[L>>8&255]^h[R&255]^n[S+2],b=A[k>>>24]^l[L>>16&255]^c[R>>8&255]^h[P&255]^n[S+3],L=Q,R=C,P=T,k=b,S=S+4;Q=o[L>>>24]<<24^o[R>>16&255]<<16^o[P>>8&255]<<8^o[k&255]^n[S],C=o[R>>>24]<<24^o[P>>16&255]<<16^o[k>>8&255]<<8^o[L&255]^n[S+1],T=o[P>>>24]<<24^o[k>>16&255]<<16^o[L>>8&255]<<8^o[R&255]^n[S+2],b=o[k>>>24]<<24^o[L>>16&255]<<16^o[R>>8&255]<<8^o[P&255]^n[S+3],v[t]=U(Q^d),v[t+1]=U(b^g),v[t+2]=U(T^f),v[t+3]=U(C^p),d=q,g=$,f=te,p=ee,t=t+4}return v.buffer}}const _p=16;class ca{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Rp(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=ts(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new Lp),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=es(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Dp(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new xp(r,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(F.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%_p;return i!==e.length&&(t=es(e,0,i),this.remainderData=es(e,i)),t}logOnce(e){this.logEnabled&&(F.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const kp={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},W={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 ha extends vp{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=W.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=F.log.bind(F,`${r}:`),this.warn=F.warn.bind(F,`${r}:`),this.hls=e,this.fragmentLoader=new Cp(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ca(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=W.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return Ge.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levels[this.levelLastLoaded])==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===W.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=Ge.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${ce(o)?o.toFixed(3):o}, state: ${n}`),this.state===W.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.stopLoad(),super.onHandlerDestroying()}onHandlerDestroyed(){this.state=W.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===W.FRAG_LOADING||!this.fragCurrent&&o===W.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=W.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===W.STOPPED||this.state===W.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===nt.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===nt.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,i})}return i}).then(i=>{const{fragCurrent:r,hls:n,levels:o}=this;if(!o)throw new Error("init load aborted, missing levels");const a=e.stats;this.state=W.IDLE,t.fragmentError=0,e.data=new Uint8Array(i.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),i.frag===r&&n.trigger(E.FRAG_BUFFERED,{stats:a,frag:r,part:null,id:e.type}),this.tick()}).catch(i=>{this.state===W.STOPPED||this.state===W.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?kp.toString(Ge.getBuffered(a)):"(detached)"})`),this.state=W.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new Aa(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=W.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===W.KEY_LOADING&&(this.state=W.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=W.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,u,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),ce(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=W.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(E.FRAG_LOADED,u);const g=$c(i,e.sn,h.index+1)||Yc(l,e.sn,h.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Y.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==W.PARSING){!this.fragCurrent&&this.state!==W.STOPPED&&this.state!==W.ERROR&&(this.state=W.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?$c(a,n,o):null,l=A?A.fragment:cp(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==W.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=ts(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ge.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Ge.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return ce(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=Ge.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return Ge.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,i=e||t.maxBufferLength;return t.maxMaxBufferLength>=i?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(a=this.getInitialLiveFragment(t,i),this.startPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===nt.OK||i===nt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=up(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=gp(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,l=r.maxFragLookUpTolerance,c=i.partList,h=!!(r.lowLatencyMode&&c!=null&&c.length&&A);h&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let u;if(e<t){const d=e>t-l?0:l;u=ur(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,g=this.fragmentTracker.getState(u);if((g===nt.OK||g===nt.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const p=o[d+1];u.sn<a&&this.fragmentTracker.getState(p)!==nt.OK?u=p:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t){const{levels:i,levelLastLoaded:r,fragPrevious:n}=this,o=r!==null?i[r]:null,a=e.fragments.length;if(!a)return this.warn("No fragments in live playlist"),0;const A=e.fragments[0].start,l=!t,c=e.alignedSliding&&ce(A);if(l||!c&&!A){Sp(n,o,e);const h=e.fragments[0].start;return this.log(`Live playlist sliding: ${h.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${n?n.sn:"na"} fragments: ${a}`),h}return A}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&ce(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==W.FRAG_LOADING_WAITING_RETRY)&&(this.state=W.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===Y.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===ft.RetryRequest&&l){var c;this.resetStartWhenNotLoaded((c=this.levelLastLoaded)!=null?c:i.level);const h=ra(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${h}ms`),o.resolved=!0,this.retryDate=self.performance.now()+h,this.state=W.FRAG_LOADING_WAITING_RETRY}else l&&o?(this.resetFragmentErrors(e),A<l.maxNumRetry?n||(o.resolved=!0):F.warn(`${t.details} reached or exceeded max retry (${A})`)):(o==null?void 0:o.action)===ft.SendAlternateToPenaltyBox?this.state=W.WAITING_LEVEL:this.state=W.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===W.PARSING||this.state===W.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==W.STOPPED&&(this.state=W.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ge.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===W.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=W.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=this.levels?this.levels[e].details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){var t;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((t=this.levelLastLoaded)!=null?t:e.level),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:Gc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1))i.fragmentError=0;else if(((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=W.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){if(e.event==="demuxerWorker"){var t,i,r;this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded((t=(i=this.levelLastLoaded)!=null?i:(r=this.fragCurrent)==null?void 0:r.level)!=null?t:0),this.resetLoadingState()}}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function th(){return self.SourceBuffer||self.WebKitSourceBuffer}function Fp(){const s=In();if(!s)return!1;const e=th(),t=s&&typeof s.isTypeSupported=="function"&&s.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function";return!!t&&!!i}function Np(){var s;const e=th();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}function Mp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Op(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function Pp(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Zt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ih{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ts(this.cachedData,e),this.cachedData=null);let i=gn(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?y0(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&ce(A))&&(this.basePTS=Up(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yt.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else C0(e,r)?(i=gn(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yt.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=es(e,n);this.cachedData?this.cachedData=ts(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:Zt(),id3Track:a,textTrack:Zt()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Zt(),id3Track:this._id3Track,textTrack:Zt()}}destroy(){}}const Up=(s,e,t)=>{if(ce(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function Gp(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){s.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!0,reason:`invalid ADTS sampling index:${h}`});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,F.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${h}`),/firefox/i.test(A)?h>=6?(r=5,a=new Array(4),n=h-3):(r=2,a=new Array(2),n=h):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=h):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&h>=6?n=h-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(h>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=h)),a[0]=r<<3,a[0]|=(h&14)>>1,a[1]|=(h&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[h],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function sh(s,e){return s[e]===255&&(s[e+1]&246)===240}function rh(s,e){return s[e+1]&1?7:9}function ua(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function Hp(s,e){return e+5<s.length}function bn(s,e){return e+1<s.length&&sh(s,e)}function $p(s,e){return Hp(s,e)&&sh(s,e)&&ua(s,e)<=s.length-e}function Yp(s,e){if(bn(s,e)){const t=rh(s,e);if(e+t>=s.length)return!1;const i=ua(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||bn(s,r)}return!1}function nh(s,e,t,i,r){if(!s.samplerate){const n=Gp(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,F.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function oh(s){return 9216e4/s}function Kp(s,e){const t=rh(s,e);if(e+t<=s.length){const i=ua(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function ah(s,e,t,i,r){const n=oh(s.samplerate),o=i+r*n,a=Kp(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}class Vp extends ih{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(gn(e,0)||[]).length;for(let r=e.length;i<r;i++)if(Yp(e,i))return F.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return $p(e,t)}appendFrame(e,t,i){nh(e,this.observer,t,i,e.manifestCodec);const r=ah(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Jp=/\/emsg[-/]ID3/i;class Wp{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=Zt("video",1),o=this.audioTrack=Zt("audio",1),a=this.txtTrack=Zt("text",1);if(this.id3Track=Zt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=mc(e);if(A.video){const{id:l,timescale:c,codec:h}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=h}if(A.audio){const{id:l,timescale:c,codec:h}=A.audio;o.id=l,o.timescale=c,o.codec=h}a.id=pc.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return e=e.length>16384?e.subarray(0,16384):e,Te(e,["moof"]).length>0}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ts(this.remainderData,e));const a=N0(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=yc(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=yc(e,t),{videoTrack:t,audioTrack:Zt(),id3Track:r,textTrack:Zt()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=Te(e.samples,["emsg"]);r&&r.forEach(n=>{const o=P0(n);if(Jp.test(o.schemeIdUri)){const a=ce(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Yt.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}let Sn=null;const qp=[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],jp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Xp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],zp=[0,1,1,4];function Ah(s,e,t,i,r){if(t+24>e.length)return;const n=lh(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function lh(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=qp[A*14+r-1]*1e3,h=jp[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=Xp[t][i],g=zp[i],f=d*8*g,p=Math.floor(d*l/h+o)*g;if(Sn===null){const Q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sn=Q?parseInt(Q[1]):0}return!!Sn&&Sn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:p,samplesPerFrame:f}}}function da(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function ch(s,e){return e+1<s.length&&da(s,e)}function Zp(s,e){return da(s,e)&&4<=s.length-e}function eE(s,e){if(e+1<s.length&&da(s,e)){const i=lh(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||ch(s,n)}return!1}class hh{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&F.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const p=A();if(l(5),u(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const b=c();if(b===3&&u(1),g(),g(),u(1),h())for(o=b!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const y=c();if(y===0)c();else if(y===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const v=c(),Q=c(),C=l(1);C===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let T=[1,1];if(h()&&h())switch(A()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((v+1)*16-e*2-t*2),height:(2-C)*(Q+1)*16-(C?2:4)*(i+r),pixelRatio:T}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class tE{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ca(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=Bc(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const pt=188;class ki{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=i}static probe(e){const t=ki.syncOffset(e);return t>0&&F.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(pt*5,e.length-pt)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=pt)if(e[A]===71){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+pt*99,e.length-pt)+1)),n||(n=ga(e,A)===0),n&&a>1&&(o===0&&a>2||A+pt>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:pc[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=ki.createTrack("video"),this._audioTrack=ki.createTrack("audio",r),this._id3Track=ki.createTrack("id3"),this._txtTrack=ki.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_avcTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const o=this._avcTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,y=this.pmtParsed,v=this._pmtId,Q=e.length;if(this.remainderData&&(e=ts(this.remainderData,e),Q=e.length,this.remainderData=null),Q<pt&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,ki.syncOffset(e));Q-=(Q-C)%pt,Q<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,Q,e.buffer.byteLength-Q));let T=0;for(let L=C;L<Q;L+=pt)if(e[L]===71){const R=!!(e[L+1]&64),P=ga(e,L),k=(e[L+3]&48)>>4;let q;if(k>1){if(q=L+5+e[L+4],q===L+pt)continue}else q=L+4;switch(P){case c:R&&(h&&(n=Es(h))&&this.parseAVCPES(o,l,n,!1),h={data:[],size:0}),h&&(h.data.push(e.subarray(q,L+pt)),h.size+=L+pt-q);break;case u:if(R){if(g&&(n=Es(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(q,L+pt)),g.size+=L+pt-q);break;case d:R&&(f&&(n=Es(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(q,L+pt)),f.size+=L+pt-q);break;case 0:R&&(q+=e[q]+1),v=this._pmtId=iE(e,q);break;case v:{R&&(q+=e[q]+1);const $=sE(e,q,this.typeSupported,i);c=$.avc,c>0&&(o.pid=c),u=$.audio,u>0&&(a.pid=u,a.segmentCodec=$.segmentCodec),d=$.id3,d>0&&(A.pid=d),p!==null&&!y&&(F.warn(`MPEG-TS PMT found at ${L} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,L=C-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=P;break}}else T++;if(T>0){const L=new Error(`Found ${T} TS packet/s that do not start with 0x47`);this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:L,reason:L.message})}o.pesData=h,a.pesData=g,A.pesData=f;const b={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(b),b}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=Es(o))?(this.parseAVCPES(i,n,l,!0),i.pesData=null):i.pesData=o,a&&(l=Es(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break}t.pesData=null}else a!=null&&a.size&&F.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=Es(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new tE(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAVCPES(e,t,i,r){const n=this.parseAVCNALu(e,i.data);let o=this.avcSample,a,A=!1;i.data=null,o&&n.length&&!e.audFound&&(dr(o,e),o=this.avcSample=wn(!1,i.pts,i.dts,"")),n.forEach(l=>{var c;switch(l.type){case 1:{let u=!1;a=!0;const d=l.data;if(A&&d.length>4){const g=new hh(d).readSliceType();(g===2||g===4||g===7||g===9)&&(u=!0)}if(u){var h;(h=o)!=null&&h.frame&&!o.key&&(dr(o,e),o=this.avcSample=null)}o||(o=this.avcSample=wn(!0,i.pts,i.dts,"")),o.frame=!0,o.key=u;break}case 5:a=!0,(c=o)!=null&&c.frame&&!o.key&&(dr(o,e),o=this.avcSample=null),o||(o=this.avcSample=wn(!0,i.pts,i.dts,"")),o.key=!0,o.frame=!0;break;case 6:{a=!0,vc(l.data,1,i.pts,t.samples);break}case 7:if(a=!0,A=!0,!e.sps){const u=l.data,g=new hh(u).readSPS();e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[u],e.duration=this._duration;const f=u.subarray(1,4);let p="avc1.";for(let y=0;y<3;y++){let v=f[y].toString(16);v.length<2&&(v="0"+v),p+=v}e.codec=p}break;case 8:a=!0,e.pps||(e.pps=[l.data]);break;case 9:a=!1,e.audFound=!0,o&&dr(o,e),o=this.avcSample=wn(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,o&&(o.debug+="unknown NAL "+l.type+" ");break}o&&a&&o.units.push(l)}),r&&o&&(dr(o,e),this.avcSample=null)}getLastNalUnit(e){var t;let i=this.avcSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(h>=0){const d={data:t.subarray(h,a-r-1),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);if(d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l=a-r-1,l>0)){const g=new Uint8Array(d.data.byteLength+l);g.set(d.data,0),g.set(t.subarray(0,l),d.data.byteLength),d.data=g,d.state=0}}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);if(d){const g=new Uint8Array(d.data.byteLength+t.byteLength);g.set(d.data,0),g.set(t,d.data.byteLength),d.data=g}}return e.naluState=r,o}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1){const d=new Uint8Array(u+n.byteLength);d.set(r.sample.unit,0),d.set(n,u),n=d}else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!bn(n,o);o++);if(o!==i){let h;const u=o<a-1;u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES";const d=new Error(h);if(F.warn(`parsing error: ${h}`),this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,levelRetry:u,error:d,reason:h}),!u)return}nh(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=oh(e.samplerate);A=r.sample.pts+h}else{F.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=ah(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!bn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){F.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(ch(i,o)){const A=Ah(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseID3PES(e,t){if(t.pts===void 0){F.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=tt({},t,{type:this._avcTrack?Yt.emsg:Yt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function wn(s,e,t,i){return{key:s,frame:!1,pts:e,dts:t,units:[],debug:i,length:0}}function ga(s,e){return((s[e+1]&31)<<8)+s[e+2]}function iE(s,e){return(s[e+10]&31)<<8|s[e+11]}function sE(s,e,t,i){const r={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],o=e+3+n-4,a=(s[e+10]&15)<<8|s[e+11];for(e+=12+a;e<o;){const A=ga(s,e);switch(s[e]){case 207:if(!i){F.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:r.audio===-1&&(r.audio=A);break;case 21:r.id3===-1&&(r.id3=A);break;case 219:if(!i){F.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:r.avc===-1&&(r.avc=A);break;case 3:case 4:t.mpeg!==!0&&t.mp3!==!0?F.log("MPEG audio found, not supported in this browser"):r.audio===-1&&(r.audio=A,r.segmentCodec="mp3");break;case 36:F.warn("Unsupported HEVC stream type found");break}e+=((s[e+3]&15)<<8|s[e+4])+5}return r}function Es(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;){const l=new Uint8Array(a[0].length+a[1].length);l.set(a[0]),l.set(a[1],a[0].length),a[0]=l,a.splice(1,1)}if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(F.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const h=new Uint8Array(s.size);for(let u=0,d=a.length;u<d;u++){t=a[u];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;h.set(t,e),e+=g}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}function dr(s,e){if(s.units.length&&s.frame){if(s.pts===void 0){const t=e.samples,i=t.length;if(i){const r=t[i-1];s.pts=r.pts,s.dts=r.dts}else{e.dropped++;return}}e.samples.push(s)}s.debug.length&&F.log(s.pts+"/"+s.dts+":"+s.debug)}class rE extends ih{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(gn(e,0)||[]).length;for(let r=e.length;i<r;i++)if(eE(e,i))return F.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Zp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Ah(e,t,i,this.basePTS,this.frameIndex)}}class uh{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 Fi=Math.pow(2,32)-1;class O{static init(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in O.types)O.types.hasOwnProperty(e)&&(O.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=n,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,o,A,o,a),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return O.box(O.types.hdlr,O.HDLR_TYPES[e])}static mdat(e){return O.box(O.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Fi+1)),r=Math.floor(t%(Fi+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return O.box(O.types.mdia,O.mdhd(e.timescale,e.duration),O.hdlr(e.type),O.minf(e))}static mfhd(e){return O.box(O.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"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(e)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(e))}static moof(e,t,i){return O.box(O.types.moof,O.mfhd(e),O.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trak(e[t]);return O.box.apply(null,[O.types.moov,O.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(O.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trex(e[t]);return O.box.apply(null,[O.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Fi+1)),r=Math.floor(t%(Fi+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return O.box(O.types.sdtp,i)}static stbl(e){return O.box(O.types.stbl,O.stsd(e),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=O.box(O.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,A>>8&255,A&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static mp4a(e){const t=e.samplerate;return O.box(O.types.mp4a,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]),O.box(O.types.esds,O.esds(e)))}static mp3(e){const t=e.samplerate;return O.box(O.types[".mp3"],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 stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(e)):O.box(O.types.stsd,O.STSD,O.mp4a(e)):O.box(O.types.stsd,O.STSD,O.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Fi+1)),a=Math.floor(i%(Fi+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=O.sdtp(e),r=e.id,n=Math.floor(t/(Fi+1)),o=Math.floor(t%(Fi+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),O.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,O.box(O.types.trak,O.tkhd(e),O.mdia(e))}static trex(e){const t=e.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,h,u;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,h=A.flags,u=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*a);return O.box(O.types.trun,o)}static initSegment(e){O.types||O.init();const t=O.moov(e),i=new Uint8Array(O.FTYP.byteLength+t.byteLength);return i.set(O.FTYP),i.set(t,O.FTYP.byteLength),i}}O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0;const dh=9e4;function fa(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function nE(s,e,t=1,i=!1){return fa(s,e,1/t,i)}function gr(s,e=!1){return fa(s,1e3,1/dh,e)}function oE(s,e=1){return fa(s,dh,1/e)}const aE=10*1e3,gh=1024,AE=1152;let Tn=null,pa=null;class Ea{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Tn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Tn=o?parseInt(o[1]):0}if(pa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);pa=n?parseInt(n[1]):0}}destroy(){}resetTimeStamp(e){F.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){F.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){F.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Mt(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&F.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,h,u,d,g,f=n,p=n;const y=e.pid>-1,v=t.pid>-1,Q=t.samples.length,C=e.samples.length>0,T=a&&Q>0||Q>1;if((!y||C)&&(!v||T)||this.ISGenerated||a){this.ISGenerated||(h=this.generateIS(e,t,n,o));const L=this.isVideoContiguous;let R=-1,P;if(T&&(R=lE(t.samples),!L&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,R>0){F.warn(`[mp4-remuxer]: Dropped ${R} out of ${Q} video samples due to a missing keyframe`);const k=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(R),t.dropped+=R,p+=(t.samples[0].pts-k)/t.inputTimeScale,P=p}else R===-1&&(F.warn(`[mp4-remuxer]: No keyframe found out of ${Q} video samples`),g=!1);if(this.ISGenerated){if(C&&T){const k=this.getVideoStartPts(t.samples),$=(Mt(e.samples[0].pts,k)-k)/t.inputTimeScale;f+=Math.max(0,$),p+=Math.max(0,-$)}if(C){if(e.samplerate||(F.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,v||T||A===Ee.AUDIO?p:void 0),T){const k=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(F.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,L,k)}}else T&&(l=this.remuxVideo(t,p,L,0));l&&(l.firstKeyFrame=R,l.independent=R!==-1,l.firstKeyFramePTS=P)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=fh(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=ph(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:g,text:u,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,h="audio/mp4",u,d,g;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):O.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?u=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length&&(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},c))if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),p=Math.round(g*i);d=Math.min(d,Mt(o[0].dts,f)-p),u=Math.min(u,f-p)}else c=!1;if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:g},this._initDTS={baseTime:d,timescale:g}):u=g=void 0,{tracks:A,initPTS:u,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,h=8,u=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!i||c===null){const B=t*n,w=o[0].pts-Mt(o[0].dts,o[0].pts);c=B-w}const v=l.baseTime*n/l.timescale;for(let B=0;B<A;B++){const w=o[B];w.pts=Mt(w.pts-v,c),w.dts=Mt(w.dts-v,c),w.dts<o[B>0?B-1:B].dts&&(y=!0)}y&&o.sort(function(B,w){const N=B.dts-w.dts,H=B.pts-w.pts;return N||H}),d=o[0].dts,g=o[o.length-1].dts;const Q=g-d,C=Q?Math.round(Q/(A-1)):u||e.inputTimeScale/30;if(i){const B=d-c,w=B>C,N=B<-1;if((w||N)&&(w?F.warn(`AVC: ${gr(B,!0)} ms (${B}dts) hole between fragments detected, filling it`):F.warn(`AVC: ${gr(-B,!0)} ms (${B}dts) overlapping between fragments detected`),!N||c>=o[0].pts)){d=c;const H=o[0].pts-B;o[0].dts=d,o[0].pts=H,F.log(`Video: First PTS/DTS adjusted: ${gr(H,!0)}/${gr(d,!0)}, delta: ${gr(B,!0)} ms`)}}d=Math.max(0,d);let T=0,b=0;for(let B=0;B<A;B++){const w=o[B],N=w.units,H=N.length;let K=0;for(let X=0;X<H;X++)K+=N[X].data.length;b+=K,T+=H,w.length=K,w.dts=Math.max(w.dts,d),f=Math.min(w.pts,f),p=Math.max(w.pts,p)}g=o[A-1].dts;const L=b+4*T+8;let R;try{R=new Uint8Array(L)}catch(B){this.observer.emit(E.ERROR,E.ERROR,{type:fe.MUX_ERROR,details:Y.REMUX_ALLOC_ERROR,fatal:!1,error:B,bytes:L,reason:`fail allocating video mdat ${L}`});return}const P=new DataView(R.buffer);P.setUint32(0,L),R.set(O.types.mdat,4);let k=!1,q=Number.POSITIVE_INFINITY,$=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,ee=Number.NEGATIVE_INFINITY;for(let B=0;B<A;B++){const w=o[B],N=w.units;let H=0;for(let se=0,ue=N.length;se<ue;se++){const Ae=N[se],Ce=Ae.data,be=Ae.data.byteLength;P.setUint32(h,be),h+=4,R.set(Ce,h),h+=be,H+=4+be}let K;if(B<A-1)u=o[B+1].dts-w.dts,K=o[B+1].pts-w.pts;else{const se=this.config,ue=B>0?w.dts-o[B-1].dts:C;if(K=B>0?w.pts-o[B-1].pts:C,se.stretchShortVideoTrack&&this.nextAudioPts!==null){const Ae=Math.floor(se.maxBufferHole*n),Ce=(r?f+r*n:this.nextAudioPts)-w.pts;Ce>Ae?(u=Ce-ue,u<0?u=ue:k=!0,F.log(`[mp4-remuxer]: It is approximately ${Ce/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=ue}else u=ue}const X=Math.round(w.pts-w.dts);q=Math.min(q,u),te=Math.max(te,u),$=Math.min($,K),ee=Math.max(ee,K),a.push(new Eh(w.key,u,H,X))}if(a.length){if(Tn){if(Tn<70){const B=a[0].flags;B.dependsOn=2,B.isNonSync=0}}else if(pa&&ee-$<te-q&&C/te<.025&&a[0].cts===0){F.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let B=d;for(let w=0,N=a.length;w<N;w++){const H=B+a[w].duration,K=B+a[w].cts;if(w<N-1){const X=H+a[w+1].cts;a[w].duration=X-K}else a[w].duration=w?a[w-1].duration:C;a[w].cts=0,B=H}}}u=k||!u?C:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const S=O.moof(e.sequenceNumber++,d,tt({},e,{samples:a})),D="video",U={data1:S,data2:R,startPTS:f/n,endPTS:(p+u)/n,startDTS:d/n,endDTS:c/n,type:D,hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,U}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=e.segmentCodec==="aac"?gh:AE,c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,p=u?0:8,y=this.nextAudioPts||-1;const v=t*o,Q=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&y>0&&(r&&Math.abs(v-y)<9e3||Math.abs(Mt(f[0].pts-Q,v)-y)<20*c),f.forEach(function(D){D.pts=Mt(D.pts-Q,v)}),!i||y<0){if(f=f.filter(D=>D.pts>=0),!f.length)return;n===0?y=0:r&&!g?y=Math.max(0,v):y=f[0].pts}if(e.segmentCodec==="aac"){const D=this.config.maxAudioFramesDrift;for(let U=0,B=y;U<f.length;U++){const w=f[U],N=w.pts,H=N-B,K=Math.abs(1e3*H/o);if(H<=-D*c&&g)U===0&&(F.warn(`Audio frame @ ${(N/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*H/o)} ms.`),this.nextAudioPts=y=B=N);else if(H>=D*c&&K<aE&&g){let X=Math.round(H/c);B=N-X*c,B<0&&(X--,B+=c),U===0&&(this.nextAudioPts=y=B),F.warn(`[mp4-remuxer]: Injecting ${X} audio frame @ ${(B/o).toFixed(3)}s due to ${Math.round(1e3*H/o)} ms gap.`);for(let se=0;se<X;se++){const ue=Math.max(B,0);let Ae=uh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);Ae||(F.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ae=w.unit.subarray()),f.splice(U,0,{unit:Ae,pts:ue}),B+=c,U++}}w.pts=B,B+=c}}let C=null,T=null,b,L=0,R=f.length;for(;R--;)L+=f[R].unit.byteLength;for(let D=0,U=f.length;D<U;D++){const B=f[D],w=B.unit;let N=B.pts;if(T!==null){const K=d[D-1];K.duration=Math.round((N-T)/A)}else if(i&&e.segmentCodec==="aac"&&(N=y),C=N,L>0){L+=p;try{b=new Uint8Array(L)}catch(K){this.observer.emit(E.ERROR,E.ERROR,{type:fe.MUX_ERROR,details:Y.REMUX_ALLOC_ERROR,fatal:!1,error:K,bytes:L,reason:`fail allocating audio mdat ${L}`});return}u||(new DataView(b.buffer).setUint32(0,L),b.set(O.types.mdat,4))}else return;b.set(w,p);const H=w.byteLength;p+=H,d.push(new Eh(!0,l,H,0)),T=N}const P=d.length;if(!P)return;const k=d[d.length-1];this.nextAudioPts=y=T+A*k.duration;const q=u?new Uint8Array(0):O.moof(e.sequenceNumber++,C/A,tt({},e,{samples:d}));e.samples=[];const $=C/o,te=y/o,S={data1:q,data2:b,startPTS:$,endPTS:te,startDTS:$,endDTS:te,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,S}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*gh,g=Math.ceil((u-h)/d),f=uh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(F.warn("[mp4-remuxer]: remux empty Audio"),!f){F.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let y=0;y<g;y++){const v=h+y*d;p.push({unit:f,pts:v,dts:v})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Mt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function lE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function fh(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Mt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Mt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function ph(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=Mt(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class Eh{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new cE(e)}}class cE{constructor(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}}class hE{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(R0(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=mc(e);t||(t=Ih(r.audio,Ne.AUDIO)),i||(i=Ih(r.video,Ne.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:F.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};ce(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(u),g=this.initData),!((A=g)!=null&&A.length))return F.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=_0(u,g),p=L0(g,u),y=p===null?n:p;(uE(l,y,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=y-n,l&&l.timescale===1&&F.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const v=e?y-l.baseTime/l.timescale:c,Q=v+f;F0(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=Q:(F.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,T=!!g.video;let b="";C&&(b+="audio"),T&&(b+="video");const L={data1:u,startPTS:v,startDTS:v,endPTS:Q,endDTS:Q,type:b,hasAudio:C,hasVideo:T,nb:1,dropped:0};return h.audio=L.type==="audio"?L:void 0,h.video=L.type!=="audio"?L:void 0,h.initSegment=d,h.id3=fh(i,n,l,l),r.samples.length&&(h.text=ph(r,n,l)),h}}function uE(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function Ih(s,e){const t=s==null?void 0:s.codec;return t&&t.length>4?t:t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":t==="avc1"||e===Ne.VIDEO?"avc1.42e01e":"mp4a.40.5"}let fi;try{fi=self.performance.now.bind(self.performance)}catch{F.debug("Unable to use Performance API on this environment"),fi=typeof self<"u"&&self.Date.now}const Ia=[{demux:Wp,remux:hE},{demux:ki,remux:Ea},{demux:Vp,remux:Ea},{demux:rE,remux:Ea}];class mh{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=fi();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:y,duration:v,initSegmentData:Q}=A,C=dE(o,t);if(C&&C.method==="AES-128"){const R=this.getDecrypter();if(R.isSync()){let P=R.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&(P=R.flush()),!P)return n.executeEnd=fi(),ma(i);o=new Uint8Array(P)}else return this.decryptionPromise=R.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(P=>{const k=this.push(P,null,i);return this.decryptionPromise=null,k}),this.decryptionPromise}const T=this.needsProbing(c,h);if(T){const R=this.configureTransmuxer(o);if(R)return F.warn(`[transmuxer] ${R.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),n.executeEnd=fi(),ma(i)}(c||h||g||T)&&this.resetInitSegment(Q,f,p,v,t),(c||g||T)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const b=this.transmux(o,C,d,u,i),L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,n.executeEnd=fi(),b}flush(e){const t=e.transmuxing;t.executeStart=fi();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=fi(),[ma(e)];const c=A.flush(a);return xn(c)?c.then(h=>(this.flushRemux(o,h,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;F.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=fi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let h=0,u=Ia.length;h<u;h++)if(Ia[h].demux.probe(e)){o=Ia[h];break}if(!o)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,A=this.remuxer,l=o.remux,c=o.demux;(!A||!(A instanceof l))&&(this.remuxer=new l(i,t,r,n)),(!a||!(a instanceof c))&&(this.demuxer=new c(i,t,r),this.probe=c.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ca(this.config)),e}}function dE(s,e){let t=null;return s.byteLength>0&&e!=null&&e.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ma=s=>({remuxResult:{},chunkMeta:s});function xn(s){return"then"in s&&s.then instanceof Function}class gE{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class fE{constructor(e,t,i,r,n,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=o}}var Ch={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,h,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,h||A,u),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)e.call(c,h)&&l.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,d=h.length,g=new Array(d);u<d;u++)g[u]=h[u].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,u,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var p=this._events[f],y=arguments.length,v,Q;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,h),!0;case 4:return p.fn.call(p.context,c,h,u),!0;case 5:return p.fn.call(p.context,c,h,u,d),!0;case 6:return p.fn.call(p.context,c,h,u,d,g),!0}for(Q=1,v=new Array(y-1);Q<y;Q++)v[Q-1]=arguments[Q];p.fn.apply(p.context,v)}else{var C=p.length,T;for(Q=0;Q<C;Q++)switch(p[Q].once&&this.removeListener(l,p[Q].fn,void 0,!0),y){case 1:p[Q].fn.call(p[Q].context);break;case 2:p[Q].fn.call(p[Q].context,c);break;case 3:p[Q].fn.call(p[Q].context,c,h);break;case 4:p[Q].fn.call(p[Q].context,c,h,u);break;default:if(!v)for(T=1,v=new Array(y-1);T<y;T++)v[T-1]=arguments[T];p[Q].fn.apply(p[Q].context,v)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,u){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!u||g.once)&&(!h||g.context===h)&&o(this,d);else{for(var f=0,p=[],y=g.length;f<y;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&p.push(g[f]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(Ch);var pE=Ch.exports,Ca=t0(pE);const ya=In()||{isTypeSupported:()=>!1};class yh{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(l,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,l===E.ERROR&&(this.error=c.error),this.hls.trigger(l,c)};this.observer=new Ca,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a={mp4:ya.isTypeSupported("video/mp4"),mpeg:ya.isTypeSupported("audio/mpeg"),mp3:ya.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||Mp())){try{n.workerPath?(F.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Pp(n.workerPath)):(F.log(`injecting Web Worker for "${t}"`),this.workerContext=Op()),this.onwmsg=h=>this.onWorkerMessage(h);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=h=>{const u=new Error(`${h.message} (${h.filename}:${h.lineno})`);n.enableWorker=!1,F.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})},c.postMessage({cmd:"init",typeSupported:a,vendor:A,id:t,config:JSON.stringify(n)})}catch(c){F.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new mh(this.observer,a,n,A,t)}return}this.transmuxer=new mh(this.observer,a,n,A,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,p=this.frag,y=!(p&&n.cc===p.cc),v=!(p&&l.level===p.level),Q=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,T=Q===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),b=!v&&(Q===1||Q===0&&(C===1||T&&C<=0)),L=self.performance.now();(v||Q||n.stats.parsing.start===0)&&(n.stats.parsing.start=L),o&&(C||!b)&&(o.stats.parsing.start=L);const R=!(p&&((h=n.initSegment)==null?void 0:h.url)===((u=p.initSegment)==null?void 0:u.url)),P=new fE(y,b,A,v,g,R);if(!b||y||R){F.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
179
+ */const sc="important",t0=" !"+sc,ar=ds(class extends Ws{constructor(s){var e;if(super(s),s.type!==us.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ut===void 0)return this.ut=new Set(Object.keys(e)),this.render(e);for(const i of this.ut)e[i]==null&&(this.ut.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ut.add(i);const n=typeof r=="string"&&r.endsWith(t0);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?sc:""):t[i]=r}}return Si}});function i0(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var rc={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse base URL.");return h.path=a.normalizePath(h.path),a.buildURLFromParts(h)}var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=a.normalizePath(u.path),a.buildURLFromParts(u)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(f.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)f.path=d.path,u.params||(f.params=d.params,u.query||(f.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(y)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(rc);var Go=rc.exports;function nc(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function bt(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?nc(Object(t),!0).forEach(function(i){s0(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):nc(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function s0(s,e,t){return e=n0(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function tt(){return tt=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},tt.apply(this,arguments)}function r0(s,e){if(typeof s!="object"||s===null)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function n0(s){var e=r0(s,"string");return typeof e=="symbol"?e:String(e)}const he=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)};let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s}({}),fe=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),Y=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const Zi=function(){},Ho={trace:Zi,debug:Zi,log:Zi,warn:Zi,info:Zi,error:Zi};let Ar=Ho;function o0(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Zi}function a0(s,...e){e.forEach(function(t){Ar[t]=s[t]?s[t].bind(s):o0(t)})}function A0(s,e){if(self.console&&s===!0||typeof s=="object"){a0(s,"debug","log","info","warn","error");try{Ar.log(`Debug logs enabled for "${e}" in hls.js version 1.4.12`)}catch{Ar=Ho}}else Ar=Ho}const F=Ar,l0=/^(\d+)x(\d+)$/,oc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ke{constructor(e){typeof e=="string"&&(e=Ke.parseAttrList(e));for(const t in e)e.hasOwnProperty(t)&&(t.substring(0,2)==="X-"&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=l0.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(oc.lastIndex=0;(t=oc.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function c0(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function h0(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class ac{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){F.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=tt(new Ke({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);he(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(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 dn{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 Me={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Ac{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Me.AUDIO]:null,[Me.VIDEO]:null,[Me.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2),r=[];i.length===1?r[0]=t?t.byteRangeEndOffset:0:r[0]=parseInt(i[1]),r[1]=parseInt(i[0])+r[0],this._byteRange=r}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Go.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class $o extends Ac{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 dn,this.urlId=0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!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),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Me.AUDIO]=null,e[Me.VIDEO]=null,e[Me.AUDIOVIDEO]=null}}class u0 extends Ac{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new dn,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const d0=10;class g0{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?he(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||d0}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 Yo(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function f0(s){const e=lc(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function p0(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function E0(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=Yo(o)):t=f0(o)}}return t}function lc(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}var Ve={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},St={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function cc(s){switch(s){case St.FAIRPLAY:return Ve.FAIRPLAY;case St.PLAYREADY:return Ve.PLAYREADY;case St.WIDEVINE:return Ve.WIDEVINE;case St.CLEARKEY:return Ve.CLEARKEY}}var hc={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function I0(s){if(s===hc.WIDEVINE)return Ve.WIDEVINE}function uc(s){switch(s){case Ve.FAIRPLAY:return St.FAIRPLAY;case Ve.PLAYREADY:return St.PLAYREADY;case Ve.WIDEVINE:return St.WIDEVINE;case Ve.CLEARKEY:return St.CLEARKEY}}function Ko(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ve.FAIRPLAY,Ve.WIDEVINE,Ve.PLAYREADY,Ve.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ve.WIDEVINE]&&t&&i.push(Ve.WIDEVINE),i}const dc=function(){return typeof self<"u"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function m0(s,e,t,i){let r;switch(s){case Ve.FAIRPLAY:r=["cenc","sinf"];break;case Ve.WIDEVINE:case Ve.PLAYREADY:r=["cenc"];break;case Ve.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return C0(r,e,t,i)}function C0(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function es(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const Vo=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,gc=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,gn=(s,e)=>{const t=e;let i=0;for(;Vo(s,e);){i+=10;const r=fn(s,e+6);i+=r,gc(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},fn=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},y0=(s,e)=>Vo(s,e)&&fn(s,e+6)+10<=s.length-e,v0=s=>{const e=pc(s);for(let t=0;t<e.length;t++){const i=e[t];if(fc(i))return T0(i)}},fc=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",B0=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=fn(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},pc=s=>{let e=0;const t=[];for(;Vo(s,e);){const i=fn(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=B0(s.subarray(e)),o=Q0(n);o&&t.push(o),e+=n.size+10}gc(s,e)&&(e+=10)}return t},Q0=s=>s.type==="PRIV"?b0(s):s.type[0]==="W"?w0(s):S0(s),b0=s=>{if(s.size<2)return;const e=Xt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},S0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Xt(s.data.subarray(t),!0);t+=i.length+1;const r=Xt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Xt(s.data.subarray(1));return{key:s.type,data:e}},w0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Xt(s.data.subarray(t),!0);t+=i.length+1;const r=Xt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Xt(s.data);return{key:s.type,data:e}},T0=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},Xt=(s,e=!1)=>{const t=x0();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let Jo;function x0(){return!Jo&&typeof self.TextDecoder<"u"&&(Jo=new self.TextDecoder("utf-8")),Jo}const zt={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},pn=Math.pow(2,32)-1,D0=[].push,Ec={video:1,audio:2,id3:3,text:4};function ht(s){return String.fromCharCode.apply(null,s)}function Ic(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function me(s,e){const t=mc(s,e);return t<0?4294967296+t:t}function mc(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Wo(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function xe(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=me(s,r),o=ht(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=xe(s.subarray(r+8,a),e.slice(1));A.length&&D0.apply(t,A)}r=a}return t}function R0(s){const e=[],t=s[0];let i=8;const r=me(s,i);i+=4;const n=0,o=0;t===0?i+=8:i+=16,i+=2;let a=s.length+o;const A=Ic(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=me(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return F.warn("SIDX has hierarchical references (not supported)"),null;const g=me(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+u-1}}),a+=u,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function Cc(s){const e=[],t=xe(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=xe(n,["tkhd"])[0];if(o){let a=o[0],A=a===0?12:20;const l=me(o,A),c=xe(n,["mdia","mdhd"])[0];if(c){a=c[0],A=a===0?12:20;const h=me(c,A),u=xe(n,["mdia","hdlr"])[0];if(u){const d=ht(u.subarray(8,12)),g={soun:Me.AUDIO,vide:Me.VIDEO}[d];if(g){const f=xe(n,["mdia","minf","stbl","stsd"])[0];let p;f&&(p=ht(f.subarray(12,16))),e[l]={timescale:h,type:g},e[g]={timescale:h,id:l,codec:p}}}}}}return xe(s,["moov","mvex","trex"]).forEach(r=>{const n=me(r,4),o=e[n];o&&(o.default={duration:me(r,12),flags:me(r,20)})}),e}function L0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&xe(s,["moov","trak"]).forEach(r=>{const o=xe(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=xe(o,["enca"]);const A=a.length>0;A||(a=xe(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);xe(c,["sinf"]).forEach(u=>{const d=yc(u);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(F.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${zt.hexDump(g)} -> ${zt.hexDump(t)}`),d.set(t,8))}})})}),s}function yc(s){const e=xe(s,["schm"])[0];if(e){const t=ht(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(s,["schi","tenc"])[0]}return F.error("[eme] missing 'schm' box"),null}function _0(s,e){return xe(e,["moof","traf"]).reduce((t,i)=>{const r=xe(i,["tfdt"])[0],n=r[0],o=xe(i,["tfhd"]).reduce((a,A)=>{const l=me(A,4),c=s[l];if(c){let h=me(r,4);if(n===1){if(h===pn)return F.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=pn+1,h+=me(r,8)}const u=c.timescale||9e4,d=h/u;if(isFinite(d)&&(a===null||d<a))return d}return a},null);return o!==null&&isFinite(o)&&(t===null||o<t)?o:t},null)}function k0(s,e){let t=0,i=0,r=0;const n=xe(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=xe(a,["tfhd"])[0],l=me(A,4),c=e[l];if(!c)continue;const h=c.default,u=me(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=me(A,12):d=me(A,8));const g=c.timescale||9e4,f=xe(a,["trun"]);for(let p=0;p<f.length;p++){if(t=F0(f[p]),!t&&d){const y=me(f[p],4);t=d*y}c.type===Me.VIDEO?i+=t/g:c.type===Me.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=0;const a=xe(s,["sidx"]);for(let A=0;A<a.length;A++){const l=R0(a[A]);l!=null&&l.references&&(o+=l.references.reduce((c,h)=>c+h.info.duration||0,0))}return o}return i||r}function F0(s){const e=me(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=me(s,4);for(let n=0;n<r;n++){if(e&256){const o=me(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function N0(s,e,t){xe(e,["moof","traf"]).forEach(i=>{xe(i,["tfhd"]).forEach(r=>{const n=me(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;xe(i,["tfdt"]).forEach(A=>{const l=A[0];let c=me(A,4);if(l===0)c-=t*a,c=Math.max(c,0),Wo(A,4,c);else{c*=Math.pow(2,32),c+=me(A,8),c-=t*a,c=Math.max(c,0);const h=Math.floor(c/(pn+1)),u=Math.floor(c%(pn+1));Wo(A,4,h),Wo(A,8,u)}})})})}function M0(s){const e={valid:null,remainder:null},t=xe(s,["moof"]);if(t){if(t.length<2)return e.remainder=s,e}else return e;const i=t[t.length-1];return e.valid=es(s,0,i.byteOffset-8),e.remainder=es(s,i.byteOffset-8),e}function ts(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function vc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return xe(i,["moof"]).map(A=>{const l=A.byteOffset-8;xe(A,["traf"]).map(h=>{const u=xe(h,["tfdt"]).map(d=>{const g=d[0];let f=me(d,4);return g===1&&(f*=Math.pow(2,32),f+=me(d,8)),f/r})[0];return u!==void 0&&(s=u),xe(h,["tfhd"]).map(d=>{const g=me(d,4),f=me(d,0)&16777215,p=(f&1)!==0,y=(f&2)!==0,v=(f&8)!==0;let Q=0;const C=(f&16)!==0;let T=0;const b=(f&32)!==0;let L=8;g===n&&(p&&(L+=8),y&&(L+=4),v&&(Q=me(d,L),L+=4),C&&(T=me(d,L),L+=4),b&&(L+=4),e.type==="video"&&(o=O0(e.codec)),xe(h,["trun"]).map(R=>{const P=R[0],k=me(R,0)&16777215,q=(k&1)!==0;let $=0;const te=(k&4)!==0,Z=(k&256)!==0;let S=0;const D=(k&512)!==0;let U=0;const B=(k&1024)!==0,w=(k&2048)!==0;let N=0;const H=me(R,4);let K=8;q&&($=me(R,K),K+=4),te&&(K+=4);let X=$+l;for(let se=0;se<H;se++){if(Z?(S=me(R,K),K+=4):S=Q,D?(U=me(R,K),K+=4):U=T,B&&(K+=4),w&&(P===0?N=me(R,K):N=mc(R,K),K+=4),e.type===Me.VIDEO){let ue=0;for(;ue<U;){const le=me(i,X);if(X+=4,P0(o,i[X])){const Ce=i.subarray(X,X+le);Bc(Ce,o?2:1,s+N/r,t)}X+=le,ue+=le+4}}s+=S/r}}))})})}),t}function O0(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function P0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Bc(s,e,t,i){const r=Qc(s);let n=0;n+=e;let o=0,a=0,A=!1,l=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(l===255);const c=r.length-n;if(!A&&o===4&&n<r.length){if(A=!0,r[n++]===181){const u=Ic(r,n);if(n+=2,u===49){const d=me(r,n);if(n+=4,d===1195456820){const g=r[n++];if(g===3){const f=r[n++],p=31&f,y=64&f,v=y?2+p*3:0,Q=new Uint8Array(v);if(y){Q[0]=f;for(let C=1;C<v;C++)Q[C]=r[n++]}i.push({type:g,payloadType:o,pts:t,bytes:Q})}}}}}else if(o===5&&a<c){if(A=!0,a>16){const h=[];for(let g=0;g<16;g++){const f=r[n++].toString(16);h.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let g=0;g<u;g++)d[g]=r[n++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Xt(d),userDataBytes:d})}}else if(a<c)n+=a;else if(a>c)break}}function Qc(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function U0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;ht(s.subarray(l,l+1))!=="\0";)t+=ht(s.subarray(l,l+1)),l+=1;for(t+=ht(s.subarray(l,l+1)),l+=1;ht(s.subarray(l,l+1))!=="\0";)i+=ht(s.subarray(l,l+1)),l+=1;i+=ht(s.subarray(l,l+1)),l+=1,r=me(s,12),n=me(s,16),a=me(s,20),A=me(s,24),l=28}else if(e===1){l+=4,r=me(s,l),l+=4;const h=me(s,l);l+=4;const u=me(s,l);for(l+=4,o=4294967296*h+u,Number.isSafeInteger(o)||(o=Number.MAX_SAFE_INTEGER,F.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(s,l),l+=4,A=me(s,l),l+=4;ht(s.subarray(l,l+1))!=="\0";)t+=ht(s.subarray(l,l+1)),l+=1;for(t+=ht(s.subarray(l,l+1)),l+=1;ht(s.subarray(l,l+1))!=="\0";)i+=ht(s.subarray(l,l+1)),l+=1;i+=ht(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function G0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function H0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),G0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function $0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=zt.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let En={};class lr{static clearKeyUriToKeyIdMap(){En={}}constructor(e,t,i,r=[1],n=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case St.FAIRPLAY:case St.WIDEVINE:case St.PLAYREADY:case St.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&F.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=Y0(e);return new lr(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=E0(this.uri);if(t)switch(this.keyFormat){case St.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case St.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=H0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const h=Yo(c).subarray(0,16);p0(h),this.keyId=h}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=En[this.uri];if(!i){const r=Object.keys(En).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),En[this.uri]=i}this.keyId=i}return this}}function Y0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const bc=/\{\$([a-zA-Z0-9-_]+)\}/g;function Sc(s){return bc.test(s)}function wt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=qo(s,n))}}function qo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(bc,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function wc(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function K0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function In(){if(!(typeof self>"u"))return self.MediaSource||self.WebKitMediaSource}const V0={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},Tc=In();function J0(s,e){const t=V0[e];return!!t&&t[s.slice(0,4)]===!0}function jo(s,e){var t;return(t=Tc==null?void 0:Tc.isTypeSupported(`${e||"video"}/mp4;codecs="${s}"`))!=null?t:!1}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,Dc=/#EXT-X-MEDIA:(.*)/g,W0=/^#EXT(?:INF|-X-TARGETDURATION):/m,Rc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),q0=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)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class $t{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static convertAVC1ToAVCOTI(e){const t=e.split(".");if(t.length>2){let i=t.shift()+".";return i+=parseInt(t.shift()).toString(16),i+=("000"+parseInt(t.shift()).toString(16)).slice(-4),i}return e}static resolve(e,t){return Go.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return W0.test(e)}static parseMasterPlaylist(e,t){const i=Sc(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];xc.lastIndex=0;let o;for(;(o=xc.exec(e))!=null;)if(o[1]){var a;const l=new Ke(o[1]);wt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=qo(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("AVERAGE-BANDWIDTH")||l.decimalInteger("BANDWIDTH"),name:l.NAME,url:$t.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),j0((l.CODECS||"").split(/[ ,]+/).filter(d=>d),h),h.videoCodec&&h.videoCodec.indexOf("avc1")!==-1&&(h.videoCodec=$t.convertAVC1ToAVCOTI(h.videoCodec)),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new Ke(c);wt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=Lc(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):F.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new Ke(c);wt(r,h,["NAME","VALUE","QUERYPARAM"]),wc(r,h,t)}break}case"CONTENT-STEERING":{const h=new Ke(c);wt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:$t.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=_c(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(Dc.lastIndex=0;(r=Dc.exec(e))!==null;){const l=new Ke(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,wt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?$t.resolve(l.URI,t):""};if(h!=null&&h.length){const g=$t.findGroup(h,d.groupId)||h[0];kc(d,g,"audioCodec"),kc(d,g,"textCodec")}u.push(d)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new g0(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new $o(r,t),p,y,v,Q=-1,C=!1;for(Rc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Sc(e);(p=Rc.exec(e))!==null;){C&&(C=!1,f=new $o(r,t),f.start=u,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null));const R=p[1];if(R){f.duration=parseFloat(R);const P=(" "+p[2]).slice(1);f.title=P||null,f.tagList.push(P?["INF",R,P]:["INF",R])}else if(p[3]){if(he(f.duration)){f.start=u,v&&Mc(f,v,a),f.sn=c,f.level=i,f.cc=d,f.urlId=n,A.push(f);const P=(" "+p[3]).slice(1);f.relurl=qo(a,P),Fc(f,g),g=f,u+=f.duration,c++,h=0,C=!0}}else if(p[4]){const P=(" "+p[4]).slice(1);g?f.setByteRange(P,g):f.setByteRange(P)}else if(p[5])f.rawProgramDateTime=(" "+p[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),Q===-1&&(Q=A.length);else{if(p=p[0].match(q0),!p){F.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const P=(" "+p[y]).slice(1),k=(" "+p[y+1]).slice(1),q=p[y+2]?(" "+p[y+2]).slice(1):"";switch(P){case"PLAYLIST-TYPE":a.type=k.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(k);break;case"SKIP":{const $=new Ke(k);wt(a,$,["RECENTLY-REMOVED-DATERANGES"]);const te=$.decimalInteger("SKIPPED-SEGMENTS");if(he(te)){a.skippedSegments=te;for(let S=te;S--;)A.unshift(null);c+=te}const Z=$.enumeratedString("RECENTLY-REMOVED-DATERANGES");Z&&(a.recentlyRemovedDateranges=Z.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(k),1);break;case"VERSION":a.version=parseInt(k);break;case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(k||q)&&f.tagList.push(q?[k,q]:[k]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([P]);break;case"BITRATE":f.tagList.push([P,k]);break;case"DATERANGE":{const $=new Ke(k);wt(a,$,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),wt(a,$,$.clientAttrs);const te=new ac($,a.dateRanges[$.ID]);te.isValid||a.skippedSegments?a.dateRanges[te.id]=te:F.warn(`Ignoring invalid DATERANGE tag: "${k}"`),f.tagList.push(["EXT-X-DATERANGE",k]);break}case"DEFINE":{{const $=new Ke(k);wt(a,$,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in $?K0(a,$,o):wc(a,$,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(k);break;case"KEY":{const $=Lc(k,t,a);if($.isSupported()){if($.method==="NONE"){v=void 0;break}v||(v={}),v[$.keyFormat]&&(v=tt({},v)),v[$.keyFormat]=$}else F.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${k}"`);break}case"START":a.startTimeOffset=_c(k);break;case"MAP":{const $=new Ke(k);if(wt(a,$,["BYTERANGE","URI"]),f.duration){const te=new $o(r,t);Nc(te,$,i,v),l=te,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else Nc(f,$,i,v),l=f,C=!0;break}case"SERVER-CONTROL":{const $=new Ke(k);a.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),a.holdBack=$.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const $=new Ke(k);a.partTarget=$.decimalFloatingPoint("PART-TARGET");break}case"PART":{let $=a.partList;$||($=a.partList=[]);const te=h>0?$[$.length-1]:void 0,Z=h++,S=new Ke(k);wt(a,S,["BYTERANGE","URI"]);const D=new u0(S,f,t,Z,te);$.push(D),f.duration+=D.duration;break}case"PRELOAD-HINT":{const $=new Ke(k);wt(a,$,["URI"]),a.preloadHint=$;break}case"RENDITION-REPORT":{const $=new Ke(k);wt(a,$,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push($);break}default:F.warn(`line parsed but not handled: ${p}`);break}}}g&&!g.relurl?(A.pop(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Fc(f,g),f.cc=d,a.fragmentHint=f,v&&Mc(f,v,a));const T=A.length,b=A[0],L=A[T-1];if(u+=a.skippedSegments*a.targetduration,u>0&&T&&L){a.averagetargetduration=u/T;const R=L.sn;a.endSN=R!=="initSegment"?R:0,a.live||(L.endList=!0),b&&(a.startCC=b.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,Q>0&&X0(A,Q),a}}function Lc(s,e,t){var i,r;const n=new Ke(s);wt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&F.error(`Invalid IV: ${n.IV}`);const h=a?$t.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new lr(o,h,c,u,A)}function _c(s){const t=new Ke(s).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function j0(s,e){["video","audio","text"].forEach(t=>{const i=s.filter(r=>J0(r,t));if(i.length){const r=i.filter(n=>n.lastIndexOf("avc1",0)===0||n.lastIndexOf("mp4a",0)===0);e[`${t}Codec`]=r.length>0?r[0]:i[0],s=s.filter(n=>i.indexOf(n)===-1)}}),e.unknownCodecs=s}function kc(s,e,t){const i=e[t];i&&(s[t]=i)}function X0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Fc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),he(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Nc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function Mc(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var Re={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Oc(s){const{type:e}=s;switch(e){case Re.AUDIO_TRACK:return Ee.AUDIO;case Re.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function Xo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class z0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Re.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,url:n,deliveryDirectives:o}=t;this.load({id:i,level:r,responseType:"text",type:Re.LEVEL,url:n,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Re.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Re.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url){F.trace("[playlist-loader]: playlist request ongoing");return}F.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===Re.MANIFEST?n=i.manifestLoadPolicy.default:n=tt({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),(t=e.deliveryDirectives)!=null&&t.part){let l;if(e.type===Re.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===Re.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===Re.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,h=l.targetduration;if(c&&h){const u=Math.max(c*3,h*.8)*1e3;n=tt({},n,{maxTimeToFirstByteMs:Math.min(u,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,h,u)=>{const d=this.getInternalLoader(h);this.resetInternalLoader(h.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),$t.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,h,u||null,d):this.handleMasterPlaylist(l,c,h,u)},onError:(l,c,h,u)=>{this.handleNetworkError(c,h,!1,l,u)},onTimeout:(l,c,h)=>{this.handleNetworkError(c,h,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Xo(e,i),A=$t.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=$t.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(Q=>!Q.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(F.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ke({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:p,captions:y,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Xo(e,i),h=he(a)?a:0,u=he(A)?A:h,d=Oc(i),g=$t.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===Re.MANIFEST){const f={attrs:new Ke({}),bitrate:0,details:g,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.MANIFEST_PARSING_ERROR,fatal:t.type===Re.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Re.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Re.AUDIO_TRACK||e.type===Re.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);F.warn(`[playlist-loader]: ${o}`);let A=Y.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case Re.MANIFEST:A=i?Y.MANIFEST_LOAD_TIMEOUT:Y.MANIFEST_LOAD_ERROR,l=!0;break;case Re.LEVEL:A=i?Y.LEVEL_LOAD_TIMEOUT:Y.LEVEL_LOAD_ERROR,l=!1;break;case Re.AUDIO_TRACK:A=i?Y.AUDIO_TRACK_LOAD_TIMEOUT:Y.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Re.SUBTITLE_TRACK:A=i?Y.SUBTITLE_TRACK_LOAD_TIMEOUT:Y.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:fe.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=(t==null?void 0:t.url)||e.url;h.response=bt({url:u,data:void 0},r)}this.hls.trigger(E.ERROR,h)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:h,deliveryDirectives:u}=r,d=Xo(t,r),g=Oc(r),f=typeof r.level=="number"&&g===Ee.MAIN?l:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(E.ERROR,{type:fe.NETWORK_ERROR,details:Y.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case Re.MANIFEST:case Re.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case Re.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case Re.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function Pc(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function Uc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){F.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){F.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function fs(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function zo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=ep(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function Z0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function ep(s,e,t){const i=[],r=Z0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}var Yt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const tp=.25;function Zo(){if(!(typeof self>"u"))return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}const mn=(()=>{const s=Zo();try{new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ea(s,e){return s.getTime()/1e3-e}function ip(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class sp{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(fs(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Pc(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Zo();for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Yt.emsg&&!i||!r)continue;const l=pc(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>mn&&(h=mn),h-c<=0&&(h=c+tp);for(let d=0;d<l.length;d++){const g=l[d];if(!fc(g)){this.updateId3CueEnds(c,A);const f=new o(c,h,"");f.value=g,A&&(f.type=A),this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===mn&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Yt.audioId3&&A:r==="video"?l=c=>c.type===Yt.emsg&&a:l=c=>c.type===Yt.audioId3&&A||c.type===Yt.emsg&&a,zo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!he(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Zo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=i[h],g=(d==null?void 0:d.cues)||{};let f=(d==null?void 0:d.durationKnown)||!1;const p=ea(u.startDate,A);let y=mn;const v=u.endDate;if(v)y=ea(v,A),f=!0;else if(u.endOnNext&&!f){const C=o.reduce((T,b)=>{const L=n[b];return L.class===u.class&&L.id!==b&&L.startDate>u.startDate&&T.push(L),T},[]).sort((T,b)=>T.startDate.getTime()-b.startDate.getTime())[0];C&&(y=ea(C.startDate,A),f=!0)}const Q=Object.keys(u.attr);for(let C=0;C<Q.length;C++){const T=Q[C];if(!c0(T))continue;let b=g[T];if(b)f&&!d.durationKnown&&(b.endTime=y);else{let L=u.attr[T];b=new l(p,y,""),h0(T)&&(L=ip(L)),b.value={key:T,data:L},b.type=Yt.dateRange,b.id=h,this.id3Track.addCue(b),g[T]=b}}i[h]={cues:g,dateRange:u,durationKnown:f}}}}class rp{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r,h=1;return l+Math.min(this.stallCount*h,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===Y.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&F.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration),l=a<A;if(t.live&&l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ta=["NONE","TYPE-0","TYPE-1",null];var cr={No:"",Yes:"YES",v2:"v2"};function np(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?cr.v2:cr.Yes:cr.No}class Gc{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class hr{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=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.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>t).join(",").replace(/\.[^.,]+/g,"")}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get attrs(){return this._attrs[this._urlId]}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get uri(){return this.url[this._urlId]||""}get urlId(){return this._urlId}set urlId(e){const t=e%this.url.length;this._urlId!==t&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=t)}get audioGroupId(){var e;return(e=this.audioGroupIds)==null?void 0:e[this.urlId]}get textGroupId(){var e;return(e=this.textGroupIds)==null?void 0:e[this.urlId]}addFallback(e){this.url.push(e.url),this._attrs.push(e.attrs)}}function ia(s,e){const t=e.startPTS;if(he(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function Hc(s,e,t,i,r,n){i-t<=0&&(F.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(he(l)){const p=Math.abs(l-t);he(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const h=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const u=e.sn;if(!s||u<s.startSN||u>s.endSN)return 0;let d;const g=u-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)ia(f[d],f[d-1]);for(d=g;d<f.length-1;d++)ia(f[d],f[d+1]);return s.fragmentHint&&ia(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function op(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(lp(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),he(A.startPTS)&&he(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,l.urlId=A.urlId,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){F.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=ap(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){F.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),Ap(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?Hc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):$c(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function ap(s,e,t){const i=tt({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new ac(e[r].attr,i[r]);n.isValid?i[r]=n:F.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function Ap(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function lp(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let h=a[l];i&&!h&&l<i&&(h=e.fragments[l]=c),c&&h&&t(c,h)}}function $c(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||sa(e,i[t].start)}function sa(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function cp(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments,r=4;if(i.length&&t*r>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function hp(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function Yc(s,e,t){var i;return s!=null&&s.details?Kc((i=s.details)==null?void 0:i.partList,e,t):null}function Kc(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function Cn(s){switch(s.details){case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_TIMEOUT:case Y.LEVEL_LOAD_TIMEOUT:case Y.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Vc(s,e){const t=Cn(e);return s.default[`${t?"timeout":"error"}Retry`]}function ra(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Jc(s){return bt(bt({},s),{errorRetry:null,timeoutRetry:null})}function yn(s,e,t,i){return!!s&&e<s.maxNumRetry&&(up(i)||!!t)}function up(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Wc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function dp(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!he(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(gp(e,t,o))return o}return null}function ur(s,e,t=0,i=0){let r=null;if(s?r=e[s.sn-e[0].sn+1]||null:t===0&&e[0].start===0&&(r=e[0]),r&&na(t,i,r)===0)return r;const n=Wc.search(e,na.bind(null,t,i));return n&&(n!==s||!r)?n:r}function na(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function gp(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function fp(s,e){return Wc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}const pp=3e5;var ft={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Nt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Ep{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=F.log.bind(F,"[info]:"),this.warn=F.warn.bind(F,"[warning]:"),this.error=F.error.bind(F,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){this.playlistError=0}stopLoad(){}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 i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case Y.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:ft.DoNothing,flags:Nt.None};return}case Y.FRAG_GAP:case Y.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ft.SendAlternateToPenaltyBox;return}case Y.LEVEL_EMPTY_ERROR:case Y.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===Ee.MAIN?t.level:n.loadLevel;t.details===Y.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(A=a.levelDetails)!=null&&A.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case Y.LEVEL_LOAD_ERROR:case Y.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case Y.AUDIO_TRACK_LOAD_ERROR:case Y.AUDIO_TRACK_LOAD_TIMEOUT:case Y.SUBTITLE_LOAD_ERROR:case Y.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===Re.AUDIO_TRACK&&o.groupId===l.audioGroupId||o.type===Re.SUBTITLE_TRACK&&o.groupId===l.textGroupId)){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ft.SendAlternateToPenaltyBox,t.errorAction.flags=Nt.MoveAllAlternatesMatchingHost;return}}return;case Y.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c&&(t.errorAction={action:ft.SendAlternateToPenaltyBox,flags:Nt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c})}return;case Y.BUFFER_ADD_CODEC_ERROR:case Y.REMUX_ALLOC_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case Y.INTERNAL_EXCEPTION:case Y.BUFFER_APPENDING_ERROR:case Y.BUFFER_APPEND_ERROR:case Y.BUFFER_FULL_ERROR:case Y.LEVEL_SWITCH_ERROR:case Y.BUFFER_STALLED_ERROR:case Y.BUFFER_SEEK_OVER_HOLE:case Y.BUFFER_NUDGE_ON_STALL:t.errorAction={action:ft.DoNothing,flags:Nt.None};return}if(t.type===fe.KEY_SYSTEM_ERROR){const l=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l);return}}getPlaylistRetryOrSwitchAction(e,t){var i;const r=this.hls,n=Vc(r.config.playlistLoadPolicy,e),o=this.playlistError++,a=(i=e.response)==null?void 0:i.code;if(yn(n,o,Cn(e),a))return{action:ft.RetryRequest,flags:Nt.None,retryConfig:n,retryCount:o};const l=this.getLevelSwitchAction(e,t);return n&&(l.retryConfig=n,l.retryCount=o),l}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=Vc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((h,u)=>h+u.fragmentError,0);if(r){var l;e.details!==Y.FRAG_GAP&&r.fragmentError++;const h=(l=e.response)==null?void 0:l.code;if(yn(a,A,Cn(e),h))return{action:ft.RetryRequest,flags:Nt.None,retryConfig:a,retryCount:A}}const c=this.getLevelSwitchAction(e,i);return a&&(c.retryConfig=a,c.retryCount=A),c}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r&&(r.loadError++,i.autoLevelEnabled)){var n,o;let a=-1;const{levels:A,loadLevel:l,minAutoLevel:c,maxAutoLevel:h}=i,u=(n=e.frag)==null?void 0:n.type,{type:d,groupId:g}=(o=e.context)!=null?o:{};for(let f=A.length;f--;){const p=(f+l)%A.length;if(p!==l&&p>=c&&p<=h&&A[p].loadError===0){const y=A[p];if(e.details===Y.FRAG_GAP&&e.frag){const v=A[p].details;if(v){const Q=ur(e.frag,v.fragments,e.frag.start);if(Q!=null&&Q.gap)continue}}else{if(d===Re.AUDIO_TRACK&&g===y.audioGroupId||d===Re.SUBTITLE_TRACK&&g===y.textGroupId)continue;if(u===Ee.AUDIO&&r.audioGroupId===y.audioGroupId||u===Ee.SUBTITLE&&r.textGroupId===y.textGroupId)continue}a=p;break}}if(a>-1&&i.loadLevel!==a)return e.levelRetry=!0,this.playlistError=0,{action:ft.SendAlternateToPenaltyBox,flags:Nt.None,nextAutoLevel:a}}return{action:ft.SendAlternateToPenaltyBox,flags:Nt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ft.DoNothing:break;case ft.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==Y.FRAG_GAP&&(t.fatal=!0);break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Nt.None:this.switchLevel(e,o);break;case Nt.MoveAllAlternatesMatchingHost:i.resolved||(i.resolved=this.redundantFailover(e));break;case Nt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=ta[ta.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}redundantFailover(e){const{hls:t,penalizedRenditions:i}=this,r=e.parent===Ee.MAIN?e.level:t.loadLevel,n=t.levels[r],o=n.url.length,a=e.frag?e.frag.urlId:n.urlId;n.urlId===a&&(!e.frag||n.details)&&this.penalizeRendition(n,e);for(let A=1;A<o;A++){const l=(a+A)%o,c=i[l];if(!c||Ip(c,e,i[a]))return this.warn(`Switching to Redundant Stream ${l+1}/${o}: "${n.url[l]}" after ${e.details}`),this.playlistError=0,t.levels.forEach(h=>{h.urlId=l}),t.nextLoadLevel=r,!0}return!1}penalizeRendition(e,t){const{penalizedRenditions:i}=this,r=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};r.lastErrorPerfMs=performance.now(),r.errors.push(t),r.details=e.details,i[e.urlId]=r}}function Ip(s,e,t){if(performance.now()-s.lastErrorPerfMs>pp)return!0;const i=s.details;if(e.details===Y.FRAG_GAP&&i&&e.frag){const r=e.frag.start,n=ur(null,i.fragments,r);if(n&&!n.gap)return!0}if(t&&s.errors.length<t.errors.length){const r=s.errors[s.errors.length-1];if(i&&r.frag&&e.frag&&Math.abs(r.frag.start-e.frag.start)>i.targetduration*3)return!0}return!1}class oa{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=F.log.bind(F,`${t}:`),this.warn=F.warn.bind(F,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){clearTimeout(this.timer),this.timer=-1}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const o=i[n];let a;try{a=new self.URL(o.URI,t.url).href}catch(A){F.warn(`Could not construct new URL for Rendition Report: ${A}`),a=o.URI||""}if(a===e){r=n;break}else a===e.substring(0,a.length)&&(r=n)}if(r!==-1){const n=i[r],o=parseInt(n["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let a=parseInt(n["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const A=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&A>t.partTarget&&(a+=1)}return new Gc(o,a>=0?a:void 0,cr.No)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&op(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const p=this.hls.config.lowLatencyMode,y=r.lastPartSn,v=r.endSN,Q=r.lastPartIndex,C=Q!==-1,T=y===v,b=p?0:Q;C?(l=T?v+1:y,c=T?b:Q+1):l=v+1;const L=r.age,R=L+r.ageHeader;let P=Math.min(R-r.partTarget,r.targetduration*1.5);if(P>0){if(i&&P>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${P} with playlist age: ${r.age}`),P=0;else{const k=Math.floor(P/r.targetduration);if(l+=k,c!==void 0){const q=Math.round(P%r.targetduration/r.partTarget);c+=q}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${L.toFixed(2)}s goal: ${P} skip sn ${k} to part ${c}`)}r.tuneInGoal=P}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!T){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const h=this.hls.mainForwardBufferInfo,u=h?h.end-h.len:0,d=(r.edge-u)*1e3,g=cp(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=np(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=cr.No),new Gc(i,r,n)}checkRetry(e){const t=e.details,i=Cn(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===ft.RetryRequest||!r.resolved&&n===ft.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=ra(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}let aa;class mp extends oa{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}startLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.startLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=[],r={};let n;t.levels.forEach(o=>{var a;const A=o.attrs;((a=o.audioCodec)==null?void 0:a.indexOf("mp4a.40.34"))!==-1&&(aa||(aa=/chrome|firefox/i.test(navigator.userAgent)),aa&&(o.audioCodec=void 0));const{AUDIO:l,CODECS:c,"FRAME-RATE":h,"PATHWAY-ID":u,RESOLUTION:d,SUBTITLES:g}=A,p=`${`${u||"."}-`}${o.bitrate}-${d}-${h}-${c}`;n=r[p],n?n.addFallback(o):(n=new hr(o),r[p]=n,i.push(n)),vn(n,"audio",l),vn(n,"text",g)}),this.filterAndSortMediaOptions(i,t)}filterAndSortMediaOptions(e,t){let i=[],r=[],n=!1,o=!1,a=!1,A=e.filter(({audioCodec:d,videoCodec:g,width:f,height:p,unknownCodecs:y})=>(n||(n=!!(f&&p)),o||(o=!!g),a||(a=!!d),!(y!=null&&y.length)&&(!d||jo(d,"audio"))&&(!g||jo(g,"video"))));if((n||o)&&a&&(A=A.filter(({videoCodec:d,width:g,height:f})=>!!d||!!(g&&f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){const d=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:d,reason:d.message})}});return}t.audioTracks&&(i=t.audioTracks.filter(d=>!d.audioCodec||jo(d.audioCodec,"audio")),qc(i)),t.subtitles&&(r=t.subtitles,qc(r));const l=A.slice(0);A.sort((d,g)=>d.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"]?(d.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1:d.bitrate!==g.bitrate?d.bitrate-g.bitrate:d.attrs["FRAME-RATE"]!==g.attrs["FRAME-RATE"]?d.attrs.decimalFloatingPoint("FRAME-RATE")-g.attrs.decimalFloatingPoint("FRAME-RATE"):d.attrs.SCORE!==g.attrs.SCORE?d.attrs.decimalFloatingPoint("SCORE")-g.attrs.decimalFloatingPoint("SCORE"):n&&d.height!==g.height?d.height-g.height:0);let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let d=0;d<l.length;d++)if(l[d].pathwayId===A[0].pathwayId){c=l[d];break}}this._levels=A;for(let d=0;d<A.length;d++)if(A[d]===c){this._firstLevel=d,this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${c.bitrate}`);break}const h=a&&!o,u={levels:A,audioTracks:i,subtitleTracks:r,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:o,altAudio:!h&&i.some(d=>!!d.url)};this.hls.trigger(E.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e}${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A=tt({},o,{level:e,maxBitrate:o.maxBitrate,attrs:o.attrs,uri:o.uri,urlId:o.urlId});delete A._attrs,delete A._urlId,this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this._firstLevel}else return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===Re.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragLoaded(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const i=this._levels[t.level];i!==void 0&&(i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}onAudioTrackSwitched(e,t){const i=this.currentLevel;if(!i)return;const r=this.hls.audioTracks[t.id].groupId;if(i.audioGroupIds&&i.audioGroupId!==r){let n=-1;for(let o=0;o<i.audioGroupIds.length;o++)if(i.audioGroupIds[o]===r){n=o;break}n!==-1&&n!==i.urlId&&(i.urlId=n,this.canLoad&&this.startLoad())}}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){const r=i.urlId;let n=i.uri;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const o=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} URI ${r+1}/${i.url.length} ${n}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:n,level:t,id:r,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,t){const i=(n,o)=>o!==t,r=this._levels.filter((n,o)=>o!==e?!0:n.url.length>1&&t!==void 0?(n.url=n.url.filter(i),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(i)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(i)),n.urlId=0,!0):(this.steering&&this.steering.removeLevel(n),!1));this.hls.trigger(E.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){t.forEach((i,r)=>{const{details:n}=i;n!=null&&n.fragments&&n.fragments.forEach(o=>{o.level=r})}),this._levels=t}}function vn(s,e,t){t&&(e==="audio"?(s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds[s.url.length-1]=t):e==="text"&&(s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds[s.url.length-1]=t))}function qc(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}var nt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Cp{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=ps(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],h=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,h,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Bn(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=ps(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h)n.partial=!0,n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});else if(a<=h)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&Bn(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Bn(t))}getState(e){const t=ps(e),i=this.fragments[t];return i?i.buffered?Bn(i)?nt.PARTIAL:nt.OK:nt.APPENDING:nt.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=ps(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ps(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=ps(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function Bn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function ps(s){return`${s.type}_${s.level}_${s.urlId}_${s.sn}`}const jc=Math.pow(2,17);class yp{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new fi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(zc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=Xc(e),h=Jc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:jc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l);let y=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),a({frag:e,part:null,payload:y,networkDetails:p})},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:bt({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,p)=>{t&&t({frag:e,part:null,payload:f,networkDetails:p})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(zc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=Xc(e,t),h=Jc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:jc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};i(y),a(y)},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:bt({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new fi({type:fe.NETWORK_ERROR,details:Y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),h=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Xc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(he(r)&&he(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function zc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:fe.MEDIA_ERROR,details:Y.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new fi(i)}class fi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class vp{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const t in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[t].loader;if(i){if(e&&e!==i.context.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=Y.KEY_LOAD_ERROR,i,r,n){return new fi({type:fe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,Y.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{const{frag:p,keyInfo:y,url:v}=g;if(!p.decryptdata||y!==this.keyUriToKeyInfo[v])return a(this.createKeyLoadError(p,Y.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));y.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,bt({url:A.url,data:void 0},u)))},onTimeout:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,Y.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}class Bp{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(){}}const Qp={length:0,start:()=>0,end:()=>0};class Ge{static isBuffered(e,t){try{if(e){const i=Ge.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=Ge.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const h=l.start-c.start;return h||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const h=r[c-1].end;e[l].start-h<i?e[l].end>h&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,h=r[l].end;if(t+i>=c&&t<h)a=c,A=h,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return F.log("failed to get media.buffered",t),Qp}}}class Aa{constructor(e,t,i,r=0,n=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Qn(),this.buffering={audio:Qn(),video:Qn(),audiovideo:Qn()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function Qn(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Zc(s,e){let t=null;for(let i=0,r=s.length;i<r;i++){const n=s[i];if(n&&n.cc===e){t=n;break}}return t}function bp(s,e,t){return!!(e.details&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function Sp(s,e,t=0){const i=s.fragments,r=e.fragments;if(!r.length||!i.length){F.log("No fragments to align");return}const n=Zc(i,r[0].cc);if(!n||n&&!n.startPTS){F.log("No frag in previous level to align on");return}return n}function eh(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function la(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)eh(t[i],s);e.fragmentHint&&eh(e.fragmentHint,s),e.alignedSliding=!0}function wp(s,e,t){e&&(Tp(s,t,e),!t.alignedSliding&&e.details&&xp(t,e.details),!t.alignedSliding&&e.details&&!t.skippedSegments&&$c(e.details,t))}function Tp(s,e,t){if(bp(s,t,e)){const i=Sp(t.details,e);i&&he(i.start)&&(F.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),la(i.start,e))}}function xp(s,e){if(!e.fragments.length||!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=e.fragments[0].programDateTime,i=s.fragments[0].programDateTime,r=(i-t)/1e3+e.fragments[0].start;r&&he(r)&&(F.log(`Adjusting PTS using programDateTime delta ${i-t}ms, sliding:${r.toFixed(3)} ${s.url} `),la(r,s))}function th(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;const r=Math.round(i.length/2)-1,n=i[r],o=Zc(t,n.cc)||t[Math.round(t.length/2)-1],a=n.programDateTime,A=o.programDateTime;if(a===null||A===null)return;const l=(A-a)/1e3-(o.start-n.start);la(l,s)}class Dp{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 Rp{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 Lp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?es(s,0,e-t):s}class _p{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],h=A[2],u=A[3],d=new Uint32Array(256);let g=0,f=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){let y=f^f<<1^f<<2^f<<3^f<<4;y=y>>>8^y&255^99,e[g]=y,t[y]=g;const v=d[g],Q=d[v],C=d[Q];let T=d[y]*257^y*16843008;r[g]=T<<24|T>>>8,n[g]=T<<16|T>>>16,o[g]=T<<8|T>>>24,a[g]=T,T=C*16843009^Q*65537^v*257^g*16843008,l[y]=T<<24|T>>>8,c[y]=T<<16|T>>>16,h[y]=T<<8|T>>>24,u[y]=T,g?(g=v^d[d[d[C^v]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],y=d[3];let v,Q;for(a=0;a<o;a++){if(a<n){v=l[a]=t[a];continue}Q=v,a%n===0?(Q=Q<<8|Q>>>24,Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255],Q^=u[a/n|0]<<24):n>6&&a%n===4&&(Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255]),l[a]=v=(l[a-n]^Q)>>>0}for(A=0;A<o;A++)a=o-A,A&3?Q=l[a]:Q=l[a-4],A<4||a<=4?c[A]=Q:c[A]=g[h[Q>>>24]]^f[h[Q>>>16&255]]^p[h[Q>>>8&255]]^y[h[Q&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],h=a[3],u=this.uint8ArrayToUint32Array_(i);let d=u[0],g=u[1],f=u[2],p=u[3];const y=new Int32Array(e),v=new Int32Array(y.length);let Q,C,T,b,L,R,P,k,q,$,te,Z,S,D;const U=this.networkToHostOrderSwap;for(;t<y.length;){for(q=U(y[t]),$=U(y[t+1]),te=U(y[t+2]),Z=U(y[t+3]),L=q^n[0],R=Z^n[1],P=te^n[2],k=$^n[3],S=4,D=1;D<r;D++)Q=A[L>>>24]^l[R>>16&255]^c[P>>8&255]^h[k&255]^n[S],C=A[R>>>24]^l[P>>16&255]^c[k>>8&255]^h[L&255]^n[S+1],T=A[P>>>24]^l[k>>16&255]^c[L>>8&255]^h[R&255]^n[S+2],b=A[k>>>24]^l[L>>16&255]^c[R>>8&255]^h[P&255]^n[S+3],L=Q,R=C,P=T,k=b,S=S+4;Q=o[L>>>24]<<24^o[R>>16&255]<<16^o[P>>8&255]<<8^o[k&255]^n[S],C=o[R>>>24]<<24^o[P>>16&255]<<16^o[k>>8&255]<<8^o[L&255]^n[S+1],T=o[P>>>24]<<24^o[k>>16&255]<<16^o[L>>8&255]<<8^o[R&255]^n[S+2],b=o[k>>>24]<<24^o[L>>16&255]<<16^o[R>>8&255]<<8^o[P&255]^n[S+3],v[t]=U(Q^d),v[t+1]=U(b^g),v[t+2]=U(T^f),v[t+3]=U(C^p),d=q,g=$,f=te,p=Z,t=t+4}return v.buffer}}const kp=16;class ca{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Lp(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=ts(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new _p),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=es(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new Rp(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new Dp(r,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(F.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%kp;return i!==e.length&&(t=es(e,0,i),this.remainderData=es(e,i)),t}logOnce(e){this.logEnabled&&(F.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Fp={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},W={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 ha extends Bp{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=W.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=F.log.bind(F,`${r}:`),this.warn=F.warn.bind(F,`${r}:`),this.hls=e,this.fragmentLoader=new yp(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ca(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=W.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return Ge.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levels[this.levelLastLoaded])==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===W.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=Ge.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${he(o)?o.toFixed(3):o}, state: ${n}`),this.state===W.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.stopLoad(),super.onHandlerDestroying()}onHandlerDestroyed(){this.state=W.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===W.FRAG_LOADING||!this.fragCurrent&&o===W.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=W.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===W.STOPPED||this.state===W.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===nt.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===nt.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,i})}return i}).then(i=>{const{fragCurrent:r,hls:n,levels:o}=this;if(!o)throw new Error("init load aborted, missing levels");const a=e.stats;this.state=W.IDLE,t.fragmentError=0,e.data=new Uint8Array(i.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),i.frag===r&&n.trigger(E.FRAG_BUFFERED,{stats:a,frag:r,part:null,id:e.type}),this.tick()}).catch(i=>{this.state===W.STOPPED||this.state===W.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?Fp.toString(Ge.getBuffered(a)):"(detached)"})`),this.state=W.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new Aa(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=W.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===W.KEY_LOADING&&(this.state=W.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=W.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,u,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),he(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=W.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(E.FRAG_LOADED,u);const g=Yc(i,e.sn,h.index+1)||Kc(l,e.sn,h.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===Y.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==W.PARSING){!this.fragCurrent&&this.state!==W.STOPPED&&this.state!==W.ERROR&&(this.state=W.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?Yc(a,n,o):null,l=A?A.fragment:hp(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==W.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=ts(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ge.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Ge.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return he(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=Ge.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return Ge.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,i=e||t.maxBufferLength;return t.maxMaxBufferLength>=i?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(a=this.getInitialLiveFragment(t,i),this.startPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===nt.OK||i===nt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=dp(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=fp(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,l=r.maxFragLookUpTolerance,c=i.partList,h=!!(r.lowLatencyMode&&c!=null&&c.length&&A);h&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let u;if(e<t){const d=e>t-l?0:l;u=ur(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,g=this.fragmentTracker.getState(u);if((g===nt.OK||g===nt.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const p=o[d+1];u.sn<a&&this.fragmentTracker.getState(p)!==nt.OK?u=p:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t){const{levels:i,levelLastLoaded:r,fragPrevious:n}=this,o=r!==null?i[r]:null,a=e.fragments.length;if(!a)return this.warn("No fragments in live playlist"),0;const A=e.fragments[0].start,l=!t,c=e.alignedSliding&&he(A);if(l||!c&&!A){wp(n,o,e);const h=e.fragments[0].start;return this.log(`Live playlist sliding: ${h.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${n?n.sn:"na"} fragments: ${a}`),h}return A}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&he(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==W.FRAG_LOADING_WAITING_RETRY)&&(this.state=W.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===Y.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===ft.RetryRequest&&l){var c;this.resetStartWhenNotLoaded((c=this.levelLastLoaded)!=null?c:i.level);const h=ra(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${h}ms`),o.resolved=!0,this.retryDate=self.performance.now()+h,this.state=W.FRAG_LOADING_WAITING_RETRY}else l&&o?(this.resetFragmentErrors(e),A<l.maxNumRetry?n||(o.resolved=!0):F.warn(`${t.details} reached or exceeded max retry (${A})`)):(o==null?void 0:o.action)===ft.SendAlternateToPenaltyBox?this.state=W.WAITING_LEVEL:this.state=W.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===W.PARSING||this.state===W.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==W.STOPPED&&(this.state=W.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ge.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===W.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=W.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=this.levels?this.levels[e].details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){var t;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((t=this.levelLastLoaded)!=null?t:e.level),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:Hc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1))i.fragmentError=0;else if(((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=W.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){if(e.event==="demuxerWorker"){var t,i,r;this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded((t=(i=this.levelLastLoaded)!=null?i:(r=this.fragCurrent)==null?void 0:r.level)!=null?t:0),this.resetLoadingState()}}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function ih(){return self.SourceBuffer||self.WebKitSourceBuffer}function Np(){const s=In();if(!s)return!1;const e=ih(),t=s&&typeof s.isTypeSupported=="function"&&s.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function";return!!t&&!!i}function Mp(){var s;const e=ih();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}function Op(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Pp(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function Up(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Zt(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class sh{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=ts(this.cachedData,e),this.cachedData=null);let i=gn(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?v0(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&he(A))&&(this.basePTS=Gp(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yt.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else y0(e,r)?(i=gn(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Yt.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=es(e,n);this.cachedData?this.cachedData=ts(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:Zt(),id3Track:a,textTrack:Zt()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Zt(),id3Track:this._id3Track,textTrack:Zt()}}destroy(){}}const Gp=(s,e,t)=>{if(he(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function Hp(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){s.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!0,reason:`invalid ADTS sampling index:${h}`});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,F.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${h}`),/firefox/i.test(A)?h>=6?(r=5,a=new Array(4),n=h-3):(r=2,a=new Array(2),n=h):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=h):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&h>=6?n=h-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(h>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=h)),a[0]=r<<3,a[0]|=(h&14)>>1,a[1]|=(h&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[h],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function rh(s,e){return s[e]===255&&(s[e+1]&246)===240}function nh(s,e){return s[e+1]&1?7:9}function ua(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function $p(s,e){return e+5<s.length}function bn(s,e){return e+1<s.length&&rh(s,e)}function Yp(s,e){return $p(s,e)&&rh(s,e)&&ua(s,e)<=s.length-e}function Kp(s,e){if(bn(s,e)){const t=nh(s,e);if(e+t>=s.length)return!1;const i=ua(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||bn(s,r)}return!1}function oh(s,e,t,i,r){if(!s.samplerate){const n=Hp(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,F.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function ah(s){return 9216e4/s}function Vp(s,e){const t=nh(s,e);if(e+t<=s.length){const i=ua(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ah(s,e,t,i,r){const n=ah(s.samplerate),o=i+r*n,a=Vp(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}class Jp extends sh{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(gn(e,0)||[]).length;for(let r=e.length;i<r;i++)if(Kp(e,i))return F.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Yp(e,t)}appendFrame(e,t,i){oh(e,this.observer,t,i,e.manifestCodec);const r=Ah(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Wp=/\/emsg[-/]ID3/i;class qp{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=Zt("video",1),o=this.audioTrack=Zt("audio",1),a=this.txtTrack=Zt("text",1);if(this.id3Track=Zt("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=Cc(e);if(A.video){const{id:l,timescale:c,codec:h}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=h}if(A.audio){const{id:l,timescale:c,codec:h}=A.audio;o.id=l,o.timescale=c,o.codec=h}a.id=Ec.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return e=e.length>16384?e.subarray(0,16384):e,xe(e,["moof"]).length>0}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ts(this.remainderData,e));const a=M0(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=vc(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=vc(e,t),{videoTrack:t,audioTrack:Zt(),id3Track:r,textTrack:Zt()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=xe(e.samples,["emsg"]);r&&r.forEach(n=>{const o=U0(n);if(Wp.test(o.schemeIdUri)){const a=he(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Yt.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}let Sn=null;const jp=[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],Xp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],zp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Zp=[0,1,1,4];function lh(s,e,t,i,r){if(t+24>e.length)return;const n=ch(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function ch(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=jp[A*14+r-1]*1e3,h=Xp[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=zp[t][i],g=Zp[i],f=d*8*g,p=Math.floor(d*l/h+o)*g;if(Sn===null){const Q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Sn=Q?parseInt(Q[1]):0}return!!Sn&&Sn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:p,samplesPerFrame:f}}}function da(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function hh(s,e){return e+1<s.length&&da(s,e)}function eE(s,e){return da(s,e)&&4<=s.length-e}function tE(s,e){if(e+1<s.length&&da(s,e)){const i=ch(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||hh(s,n)}return!1}class uh{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&F.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const p=A();if(l(5),u(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const b=c();if(b===3&&u(1),g(),g(),u(1),h())for(o=b!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const y=c();if(y===0)c();else if(y===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const v=c(),Q=c(),C=l(1);C===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let T=[1,1];if(h()&&h())switch(A()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((v+1)*16-e*2-t*2),height:(2-C)*(Q+1)*16-(C?2:4)*(i+r),pixelRatio:T}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class iE{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ca(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=Qc(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const pt=188;class ki{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=i}static probe(e){const t=ki.syncOffset(e);return t>0&&F.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(pt*5,e.length-pt)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=pt)if(e[A]===71){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+pt*99,e.length-pt)+1)),n||(n=ga(e,A)===0),n&&a>1&&(o===0&&a>2||A+pt>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Ec[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=ki.createTrack("video"),this._audioTrack=ki.createTrack("audio",r),this._id3Track=ki.createTrack("id3"),this._txtTrack=ki.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_avcTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const o=this._avcTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,y=this.pmtParsed,v=this._pmtId,Q=e.length;if(this.remainderData&&(e=ts(this.remainderData,e),Q=e.length,this.remainderData=null),Q<pt&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,ki.syncOffset(e));Q-=(Q-C)%pt,Q<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,Q,e.buffer.byteLength-Q));let T=0;for(let L=C;L<Q;L+=pt)if(e[L]===71){const R=!!(e[L+1]&64),P=ga(e,L),k=(e[L+3]&48)>>4;let q;if(k>1){if(q=L+5+e[L+4],q===L+pt)continue}else q=L+4;switch(P){case c:R&&(h&&(n=Es(h))&&this.parseAVCPES(o,l,n,!1),h={data:[],size:0}),h&&(h.data.push(e.subarray(q,L+pt)),h.size+=L+pt-q);break;case u:if(R){if(g&&(n=Es(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(q,L+pt)),g.size+=L+pt-q);break;case d:R&&(f&&(n=Es(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(q,L+pt)),f.size+=L+pt-q);break;case 0:R&&(q+=e[q]+1),v=this._pmtId=sE(e,q);break;case v:{R&&(q+=e[q]+1);const $=rE(e,q,this.typeSupported,i);c=$.avc,c>0&&(o.pid=c),u=$.audio,u>0&&(a.pid=u,a.segmentCodec=$.segmentCodec),d=$.id3,d>0&&(A.pid=d),p!==null&&!y&&(F.warn(`MPEG-TS PMT found at ${L} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,L=C-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=P;break}}else T++;if(T>0){const L=new Error(`Found ${T} TS packet/s that do not start with 0x47`);this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:L,reason:L.message})}o.pesData=h,a.pesData=g,A.pesData=f;const b={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(b),b}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=Es(o))?(this.parseAVCPES(i,n,l,!0),i.pesData=null):i.pesData=o,a&&(l=Es(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break}t.pesData=null}else a!=null&&a.size&&F.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=Es(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new iE(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAVCPES(e,t,i,r){const n=this.parseAVCNALu(e,i.data);let o=this.avcSample,a,A=!1;i.data=null,o&&n.length&&!e.audFound&&(dr(o,e),o=this.avcSample=wn(!1,i.pts,i.dts,"")),n.forEach(l=>{var c;switch(l.type){case 1:{let u=!1;a=!0;const d=l.data;if(A&&d.length>4){const g=new uh(d).readSliceType();(g===2||g===4||g===7||g===9)&&(u=!0)}if(u){var h;(h=o)!=null&&h.frame&&!o.key&&(dr(o,e),o=this.avcSample=null)}o||(o=this.avcSample=wn(!0,i.pts,i.dts,"")),o.frame=!0,o.key=u;break}case 5:a=!0,(c=o)!=null&&c.frame&&!o.key&&(dr(o,e),o=this.avcSample=null),o||(o=this.avcSample=wn(!0,i.pts,i.dts,"")),o.key=!0,o.frame=!0;break;case 6:{a=!0,Bc(l.data,1,i.pts,t.samples);break}case 7:if(a=!0,A=!0,!e.sps){const u=l.data,g=new uh(u).readSPS();e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[u],e.duration=this._duration;const f=u.subarray(1,4);let p="avc1.";for(let y=0;y<3;y++){let v=f[y].toString(16);v.length<2&&(v="0"+v),p+=v}e.codec=p}break;case 8:a=!0,e.pps||(e.pps=[l.data]);break;case 9:a=!1,e.audFound=!0,o&&dr(o,e),o=this.avcSample=wn(!1,i.pts,i.dts,"");break;case 12:a=!0;break;default:a=!1,o&&(o.debug+="unknown NAL "+l.type+" ");break}o&&a&&o.units.push(l)}),r&&o&&(dr(o,e),this.avcSample=null)}getLastNalUnit(e){var t;let i=this.avcSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(h>=0){const d={data:t.subarray(h,a-r-1),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);if(d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l=a-r-1,l>0)){const g=new Uint8Array(d.data.byteLength+l);g.set(d.data,0),g.set(t.subarray(0,l),d.data.byteLength),d.data=g,d.state=0}}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);if(d){const g=new Uint8Array(d.data.byteLength+t.byteLength);g.set(d.data,0),g.set(t,d.data.byteLength),d.data=g}}return e.naluState=r,o}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1){const d=new Uint8Array(u+n.byteLength);d.set(r.sample.unit,0),d.set(n,u),n=d}else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!bn(n,o);o++);if(o!==i){let h;const u=o<a-1;u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES";const d=new Error(h);if(F.warn(`parsing error: ${h}`),this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,levelRetry:u,error:d,reason:h}),!u)return}oh(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=ah(e.samplerate);A=r.sample.pts+h}else{F.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=Ah(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!bn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){F.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(hh(i,o)){const A=lh(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseID3PES(e,t){if(t.pts===void 0){F.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=tt({},t,{type:this._avcTrack?Yt.emsg:Yt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function wn(s,e,t,i){return{key:s,frame:!1,pts:e,dts:t,units:[],debug:i,length:0}}function ga(s,e){return((s[e+1]&31)<<8)+s[e+2]}function sE(s,e){return(s[e+10]&31)<<8|s[e+11]}function rE(s,e,t,i){const r={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],o=e+3+n-4,a=(s[e+10]&15)<<8|s[e+11];for(e+=12+a;e<o;){const A=ga(s,e);switch(s[e]){case 207:if(!i){F.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:r.audio===-1&&(r.audio=A);break;case 21:r.id3===-1&&(r.id3=A);break;case 219:if(!i){F.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:r.avc===-1&&(r.avc=A);break;case 3:case 4:t.mpeg!==!0&&t.mp3!==!0?F.log("MPEG audio found, not supported in this browser"):r.audio===-1&&(r.audio=A,r.segmentCodec="mp3");break;case 36:F.warn("Unsupported HEVC stream type found");break}e+=((s[e+3]&15)<<8|s[e+4])+5}return r}function Es(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;){const l=new Uint8Array(a[0].length+a[1].length);l.set(a[0]),l.set(a[1],a[0].length),a[0]=l,a.splice(1,1)}if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(F.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const h=new Uint8Array(s.size);for(let u=0,d=a.length;u<d;u++){t=a[u];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;h.set(t,e),e+=g}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}function dr(s,e){if(s.units.length&&s.frame){if(s.pts===void 0){const t=e.samples,i=t.length;if(i){const r=t[i-1];s.pts=r.pts,s.dts=r.dts}else{e.dropped++;return}}e.samples.push(s)}s.debug.length&&F.log(s.pts+"/"+s.dts+":"+s.debug)}class nE extends sh{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let i=(gn(e,0)||[]).length;for(let r=e.length;i<r;i++)if(tE(e,i))return F.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return eE(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return lh(e,t,i,this.basePTS,this.frameIndex)}}class dh{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 Fi=Math.pow(2,32)-1;class O{static init(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in O.types)O.types.hasOwnProperty(e)&&(O.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=n,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,o,A,o,a),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return O.box(O.types.hdlr,O.HDLR_TYPES[e])}static mdat(e){return O.box(O.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Fi+1)),r=Math.floor(t%(Fi+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return O.box(O.types.mdia,O.mdhd(e.timescale,e.duration),O.hdlr(e.type),O.minf(e))}static mfhd(e){return O.box(O.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"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(e)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(e))}static moof(e,t,i){return O.box(O.types.moof,O.mfhd(e),O.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trak(e[t]);return O.box.apply(null,[O.types.moov,O.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(O.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trex(e[t]);return O.box.apply(null,[O.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Fi+1)),r=Math.floor(t%(Fi+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return O.box(O.types.sdtp,i)}static stbl(e){return O.box(O.types.stbl,O.stsd(e),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=O.box(O.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,A>>8&255,A&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static mp4a(e){const t=e.samplerate;return O.box(O.types.mp4a,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]),O.box(O.types.esds,O.esds(e)))}static mp3(e){const t=e.samplerate;return O.box(O.types[".mp3"],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 stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(e)):O.box(O.types.stsd,O.STSD,O.mp4a(e)):O.box(O.types.stsd,O.STSD,O.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Fi+1)),a=Math.floor(i%(Fi+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=O.sdtp(e),r=e.id,n=Math.floor(t/(Fi+1)),o=Math.floor(t%(Fi+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),O.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,O.box(O.types.trak,O.tkhd(e),O.mdia(e))}static trex(e){const t=e.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,h,u;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,h=A.flags,u=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*a);return O.box(O.types.trun,o)}static initSegment(e){O.types||O.init();const t=O.moov(e),i=new Uint8Array(O.FTYP.byteLength+t.byteLength);return i.set(O.FTYP),i.set(t,O.FTYP.byteLength),i}}O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0;const gh=9e4;function fa(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function oE(s,e,t=1,i=!1){return fa(s,e,1/t,i)}function gr(s,e=!1){return fa(s,1e3,1/gh,e)}function aE(s,e=1){return fa(s,gh,1/e)}const AE=10*1e3,fh=1024,lE=1152;let Tn=null,pa=null;class Ea{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Tn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Tn=o?parseInt(o[1]):0}if(pa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);pa=n?parseInt(n[1]):0}}destroy(){}resetTimeStamp(e){F.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){F.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){F.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Mt(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&F.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,h,u,d,g,f=n,p=n;const y=e.pid>-1,v=t.pid>-1,Q=t.samples.length,C=e.samples.length>0,T=a&&Q>0||Q>1;if((!y||C)&&(!v||T)||this.ISGenerated||a){this.ISGenerated||(h=this.generateIS(e,t,n,o));const L=this.isVideoContiguous;let R=-1,P;if(T&&(R=cE(t.samples),!L&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,R>0){F.warn(`[mp4-remuxer]: Dropped ${R} out of ${Q} video samples due to a missing keyframe`);const k=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(R),t.dropped+=R,p+=(t.samples[0].pts-k)/t.inputTimeScale,P=p}else R===-1&&(F.warn(`[mp4-remuxer]: No keyframe found out of ${Q} video samples`),g=!1);if(this.ISGenerated){if(C&&T){const k=this.getVideoStartPts(t.samples),$=(Mt(e.samples[0].pts,k)-k)/t.inputTimeScale;f+=Math.max(0,$),p+=Math.max(0,-$)}if(C){if(e.samplerate||(F.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,v||T||A===Ee.AUDIO?p:void 0),T){const k=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(F.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,L,k)}}else T&&(l=this.remuxVideo(t,p,L,0));l&&(l.firstKeyFrame=R,l.independent=R!==-1,l.firstKeyFramePTS=P)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=ph(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=Eh(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:g,text:u,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,h="audio/mp4",u,d,g;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):O.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?u=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length&&(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},c))if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),p=Math.round(g*i);d=Math.min(d,Mt(o[0].dts,f)-p),u=Math.min(u,f-p)}else c=!1;if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:g},this._initDTS={baseTime:d,timescale:g}):u=g=void 0,{tracks:A,initPTS:u,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,h=8,u=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!i||c===null){const B=t*n,w=o[0].pts-Mt(o[0].dts,o[0].pts);c=B-w}const v=l.baseTime*n/l.timescale;for(let B=0;B<A;B++){const w=o[B];w.pts=Mt(w.pts-v,c),w.dts=Mt(w.dts-v,c),w.dts<o[B>0?B-1:B].dts&&(y=!0)}y&&o.sort(function(B,w){const N=B.dts-w.dts,H=B.pts-w.pts;return N||H}),d=o[0].dts,g=o[o.length-1].dts;const Q=g-d,C=Q?Math.round(Q/(A-1)):u||e.inputTimeScale/30;if(i){const B=d-c,w=B>C,N=B<-1;if((w||N)&&(w?F.warn(`AVC: ${gr(B,!0)} ms (${B}dts) hole between fragments detected, filling it`):F.warn(`AVC: ${gr(-B,!0)} ms (${B}dts) overlapping between fragments detected`),!N||c>=o[0].pts)){d=c;const H=o[0].pts-B;o[0].dts=d,o[0].pts=H,F.log(`Video: First PTS/DTS adjusted: ${gr(H,!0)}/${gr(d,!0)}, delta: ${gr(B,!0)} ms`)}}d=Math.max(0,d);let T=0,b=0;for(let B=0;B<A;B++){const w=o[B],N=w.units,H=N.length;let K=0;for(let X=0;X<H;X++)K+=N[X].data.length;b+=K,T+=H,w.length=K,w.dts=Math.max(w.dts,d),f=Math.min(w.pts,f),p=Math.max(w.pts,p)}g=o[A-1].dts;const L=b+4*T+8;let R;try{R=new Uint8Array(L)}catch(B){this.observer.emit(E.ERROR,E.ERROR,{type:fe.MUX_ERROR,details:Y.REMUX_ALLOC_ERROR,fatal:!1,error:B,bytes:L,reason:`fail allocating video mdat ${L}`});return}const P=new DataView(R.buffer);P.setUint32(0,L),R.set(O.types.mdat,4);let k=!1,q=Number.POSITIVE_INFINITY,$=Number.POSITIVE_INFINITY,te=Number.NEGATIVE_INFINITY,Z=Number.NEGATIVE_INFINITY;for(let B=0;B<A;B++){const w=o[B],N=w.units;let H=0;for(let se=0,ue=N.length;se<ue;se++){const le=N[se],Ce=le.data,Se=le.data.byteLength;P.setUint32(h,Se),h+=4,R.set(Ce,h),h+=Se,H+=4+Se}let K;if(B<A-1)u=o[B+1].dts-w.dts,K=o[B+1].pts-w.pts;else{const se=this.config,ue=B>0?w.dts-o[B-1].dts:C;if(K=B>0?w.pts-o[B-1].pts:C,se.stretchShortVideoTrack&&this.nextAudioPts!==null){const le=Math.floor(se.maxBufferHole*n),Ce=(r?f+r*n:this.nextAudioPts)-w.pts;Ce>le?(u=Ce-ue,u<0?u=ue:k=!0,F.log(`[mp4-remuxer]: It is approximately ${Ce/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=ue}else u=ue}const X=Math.round(w.pts-w.dts);q=Math.min(q,u),te=Math.max(te,u),$=Math.min($,K),Z=Math.max(Z,K),a.push(new Ih(w.key,u,H,X))}if(a.length){if(Tn){if(Tn<70){const B=a[0].flags;B.dependsOn=2,B.isNonSync=0}}else if(pa&&Z-$<te-q&&C/te<.025&&a[0].cts===0){F.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let B=d;for(let w=0,N=a.length;w<N;w++){const H=B+a[w].duration,K=B+a[w].cts;if(w<N-1){const X=H+a[w+1].cts;a[w].duration=X-K}else a[w].duration=w?a[w-1].duration:C;a[w].cts=0,B=H}}}u=k||!u?C:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const S=O.moof(e.sequenceNumber++,d,tt({},e,{samples:a})),D="video",U={data1:S,data2:R,startPTS:f/n,endPTS:(p+u)/n,startDTS:d/n,endDTS:c/n,type:D,hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,U}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=e.segmentCodec==="aac"?fh:lE,c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,p=u?0:8,y=this.nextAudioPts||-1;const v=t*o,Q=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&y>0&&(r&&Math.abs(v-y)<9e3||Math.abs(Mt(f[0].pts-Q,v)-y)<20*c),f.forEach(function(D){D.pts=Mt(D.pts-Q,v)}),!i||y<0){if(f=f.filter(D=>D.pts>=0),!f.length)return;n===0?y=0:r&&!g?y=Math.max(0,v):y=f[0].pts}if(e.segmentCodec==="aac"){const D=this.config.maxAudioFramesDrift;for(let U=0,B=y;U<f.length;U++){const w=f[U],N=w.pts,H=N-B,K=Math.abs(1e3*H/o);if(H<=-D*c&&g)U===0&&(F.warn(`Audio frame @ ${(N/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*H/o)} ms.`),this.nextAudioPts=y=B=N);else if(H>=D*c&&K<AE&&g){let X=Math.round(H/c);B=N-X*c,B<0&&(X--,B+=c),U===0&&(this.nextAudioPts=y=B),F.warn(`[mp4-remuxer]: Injecting ${X} audio frame @ ${(B/o).toFixed(3)}s due to ${Math.round(1e3*H/o)} ms gap.`);for(let se=0;se<X;se++){const ue=Math.max(B,0);let le=dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);le||(F.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),le=w.unit.subarray()),f.splice(U,0,{unit:le,pts:ue}),B+=c,U++}}w.pts=B,B+=c}}let C=null,T=null,b,L=0,R=f.length;for(;R--;)L+=f[R].unit.byteLength;for(let D=0,U=f.length;D<U;D++){const B=f[D],w=B.unit;let N=B.pts;if(T!==null){const K=d[D-1];K.duration=Math.round((N-T)/A)}else if(i&&e.segmentCodec==="aac"&&(N=y),C=N,L>0){L+=p;try{b=new Uint8Array(L)}catch(K){this.observer.emit(E.ERROR,E.ERROR,{type:fe.MUX_ERROR,details:Y.REMUX_ALLOC_ERROR,fatal:!1,error:K,bytes:L,reason:`fail allocating audio mdat ${L}`});return}u||(new DataView(b.buffer).setUint32(0,L),b.set(O.types.mdat,4))}else return;b.set(w,p);const H=w.byteLength;p+=H,d.push(new Ih(!0,l,H,0)),T=N}const P=d.length;if(!P)return;const k=d[d.length-1];this.nextAudioPts=y=T+A*k.duration;const q=u?new Uint8Array(0):O.moof(e.sequenceNumber++,C/A,tt({},e,{samples:d}));e.samples=[];const $=C/o,te=y/o,S={data1:q,data2:b,startPTS:$,endPTS:te,startDTS:$,endDTS:te,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,S}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*fh,g=Math.ceil((u-h)/d),f=dh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(F.warn("[mp4-remuxer]: remux empty Audio"),!f){F.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let y=0;y<g;y++){const v=h+y*d;p.push({unit:f,pts:v,dts:v})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Mt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function cE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function ph(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Mt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Mt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Eh(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=Mt(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class Ih{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new hE(e)}}class hE{constructor(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}}class uE{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(L0(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Cc(e);t||(t=mh(r.audio,Me.AUDIO)),i||(i=mh(r.video,Me.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:F.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};he(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(u),g=this.initData),!((A=g)!=null&&A.length))return F.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=k0(u,g),p=_0(g,u),y=p===null?n:p;(dE(l,y,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=y-n,l&&l.timescale===1&&F.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const v=e?y-l.baseTime/l.timescale:c,Q=v+f;N0(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=Q:(F.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,T=!!g.video;let b="";C&&(b+="audio"),T&&(b+="video");const L={data1:u,startPTS:v,startDTS:v,endPTS:Q,endDTS:Q,type:b,hasAudio:C,hasVideo:T,nb:1,dropped:0};return h.audio=L.type==="audio"?L:void 0,h.video=L.type!=="audio"?L:void 0,h.initSegment=d,h.id3=ph(i,n,l,l),r.samples.length&&(h.text=Eh(r,n,l)),h}}function dE(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function mh(s,e){const t=s==null?void 0:s.codec;return t&&t.length>4?t:t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":t==="avc1"||e===Me.VIDEO?"avc1.42e01e":"mp4a.40.5"}let pi;try{pi=self.performance.now.bind(self.performance)}catch{F.debug("Unable to use Performance API on this environment"),pi=typeof self<"u"&&self.Date.now}const Ia=[{demux:qp,remux:uE},{demux:ki,remux:Ea},{demux:Jp,remux:Ea},{demux:nE,remux:Ea}];class Ch{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=pi();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:y,duration:v,initSegmentData:Q}=A,C=gE(o,t);if(C&&C.method==="AES-128"){const R=this.getDecrypter();if(R.isSync()){let P=R.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&(P=R.flush()),!P)return n.executeEnd=pi(),ma(i);o=new Uint8Array(P)}else return this.decryptionPromise=R.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(P=>{const k=this.push(P,null,i);return this.decryptionPromise=null,k}),this.decryptionPromise}const T=this.needsProbing(c,h);if(T){const R=this.configureTransmuxer(o);if(R)return F.warn(`[transmuxer] ${R.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),n.executeEnd=pi(),ma(i)}(c||h||g||T)&&this.resetInitSegment(Q,f,p,v,t),(c||g||T)&&this.resetInitialTimestamp(y),l||this.resetContiguity();const b=this.transmux(o,C,d,u,i),L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,n.executeEnd=pi(),b}flush(e){const t=e.transmuxing;t.executeStart=pi();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=pi(),[ma(e)];const c=A.flush(a);return xn(c)?c.then(h=>(this.flushRemux(o,h,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;F.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=pi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let h=0,u=Ia.length;h<u;h++)if(Ia[h].demux.probe(e)){o=Ia[h];break}if(!o)return new Error("Failed to find demuxer by probing fragment data");const a=this.demuxer,A=this.remuxer,l=o.remux,c=o.demux;(!A||!(A instanceof l))&&(this.remuxer=new l(i,t,r,n)),(!a||!(a instanceof c))&&(this.demuxer=new c(i,t,r),this.probe=c.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ca(this.config)),e}}function gE(s,e){let t=null;return s.byteLength>0&&e!=null&&e.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ma=s=>({remuxResult:{},chunkMeta:s});function xn(s){return"then"in s&&s.then instanceof Function}class fE{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class pE{constructor(e,t,i,r,n,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=o}}var yh={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,h,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,h||A,u),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)e.call(c,h)&&l.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,d=h.length,g=new Array(d);u<d;u++)g[u]=h[u].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,u,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var p=this._events[f],y=arguments.length,v,Q;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),y){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,h),!0;case 4:return p.fn.call(p.context,c,h,u),!0;case 5:return p.fn.call(p.context,c,h,u,d),!0;case 6:return p.fn.call(p.context,c,h,u,d,g),!0}for(Q=1,v=new Array(y-1);Q<y;Q++)v[Q-1]=arguments[Q];p.fn.apply(p.context,v)}else{var C=p.length,T;for(Q=0;Q<C;Q++)switch(p[Q].once&&this.removeListener(l,p[Q].fn,void 0,!0),y){case 1:p[Q].fn.call(p[Q].context);break;case 2:p[Q].fn.call(p[Q].context,c);break;case 3:p[Q].fn.call(p[Q].context,c,h);break;case 4:p[Q].fn.call(p[Q].context,c,h,u);break;default:if(!v)for(T=1,v=new Array(y-1);T<y;T++)v[T-1]=arguments[T];p[Q].fn.apply(p[Q].context,v)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,u){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!u||g.once)&&(!h||g.context===h)&&o(this,d);else{for(var f=0,p=[],y=g.length;f<y;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&p.push(g[f]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(yh);var EE=yh.exports,Ca=i0(EE);const ya=In()||{isTypeSupported:()=>!1};class vh{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(l,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,l===E.ERROR&&(this.error=c.error),this.hls.trigger(l,c)};this.observer=new Ca,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a={mp4:ya.isTypeSupported("video/mp4"),mpeg:ya.isTypeSupported("audio/mpeg"),mp3:ya.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||Op())){try{n.workerPath?(F.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Up(n.workerPath)):(F.log(`injecting Web Worker for "${t}"`),this.workerContext=Pp()),this.onwmsg=h=>this.onWorkerMessage(h);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=h=>{const u=new Error(`${h.message} (${h.filename}:${h.lineno})`);n.enableWorker=!1,F.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})},c.postMessage({cmd:"init",typeSupported:a,vendor:A,id:t,config:JSON.stringify(n)})}catch(c){F.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new Ch(this.observer,a,n,A,t)}return}this.transmuxer=new Ch(this.observer,a,n,A,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,p=this.frag,y=!(p&&n.cc===p.cc),v=!(p&&l.level===p.level),Q=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,T=Q===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),b=!v&&(Q===1||Q===0&&(C===1||T&&C<=0)),L=self.performance.now();(v||Q||n.stats.parsing.start===0)&&(n.stats.parsing.start=L),o&&(C||!b)&&(o.stats.parsing.start=L);const R=!(p&&((h=n.initSegment)==null?void 0:h.url)===((u=p.initSegment)==null?void 0:u.url)),P=new pE(y,b,A,v,g,R);if(!b||y||R){F.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
180
180
  discontinuity: ${y}
181
181
  trackSwitch: ${v}
182
182
  contiguous: ${b}
183
183
  accurateTimeOffset: ${A}
184
184
  timeOffset: ${g}
185
- initSegmentChange: ${R}`);const k=new gE(i,r,t,a,c);this.configureTransmuxer(k)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:P},e instanceof ArrayBuffer?[e]:[]);else if(d){const k=d.push(e,f,l,P);xn(k)?(d.async=!0,k.then(q=>{this.handleTransmuxComplete(q)}).catch(q=>{this.transmuxerError(q,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(k))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);xn(i)||t.async?(xn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":F[t.data.logType]&&F[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const EE=250,va=2,IE=.1,mE=.05;class CE{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,n!==null){if(this.stallReported){const y=self.performance.now()-n;F.warn(`playback not stuck anymore @${o}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!Ge.getBuffered(r).length)return;const c=Ge.bufferInfo(r,o,0),h=c.len>0,u=c.nextStart||0;if(!h&&!u)return;if(a){const y=c.len>va,v=!u||t&&t.start<=o||u-o>va&&!this.fragmentTracker.getPartialFragment(o);if(y||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var d;const y=Math.max(u,c.start||0)-o,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(v==null||(d=v.details)==null?void 0:d.live)?v.details.targetduration*2:va,T=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=C||T)){this._trySkipBufferHole(T);return}}const g=self.performance.now();if(n===null){this.stalled=g;return}const f=g-n;if(!a&&f>=EE&&(this._reportStall(c),!this.media))return;const p=Ge.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(F.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);F.warn(n.message),t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=Ge.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:u}=this;let d=!1;if(n===0){const g=u.getAppendedFrag(0,Ee.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,Ee.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const y=u.getPartialFragment(p);if(y)p+=y.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+mE,n+IE);if(F.warn(`skipping hole, adjusting currentTime from ${n} to ${h}`),this.moved=!0,this.stalled=null,r.currentTime=h,e&&!e.gap){const u=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${h}`);i.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:e})}return h}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);F.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);F.error(o.message),t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const yE=100;class vE extends ha{constructor(e,t,i){super(e,t,i,"[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(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),this.onMediaDetaching()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(yE),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=W.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=W.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case W.WAITING_LEVEL:{var e;const{levels:i,level:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=W.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=W.IDLE;break}break}case W.FRAG_LOADING_WAITING_RETRY:{var t;const i=self.performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=W.IDLE)}break}this.state===W.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this,{config:n,nextLoadLevel:o}=e;if(t===null||!r&&(this.startFragRequested||!n.startFragPrefetch)||this.altAudio&&this.audioOnly||!(i!=null&&i[o]))return;const a=i[o],A=this.getMainFwdBufferInfo();if(A===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(A,l)){const p={};this.altAudio&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=W.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=a.details;if(!c||this.state===W.WAITING_LEVEL||c.live&&this.levelLastLoaded!==o){this.level=o,this.state=W.WAITING_LEVEL;return}const h=A.len,u=this.getMaxBufferLength(a.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>A.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:A.end;let g=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==nt.OK){var f;const y=((f=this.backtrackFragment)!=null?f:g).sn-c.startSN,v=c.fragments[y-1];v&&g.cc===v.cc&&(g=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&A.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,d)){if(!g.gap){const y=this.audioOnly&&!this.altAudio?Ne.AUDIO:Ne.VIDEO,v=(y===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,y,Ee.MAIN)}g=this.getNextFragmentLoopLoading(g,c,A,Ee.MAIN,u)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,a,d))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===nt.NOT_LOADED||r===nt.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,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 i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*.5),l*.75));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 W.KEY_LOADING:case W.FRAG_LOADING:case W.FRAG_LOADING_WAITING_RETRY:case W.PARSING:case W.PARSED:this.state=W.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new CE(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ce(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1,n;t.levels.forEach(o=>{n=o.audioCodec,n&&(n.indexOf("mp4a.40.2")!==-1&&(i=!0),n.indexOf("mp4a.40.5")!==-1&&(r=!0))}),this.audioCodecSwitch=i&&r&&!Np(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==W.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(r.details))&&(this.state=W.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===W.FRAG_LOADING||this.state===W.FRAG_LOADING_WAITING_RETRY)&&(l.level!==t.level||l.urlId!==A.urlId)&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details)}if(A.details=o,this.levelLastLoaded=n,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===W.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=W.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new yh(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new Aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),y=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==Ee.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===W.PARSED&&(this.state=W.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=W.ERROR;return}switch(t.details){case Y.FRAG_GAP:case Y.FRAG_PARSING_ERROR:case Y.FRAG_DECRYPT_ERROR:case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case Y.LEVEL_LOAD_ERROR:case Y.LEVEL_LOAD_TIMEOUT:case Y.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===W.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===De.LEVEL&&(this.state=W.IDLE);break;case Y.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Y.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ge.getBuffered(e).length){const i=this.state!==W.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=W.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Ne.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,Ee.MAIN)}}onLevelsUpdated(e,t){this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=Ge.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=W.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:g}=n,{details:f}=c,p=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=W.PARSING,g){if(g!=null&&g.tracks){const Q=A.initSegment||A;this._bufferInitSegment(c,g.tracks,Q,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:g.tracks})}const y=g.initPTS,v=g.timescale;ce(y)&&(this.initPTS[A.cc]={baseTime:y,timescale:v},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:y,timescale:v}))}if(h&&f&&A.sn!=="initSegment"){const y=f.fragments[A.sn-1-f.startSN],v=A.sn===f.startSN,Q=!y||A.cc>y.cc;if(n.independent!==!1){const{startPTS:C,endPTS:T,startDTS:b,endDTS:L}=h;if(l)l.elementaryStreams[h.type]={startPTS:C,endPTS:T,startDTS:b,endDTS:L};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!Q&&(this.couldBacktrack=!0),h.dropped&&h.independent){const R=this.getMainFwdBufferInfo(),P=(R?R.end:this.getLoadPosition())+this.config.maxBufferHole,k=h.firstKeyFramePTS?h.firstKeyFramePTS:C;if(!v&&P<k-this.config.maxBufferHole&&!Q){this.backtrack(A);return}else Q&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,T,A.start,L,!0)}A.setElementaryStreamInfo(h.type,C,T,b,L),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,v||Q)}else if(v||Q)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:y,endPTS:v,startDTS:Q,endDTS:C}=p;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:y,endPTS:v,startDTS:Q,endDTS:C}),A.setElementaryStreamInfo(Ne.AUDIO,y,v,Q,C),this.bufferFragmentData(p,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:i,frag:A,details:f,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,y)}if(f&&u){const y={id:i,frag:A,details:f,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,i,r){if(this.state!==W.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),n.metadata.channelCount!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")),l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.attrs.CODECS||""}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tick()}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=W.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ge.isBuffered(e,i)?t=this.getAppendedFrag(i):Ge.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n||t.urlId!==r.urlId)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&ce(t)&&ce(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Is{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class BE{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Is(e),this.fast_=new Is(t),this.defaultTTFB_=r,this.ttfb_=new Is(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Is(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Is(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Is(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}class QE{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;const t=e.config;this.bwEstimator=new BE(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this)}unregisterListeners(){const{hls:e}=this;e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this)}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null}onFragLoading(e,t){var i;const r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))}onLevelSwitching(e,t){this.clearTimer()}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{total:r,bwEstimate:n}=t.stats;ce(r)&&ce(n)&&(this.lastLevelLoadSec=8*r/n),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}_abandonRulesCheck(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:r,media:n}=i;if(!e||!n)return;const o=performance.now(),a=t?t.stats:e.stats,A=t?t.duration:e.duration,l=o-a.loading.start;if(a.aborted||a.loaded&&a.loaded===a.total||e.level===0){this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||n.paused||!n.playbackRate||!n.readyState)return;const c=i.mainForwardBufferInfo;if(c===null)return;const h=this.bwEstimator.getEstimateTTFB(),u=Math.abs(n.playbackRate);if(l<=Math.max(h,1e3*(A/(u*2))))return;const d=c.len/u;if(d>=2*A/u)return;const g=a.loading.first?a.loading.first-a.loading.start:-1,f=a.loaded&&g>-1,p=this.bwEstimator.getEstimate(),{levels:y,minAutoLevel:v}=i,Q=y[e.level],C=a.total||Math.max(a.loaded,Math.round(A*Q.maxBitrate/8));let T=l-g;T<1&&f&&(T=Math.min(l,a.loaded*8/p));const b=f?a.loaded*1e3/T:0,L=b?(C-a.loaded)/b:C*8/p+h/1e3;if(L<=d)return;const R=b?b*8:p;let P=Number.POSITIVE_INFINITY,k;for(k=e.level-1;k>v;k--){const q=y[k].maxBitrate;if(P=this.getTimeToLoadFrag(h/1e3,R,A*q,!y[k].details),P<d)break}P>=L||P>A*10||(i.nextLoadLevel=k,f?this.bwEstimator.sample(l-Math.min(h,g),a.loaded):this.bwEstimator.sampleTTFB(l),this.clearTimer(),F.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;
185
+ initSegmentChange: ${R}`);const k=new fE(i,r,t,a,c);this.configureTransmuxer(k)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:P},e instanceof ArrayBuffer?[e]:[]);else if(d){const k=d.push(e,f,l,P);xn(k)?(d.async=!0,k.then(q=>{this.handleTransmuxComplete(q)}).catch(q=>{this.transmuxerError(q,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(k))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);xn(i)||t.async?(xn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":F[t.data.logType]&&F[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const IE=250,va=2,mE=.1,CE=.05;class yE{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,n!==null){if(this.stallReported){const y=self.performance.now()-n;F.warn(`playback not stuck anymore @${o}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!Ge.getBuffered(r).length)return;const c=Ge.bufferInfo(r,o,0),h=c.len>0,u=c.nextStart||0;if(!h&&!u)return;if(a){const y=c.len>va,v=!u||t&&t.start<=o||u-o>va&&!this.fragmentTracker.getPartialFragment(o);if(y||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var d;const y=Math.max(u,c.start||0)-o,v=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(v==null||(d=v.details)==null?void 0:d.live)?v.details.targetduration*2:va,T=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=C||T)){this._trySkipBufferHole(T);return}}const g=self.performance.now();if(n===null){this.stalled=g;return}const f=g-n;if(!a&&f>=IE&&(this._reportStall(c),!this.media))return;const p=Ge.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(F.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);F.warn(n.message),t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=Ge.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:u}=this;let d=!1;if(n===0){const g=u.getAppendedFrag(0,Ee.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,Ee.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const y=u.getPartialFragment(p);if(y)p+=y.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+CE,n+mE);if(F.warn(`skipping hole, adjusting currentTime from ${n} to ${h}`),this.moved=!0,this.stalled=null,r.currentTime=h,e&&!e.gap){const u=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${h}`);i.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:e})}return h}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);F.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);F.error(o.message),t.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const vE=100;class BE extends ha{constructor(e,t,i){super(e,t,i,"[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(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),this.onMediaDetaching()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(vE),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=W.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=W.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case W.WAITING_LEVEL:{var e;const{levels:i,level:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=W.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=W.IDLE;break}break}case W.FRAG_LOADING_WAITING_RETRY:{var t;const i=self.performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=W.IDLE)}break}this.state===W.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this,{config:n,nextLoadLevel:o}=e;if(t===null||!r&&(this.startFragRequested||!n.startFragPrefetch)||this.altAudio&&this.audioOnly||!(i!=null&&i[o]))return;const a=i[o],A=this.getMainFwdBufferInfo();if(A===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(A,l)){const p={};this.altAudio&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=W.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=a.details;if(!c||this.state===W.WAITING_LEVEL||c.live&&this.levelLastLoaded!==o){this.level=o,this.state=W.WAITING_LEVEL;return}const h=A.len,u=this.getMaxBufferLength(a.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>A.end&&(this.backtrackFragment=null);const d=this.backtrackFragment?this.backtrackFragment.start:A.end;let g=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==nt.OK){var f;const y=((f=this.backtrackFragment)!=null?f:g).sn-c.startSN,v=c.fragments[y-1];v&&g.cc===v.cc&&(g=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&A.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,d)){if(!g.gap){const y=this.audioOnly&&!this.altAudio?Me.AUDIO:Me.VIDEO,v=(y===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,y,Ee.MAIN)}g=this.getNextFragmentLoopLoading(g,c,A,Ee.MAIN,u)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,a,d))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===nt.NOT_LOADED||r===nt.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,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 i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*.5),l*.75));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 W.KEY_LOADING:case W.FRAG_LOADING:case W.FRAG_LOADING_WAITING_RETRY:case W.PARSING:case W.PARSED:this.state=W.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new yE(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;he(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1,n;t.levels.forEach(o=>{n=o.audioCodec,n&&(n.indexOf("mp4a.40.2")!==-1&&(i=!0),n.indexOf("mp4a.40.5")!==-1&&(r=!0))}),this.audioCodecSwitch=i&&r&&!Mp(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==W.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(r.details))&&(this.state=W.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===W.FRAG_LOADING||this.state===W.FRAG_LOADING_WAITING_RETRY)&&(l.level!==t.level||l.urlId!==A.urlId)&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details)}if(A.details=o,this.levelLastLoaded=n,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===W.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=W.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new vh(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new Aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),y=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==Ee.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===W.PARSED&&(this.state=W.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=W.ERROR;return}switch(t.details){case Y.FRAG_GAP:case Y.FRAG_PARSING_ERROR:case Y.FRAG_DECRYPT_ERROR:case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case Y.LEVEL_LOAD_ERROR:case Y.LEVEL_LOAD_TIMEOUT:case Y.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===W.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Re.LEVEL&&(this.state=W.IDLE);break;case Y.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Y.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ge.getBuffered(e).length){const i=this.state!==W.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=W.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Me.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,Ee.MAIN)}}onLevelsUpdated(e,t){this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=Ge.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=W.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:g}=n,{details:f}=c,p=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=W.PARSING,g){if(g!=null&&g.tracks){const Q=A.initSegment||A;this._bufferInitSegment(c,g.tracks,Q,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:g.tracks})}const y=g.initPTS,v=g.timescale;he(y)&&(this.initPTS[A.cc]={baseTime:y,timescale:v},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:y,timescale:v}))}if(h&&f&&A.sn!=="initSegment"){const y=f.fragments[A.sn-1-f.startSN],v=A.sn===f.startSN,Q=!y||A.cc>y.cc;if(n.independent!==!1){const{startPTS:C,endPTS:T,startDTS:b,endDTS:L}=h;if(l)l.elementaryStreams[h.type]={startPTS:C,endPTS:T,startDTS:b,endDTS:L};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!Q&&(this.couldBacktrack=!0),h.dropped&&h.independent){const R=this.getMainFwdBufferInfo(),P=(R?R.end:this.getLoadPosition())+this.config.maxBufferHole,k=h.firstKeyFramePTS?h.firstKeyFramePTS:C;if(!v&&P<k-this.config.maxBufferHole&&!Q){this.backtrack(A);return}else Q&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,T,A.start,L,!0)}A.setElementaryStreamInfo(h.type,C,T,b,L),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,v||Q)}else if(v||Q)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:y,endPTS:v,startDTS:Q,endDTS:C}=p;l&&(l.elementaryStreams[Me.AUDIO]={startPTS:y,endPTS:v,startDTS:Q,endDTS:C}),A.setElementaryStreamInfo(Me.AUDIO,y,v,Q,C),this.bufferFragmentData(p,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:i,frag:A,details:f,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,y)}if(f&&u){const y={id:i,frag:A,details:f,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,i,r){if(this.state!==W.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),n.metadata.channelCount!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")),l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.attrs.CODECS||""}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tick()}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=W.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ge.isBuffered(e,i)?t=this.getAppendedFrag(i):Ge.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n||t.urlId!==r.urlId)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&he(t)&&he(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Is{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class QE{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Is(e),this.fast_=new Is(t),this.defaultTTFB_=r,this.ttfb_=new Is(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Is(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Is(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Is(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}class bE{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;const t=e.config;this.bwEstimator=new QE(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this)}unregisterListeners(){const{hls:e}=this;e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this)}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null}onFragLoading(e,t){var i;const r=t.frag;this.ignoreFragment(r)||(this.fragCurrent=r,this.partCurrent=(i=t.part)!=null?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))}onLevelSwitching(e,t){this.clearTimer()}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{total:r,bwEstimate:n}=t.stats;he(r)&&he(n)&&(this.lastLevelLoadSec=8*r/n),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}_abandonRulesCheck(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:r,media:n}=i;if(!e||!n)return;const o=performance.now(),a=t?t.stats:e.stats,A=t?t.duration:e.duration,l=o-a.loading.start;if(a.aborted||a.loaded&&a.loaded===a.total||e.level===0){this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||n.paused||!n.playbackRate||!n.readyState)return;const c=i.mainForwardBufferInfo;if(c===null)return;const h=this.bwEstimator.getEstimateTTFB(),u=Math.abs(n.playbackRate);if(l<=Math.max(h,1e3*(A/(u*2))))return;const d=c.len/u;if(d>=2*A/u)return;const g=a.loading.first?a.loading.first-a.loading.start:-1,f=a.loaded&&g>-1,p=this.bwEstimator.getEstimate(),{levels:y,minAutoLevel:v}=i,Q=y[e.level],C=a.total||Math.max(a.loaded,Math.round(A*Q.maxBitrate/8));let T=l-g;T<1&&f&&(T=Math.min(l,a.loaded*8/p));const b=f?a.loaded*1e3/T:0,L=b?(C-a.loaded)/b:C*8/p+h/1e3;if(L<=d)return;const R=b?b*8:p;let P=Number.POSITIVE_INFINITY,k;for(k=e.level-1;k>v;k--){const q=y[k].maxBitrate;if(P=this.getTimeToLoadFrag(h/1e3,R,A*q,!y[k].details),P<d)break}P>=L||P>A*10||(i.nextLoadLevel=k,f?this.bwEstimator.sample(l-Math.min(h,g),a.loaded):this.bwEstimator.sampleTTFB(l),this.clearTimer(),F.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;
186
186
  Time to underbuffer: ${d.toFixed(3)} s
187
187
  Estimated load time for current fragment: ${L.toFixed(3)} s
188
188
  Estimated load time for down switch fragment: ${P.toFixed(3)} s
189
189
  TTFB estimate: ${g}
190
- Current BW estimate: ${ce(p)?(p/1024).toFixed(3):"Unknown"} Kb/s
190
+ Current BW estimate: ${he(p)?(p/1024).toFixed(3):"Unknown"} Kb/s
191
191
  New BW estimate: ${(this.bwEstimator.getEstimate()/1024).toFixed(3)} Kb/s
192
- Aborting and switching to level ${k}`),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a}))}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){self.clearInterval(this.timer)}get nextAutoLevel(){const e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;let i=this.getNextABRAutoLevel();if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o,media:a}=i,A=t?t.duration:e?e.duration:0,l=a&&a.playbackRate!==0?Math.abs(a.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,h=i.mainForwardBufferInfo,u=(h?h.len:0)/l;let d=this.findBestLevel(c,o,r,u,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(d>=0)return d;F.trace(`[abr] ${u?"rebuffering expected":"buffer is empty"}, finding optimal quality level`);let g=A?Math.min(A,n.maxStarvationDelay):n.maxStarvationDelay,f=n.abrBandWidthFactor,p=n.abrBandWidthUpFactor;if(!u){const y=this.bitrateTestDelay;y&&(g=(A?Math.min(A,n.maxLoadingDelay):n.maxLoadingDelay)-y,F.trace(`[abr] bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),f=p=1)}return d=this.findBestLevel(c,o,r,u+g,f,p),Math.max(d,0)}findBestLevel(e,t,i,r,n,o){var a;const{fragCurrent:A,partCurrent:l,lastLoadedFragLevel:c}=this,{levels:h}=this.hls,u=h[c],d=!!(u!=null&&(a=u.details)!=null&&a.live),g=u==null?void 0:u.codecSet,f=l?l.duration:A?A.duration:0,p=this.bwEstimator.getEstimateTTFB()/1e3;let y=t,v=-1;for(let Q=i;Q>=t;Q--){const C=h[Q];if(!C||g&&C.codecSet!==g){C&&(y=Math.min(Q,y),v=Math.max(Q,v));continue}v!==-1&&F.trace(`[abr] Skipped level(s) ${y}-${v} with CODECS:"${h[v].attrs.CODECS}"; not compatible with "${u.attrs.CODECS}"`);const T=C.details,b=(l?T==null?void 0:T.partTarget:T==null?void 0:T.averagetargetduration)||f;let L;Q<=c?L=n*e:L=o*e;const R=h[Q].maxBitrate,P=this.getTimeToLoadFrag(p,L,R*b,T===void 0);if(F.trace(`[abr] level:${Q} adjustedbw-bitrate:${Math.round(L-R)} avgDuration:${b.toFixed(1)} maxFetchDuration:${r.toFixed(1)} fetchDuration:${P.toFixed(1)}`),L>R&&(P===0||!ce(P)||d&&!this.bitrateTestDelay||P<r))return Q}return-1}set nextAutoLevel(e){this._nextAutoLevel=e}}class vh{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=bE(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function bE(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}const Bh=100;class SE extends ha{constructor(e,t,i){super(e,t,i,"[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.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===W.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=W.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Bh),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=W.IDLE):(this.loadedmetadata=!1,this.state=W.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case W.IDLE:this.doTickIdle();break;case W.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=W.WAITING_INIT_PTS}break}case W.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=W.IDLE);break}case W.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=W.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=Ge.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);na(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=W.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=W.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!(t!=null&&t[r])||!i&&(this.startFragRequested||!n.startFragPrefetch))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(a)){this.state=W.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Ne.AUDIO,Ee.AUDIO));const l=this.getFwdBufferInfo(A,Ee.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=W.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len);if(d>=g&&!h)return;const p=a.fragments[0].start;let y=l.end;if(h&&i){const T=this.getLoadPosition();c&&h.attrs!==c.attrs&&(y=T),a.PTSKnown&&T<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}let v=this.getNextFragment(y,a),Q=!1;if(v&&this.isLoopLoading(v,y)&&(Q=!!v.gap,v=this.getNextFragmentLoopLoading(v,a,l,Ee.MAIN,g)),!v){this.bufferFlushed=!0;return}const C=u&&v.start>u.end+a.targetduration;if(C||!(u!=null&&u.len)&&l.len){const T=this.getAppendedFrag(v.start,Ee.MAIN);if(T===null||(Q||(Q=!!T.gap||!!C&&u.len===0),C&&!Q||Q&&l.nextStart&&l.nextStart<T.end))return}this.loadFragment(v,o,y)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new hr(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(Bh):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=W.IDLE):(this.switchingTrack=null,this.bufferedTrack=t,this.state=W.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const l=this.mainDetails;if(n.deltaUpdateFailed||!l)return;!a.details&&n.hasProgramDateTime&&l.hasProgramDateTime?(eh(n,l),A=n.fragments[0].start):A=this.alignPlaylists(n,a.details)}a.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(a.details,A),this.state===W.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=W.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new yh(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const p=r?r.index:-1,y=p!==-1,v=new Aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,y);u.push(n,g,h,"",i,r,c.totalduration,!1,v,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new vh,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=W.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==Ee.AUDIO){if(!this.loadedmetadata&&i.type===Ee.MAIN){const n=this.videoBuffer||this.media;n&&Ge.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,bt({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=W.ERROR;return}switch(t.details){case Y.FRAG_GAP:case Y.FRAG_PARSING_ERROR:case Y.FRAG_DECRYPT_ERROR:case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case Y.AUDIO_TRACK_LOAD_ERROR:case Y.AUDIO_TRACK_LOAD_TIMEOUT:case Y.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===W.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===De.AUDIO_TRACK&&(this.state=W.IDLE);break;case Y.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Y.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushed(e,{type:t}){t===Ne.AUDIO&&(this.bufferFlushed=!0,this.state===W.ENDED&&(this.state=W.IDLE))}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=W.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const p=A.initSegment||A;this._bufferInitSegment(f.tracks,p,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:f.tracks})}if(u){const{startPTS:p,endPTS:y,startDTS:v,endDTS:Q}=u;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:p,endPTS:y,startDTS:v,endDTS:Q}),A.setElementaryStreamInfo(Ne.AUDIO,p,y,v,Q),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=tt({id:i,frag:A,details:h},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=tt({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,i){if(this.state!==W.PARSING)return;e.video&&delete e.video;const r=e.audio;if(!r)return;r.levelCodec=r.codec,r.id="audio",this.log(`Init audio buffer, container:${r.container}, codecs[parsed]=[${r.codec}]`),this.hls.trigger(E.BUFFER_CODECS,e);const n=r.initSegment;if(n!=null&&n.byteLength){const o={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:n};this.hls.trigger(E.BUFFER_APPENDING,o)}this.tick()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===nt.NOT_LOADED||r===nt.PARTIAL){var n;e.sn==="initSegment"?this._loadInitSegment(e,t):(n=t.details)!=null&&n.live&&!this.initPTS[e.cc]?(this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=W.WAITING_INIT_PTS):(this.startFragRequested=!0,super.loadFragment(e,t,i))}else this.clearTrackerIfNeeded(e)}completeAudioSwitch(e){const{hls:t,media:i,bufferedTrack:r}=this,n=r==null?void 0:r.attrs,o=e.attrs;i&&n&&(n.CHANNELS!==o.CHANNELS||n.NAME!==o.NAME||n.LANGUAGE!==o.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,bt({},e))}}class wE extends oa{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Track with id:${i} and group:${r} not found in active group ${o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`audio-track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!(t!=null&&t.audioGroupIds))return;const i=t.audioGroupIds[t.urlId];if(this.groupId!==i){this.groupId=i||null;const r=this.tracks.filter(o=>!i||o.groupId===i);this.selectDefaultTrack&&!r.some(o=>o.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;const n={audioTracks:r};this.log(`Updating audio tracks, ${r.length} track(s) found in group:${i}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,n),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===De.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(t))}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();const i=this.currentTrack;t[this.trackId];const r=t[e],{groupId:n,name:o}=r;if(this.log(`Switching to audio-track ${e} "${o}" lang:${r.lang} group:${n}`),this.trackId=e,this.currentTrack=r,this.selectDefaultTrack=!1,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,bt({},r)),r.details&&!r.details.live)return;const a=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(a)}selectInitialTrack(){const e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(t!==-1)this.setAudioTrack(t);else{const i=new Error(`No track found for running audio group-ID: ${this.groupId} track count: ${e.length}`);this.warn(i.message),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:i})}}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e.attrs["STABLE-RENDITION-ID"]!==void 0&&e.attrs["STABLE-RENDITION-ID"]===r.attrs["STABLE-RENDITION-ID"]||e.name===r.name&&e.lang===r.lang))return r.id}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}function Qh(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!TE(s[t].attrs,e[t].attrs))return!1;return!0}function TE(s,e){const t=s["STABLE-RENDITION-ID"];return t?t===e["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(i=>s[i]!==e[i])}const bh=500;class xE extends ha{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Ee.SUBTITLE),this.levels=[],this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=W.IDLE,this.setInterval(bh),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=W.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===Ee.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==W.STOPPED&&(this.state=W.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(Qh(this.levels,t)){this.levels=t.map(i=>new hr(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new hr(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){if(this.currentTrackId=t.id,!this.levels.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(bh)}onSubtitleTrackLoaded(e,t){var i;const{details:r,id:n}=t,{currentTrackId:o,levels:a}=this;if(!a.length)return;const A=a[o];if(n>=a.length||n!==o||!A)return;this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(r.live||(i=A.details)!=null&&i.live){const c=this.mainDetails;if(r.deltaUpdateFailed||!c)return;const h=c.fragments[0];A.details?(l=this.alignPlaylists(r,A.details),l===0&&h&&(l=h.start,sa(r,l))):r.hasProgramDateTime&&c.hasProgramDateTime?(eh(r,c),l=r.fragments[0].start):h&&(l=h.start,sa(r,l))}A.details=r,this.levelLastLoaded=n,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(A.details,l),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===W.IDLE&&(ur(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=W.IDLE})}}doTick(){if(!this.media){this.state=W.IDLE;return}if(this.state===W.IDLE){const{currentTrackId:e,levels:t}=this,i=t[e];if(!t.length||!i||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=Ge.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,Ee.MAIN),c=i.details,h=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const p=this.fragPrevious;if(a<g){const y=r.maxFragLookUpTolerance,v=a>g-y?0:y;f=ur(p,u,Math.max(u[0].start,a),v),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const y=f.sn-c.startSN,v=u[y-1];v&&v.cc===f.cc&&this.fragmentTracker.getState(v)===nt.NOT_LOADED&&(f=v)}this.fragmentTracker.getState(f)===nt.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new DE(this.tracksBuffered[this.currentTrackId]||[])}}class DE{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class RE extends oa{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.trackChangeListener=()=>this.onTextTracksChanged(),this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes(this.trackId)}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,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),Ba(this.media.textTracks).forEach(t=>{fs(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,details:r}=t,{trackId:n}=this,o=this.tracksInGroup[n];if(!o){this.warn(`Invalid subtitle track id ${i}`);return}const a=o.details;o.details=t.details,this.log(`subtitle track ${i} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;const i=t.textGroupIds[t.urlId],r=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==i){const n=this.tracks.filter(A=>!i||A.groupId===i);this.tracksInGroup=n;const o=this.findTrackId(r==null?void 0:r.name)||this.findTrackId();this.groupId=i||null;const a={subtitleTracks:n};this.log(`Updating subtitle tracks, ${n.length} track(s) found in "${i}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,a),o!==-1&&this.setSubtitleTrack(o,r)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId,r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1}onError(e,t){t.fatal||!t.context||t.context.type===De.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.checkRetry(t)}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1;const t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(e){const{media:t,trackId:i}=this;if(!t)return;const r=Ba(t.textTracks),n=r.filter(a=>a.groupId===this.groupId);if(e===-1)[].slice.call(r).forEach(a=>{a.mode="disabled"});else{const a=n[i];a&&(a.mode="disabled")}const o=n[e];o&&(o.mode=this.subtitleDisplay?"showing":"hidden")}setSubtitleTrack(e,t){var i;const r=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(i=r[e])!=null&&i.details)||e<-1||e>=r.length)return;this.clearTimer();const n=r[e];if(this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:"")),this.trackId=e,n){const{id:o,groupId:a="",name:A,type:l,url:c}=n;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(n.url,t==null?void 0:t.details);this.loadPlaylist(h)}else this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e})}onTextTracksChanged(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=-1;const t=Ba(this.media.textTracks);for(let i=0;i<t.length;i++)if(t[i].mode==="hidden")e=i;else if(t[i].mode==="showing"){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}}function Ba(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}class LE{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t){const i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const{buffers:t,queues:i}=this,r=t[e],n=i[e];if(n.length){const o=n[0];try{o.execute()}catch(a){F.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(a),r!=null&&r.updating||(n.shift(),this.executeNext(e))}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Sh=In(),wh=/([ha]vc.)(?:\.[^.,]+)+/;class _E{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.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=()=>{const{media:t,mediaSource:i}=this;F.log("[buffer-controller]: Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:t})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{F.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=()=>{F.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=()=>{const{media:t,_objectUrl:i}=this;t&&t.src!==i&&F.error(`Media element src was set while attaching MediaSource (${i} > ${t.src})`)},this.hls=e,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}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new LE(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,F.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media;if(i&&Sh){const r=this.mediaSource=new Sh;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(F.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){F.warn(`[buffer-controller]: onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):F.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];try{t&&(this.removeBufferListeners(e),this.mediaSource&&this.mediaSource.removeSourceBuffer(t),this.sourceBuffer[e]=void 0)}catch(i){F.warn(`[buffer-controller]: Failed to reset the ${e} buffer`,i)}}),this._initSourceBuffer()}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length;Object.keys(t).forEach(r=>{if(i){const n=this.tracks[r];if(n&&typeof n.buffer.changeType=="function"){const{id:o,codec:a,levelCodec:A,container:l,metadata:c}=t[r],h=(n.levelCodec||n.codec).replace(wh,"$1"),u=(A||a).replace(wh,"$1");if(h!==u){const d=`${l};codecs=${A||a}`;this.appendChangeType(r,d),F.log(`[buffer-controller]: switching codec ${h} to ${u}`),this.tracks[r]={buffer:n.buffer,codec:a,container:l,levelCodec:A,metadata:c,id:o}}}}else this.pendingTracks[r]=t[r]}),!i&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(F.log(`[buffer-controller]: changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{F.warn(`[buffer-controller]: Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e)}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=u),g&&g.start===0&&(g.start=u);const f=n.audio;let p=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=A.start,v={execute:()=>{if(h.executeStart=self.performance.now(),p){const Q=this.sourceBuffer[a];if(Q){const C=y-Q.timestampOffset;Math.abs(C)>=.1&&(F.log(`[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${y} (delta: ${C}) sn: ${A.sn})`),Q.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const Q=self.performance.now();h.executeEnd=h.end=Q,d.first===0&&(d.first=Q),g&&g.first===0&&(g.first=Q);const{sourceBuffer:C}=this,T={};for(const b in C)T[b]=Ge.getBuffered(C[b]);this.appendError=0,this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:T})},onError:Q=>{F.error(`[buffer-controller]: Error encountered while trying to append to the ${a} SourceBuffer`,Q);const C={type:fe.MEDIA_ERROR,parent:A.type,details:Y.BUFFER_APPEND_ERROR,frag:A,part:l,chunkMeta:c,error:Q,err:Q,fatal:!1};Q.code===DOMException.QUOTA_EXCEEDED_ERR?C.details=Y.BUFFER_FULL_ERROR:(this.appendError++,C.details=Y.BUFFER_APPEND_ERROR,this.appendError>i.config.appendErrorMaxRetry&&(F.error(`[buffer-controller]: Failed ${i.config.appendErrorMaxRetry} times to append segment in sourceBuffer`),C.fatal=!0)),i.trigger(E.ERROR,C)}};r.append(v,a)}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{F.warn(`[buffer-controller]: Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[Ne.AUDIOVIDEO]?n.push("audiovideo"):(o[Ne.AUDIO]&&n.push("audio"),o[Ne.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&F.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.flushBackBuffer()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,F.log(`[buffer-controller]: ${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(F.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&F.info(`[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}F.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}flushBackBuffer(){const{hls:e,details:t,media:i,sourceBuffer:r}=this;if(!i||t===null)return;const n=this.getSourceBufferTypes();if(!n.length)return;const o=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!ce(o)||o<0)return;const a=i.currentTime,A=t.levelTargetDuration,l=Math.max(o,A),c=Math.floor(a/A)*A-l;n.forEach(h=>{const u=r[h];if(u){const d=Ge.getBuffered(u);if(d.length>0&&c>d.start(0)){if(e.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:c}),t.live)e.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c});else if(u.ended&&d.end(d.length-1)-a<A*2){F.info(`[buffer-controller]: Cannot flush ${h} back buffer while SourceBuffer is in ended state`);return}e.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:h})}}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=ce(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(F.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!ce(o))&&(F.log(`[buffer-controller]: Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);const o=n.levelCodec||n.codec,a=`${n.container};codecs=${o}`;F.log(`[buffer-controller]: creating sourceBuffer(${a})`);try{const A=t[r]=i.addSourceBuffer(a),l=r;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.tracks[r]={buffer:A,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(A){F.error(`[buffer-controller]: error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,mimeType:a})}}}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){const{operationQueue:t}=this;t.current(e).onComplete(),t.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){const i=new Error(`${e} SourceBuffer error`);F.error(`[buffer-controller]: ${i}`,t),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_APPENDING_ERROR,error:i,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(t)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){F.warn(`[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=ce(r.duration)?r.duration:1/0,c=ce(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&!A.ending?(A.ended=!1,F.log(`[buffer-controller]: Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const{operationQueue:i,sourceBuffer:r}=this,n=r[t];if(!n){F.warn(`[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist`),i.shiftAndExecuteNext(t);return}n.ended=!1,n.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){F.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}const Th={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},xh=function(e){let t=e;return Th.hasOwnProperty(e)&&(t=Th[e]),String.fromCharCode(t)},Kt=15,pi=100,kE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},FE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},NE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ME={25:2,26:4,29:6,30:8,31:10,27:13,28:15},OE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class PE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;F.log(`${this.time} [${e}] ${i}`)}}}const is=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Dh{constructor(e,t,i,r,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=n||!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class UE{constructor(e,t,i,r,n,o){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Dh(t,i,r,n,o)}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 GE{constructor(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(let t=0;t<pi;t++)this.chars.push(new UE);this.logger=e,this.pos=0,this.currPenState=new Dh}equals(e){let t=!0;for(let i=0;i<pi;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t}copy(e){for(let t=0;t<pi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<pi;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>pi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=pi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=xh(e);if(this.pos>=pi){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<pi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<pi;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Qa{constructor(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(let t=0;t<Kt;t++)this.rows.push(new GE(e));this.logger=e,this.currRow=Kt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}reset(){for(let e=0;e<Kt;e++)this.rows[e].clear();this.currRow=Kt-1}equals(e){let t=!0;for(let i=0;i<Kt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Kt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Kt;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<Kt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<Kt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
193
- `)),i}getTextAndFormat(){return this.rows}}class Rh{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Qa(i),this.nonDisplayedMemory=new Qa(i),this.lastOutputScreen=new Qa(i),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Lh{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;const r=new PE;this.channels=[null,new Rh(e,t,r),new Rh(e+1,i,r)],this.cmdHistory=kh(),this.logger=r}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(r=t[a]&127,n=t[a+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+is([t[a],t[a+1]])+"] -> ("+is([r,n])+")"),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n)),!i&&(o=this.parseChars(r,n),o)){const A=this.currentChannel;A&&A>0?this.channels[A].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!o&&this.logger.log(2,"Couldn't parse cleaned data "+is([r,n])+" orig: "+is([t[a],t[a+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(_h(e,t,i))return ms(null,null,i),this.logger.log(3,"Repeated command ("+is([e,t])+") is dropped"),!0;const o=e===20||e===21||e===23?1:2,a=this.channels[o];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),ms(e,t,i),this.currentChannel=o,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+is([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(n||o))return!1;if(_h(e,t,r))return ms(null,null,r),!0;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?kE[e]:NE[e]:i=a===1?FE[e]:ME[e];const A=this.channels[a];return A?(A.setPAC(this.interpretPAC(i,t)),ms(e,t,r),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,"Special char '"+xh(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const o=is(r);this.logger.log(3,"Char codes = "+o.join(",")),ms(e,t,this.cmdHistory)}return r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=OE[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),ms(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=kh()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function ms(s,e,t){t.a=s,t.b=e}function _h(s,e,t){return t.a===s&&t.b===e}function kh(){return{a:null,b:null}}class Dn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var ba=function(){if(typeof self<"u"&&self.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const h in c)a[h]=c[h]}return a}function o(a,A,l){const c=this,h={enumerable:!0};c.hasBeenReset=!1;let u="",d=!1,g=a,f=A,p=l,y=null,v="",Q=!0,C="auto",T="start",b=50,L="middle",R=50,P="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(k){u=""+k}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(k){d=!!k}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return g},set:function(k){if(typeof k!="number")throw new TypeError("Start time must be set to a number.");g=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return f},set:function(k){if(typeof k!="number")throw new TypeError("End time must be set to a number.");f=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return p},set:function(k){p=""+k,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return y},set:function(k){y=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return v},set:function(k){const q=i(k);if(q===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return Q},set:function(k){Q=!!k,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return C},set:function(k){if(typeof k!="number"&&k!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return T},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");T=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return b},set:function(k){if(k<0||k>100)throw new Error("Position must be between 0 and 100.");b=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return L},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");L=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return R},set:function(k){if(k<0||k>100)throw new Error("Size must be between 0 and 100.");R=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return P},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");P=q,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class HE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Fh(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class $E{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function Nh(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const Sa=new ba(0,0,""),Rn=Sa.align==="middle"?"middle":"center";function YE(s,e,t){const i=s;function r(){const a=Fh(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new $E;Nh(a,function(u,d){let g;switch(u){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(u,t[f].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",Rn,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",Rn,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",Rn,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&Sa.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",Rn);let h=l.get("position","auto");h==="auto"&&Sa.position===50&&(h=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=h}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function Mh(s){return s.replace(/<br(?: \/)?>/gi,`
194
- `)}class KE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new HE,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,o=0;for(n=Mh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
192
+ Aborting and switching to level ${k}`),e.loader&&(this.fragCurrent=this.partCurrent=null,e.abortRequests()),i.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:a}))}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){self.clearInterval(this.timer)}get nextAutoLevel(){const e=this._nextAutoLevel,t=this.bwEstimator;if(e!==-1&&!t.canEstimate())return e;let i=this.getNextABRAutoLevel();if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,i)&&r[e].loadError<=r[i].loadError)return e}return e!==-1&&(i=Math.min(e,i)),i}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o,media:a}=i,A=t?t.duration:e?e.duration:0,l=a&&a.playbackRate!==0?Math.abs(a.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,h=i.mainForwardBufferInfo,u=(h?h.len:0)/l;let d=this.findBestLevel(c,o,r,u,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(d>=0)return d;F.trace(`[abr] ${u?"rebuffering expected":"buffer is empty"}, finding optimal quality level`);let g=A?Math.min(A,n.maxStarvationDelay):n.maxStarvationDelay,f=n.abrBandWidthFactor,p=n.abrBandWidthUpFactor;if(!u){const y=this.bitrateTestDelay;y&&(g=(A?Math.min(A,n.maxLoadingDelay):n.maxLoadingDelay)-y,F.trace(`[abr] bitrate test took ${Math.round(1e3*y)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),f=p=1)}return d=this.findBestLevel(c,o,r,u+g,f,p),Math.max(d,0)}findBestLevel(e,t,i,r,n,o){var a;const{fragCurrent:A,partCurrent:l,lastLoadedFragLevel:c}=this,{levels:h}=this.hls,u=h[c],d=!!(u!=null&&(a=u.details)!=null&&a.live),g=u==null?void 0:u.codecSet,f=l?l.duration:A?A.duration:0,p=this.bwEstimator.getEstimateTTFB()/1e3;let y=t,v=-1;for(let Q=i;Q>=t;Q--){const C=h[Q];if(!C||g&&C.codecSet!==g){C&&(y=Math.min(Q,y),v=Math.max(Q,v));continue}v!==-1&&F.trace(`[abr] Skipped level(s) ${y}-${v} with CODECS:"${h[v].attrs.CODECS}"; not compatible with "${u.attrs.CODECS}"`);const T=C.details,b=(l?T==null?void 0:T.partTarget:T==null?void 0:T.averagetargetduration)||f;let L;Q<=c?L=n*e:L=o*e;const R=h[Q].maxBitrate,P=this.getTimeToLoadFrag(p,L,R*b,T===void 0);if(F.trace(`[abr] level:${Q} adjustedbw-bitrate:${Math.round(L-R)} avgDuration:${b.toFixed(1)} maxFetchDuration:${r.toFixed(1)} fetchDuration:${P.toFixed(1)}`),L>R&&(P===0||!he(P)||d&&!this.bitrateTestDelay||P<r))return Q}return-1}set nextAutoLevel(e){this._nextAutoLevel=e}}class Bh{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=SE(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function SE(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}const Qh=100;class wE extends ha{constructor(e,t,i){super(e,t,i,"[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.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===W.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=W.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Qh),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=W.IDLE):(this.loadedmetadata=!1,this.state=W.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case W.IDLE:this.doTickIdle();break;case W.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=W.WAITING_INIT_PTS}break}case W.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;(!r||i>=r||(t=this.media)!=null&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=W.IDLE);break}case W.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=W.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=Ge.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);na(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=W.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=W.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!(t!=null&&t[r])||!i&&(this.startFragRequested||!n.startFragPrefetch))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(a)){this.state=W.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Me.AUDIO,Ee.AUDIO));const l=this.getFwdBufferInfo(A,Ee.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=W.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len);if(d>=g&&!h)return;const p=a.fragments[0].start;let y=l.end;if(h&&i){const T=this.getLoadPosition();c&&h.attrs!==c.attrs&&(y=T),a.PTSKnown&&T<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}let v=this.getNextFragment(y,a),Q=!1;if(v&&this.isLoopLoading(v,y)&&(Q=!!v.gap,v=this.getNextFragmentLoopLoading(v,a,l,Ee.MAIN,g)),!v){this.bufferFlushed=!0;return}const C=u&&v.start>u.end+a.targetduration;if(C||!(u!=null&&u.len)&&l.len){const T=this.getAppendedFrag(v.start,Ee.MAIN);if(T===null||(Q||(Q=!!T.gap||!!C&&u.len===0),C&&!Q||Q&&l.nextStart&&l.nextStart<T.end))return}this.loadFragment(v,o,y)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new hr(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(Qh):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=W.IDLE):(this.switchingTrack=null,this.bufferedTrack=t,this.state=W.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const l=this.mainDetails;if(n.deltaUpdateFailed||!l)return;!a.details&&n.hasProgramDateTime&&l.hasProgramDateTime?(th(n,l),A=n.fragments[0].start):A=this.alignPlaylists(n,a.details)}a.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(a.details,A),this.state===W.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=W.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new vh(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const p=r?r.index:-1,y=p!==-1,v=new Aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,y);u.push(n,g,h,"",i,r,c.totalduration,!1,v,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Bh,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=W.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==Ee.AUDIO){if(!this.loadedmetadata&&i.type===Ee.MAIN){const n=this.videoBuffer||this.media;n&&Ge.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,bt({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=W.ERROR;return}switch(t.details){case Y.FRAG_GAP:case Y.FRAG_PARSING_ERROR:case Y.FRAG_DECRYPT_ERROR:case Y.FRAG_LOAD_ERROR:case Y.FRAG_LOAD_TIMEOUT:case Y.KEY_LOAD_ERROR:case Y.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case Y.AUDIO_TRACK_LOAD_ERROR:case Y.AUDIO_TRACK_LOAD_TIMEOUT:case Y.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===W.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Re.AUDIO_TRACK&&(this.state=W.IDLE);break;case Y.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Y.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushed(e,{type:t}){t===Me.AUDIO&&(this.bufferFlushed=!0,this.state===W.ENDED&&(this.state=W.IDLE))}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=W.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const p=A.initSegment||A;this._bufferInitSegment(f.tracks,p,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:f.tracks})}if(u){const{startPTS:p,endPTS:y,startDTS:v,endDTS:Q}=u;l&&(l.elementaryStreams[Me.AUDIO]={startPTS:p,endPTS:y,startDTS:v,endDTS:Q}),A.setElementaryStreamInfo(Me.AUDIO,p,y,v,Q),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=tt({id:i,frag:A,details:h},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=tt({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,i){if(this.state!==W.PARSING)return;e.video&&delete e.video;const r=e.audio;if(!r)return;r.levelCodec=r.codec,r.id="audio",this.log(`Init audio buffer, container:${r.container}, codecs[parsed]=[${r.codec}]`),this.hls.trigger(E.BUFFER_CODECS,e);const n=r.initSegment;if(n!=null&&n.byteLength){const o={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:n};this.hls.trigger(E.BUFFER_APPENDING,o)}this.tick()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===nt.NOT_LOADED||r===nt.PARTIAL){var n;e.sn==="initSegment"?this._loadInitSegment(e,t):(n=t.details)!=null&&n.live&&!this.initPTS[e.cc]?(this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=W.WAITING_INIT_PTS):(this.startFragRequested=!0,super.loadFragment(e,t,i))}else this.clearTrackerIfNeeded(e)}completeAudioSwitch(e){const{hls:t,media:i,bufferedTrack:r}=this,n=r==null?void 0:r.attrs,o=e.attrs;i&&n&&(n.CHANNELS!==o.CHANNELS||n.NAME!==o.NAME||n.LANGUAGE!==o.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,bt({},e))}}class TE extends oa{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Track with id:${i} and group:${r} not found in active group ${o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`audio-track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!(t!=null&&t.audioGroupIds))return;const i=t.audioGroupIds[t.urlId];if(this.groupId!==i){this.groupId=i||null;const r=this.tracks.filter(o=>!i||o.groupId===i);this.selectDefaultTrack&&!r.some(o=>o.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=r;const n={audioTracks:r};this.log(`Updating audio tracks, ${r.length} track(s) found in group:${i}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,n),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Re.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(t))}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();const i=this.currentTrack;t[this.trackId];const r=t[e],{groupId:n,name:o}=r;if(this.log(`Switching to audio-track ${e} "${o}" lang:${r.lang} group:${n}`),this.trackId=e,this.currentTrack=r,this.selectDefaultTrack=!1,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,bt({},r)),r.details&&!r.details.live)return;const a=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(a)}selectInitialTrack(){const e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(t!==-1)this.setAudioTrack(t);else{const i=new Error(`No track found for running audio group-ID: ${this.groupId} track count: ${e.length}`);this.warn(i.message),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:i})}}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e.attrs["STABLE-RENDITION-ID"]!==void 0&&e.attrs["STABLE-RENDITION-ID"]===r.attrs["STABLE-RENDITION-ID"]||e.name===r.name&&e.lang===r.lang))return r.id}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}function bh(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!xE(s[t].attrs,e[t].attrs))return!1;return!0}function xE(s,e){const t=s["STABLE-RENDITION-ID"];return t?t===e["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some(i=>s[i]!==e[i])}const Sh=500;class DE extends ha{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Ee.SUBTITLE),this.levels=[],this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=W.IDLE,this.setInterval(Sh),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=W.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===Ee.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==W.STOPPED&&(this.state=W.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(bh(this.levels,t)){this.levels=t.map(i=>new hr(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new hr(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){if(this.currentTrackId=t.id,!this.levels.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(Sh)}onSubtitleTrackLoaded(e,t){var i;const{details:r,id:n}=t,{currentTrackId:o,levels:a}=this;if(!a.length)return;const A=a[o];if(n>=a.length||n!==o||!A)return;this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(r.live||(i=A.details)!=null&&i.live){const c=this.mainDetails;if(r.deltaUpdateFailed||!c)return;const h=c.fragments[0];A.details?(l=this.alignPlaylists(r,A.details),l===0&&h&&(l=h.start,sa(r,l))):r.hasProgramDateTime&&c.hasProgramDateTime?(th(r,c),l=r.fragments[0].start):h&&(l=h.start,sa(r,l))}A.details=r,this.levelLastLoaded=n,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(A.details,l),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===W.IDLE&&(ur(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=W.IDLE})}}doTick(){if(!this.media){this.state=W.IDLE;return}if(this.state===W.IDLE){const{currentTrackId:e,levels:t}=this,i=t[e];if(!t.length||!i||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=Ge.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,Ee.MAIN),c=i.details,h=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const p=this.fragPrevious;if(a<g){const y=r.maxFragLookUpTolerance,v=a>g-y?0:y;f=ur(p,u,Math.max(u[0].start,a),v),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const y=f.sn-c.startSN,v=u[y-1];v&&v.cc===f.cc&&this.fragmentTracker.getState(v)===nt.NOT_LOADED&&(f=v)}this.fragmentTracker.getState(f)===nt.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new RE(this.tracksBuffered[this.currentTrackId]||[])}}class RE{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class LE extends oa{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.trackChangeListener=()=>this.onTextTracksChanged(),this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes(this.trackId)}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,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),Ba(this.media.textTracks).forEach(t=>{fs(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,details:r}=t,{trackId:n}=this,o=this.tracksInGroup[n];if(!o){this.warn(`Invalid subtitle track id ${i}`);return}const a=o.details;o.details=t.details,this.log(`subtitle track ${i} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!(t!=null&&t.textGroupIds))return;const i=t.textGroupIds[t.urlId],r=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==i){const n=this.tracks.filter(A=>!i||A.groupId===i);this.tracksInGroup=n;const o=this.findTrackId(r==null?void 0:r.name)||this.findTrackId();this.groupId=i||null;const a={subtitleTracks:n};this.log(`Updating subtitle tracks, ${n.length} track(s) found in "${i}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,a),o!==-1&&this.setSubtitleTrack(o,r)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId,r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Re.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.checkRetry(t)}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1;const t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}loadPlaylist(e){super.loadPlaylist();const t=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(t)){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(e){const{media:t,trackId:i}=this;if(!t)return;const r=Ba(t.textTracks),n=r.filter(a=>a.groupId===this.groupId);if(e===-1)[].slice.call(r).forEach(a=>{a.mode="disabled"});else{const a=n[i];a&&(a.mode="disabled")}const o=n[e];o&&(o.mode=this.subtitleDisplay?"showing":"hidden")}setSubtitleTrack(e,t){var i;const r=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(e===-1||(i=r[e])!=null&&i.details)||e<-1||e>=r.length)return;this.clearTimer();const n=r[e];if(this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:"")),this.trackId=e,n){const{id:o,groupId:a="",name:A,type:l,url:c}=n;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(n.url,t==null?void 0:t.details);this.loadPlaylist(h)}else this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e})}onTextTracksChanged(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=-1;const t=Ba(this.media.textTracks);for(let i=0;i<t.length;i++)if(t[i].mode==="hidden")e=i;else if(t[i].mode==="showing"){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}}function Ba(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}class _E{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t){const i=this.queues[t];i.push(e),i.length===1&&this.buffers[t]&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const{buffers:t,queues:i}=this,r=t[e],n=i[e];if(n.length){const o=n[0];try{o.execute()}catch(a){F.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(a),r!=null&&r.updating||(n.shift(),this.executeNext(e))}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const wh=In(),Th=/([ha]vc.)(?:\.[^.,]+)+/;class kE{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.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=()=>{const{media:t,mediaSource:i}=this;F.log("[buffer-controller]: Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:t})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{F.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=()=>{F.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=()=>{const{media:t,_objectUrl:i}=this;t&&t.src!==i&&F.error(`Media element src was set while attaching MediaSource (${i} > ${t.src})`)},this.hls=e,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}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new _E(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,F.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media;if(i&&wh){const r=this.mediaSource=new wh;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src,i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(F.log("[buffer-controller]: media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){F.warn(`[buffer-controller]: onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):F.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{const t=this.sourceBuffer[e];try{t&&(this.removeBufferListeners(e),this.mediaSource&&this.mediaSource.removeSourceBuffer(t),this.sourceBuffer[e]=void 0)}catch(i){F.warn(`[buffer-controller]: Failed to reset the ${e} buffer`,i)}}),this._initSourceBuffer()}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length;Object.keys(t).forEach(r=>{if(i){const n=this.tracks[r];if(n&&typeof n.buffer.changeType=="function"){const{id:o,codec:a,levelCodec:A,container:l,metadata:c}=t[r],h=(n.levelCodec||n.codec).replace(Th,"$1"),u=(A||a).replace(Th,"$1");if(h!==u){const d=`${l};codecs=${A||a}`;this.appendChangeType(r,d),F.log(`[buffer-controller]: switching codec ${h} to ${u}`),this.tracks[r]={buffer:n.buffer,codec:a,container:l,levelCodec:A,metadata:c,id:o}}}}else this.pendingTracks[r]=t[r]}),!i&&(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks())}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(F.log(`[buffer-controller]: changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{F.warn(`[buffer-controller]: Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e)}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=u),g&&g.start===0&&(g.start=u);const f=n.audio;let p=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=A.start,v={execute:()=>{if(h.executeStart=self.performance.now(),p){const Q=this.sourceBuffer[a];if(Q){const C=y-Q.timestampOffset;Math.abs(C)>=.1&&(F.log(`[buffer-controller]: Updating audio SourceBuffer timestampOffset to ${y} (delta: ${C}) sn: ${A.sn})`),Q.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const Q=self.performance.now();h.executeEnd=h.end=Q,d.first===0&&(d.first=Q),g&&g.first===0&&(g.first=Q);const{sourceBuffer:C}=this,T={};for(const b in C)T[b]=Ge.getBuffered(C[b]);this.appendError=0,this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:T})},onError:Q=>{F.error(`[buffer-controller]: Error encountered while trying to append to the ${a} SourceBuffer`,Q);const C={type:fe.MEDIA_ERROR,parent:A.type,details:Y.BUFFER_APPEND_ERROR,frag:A,part:l,chunkMeta:c,error:Q,err:Q,fatal:!1};Q.code===DOMException.QUOTA_EXCEEDED_ERR?C.details=Y.BUFFER_FULL_ERROR:(this.appendError++,C.details=Y.BUFFER_APPEND_ERROR,this.appendError>i.config.appendErrorMaxRetry&&(F.error(`[buffer-controller]: Failed ${i.config.appendErrorMaxRetry} times to append segment in sourceBuffer`),C.fatal=!0)),i.trigger(E.ERROR,C)}};r.append(v,a)}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{F.warn(`[buffer-controller]: Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[Me.AUDIOVIDEO]?n.push("audiovideo"):(o[Me.AUDIO]&&n.push("audio"),o[Me.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&F.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.flushBackBuffer()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,F.log(`[buffer-controller]: ${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(F.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&F.info(`[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}F.log("[buffer-controller]: Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}flushBackBuffer(){const{hls:e,details:t,media:i,sourceBuffer:r}=this;if(!i||t===null)return;const n=this.getSourceBufferTypes();if(!n.length)return;const o=t.live&&e.config.liveBackBufferLength!==null?e.config.liveBackBufferLength:e.config.backBufferLength;if(!he(o)||o<0)return;const a=i.currentTime,A=t.levelTargetDuration,l=Math.max(o,A),c=Math.floor(a/A)*A-l;n.forEach(h=>{const u=r[h];if(u){const d=Ge.getBuffered(u);if(d.length>0&&c>d.start(0)){if(e.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:c}),t.live)e.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c});else if(u.ended&&d.end(d.length-1)-a<A*2){F.info(`[buffer-controller]: Cannot flush ${h} back buffer while SourceBuffer is in ended state`);return}e.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:h})}}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=he(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(F.log("[buffer-controller]: Media Source duration is set to Infinity"),r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!he(o))&&(F.log(`[buffer-controller]: Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&!e||r===2){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);const o=n.levelCodec||n.codec,a=`${n.container};codecs=${o}`;F.log(`[buffer-controller]: creating sourceBuffer(${a})`);try{const A=t[r]=i.addSourceBuffer(a),l=r;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.tracks[r]={buffer:A,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(A){F.error(`[buffer-controller]: error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,mimeType:a})}}}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){const{operationQueue:t}=this;t.current(e).onComplete(),t.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){const i=new Error(`${e} SourceBuffer error`);F.error(`[buffer-controller]: ${i}`,t),this.hls.trigger(E.ERROR,{type:fe.MEDIA_ERROR,details:Y.BUFFER_APPENDING_ERROR,error:i,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(t)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){F.warn(`[buffer-controller]: Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=he(r.duration)?r.duration:1/0,c=he(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&!A.ending?(A.ended=!1,F.log(`[buffer-controller]: Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const{operationQueue:i,sourceBuffer:r}=this,n=r[t];if(!n){F.warn(`[buffer-controller]: Attempting to append to the ${t} SourceBuffer, but it does not exist`),i.shiftAndExecuteNext(t);return}n.ended=!1,n.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){F.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}const xh={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},Dh=function(e){let t=e;return xh.hasOwnProperty(e)&&(t=xh[e]),String.fromCharCode(t)},Kt=15,Ei=100,FE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},NE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ME={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},OE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},PE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class UE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;F.log(`${this.time} [${e}] ${i}`)}}}const is=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Rh{constructor(e,t,i,r,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=n||!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class GE{constructor(e,t,i,r,n,o){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new Rh(t,i,r,n,o)}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 HE{constructor(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(let t=0;t<Ei;t++)this.chars.push(new GE);this.logger=e,this.pos=0,this.currPenState=new Rh}equals(e){let t=!0;for(let i=0;i<Ei;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t}copy(e){for(let t=0;t<Ei;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ei;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>Ei&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ei)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Dh(e);if(this.pos>=Ei){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<Ei;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<Ei;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Qa{constructor(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(let t=0;t<Kt;t++)this.rows.push(new HE(e));this.logger=e,this.currRow=Kt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}reset(){for(let e=0;e<Kt;e++)this.rows[e].clear();this.currRow=Kt-1}equals(e){let t=!0;for(let i=0;i<Kt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Kt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Kt;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<Kt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<Kt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
193
+ `)),i}getTextAndFormat(){return this.rows}}class Lh{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Qa(i),this.nonDisplayedMemory=new Qa(i),this.lastOutputScreen=new Qa(i),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class _h{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;const r=new UE;this.channels=[null,new Lh(e,t,r),new Lh(e+1,i,r)],this.cmdHistory=Fh(),this.logger=r}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(r=t[a]&127,n=t[a+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+is([t[a],t[a+1]])+"] -> ("+is([r,n])+")"),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n)),!i&&(o=this.parseChars(r,n),o)){const A=this.currentChannel;A&&A>0?this.channels[A].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!o&&this.logger.log(2,"Couldn't parse cleaned data "+is([r,n])+" orig: "+is([t[a],t[a+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(kh(e,t,i))return ms(null,null,i),this.logger.log(3,"Repeated command ("+is([e,t])+") is dropped"),!0;const o=e===20||e===21||e===23?1:2,a=this.channels[o];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),ms(e,t,i),this.currentChannel=o,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+is([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(n||o))return!1;if(kh(e,t,r))return ms(null,null,r),!0;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?FE[e]:ME[e]:i=a===1?NE[e]:OE[e];const A=this.channels[a];return A?(A.setPAC(this.interpretPAC(i,t)),ms(e,t,r),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,"Special char '"+Dh(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const o=is(r);this.logger.log(3,"Char codes = "+o.join(",")),ms(e,t,this.cmdHistory)}return r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=PE[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),ms(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=Fh()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function ms(s,e,t){t.a=s,t.b=e}function kh(s,e,t){return t.a===s&&t.b===e}function Fh(){return{a:null,b:null}}class Dn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var ba=function(){if(typeof self<"u"&&self.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const h in c)a[h]=c[h]}return a}function o(a,A,l){const c=this,h={enumerable:!0};c.hasBeenReset=!1;let u="",d=!1,g=a,f=A,p=l,y=null,v="",Q=!0,C="auto",T="start",b=50,L="middle",R=50,P="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(k){u=""+k}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(k){d=!!k}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return g},set:function(k){if(typeof k!="number")throw new TypeError("Start time must be set to a number.");g=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return f},set:function(k){if(typeof k!="number")throw new TypeError("End time must be set to a number.");f=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return p},set:function(k){p=""+k,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return y},set:function(k){y=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return v},set:function(k){const q=i(k);if(q===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return Q},set:function(k){Q=!!k,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return C},set:function(k){if(typeof k!="number"&&k!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return T},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");T=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return b},set:function(k){if(k<0||k>100)throw new Error("Position must be between 0 and 100.");b=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return L},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");L=q,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return R},set:function(k){if(k<0||k>100)throw new Error("Size must be between 0 and 100.");R=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return P},set:function(k){const q=r(k);if(!q)throw new SyntaxError("An invalid or illegal string was specified.");P=q,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class $E{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Nh(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class YE{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function Mh(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const Sa=new ba(0,0,""),Rn=Sa.align==="middle"?"middle":"center";function KE(s,e,t){const i=s;function r(){const a=Nh(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new YE;Mh(a,function(u,d){let g;switch(u){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(u,t[f].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",Rn,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",Rn,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",Rn,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&Sa.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",Rn);let h=l.get("position","auto");h==="auto"&&Sa.position===50&&(h=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=h}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function Oh(s){return s.replace(/<br(?: \/)?>/gi,`
194
+ `)}class VE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new $E,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,o=0;for(n=Oh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
195
195
  `;)++o;const a=n.slice(0,o);return n[o]==="\r"&&++o,n[o]===`
196
- `&&++o,t.buffer=n.slice(o),a}function r(n){Nh(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new ba(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{YE(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
196
+ `&&++o,t.buffer=n.slice(o),a}function r(n){Mh(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new ba(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{KE(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
197
197
  `),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
198
198
 
199
- `,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 VE=/\r\n|\n\r|\n|\r/g,wa=function(e,t,i=0){return e.slice(i,i+t.length)===t},JE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!ce(t)||!ce(i)||!ce(r)||!ce(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},Ta=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function xa(s,e,t){return Ta(s.toString())+Ta(e.toString())+Ta(t)}const WE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function qE(s,e,t,i,r,n,o){const a=new KE,A=Xt(new Uint8Array(s)).trim().replace(VE,`
199
+ `,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 JE=/\r\n|\n\r|\n|\r/g,wa=function(e,t,i=0){return e.slice(i,i+t.length)===t},WE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!he(t)||!he(i)||!he(r)||!he(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},Ta=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function xa(s,e,t){return Ta(s.toString())+Ta(e.toString())+Ta(t)}const qE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function jE(s,e,t,i,r,n,o){const a=new VE,A=Xt(new Uint8Array(s)).trim().replace(JE,`
200
200
  `).split(`
201
- `),l=[],c=e?oE(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(p){const y=t[i];let v=t.ccOffset;const Q=(u-c)/9e4;if(y!=null&&y.new&&(d!==void 0?v=t.ccOffset=y.start:WE(t,i,Q)),Q){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}v=Q-t.presentationOffset}const C=p.endTime-p.startTime,T=Mt((p.startTime+v-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(T,0),p.endTime=Math.max(T+C,0);const b=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(b)),p.id||(p.id=xa(p.startTime,p.endTime,b)),p.endTime>0&&l.push(p)},a.onparsingerror=function(p){g=p},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(p=>{if(f)if(wa(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(y=>{wa(y,"LOCAL:")?h=y.slice(6):wa(y,"MPEGTS:")&&(u=parseInt(y.slice(7)))});try{d=JE(h)/1e3}catch(y){g=y}return}else p===""&&(f=!1);a.parse(p+`
202
- `)}),a.flush()}const Da="stpp.ttml.im1t",Oh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ph=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,jE={left:"start",center:"center",right:"end",start:"start",end:"end"};function Uh(s,e,t,i){const r=Te(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Xt(a)),o=nE(e.baseTime,1,e.timescale);try{n.forEach(a=>t(XE(a,o)))}catch(a){i(a)}}function XE(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((h,u)=>(h[u]=r.getAttribute(`ttp:${u}`)||n[u],h),{}),a=r.getAttribute("xml:space")!=="preserve",A=Gh(Ra(r,"styling","style")),l=Gh(Ra(r,"layout","region")),c=Ra(r,"body","[begin]");return[].map.call(c,h=>{const u=Hh(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=_a(h.getAttribute("begin"),o),g=_a(h.getAttribute("dur"),o);let f=_a(h.getAttribute("end"),o);if(d===null)throw $h(h);if(f===null){if(g===null)throw $h(h);f=d+g}const p=new ba(d-e,f-e,u);p.id=xa(p.startTime,p.endTime,p.text);const y=l[h.getAttribute("region")],v=A[h.getAttribute("style")],Q=zE(y,v,A),{textAlign:C}=Q;if(C){const T=jE[C];T&&(p.lineAlign=T),p.align=C}return tt(p,Q),p}).filter(h=>h!==null)}function Ra(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Gh(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Hh(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
203
- `:(n=i.childNodes)!=null&&n.length?Hh(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function zE(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=La(e,i,A)||La(s,i,A)||La(r,i,A);return l&&(a[A]=l),a},{})}function La(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function $h(s){return new Error(`Could not parse ttml timestamp ${s}`)}function _a(s,e){if(!s)return null;let t=Fh(s);return t===null&&(Oh.test(s)?t=ZE(s,e):Ph.test(s)&&(t=eI(s,e))),t}function ZE(s,e){const t=Oh.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function eI(s,e){const t=Ph.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class tI{constructor(e){if(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.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Yh(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){const t=new Dn(this,"textTrack1"),i=new Dn(this,"textTrack2"),r=new Dn(this,"textTrack3"),n=new Dn(this,"textTrack4");this.cea608Parser1=new Lh(1,t,i),this.cea608Parser2=new Lh(3,r,n)}e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=sI(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e){const{media:t}=this;if(t)for(let i=0;i<t.textTracks.length;i++){const r=t.textTracks[i];if(r[e])return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(e);if(a)i[e]=a,fs(i[e]),Oc(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{fs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Yh(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===Da);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Qh(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media?this.media.textTracks:null;this.tracks.forEach((a,A)=>{let l;if(o&&A<o.length){let c=null;for(let h=0;h<o.length;h++)if(iI(o[h],a)){c=o[h];break}c&&(l=c)}if(l)fs(l);else{const c=this._captionsOrSubtitlesFromCharacteristics(a);l=this.createTextTrack(c,a.name,a.lang),l&&(l.mode="disabled")}l&&(l.groupId=a.groupId,this.textTracks.push(l))})}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}_captionsOrSubtitlesFromCharacteristics(e){if(e.attrs.CHARACTERISTICS){const t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){const{cea608Parser1:i,cea608Parser2:r,lastSn:n,lastPartIndex:o}=this;if(!(!this.enabled||!(i&&r))&&t.frag.type===Ee.MAIN){var a,A;const l=t.frag.sn,c=(a=t==null||(A=t.part)==null?void 0:A.index)!=null?a:-1;l===n+1||l===n&&c===o+1||(i.reset(),r.reset()),this.lastSn=l,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===Ee.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===Da?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Uh(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{F.log(`Failed to parse IMSC1: ${r}`),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?ts(i.initSegment.data,new Uint8Array(r)):r;qE(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),F.log(`Failed to parse VTT cue: ${c}`),!(h&&a>i.cc)&&A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Uh(t,this.initPTS[e.cc],()=>{i.textCodec=Da,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>Pc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ee.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!(i&&r))return;const{frag:n,samples:o}=t;if(!(n.type===Ee.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function iI(s,e){return!!s&&s.label===e.name&&!(s.textTrack1||s.textTrack2)}function sI(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function Yh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class ka{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){const e=this.hls.levels;if(e.length){const t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,ka.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(o,a)=>a?o.width!==a.width||o.height!==a.height:!0;let n=e.length-1;for(let o=0;o<e.length;o+=1){const a=e[o];if((a.width>=t||a.height>=i)&&r(a,e[o+1])){n=o;break}}return n}}class rI{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;F.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const Ln="[eme]";class Cs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Cs.CDMCleanupPromise?[Cs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=F.debug.bind(F,Ln),this.log=F.log.bind(F,Ln),this.warn=F.warn.bind(F,Ln),this.error=F.error.bind(F,Ln),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Ve.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(h=>o({keySystem:c,mediaKeys:h})).catch(h=>{l.length?A(l):h instanceof Ot?a(h):a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return uc===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=I0(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(h=>h?this.setMediaKeysServerCertificate(c,e,h):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${zt.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return zt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${zt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
204
- } (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=Ko(this.config),n=e.map(lc).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=hc(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t}),l="cenc";return this.generateRequestWithPreferredKeySession(A,l,t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ot?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=lc(e.keyFormat),n=r?[r]:Ko(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Ko(this.config)),e.length===0)throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Ve.FAIRPLAY]){const c=ht(new Uint8Array(i));try{const h=Yo(JSON.parse(c).sinf),u=Cc(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ve.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=H0(i);if(c===null)return;c.version===0&&c.systemId===cc.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=E0(c.systemId)}if(!n||!r)return;const o=zt.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const h=A[c],u=h.decryptdata;if(u.pssh||!u.keyId)continue;const d=zt.hexDump(u.keyId);if(o===d||u.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],u.pssh=new Uint8Array(i),u.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(h,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:h})=>{var u;this.throwIfDestroyed();const d=new lr("ISO-23001-7",o,(u=hc(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const u=a.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(u){var A;if(this.warn(u.message),(A=this.hls)!=null&&A.config.debug)throw u}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new Ca;e.mediaKeysSession.onmessage=u=>{const d=e.mediaKeysSession;if(!d){c.emit("error",new Error("invalid state"));return}const{messageType:g,message:f}=u;this.log(`"${g}" message event for session "${d.sessionId}" message size: ${f.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,f).catch(p=>{this.handleError(p),c.emit("error",p)}):g==="license-release"?e.keySystem===Ve.FAIRPLAY&&(this.updateKeySession(e,Ac("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},e.mediaKeysSession.onkeystatuseschange=u=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;c.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};const h=new Promise((u,d)=>{c.on("error",d),c.on("keyStatus",g=>{g.startsWith("usable")?u():g==="output-restricted"?d(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?d(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?d(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var u;this.log(`Request generated for key-session "${(u=e.mediaKeysSession)==null?void 0:u.sessionId}" keyId: ${l}`)}).catch(u=>{throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_SESSION,error:u,fatal:!1},`Error generating key-session request: ${u}`)}).then(()=>h).catch(u=>{throw c.removeAllListeners(),this.removeSession(e),u}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${zt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${zt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching serverCertificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{o(u.data)},onError:(u,d,g,f)=>{a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:bt({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,g)=>{a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,g)=>{a(new Error("aborted"))}};r.load(A,c,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},lr.clearKeyUriToKeyIdMap();const i=t.length;Cs.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),t.onmessage=null,t.onkeystatuseschange=null,i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Cs.CDMCleanupPromise=void 0;class Ot 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}}const nI=1;var Tt={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"};const oI="h";class Ni{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.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Tt.MANIFEST,su:!this.initialized})}catch(n){F.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===Tt.VIDEO||a===Tt.AUDIO||a==Tt.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){F.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||Ni.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:nI,sf:oI,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tt(t,this.createData());const i=t.ot===Tt.INIT||t.ot===Tt.VIDEO||t.ot===Tt.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){const r=Ni.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),tt(e.headers,r)}else{const r=Ni.toQuery(t);if(!r)return;e.url=Ni.appendQueryToUri(e.url,r)}}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,i;const r=this.hls;if(e===Tt.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Tt.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ge.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}static uuid(){const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}static serialize(e){const t=[],i=l=>!Number.isNaN(l)&&l!=null&&l!==""&&l!==!1,r=l=>Math.round(l),n=l=>r(l/100)*100,a={br:r,d:r,bl:n,dl:n,mtp:n,nor:l=>encodeURIComponent(l),rtp:n,tb:r},A=Object.keys(e||{}).sort();for(const l of A){let c=e[l];if(!i(c)||l==="v"&&c===1||l=="pr"&&c===1)continue;const h=a[l];h&&(c=h(c));const u=typeof c;let d;l==="ot"||l==="sf"||l==="st"?d=`${l}=${c}`:u==="boolean"?d=l:u==="number"?d=`${l}=${c}`:d=`${l}=${JSON.stringify(c)}`,t.push(d)}return t.join(",")}static toHeaders(e){const t=Object.keys(e),i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(const a of t){const A=o[a]!=null?o[a]:1;n[A][a]=e[a]}for(let a=0;a<n.length;a++){const A=Ni.serialize(n[a]);A&&(i[`CMCD-${r[a]}`]=A)}return i}static toQuery(e){return`CMCD=${encodeURIComponent(Ni.serialize(e))}`}static appendQueryToUri(e,t){if(!t)return e;const i=e.includes("?")?"&":"?";return`${e}${i}${t}`}}const aI=3e5;class AI{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=F.log.bind(F,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}startLoad(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){const e=Math.max(this.timeToLoad*1e3-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===ft.SendAlternateToPenaltyBox&&i.flags===Nt.MoveAllAlternatesMatchingHost){let r=this.pathwayPriority;const n=this.pathwayId;this.penalizedPathways[n]||(this.penalizedPathways[n]=performance.now()),!r&&this.levels&&(r=this.levels.reduce((o,a)=>(o.indexOf(a.pathwayId)===-1&&o.push(a.pathwayId),o),[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==n)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>aI&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(i[o])continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=tt({},c);h.details=void 0,h.url=Vh(c.uri,c.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A);const u=new Ke(c.attrs);u["PATHWAY-ID"]=o;const d=u.AUDIO&&`${u.AUDIO}_clone_${o}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;d&&(i[u.AUDIO]=d,u.AUDIO=d),g&&(r[u.SUBTITLES]=g,u.SUBTITLES=g),h.attrs=u;const f=new hr(h);return vn(f,"audio",d),vn(f,"text",g),f});t.push(...l),Kh(this.audioTracks,i,A,o),Kh(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||u.url),p&&this.clonePathways(p),y&&this.updatePathwayPriority(y)},onError:(c,h,u,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${h.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,g)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(()=>{this.loadSteeringManifest(e)},t)}}function Kh(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=tt({},o);return a.details=void 0,a.attrs=new Ke(a.attrs),a.url=a.attrs.URI=Vh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Vh(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const lI=/^age:\s*[\d.]+\s*$/im;class Jh{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=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new dn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(i,t.url)}).catch(o=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=this.context.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&ce(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry;yn(A,l,!1,o)?this.retry(A):(F.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,i=this.stats.retry;if(yn(t,i,!0))this.retry(t);else{F.warn(`timeout while loading ${this.context.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=ra(e,i.retry),i.retry++,F.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&lI.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 cI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const hI=/(\d+)-(\d+)\/(\d+)/;class Wh{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||fI,this.controller=new self.AbortController,this.stats=new dn}destroy(){this.loader=this.callbacks=null,this.abortInternal()}abortInternal(){const e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=uI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&ce(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:g}=h;throw new pI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=gI(h.headers)||r.total,o&&ce(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const{response:u}=this;self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const g={url:u.url,data:h,code:u.status};o&&!ce(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(g,r,e,u)}).catch(h=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const u=h&&h.code||0,d=h?h.message:null;i.onError({code:u,text:d},e,h?h.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,n){const o=new vh,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,h=c.length;return t.loaded+=h,h<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function uI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(tt({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function dI(s){const e=hI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function gI(s){const e=s.get("Content-Range");if(e){const i=dI(e);if(ce(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function fI(s,e){return new self.Request(s.url,e)}class pI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const EI=/\s/,II={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(n=i.rows[u],a=!0,A=0,l="",!n.isEmpty()){var h;for(let f=0;f<n.chars.length;f++)EI.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=Mh(l.trim()),g=xa(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=u+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((u,d)=>u.line==="auto"||d.line==="auto"?0:u.line>8&&d.line>8?d.line-u.line:u.line-d.line),r.forEach(u=>Pc(s,u))),r}},mI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},CI=bt(bt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength: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:Jh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:QE,bufferController:_E,capLevelController:ka,errorController:pp,fpsController:rI,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:uc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:mI},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},yI()),{},{subtitleStreamController:xE,subtitleTrackController:RE,timelineController:tI,audioStreamController:SE,audioTrackController:wE,emeController:Cs,cmcdController:Ni,contentSteeringController:AI});function yI(){return{cueHandler:II,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function vI(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Fa(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,h=e[c];if(h!==void 0&&a){A.push(c);const u=t[o].default;switch(e[o]={default:u},l){case"TimeOut":u.maxLoadTimeMs=h,u.maxTimeToFirstByteMs=h;break;case"MaxRetry":u.errorRetry.maxNumRetry=h,u.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":u.errorRetry.retryDelayMs=h,u.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=h,u.timeoutRetry.maxRetryDelayMs=h;break}}}),A.length&&F.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),bt(bt({},t),e)}function Fa(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Fa):Object.keys(s).reduce((e,t)=>(e[t]=Fa(s[t]),e),{}):s}function BI(s){const e=s.loader;e!==Wh&&e!==Jh?(F.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):cI()&&(s.loader=Wh,s.progressive=!0,s.enableSoftwareAES=!0,F.log("[config]: Progressive streaming enabled, using FetchLoader"))}class Ei{static get version(){return"1.4.12"}static isSupported(){return Fp()}static get Events(){return E}static get ErrorTypes(){return fe}static get ErrorDetails(){return Y}static get DefaultConfig(){return Ei.defaultConfig?Ei.defaultConfig:CI}static set DefaultConfig(e){Ei.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ca,this._autoLevelCapping=void 0,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,a0(e.debug||!1,"Hls instance");const t=this.config=vI(Ei.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&BI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),h=this.capLevelController=new n(this),u=new a(this),d=new X0(this),g=new ip(this),f=t.contentSteeringController,p=f?new f(this):null,y=this.levelController=new Ip(this,p),v=new mp(this),Q=new yp(this.config),C=this.streamController=new vE(this,v,Q);h.setStreamController(C),u.setStreamController(C);const T=[d,y,C];p&&T.splice(1,0,p),this.networkControllers=T;const b=[l,c,h,u,g,v];this.audioTrackController=this.createController(t.audioTrackController,T);const L=t.audioStreamController;L&&T.push(new L(this,v,Q)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const R=t.subtitleStreamController;R&&T.push(new R(this,v,Q)),this.createController(t.timelineController,b),Q.emeController=this.emeController=this.createController(t.emeController,b),this.cmcdController=this.createController(t.cmcdController,b),this.latencyController=this.createController(sp,b),this.coreComponents=b,T.push(A);const P=A.onErrorOut;typeof P=="function"&&this.on(E.ERROR,P,A)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){F.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){F.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){F.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){F.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=Go.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});F.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){F.log(`startLoad(${e})`),this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){F.log("stopLoad"),this.networkControllers.forEach(e=>{e.stopLoad()})}swapAudioCodec(){F.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){F.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e,t=0){this.levelController.removeLevel(e,t)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){F.log(`set currentLevel:${e}`),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){F.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){F.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){F.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){return this.levelController.startLevel}set startLevel(e){F.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}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(F.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e)}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ta.indexOf(e)>-1&&(this._maxHdcpLevel=e)}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get nextAutoLevel(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)}set nextAutoLevel(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}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 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}}Ei.defaultConfig=void 0;var QI=fr;fr.flatten=fr,fr.unflatten=Xh;function qh(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function jh(s){return s}function fr(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||jh,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const h=a[c],u=e.safe&&Array.isArray(h),d=Object.prototype.toString.call(h),g=qh(h),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,p,l+1);n[p]=h})}return o(s),n}function Xh(s,e){e=e||{};const t=e.delimiter||".",i=e.overwrite||!1,r=e.transformKey||jh,n={};if(qh(s)||Object.prototype.toString.call(s)!=="[object Object]")return s;function a(c){const h=Number(c);return isNaN(h)||c.indexOf(".")!==-1||e.object?c:h}function A(c,h,u){return Object.keys(u).reduce(function(d,g){return d[c+t+g]=u[g],d},h)}function l(c){const h=Object.prototype.toString.call(c),u=h==="[object Array]",d=h==="[object Object]";if(c){if(u)return!c.length;if(d)return!Object.keys(c).length}else return!0}return s=Object.keys(s).reduce(function(c,h){const u=Object.prototype.toString.call(s[h]);return!(u==="[object Object]"||u==="[object Array]")||l(s[h])?(c[h]=s[h],c):A(h,c,fr(s[h],e))},{}),Object.keys(s).forEach(function(c){const h=c.split(t).map(r);let u=a(h.shift()),d=a(h[0]),g=n;for(;d!==void 0;){if(u==="__proto__")return;const f=Object.prototype.toString.call(g[u]),p=f==="[object Object]"||f==="[object Array]";if(!i&&!p&&typeof g[u]<"u")return;(i&&!p||!i&&g[u]==null)&&(g[u]=typeof d=="number"&&!e.object?[]:{}),g=g[u],h.length>0&&(u=a(h.shift()),d=a(h[0]))}g[u]=Xh(s[c],e)}),n}const bI=xo(QI);var zh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function SI(s,e){return!!(s===e||zh(s)&&zh(e))}function wI(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!SI(s[t],e[t]))return!1;return!0}function TI(s,e){e===void 0&&(e=wI);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}/**
201
+ `),l=[],c=e?aE(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(p){const y=t[i];let v=t.ccOffset;const Q=(u-c)/9e4;if(y!=null&&y.new&&(d!==void 0?v=t.ccOffset=y.start:qE(t,i,Q)),Q){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}v=Q-t.presentationOffset}const C=p.endTime-p.startTime,T=Mt((p.startTime+v-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(T,0),p.endTime=Math.max(T+C,0);const b=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(b)),p.id||(p.id=xa(p.startTime,p.endTime,b)),p.endTime>0&&l.push(p)},a.onparsingerror=function(p){g=p},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(p=>{if(f)if(wa(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(y=>{wa(y,"LOCAL:")?h=y.slice(6):wa(y,"MPEGTS:")&&(u=parseInt(y.slice(7)))});try{d=WE(h)/1e3}catch(y){g=y}return}else p===""&&(f=!1);a.parse(p+`
202
+ `)}),a.flush()}const Da="stpp.ttml.im1t",Ph=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Uh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,XE={left:"start",center:"center",right:"end",start:"start",end:"end"};function Gh(s,e,t,i){const r=xe(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Xt(a)),o=oE(e.baseTime,1,e.timescale);try{n.forEach(a=>t(zE(a,o)))}catch(a){i(a)}}function zE(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((h,u)=>(h[u]=r.getAttribute(`ttp:${u}`)||n[u],h),{}),a=r.getAttribute("xml:space")!=="preserve",A=Hh(Ra(r,"styling","style")),l=Hh(Ra(r,"layout","region")),c=Ra(r,"body","[begin]");return[].map.call(c,h=>{const u=$h(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=_a(h.getAttribute("begin"),o),g=_a(h.getAttribute("dur"),o);let f=_a(h.getAttribute("end"),o);if(d===null)throw Yh(h);if(f===null){if(g===null)throw Yh(h);f=d+g}const p=new ba(d-e,f-e,u);p.id=xa(p.startTime,p.endTime,p.text);const y=l[h.getAttribute("region")],v=A[h.getAttribute("style")],Q=ZE(y,v,A),{textAlign:C}=Q;if(C){const T=XE[C];T&&(p.lineAlign=T),p.align=C}return tt(p,Q),p}).filter(h=>h!==null)}function Ra(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Hh(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function $h(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
203
+ `:(n=i.childNodes)!=null&&n.length?$h(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function ZE(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=La(e,i,A)||La(s,i,A)||La(r,i,A);return l&&(a[A]=l),a},{})}function La(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Yh(s){return new Error(`Could not parse ttml timestamp ${s}`)}function _a(s,e){if(!s)return null;let t=Nh(s);return t===null&&(Ph.test(s)?t=eI(s,e):Uh.test(s)&&(t=tI(s,e))),t}function eI(s,e){const t=Ph.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function tI(s,e){const t=Uh.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class iI{constructor(e){if(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.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Kh(),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}},this.config.enableCEA708Captions){const t=new Dn(this,"textTrack1"),i=new Dn(this,"textTrack2"),r=new Dn(this,"textTrack3"),n=new Dn(this,"textTrack4");this.cea608Parser1=new _h(1,t,i),this.cea608Parser2=new _h(3,r,n)}e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=rI(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e){const{media:t}=this;if(t)for(let i=0;i<t.textTracks.length;i++){const r=t.textTracks[i];if(r[e])return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(e);if(a)i[e]=a,fs(i[e]),Pc(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{fs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Kh(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===Da);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(bh(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media?this.media.textTracks:null;this.tracks.forEach((a,A)=>{let l;if(o&&A<o.length){let c=null;for(let h=0;h<o.length;h++)if(sI(o[h],a)){c=o[h];break}c&&(l=c)}if(l)fs(l);else{const c=this._captionsOrSubtitlesFromCharacteristics(a);l=this.createTextTrack(c,a.name,a.lang),l&&(l.mode="disabled")}l&&(l.groupId=a.groupId,this.textTracks.push(l))})}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}_captionsOrSubtitlesFromCharacteristics(e){if(e.attrs.CHARACTERISTICS){const t=/transcribes-spoken-dialog/gi.test(e.attrs.CHARACTERISTICS),i=/describes-music-and-sound/gi.test(e.attrs.CHARACTERISTICS);if(t&&i)return"captions"}return"subtitles"}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){const{cea608Parser1:i,cea608Parser2:r,lastSn:n,lastPartIndex:o}=this;if(!(!this.enabled||!(i&&r))&&t.frag.type===Ee.MAIN){var a,A;const l=t.frag.sn,c=(a=t==null||(A=t.part)==null?void 0:A.index)!=null?a:-1;l===n+1||l===n&&c===o+1||(i.reset(),r.reset()),this.lastSn=l,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===Ee.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===Da?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Gh(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{F.log(`Failed to parse IMSC1: ${r}`),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?ts(i.initSegment.data,new Uint8Array(r)):r;jE(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),F.log(`Failed to parse VTT cue: ${c}`),!(h&&a>i.cc)&&A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Gh(t,this.initPTS[e.cc],()=>{i.textCodec=Da,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>Uc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ee.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!(i&&r))return;const{frag:n,samples:o}=t;if(!(n.type===Ee.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function sI(s,e){return!!s&&s.label===e.name&&!(s.textTrack1||s.textTrack2)}function rI(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function Kh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class ka{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){const e=this.hls.levels;if(e.length){const t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,ka.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(o,a)=>a?o.width!==a.width||o.height!==a.height:!0;let n=e.length-1;for(let o=0;o<e.length;o+=1){const a=e[o];if((a.width>=t||a.height>=i)&&r(a,e[o+1])){n=o;break}}return n}}class nI{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;F.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const Ln="[eme]";class Cs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Cs.CDMCleanupPromise?[Cs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=F.debug.bind(F,Ln),this.log=F.log.bind(F,Ln),this.warn=F.warn.bind(F,Ln),this.error=F.error.bind(F,Ln),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Ve.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(h=>o({keySystem:c,mediaKeys:h})).catch(h=>{l.length?A(l):h instanceof Ot?a(h):a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return dc===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=m0(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(h=>h?this.setMediaKeysServerCertificate(c,e,h):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${zt.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return zt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${zt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
204
+ } (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=Ko(this.config),n=e.map(cc).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=uc(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t}),l="cenc";return this.generateRequestWithPreferredKeySession(A,l,t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ot?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=cc(e.keyFormat),n=r?[r]:Ko(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Ko(this.config)),e.length===0)throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Ve.FAIRPLAY]){const c=ht(new Uint8Array(i));try{const h=Yo(JSON.parse(c).sinf),u=yc(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ve.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=$0(i);if(c===null)return;c.version===0&&c.systemId===hc.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=I0(c.systemId)}if(!n||!r)return;const o=zt.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const h=A[c],u=h.decryptdata;if(u.pssh||!u.keyId)continue;const d=zt.hexDump(u.keyId);if(o===d||u.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],u.pssh=new Uint8Array(i),u.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(h,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:h})=>{var u;this.throwIfDestroyed();const d=new lr("ISO-23001-7",o,(u=uc(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const u=a.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(u){var A;if(this.warn(u.message),(A=this.hls)!=null&&A.config.debug)throw u}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new Ca;e.mediaKeysSession.onmessage=u=>{const d=e.mediaKeysSession;if(!d){c.emit("error",new Error("invalid state"));return}const{messageType:g,message:f}=u;this.log(`"${g}" message event for session "${d.sessionId}" message size: ${f.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,f).catch(p=>{this.handleError(p),c.emit("error",p)}):g==="license-release"?e.keySystem===Ve.FAIRPLAY&&(this.updateKeySession(e,lc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},e.mediaKeysSession.onkeystatuseschange=u=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;c.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};const h=new Promise((u,d)=>{c.on("error",d),c.on("keyStatus",g=>{g.startsWith("usable")?u():g==="output-restricted"?d(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?d(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?d(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var u;this.log(`Request generated for key-session "${(u=e.mediaKeysSession)==null?void 0:u.sessionId}" keyId: ${l}`)}).catch(u=>{throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_NO_SESSION,error:u,fatal:!1},`Error generating key-session request: ${u}`)}).then(()=>h).catch(u=>{throw c.removeAllListeners(),this.removeSession(e),u}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${zt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${zt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching serverCertificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{o(u.data)},onError:(u,d,g,f)=>{a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:bt({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,g)=>{a(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,g)=>{a(new Error("aborted"))}};r.load(A,c,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new Ot({type:fe.KEY_SYSTEM_ERROR,details:Y.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},lr.clearKeyUriToKeyIdMap();const i=t.length;Cs.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}. media.src: ${e==null?void 0:e.src}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),t.onmessage=null,t.onkeystatuseschange=null,i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}Cs.CDMCleanupPromise=void 0;class Ot 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}}const oI=1;var Tt={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"};const aI="h";class Ni{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.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Tt.MANIFEST,su:!this.initialized})}catch(n){F.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===Tt.VIDEO||a===Tt.AUDIO||a==Tt.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){F.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||Ni.uuid(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:oI,sf:aI,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tt(t,this.createData());const i=t.ot===Tt.INIT||t.ot===Tt.VIDEO||t.ot===Tt.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){const r=Ni.toHeaders(t);if(!Object.keys(r).length)return;e.headers||(e.headers={}),tt(e.headers,r)}else{const r=Ni.toQuery(t);if(!r)return;e.url=Ni.appendQueryToUri(e.url,r)}}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,i;const r=this.hls;if(e===Tt.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Tt.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ge.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}static uuid(){const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}static serialize(e){const t=[],i=l=>!Number.isNaN(l)&&l!=null&&l!==""&&l!==!1,r=l=>Math.round(l),n=l=>r(l/100)*100,a={br:r,d:r,bl:n,dl:n,mtp:n,nor:l=>encodeURIComponent(l),rtp:n,tb:r},A=Object.keys(e||{}).sort();for(const l of A){let c=e[l];if(!i(c)||l==="v"&&c===1||l=="pr"&&c===1)continue;const h=a[l];h&&(c=h(c));const u=typeof c;let d;l==="ot"||l==="sf"||l==="st"?d=`${l}=${c}`:u==="boolean"?d=l:u==="number"?d=`${l}=${c}`:d=`${l}=${JSON.stringify(c)}`,t.push(d)}return t.join(",")}static toHeaders(e){const t=Object.keys(e),i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3};for(const a of t){const A=o[a]!=null?o[a]:1;n[A][a]=e[a]}for(let a=0;a<n.length;a++){const A=Ni.serialize(n[a]);A&&(i[`CMCD-${r[a]}`]=A)}return i}static toQuery(e){return`CMCD=${encodeURIComponent(Ni.serialize(e))}`}static appendQueryToUri(e,t){if(!t)return e;const i=e.includes("?")?"&":"?";return`${e}${i}${t}`}}const AI=3e5;class lI{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=F.log.bind(F,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}startLoad(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){const e=Math.max(this.timeToLoad*1e3-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,e)}else this.loadSteeringManifest(this.uri)}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===ft.SendAlternateToPenaltyBox&&i.flags===Nt.MoveAllAlternatesMatchingHost){let r=this.pathwayPriority;const n=this.pathwayId;this.penalizedPathways[n]||(this.penalizedPathways[n]=performance.now()),!r&&this.levels&&(r=this.levels.reduce((o,a)=>(o.indexOf(a.pathwayId)===-1&&o.push(a.pathwayId),o),[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==n)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>AI&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(i[o])continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=tt({},c);h.details=void 0,h.url=Jh(c.uri,c.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A);const u=new Ke(c.attrs);u["PATHWAY-ID"]=o;const d=u.AUDIO&&`${u.AUDIO}_clone_${o}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;d&&(i[u.AUDIO]=d,u.AUDIO=d),g&&(r[u.SUBTITLES]=g,u.SUBTITLES=g),h.attrs=u;const f=new hr(h);return vn(f,"audio",d),vn(f,"text",g),f});t.push(...l),Vh(this.audioTracks,i,A,o),Vh(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||u.url),p&&this.clonePathways(p),y&&this.updatePathwayPriority(y)},onError:(c,h,u,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${h.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,g)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout(()=>{this.loadSteeringManifest(e)},t)}}function Vh(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=tt({},o);return a.details=void 0,a.attrs=new Ke(a.attrs),a.url=a.attrs.URI=Jh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Jh(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const cI=/^age:\s*[\d.]+\s*$/im;class 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=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new dn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(i,t.url)}).catch(o=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=this.context.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&he(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry;yn(A,l,!1,o)?this.retry(A):(F.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,i=this.stats.retry;if(yn(t,i,!0))this.retry(t);else{F.warn(`timeout while loading ${this.context.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=ra(e,i.retry),i.retry++,F.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&cI.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function hI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const uI=/(\d+)-(\d+)\/(\d+)/;class qh{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||pI,this.controller=new self.AbortController,this.stats=new dn}destroy(){this.loader=this.callbacks=null,this.abortInternal()}abortInternal(){const e=this.response;e!=null&&e.ok||(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=dI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&he(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:g}=h;throw new EI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=fI(h.headers)||r.total,o&&he(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const{response:u}=this;self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const g={url:u.url,data:h,code:u.status};o&&!he(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(g,r,e,u)}).catch(h=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const u=h&&h.code||0,d=h?h.message:null;i.onError({code:u,text:d},e,h?h.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,n){const o=new Bh,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,h=c.length;return t.loaded+=h,h<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function dI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(tt({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function gI(s){const e=uI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function fI(s){const e=s.get("Content-Range");if(e){const i=gI(e);if(he(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function pI(s,e){return new self.Request(s.url,e)}class EI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const II=/\s/,mI={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(n=i.rows[u],a=!0,A=0,l="",!n.isEmpty()){var h;for(let f=0;f<n.chars.length;f++)II.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=Oh(l.trim()),g=xa(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=u+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((u,d)=>u.line==="auto"||d.line==="auto"?0:u.line>8&&d.line>8?d.line-u.line:u.line-d.line),r.forEach(u=>Uc(s,u))),r}},CI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},yI=bt(bt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength: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:kE,capLevelController:ka,errorController:Ep,fpsController:nI,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,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,certLoadPolicy:{default:CI},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},vI()),{},{subtitleStreamController:DE,subtitleTrackController:LE,timelineController:iI,audioStreamController:wE,audioTrackController:TE,emeController:Cs,cmcdController:Ni,contentSteeringController:lI});function vI(){return{cueHandler:mI,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function BI(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Fa(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,h=e[c];if(h!==void 0&&a){A.push(c);const u=t[o].default;switch(e[o]={default:u},l){case"TimeOut":u.maxLoadTimeMs=h,u.maxTimeToFirstByteMs=h;break;case"MaxRetry":u.errorRetry.maxNumRetry=h,u.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":u.errorRetry.retryDelayMs=h,u.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=h,u.timeoutRetry.maxRetryDelayMs=h;break}}}),A.length&&F.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),bt(bt({},t),e)}function Fa(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Fa):Object.keys(s).reduce((e,t)=>(e[t]=Fa(s[t]),e),{}):s}function QI(s){const e=s.loader;e!==qh&&e!==Wh?(F.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):hI()&&(s.loader=qh,s.progressive=!0,s.enableSoftwareAES=!0,F.log("[config]: Progressive streaming enabled, using FetchLoader"))}class Ii{static get version(){return"1.4.12"}static isSupported(){return Np()}static get Events(){return E}static get ErrorTypes(){return fe}static get ErrorDetails(){return Y}static get DefaultConfig(){return Ii.defaultConfig?Ii.defaultConfig:yI}static set DefaultConfig(e){Ii.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ca,this._autoLevelCapping=void 0,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,A0(e.debug||!1,"Hls instance");const t=this.config=BI(Ii.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&QI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),h=this.capLevelController=new n(this),u=new a(this),d=new z0(this),g=new sp(this),f=t.contentSteeringController,p=f?new f(this):null,y=this.levelController=new mp(this,p),v=new Cp(this),Q=new vp(this.config),C=this.streamController=new BE(this,v,Q);h.setStreamController(C),u.setStreamController(C);const T=[d,y,C];p&&T.splice(1,0,p),this.networkControllers=T;const b=[l,c,h,u,g,v];this.audioTrackController=this.createController(t.audioTrackController,T);const L=t.audioStreamController;L&&T.push(new L(this,v,Q)),this.subtitleTrackController=this.createController(t.subtitleTrackController,T);const R=t.subtitleStreamController;R&&T.push(new R(this,v,Q)),this.createController(t.timelineController,b),Q.emeController=this.emeController=this.createController(t.emeController,b),this.cmcdController=this.createController(t.cmcdController,b),this.latencyController=this.createController(rp,b),this.coreComponents=b,T.push(A);const P=A.onErrorOut;typeof P=="function"&&this.on(E.ERROR,P,A)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){F.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),this.trigger(E.ERROR,{type:fe.OTHER_ERROR,details:Y.INTERNAL_EXCEPTION,fatal:!1,event:e,error:i})}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){F.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){F.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){F.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=Go.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});F.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){F.log(`startLoad(${e})`),this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){F.log("stopLoad"),this.networkControllers.forEach(e=>{e.stopLoad()})}swapAudioCodec(){F.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){F.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e,t=0){this.levelController.removeLevel(e,t)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){F.log(`set currentLevel:${e}`),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){F.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){F.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){F.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){return this.levelController.startLevel}set startLevel(e){F.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}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(F.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e)}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ta.indexOf(e)>-1&&(this._maxHdcpLevel=e)}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get nextAutoLevel(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)}set nextAutoLevel(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}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 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}}Ii.defaultConfig=void 0;var bI=fr;fr.flatten=fr,fr.unflatten=zh;function jh(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Xh(s){return s}function fr(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||Xh,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const h=a[c],u=e.safe&&Array.isArray(h),d=Object.prototype.toString.call(h),g=jh(h),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,p,l+1);n[p]=h})}return o(s),n}function zh(s,e){e=e||{};const t=e.delimiter||".",i=e.overwrite||!1,r=e.transformKey||Xh,n={};if(jh(s)||Object.prototype.toString.call(s)!=="[object Object]")return s;function a(c){const h=Number(c);return isNaN(h)||c.indexOf(".")!==-1||e.object?c:h}function A(c,h,u){return Object.keys(u).reduce(function(d,g){return d[c+t+g]=u[g],d},h)}function l(c){const h=Object.prototype.toString.call(c),u=h==="[object Array]",d=h==="[object Object]";if(c){if(u)return!c.length;if(d)return!Object.keys(c).length}else return!0}return s=Object.keys(s).reduce(function(c,h){const u=Object.prototype.toString.call(s[h]);return!(u==="[object Object]"||u==="[object Array]")||l(s[h])?(c[h]=s[h],c):A(h,c,fr(s[h],e))},{}),Object.keys(s).forEach(function(c){const h=c.split(t).map(r);let u=a(h.shift()),d=a(h[0]),g=n;for(;d!==void 0;){if(u==="__proto__")return;const f=Object.prototype.toString.call(g[u]),p=f==="[object Object]"||f==="[object Array]";if(!i&&!p&&typeof g[u]<"u")return;(i&&!p||!i&&g[u]==null)&&(g[u]=typeof d=="number"&&!e.object?[]:{}),g=g[u],h.length>0&&(u=a(h.shift()),d=a(h[0]))}g[u]=zh(s[c],e)}),n}const SI=xo(bI);var Zh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function wI(s,e){return!!(s===e||Zh(s)&&Zh(e))}function TI(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!wI(s[t],e[t]))return!1;return!0}function xI(s,e){e===void 0&&(e=TI);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}/**
205
205
  * @license
206
206
  * Copyright 2017 Google LLC
207
207
  * SPDX-License-Identifier: BSD-3-Clause
208
- */const Zh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},eu=ds(class extends Ws{constructor(s){if(super(s),s.type!==us.CHILD)throw Error("repeat() can only be used in text expressions")}ht(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.ht(s,e,t).values}update(s,[e,t,i]){const r=Xd(s),{values:n,keys:o}=this.ht(e,t,i);if(!Array.isArray(r))return this.dt=o,n;const a=this.dt??(this.dt=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=qi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=qi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=qi(r[h],n[g]),Js(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=qi(r[u],n[d]),Js(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Zh(o,d,g),c=Zh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Js(s,r[h]);qi(y,n[d]),A[d]=y}else A[d]=qi(p,n[d]),Js(s,r[h],p),r[f]=null;d++}else uo(r[u]),u--;else uo(r[h]),h++;for(;d<=g;){const f=Js(s,A[g+1]);qi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&uo(f)}return this.dt=o,jd(s,A),bi}});var xt="top",Pt="bottom",Ut="right",Dt="left",Na="auto",pr=[xt,Pt,Ut,Dt],ys="start",Er="end",xI="clippingParents",tu="viewport",Ir="popper",DI="reference",iu=pr.reduce(function(s,e){return s.concat([e+"-"+ys,e+"-"+Er])},[]),su=[].concat(pr,[Na]).reduce(function(s,e){return s.concat([e,e+"-"+ys,e+"-"+Er])},[]),RI="beforeRead",LI="read",_I="afterRead",kI="beforeMain",FI="main",NI="afterMain",MI="beforeWrite",OI="write",PI="afterWrite",UI=[RI,LI,_I,kI,FI,NI,MI,OI,PI];function ei(s){return s?(s.nodeName||"").toLowerCase():null}function _t(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function ss(s){var e=_t(s).Element;return s instanceof e||s instanceof Element}function Gt(s){var e=_t(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ma(s){if(typeof ShadowRoot>"u")return!1;var e=_t(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function GI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Gt(n)||!ei(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function HI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Gt(r)||!ei(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const ru={name:"applyStyles",enabled:!0,phase:"write",fn:GI,effect:HI,requires:["computeStyles"]};function ti(s){return s.split("-")[0]}var rs=Math.max,_n=Math.min,vs=Math.round;function Oa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function nu(){return!/^((?!chrome|android).)*safari/i.test(Oa())}function Bs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Gt(s)&&(r=s.offsetWidth>0&&vs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&vs(i.height)/s.offsetHeight||1);var o=ss(s)?_t(s):window,a=o.visualViewport,A=!nu()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Pa(s){var e=Bs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function ou(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ma(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function Ii(s){return _t(s).getComputedStyle(s)}function $I(s){return["table","td","th"].indexOf(ei(s))>=0}function Mi(s){return((ss(s)?s.ownerDocument:s.document)||window.document).documentElement}function kn(s){return ei(s)==="html"?s:s.assignedSlot||s.parentNode||(Ma(s)?s.host:null)||Mi(s)}function au(s){return!Gt(s)||Ii(s).position==="fixed"?null:s.offsetParent}function YI(s){var e=/firefox/i.test(Oa()),t=/Trident/i.test(Oa());if(t&&Gt(s)){var i=Ii(s);if(i.position==="fixed")return null}var r=kn(s);for(Ma(r)&&(r=r.host);Gt(r)&&["html","body"].indexOf(ei(r))<0;){var n=Ii(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function mr(s){for(var e=_t(s),t=au(s);t&&$I(t)&&Ii(t).position==="static";)t=au(t);return t&&(ei(t)==="html"||ei(t)==="body"&&Ii(t).position==="static")?e:t||YI(s)||e}function Ua(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function Cr(s,e,t){return rs(s,_n(e,t))}function KI(s,e,t){var i=Cr(s,e,t);return i>t?t:i}function Au(){return{top:0,right:0,bottom:0,left:0}}function lu(s){return Object.assign({},Au(),s)}function cu(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var VI=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,lu(typeof e!="number"?e:cu(e,pr))};function JI(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ti(t.placement),A=Ua(a),l=[Dt,Ut].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=VI(r.padding,t),u=Pa(n),d=A==="y"?xt:Dt,g=A==="y"?Pt:Ut,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=mr(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,Q=f/2-p/2,C=h[d],T=v-u[c]-h[g],b=v/2-u[c]/2+Q,L=Cr(C,b,T),R=A;t.modifiersData[i]=(e={},e[R]=L,e.centerOffset=L-b,e)}}function WI(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||ou(e.elements.popper,r)&&(e.elements.arrow=r))}const qI={name:"arrow",enabled:!0,phase:"main",fn:JI,effect:WI,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Qs(s){return s.split("-")[1]}var jI={top:"auto",right:"auto",bottom:"auto",left:"auto"};function XI(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:vs(t*r)/r||0,y:vs(i*r)/r||0}}function hu(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),Q=Dt,C=xt,T=window;if(l){var b=mr(t),L="clientHeight",R="clientWidth";if(b===_t(t)&&(b=Mi(t),Ii(b).position!=="static"&&a==="absolute"&&(L="scrollHeight",R="scrollWidth")),b=b,r===xt||(r===Dt||r===Ut)&&n===Er){C=Pt;var P=h&&b===T&&T.visualViewport?T.visualViewport.height:b[L];f-=P-i.height,f*=A?1:-1}if(r===Dt||(r===xt||r===Pt)&&n===Er){Q=Ut;var k=h&&b===T&&T.visualViewport?T.visualViewport.width:b[R];d-=k-i.width,d*=A?1:-1}}var q=Object.assign({position:a},l&&jI),$=c===!0?XI({x:d,y:f},_t(t)):{x:d,y:f};if(d=$.x,f=$.y,A){var te;return Object.assign({},q,(te={},te[C]=v?"0":"",te[Q]=y?"0":"",te.transform=(T.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",te))}return Object.assign({},q,(e={},e[C]=v?f+"px":"",e[Q]=y?d+"px":"",e.transform="",e))}function zI(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ti(e.placement),variation:Qs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,hu(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,hu(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const ZI={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:zI,data:{}};var Fn={passive:!0};function em(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=_t(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,Fn)}),a&&A.addEventListener("resize",t.update,Fn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,Fn)}),a&&A.removeEventListener("resize",t.update,Fn)}}const tm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:em,data:{}};var im={left:"right",right:"left",bottom:"top",top:"bottom"};function Nn(s){return s.replace(/left|right|bottom|top/g,function(e){return im[e]})}var sm={start:"end",end:"start"};function uu(s){return s.replace(/start|end/g,function(e){return sm[e]})}function Ga(s){var e=_t(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ha(s){return Bs(Mi(s)).left+Ga(s).scrollLeft}function rm(s,e){var t=_t(s),i=Mi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=nu();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ha(s),y:A}}function nm(s){var e,t=Mi(s),i=Ga(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=rs(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=rs(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Ha(s),A=-i.scrollTop;return Ii(r||t).direction==="rtl"&&(a+=rs(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function $a(s){var e=Ii(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function du(s){return["html","body","#document"].indexOf(ei(s))>=0?s.ownerDocument.body:Gt(s)&&$a(s)?s:du(kn(s))}function yr(s,e){var t;e===void 0&&(e=[]);var i=du(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=_t(i),o=r?[n].concat(n.visualViewport||[],$a(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(yr(kn(o)))}function Ya(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function om(s,e){var t=Bs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function gu(s,e,t){return e===tu?Ya(rm(s,t)):ss(e)?om(e,t):Ya(nm(Mi(s)))}function am(s){var e=yr(kn(s)),t=["absolute","fixed"].indexOf(Ii(s).position)>=0,i=t&&Gt(s)?mr(s):s;return ss(i)?e.filter(function(r){return ss(r)&&ou(r,i)&&ei(r)!=="body"}):[]}function Am(s,e,t,i){var r=e==="clippingParents"?am(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=gu(s,l,i);return A.top=rs(c.top,A.top),A.right=_n(c.right,A.right),A.bottom=_n(c.bottom,A.bottom),A.left=rs(c.left,A.left),A},gu(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function fu(s){var e=s.reference,t=s.element,i=s.placement,r=i?ti(i):null,n=i?Qs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case xt:A={x:o,y:e.y-t.height};break;case Pt:A={x:o,y:e.y+e.height};break;case Ut:A={x:e.x+e.width,y:a};break;case Dt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ua(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case ys:A[l]=A[l]-(e[c]/2-t[c]/2);break;case Er:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function vr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?xI:a,l=t.rootBoundary,c=l===void 0?tu:l,h=t.elementContext,u=h===void 0?Ir:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=lu(typeof p!="number"?p:cu(p,pr)),v=u===Ir?DI:Ir,Q=s.rects.popper,C=s.elements[g?v:u],T=Am(ss(C)?C:C.contextElement||Mi(s.elements.popper),A,c,o),b=Bs(s.elements.reference),L=fu({reference:b,element:Q,strategy:"absolute",placement:r}),R=Ya(Object.assign({},Q,L)),P=u===Ir?R:b,k={top:T.top-P.top+y.top,bottom:P.bottom-T.bottom+y.bottom,left:T.left-P.left+y.left,right:P.right-T.right+y.right},q=s.modifiersData.offset;if(u===Ir&&q){var $=q[r];Object.keys(k).forEach(function(te){var ee=[Ut,Pt].indexOf(te)>=0?1:-1,S=[xt,Pt].indexOf(te)>=0?"y":"x";k[te]+=$[S]*ee})}return k}function lm(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?su:A,c=Qs(i),h=c?a?iu:iu.filter(function(g){return Qs(g)===c}):pr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=vr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ti(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function cm(s){if(ti(s)===Na)return[];var e=Nn(s);return[uu(s),e,uu(e)]}function hm(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ti(p),v=y===p,Q=A||(v||!g?[Nn(p)]:cm(p)),C=[p].concat(Q).reduce(function(se,ue){return se.concat(ti(ue)===Na?lm(e,{placement:ue,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ue)},[]),T=e.rects.reference,b=e.rects.popper,L=new Map,R=!0,P=C[0],k=0;k<C.length;k++){var q=C[k],$=ti(q),te=Qs(q)===ys,ee=[xt,Pt].indexOf($)>=0,S=ee?"width":"height",D=vr(e,{placement:q,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),U=ee?te?Ut:Dt:te?Pt:xt;T[S]>b[S]&&(U=Nn(U));var B=Nn(U),w=[];if(n&&w.push(D[$]<=0),a&&w.push(D[U]<=0,D[B]<=0),w.every(function(se){return se})){P=q,R=!1;break}L.set(q,w)}if(R)for(var N=g?3:1,H=function(ue){var Ae=C.find(function(Ce){var be=L.get(Ce);if(be)return be.slice(0,ue).every(function(Re){return Re})});if(Ae)return P=Ae,"break"},K=N;K>0;K--){var X=H(K);if(X==="break")break}e.placement!==P&&(e.modifiersData[i]._skip=!0,e.placement=P,e.reset=!0)}}const um={name:"flip",enabled:!0,phase:"main",fn:hm,requiresIfExists:["offset"],data:{_skip:!1}};function pu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function Eu(s){return[xt,Ut,Pt,Dt].some(function(e){return s[e]>=0})}function dm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=vr(e,{elementContext:"reference"}),a=vr(e,{altBoundary:!0}),A=pu(o,i),l=pu(a,r,n),c=Eu(A),h=Eu(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const gm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:dm};function fm(s,e,t){var i=ti(s),r=[Dt,xt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Dt,Ut].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function pm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=su.reduce(function(c,h){return c[h]=fm(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Em={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:pm};function Im(s){var e=s.state,t=s.name;e.modifiersData[t]=fu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const mm={name:"popperOffsets",enabled:!0,phase:"read",fn:Im,data:{}};function Cm(s){return s==="x"?"y":"x"}function ym(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=vr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ti(e.placement),v=Qs(e.placement),Q=!v,C=Ua(y),T=Cm(C),b=e.modifiersData.popperOffsets,L=e.rects.reference,R=e.rects.popper,P=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,k=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(b){if(n){var te,ee=C==="y"?xt:Dt,S=C==="y"?Pt:Ut,D=C==="y"?"height":"width",U=b[C],B=U+p[ee],w=U-p[S],N=d?-R[D]/2:0,H=v===ys?L[D]:R[D],K=v===ys?-R[D]:-L[D],X=e.elements.arrow,se=d&&X?Pa(X):{width:0,height:0},ue=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Au(),Ae=ue[ee],Ce=ue[S],be=Cr(0,L[D],se[D]),Re=Q?L[D]/2-N-be-Ae-k.mainAxis:H-be-Ae-k.mainAxis,ne=Q?-L[D]/2+N+be+Ce+k.mainAxis:K+be+Ce+k.mainAxis,Ie=e.elements.arrow&&mr(e.elements.arrow),Be=Ie?C==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,he=(te=q==null?void 0:q[C])!=null?te:0,le=U+Re-he-Be,oe=U+ne-he,we=Cr(d?_n(B,le):B,U,d?rs(w,oe):w);b[C]=we,$[C]=we-U}if(a){var Oe,Le=C==="x"?xt:Dt,Me=C==="x"?Pt:Ut,Pe=b[T],xe=T==="y"?"height":"width",ve=Pe+p[Le],He=Pe-p[Me],We=[xt,Dt].indexOf(y)!==-1,at=(Oe=q==null?void 0:q[T])!=null?Oe:0,Xe=We?ve:Pe-L[xe]-R[xe]-at+k.altAxis,It=We?Pe+L[xe]+R[xe]-at-k.altAxis:He,Ci=d&&We?KI(Xe,Pe,It):Cr(d?Xe:ve,Pe,d?It:He);b[T]=Ci,$[T]=Ci-Pe}e.modifiersData[i]=$}}const vm={name:"preventOverflow",enabled:!0,phase:"main",fn:ym,requiresIfExists:["offset"]};function Bm(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function Qm(s){return s===_t(s)||!Gt(s)?Ga(s):Bm(s)}function bm(s){var e=s.getBoundingClientRect(),t=vs(e.width)/s.offsetWidth||1,i=vs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function Sm(s,e,t){t===void 0&&(t=!1);var i=Gt(e),r=Gt(e)&&bm(e),n=Mi(e),o=Bs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ei(e)!=="body"||$a(n))&&(a=Qm(e)),Gt(e)?(A=Bs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ha(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function wm(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function Tm(s){var e=wm(s);return UI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function xm(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Dm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var Iu={placement:"bottom",modifiers:[],strategy:"absolute"};function mu(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Rm(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?Iu:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Iu,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:ss(a)?yr(a):a.contextElement?yr(a.contextElement):[],popper:yr(A)};var Q=Tm(Dm([].concat(i,c.options.modifiers)));return c.orderedModifiers=Q.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,Q=y.popper;if(mu(v,Q)){c.rects={reference:Sm(v,mr(Q),c.options.strategy==="fixed"),popper:Pa(Q)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(k){return c.modifiersData[k.name]=Object.assign({},k.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var T=c.orderedModifiers[C],b=T.fn,L=T.options,R=L===void 0?{}:L,P=T.name;typeof b=="function"&&(c=b({state:c,options:R,name:P,instance:d})||c)}}}},update:xm(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!mu(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,Q=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var T=C({state:c,name:y,instance:d,options:Q}),b=function(){};h.push(T||b)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var Lm=[tm,mm,ZI,ru,Em,um,vm,qI,gm],_m=Rm({defaultModifiers:Lm}),km="tippy-box",Cu="tippy-content",Fm="tippy-backdrop",yu="tippy-arrow",vu="tippy-svg-arrow",ns={passive:!0,capture:!0},Bu=function(){return document.body};function Ka(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Va(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Qu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function bu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Nm(s){return s.split(/\s+/).filter(Boolean)}function bs(s){return[].concat(s)}function Su(s,e){s.indexOf(e)===-1&&s.push(e)}function Mm(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function Om(s){return s.split("-")[0]}function Mn(s){return[].slice.call(s)}function wu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function Br(){return document.createElement("div")}function On(s){return["Element","Fragment"].some(function(e){return Va(s,e)})}function Pm(s){return Va(s,"NodeList")}function Um(s){return Va(s,"MouseEvent")}function Gm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function Hm(s){return On(s)?[s]:Pm(s)?Mn(s):Array.isArray(s)?s:Mn(document.querySelectorAll(s))}function Ja(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Tu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function $m(s){var e,t=bs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function Ym(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=Om(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function Wa(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function xu(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var ii={isTouch:!1},Du=0;function Km(){ii.isTouch||(ii.isTouch=!0,window.performance&&document.addEventListener("mousemove",Ru))}function Ru(){var s=performance.now();s-Du<20&&(ii.isTouch=!1,document.removeEventListener("mousemove",Ru)),Du=s}function Vm(){var s=document.activeElement;if(Gm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function Jm(){document.addEventListener("touchstart",Km,ns),window.addEventListener("blur",Vm)}var Wm=typeof window<"u"&&typeof document<"u",qm=Wm?!!window.msCrypto:!1,jm={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Xm={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Vt=Object.assign({appendTo:Bu,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},jm,Xm),zm=Object.keys(Vt),Zm=function(e){var t=Object.keys(e);t.forEach(function(i){Vt[i]=e[i]})};function Lu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Vt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function eC(s,e){var t=e?Object.keys(Lu(Object.assign({},Vt,{plugins:e}))):zm,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function _u(s,e){var t=Object.assign({},e,{content:Qu(e.content,[s])},e.ignoreAttributes?{}:eC(s,e.plugins));return t.aria=Object.assign({},Vt.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 tC=function(){return"innerHTML"};function qa(s,e){s[tC()]=e}function ku(s){var e=Br();return s===!0?e.className=yu:(e.className=vu,On(s)?e.appendChild(s):qa(e,s)),e}function Fu(s,e){On(e.content)?(qa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?qa(s,e.content):s.textContent=e.content)}function ja(s){var e=s.firstElementChild,t=Mn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(Cu)}),arrow:t.find(function(i){return i.classList.contains(yu)||i.classList.contains(vu)}),backdrop:t.find(function(i){return i.classList.contains(Fm)})}}function Nu(s){var e=Br(),t=Br();t.className=km,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=Br();i.className=Cu,i.setAttribute("data-state","hidden"),Fu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=ja(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&Fu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(ku(o.arrow))):A.appendChild(ku(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}Nu.$$tippy=!0;var iC=1,Pn=[],Xa=[];function sC(s,e){var t=_u(s,Object.assign({},Vt,Lu(wu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=bu(le,t.interactiveDebounce),f,p=iC++,y=null,v=Mm(t.plugins),Q={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:Br(),popperInstance:y,props:t,state:Q,plugins:v,clearDelayTimeouts:Xe,setProps:It,setContent:Ci,show:mt,hide:oi,hideWithInteractivity:ai,enable:We,disable:at,unmount:Ai,destroy:gt};if(!t.render)return C;var T=t.render(C),b=T.popper,L=T.onUpdate;b.setAttribute("data-tippy-root",""),b.id="tippy-"+C.id,C.popper=b,s._tippy=C,b._tippy=C;var R=v.map(function(G){return G.fn(C)}),P=s.hasAttribute("aria-expanded");return Ie(),N(),U(),B("onCreate",[C]),t.showOnCreate&&ve(),b.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),b.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&ee().addEventListener("mousemove",g)}),C;function k(){var G=C.props.touch;return Array.isArray(G)?G:[G,0]}function q(){return k()[0]==="hold"}function $(){var G;return!!((G=C.props.render)!=null&&G.$$tippy)}function te(){return f||s}function ee(){var G=te().parentNode;return G?$m(G):document}function S(){return ja(b)}function D(G){return C.state.isMounted&&!C.state.isVisible||ii.isTouch||c&&c.type==="focus"?0:Ka(C.props.delay,G?0:1,Vt.delay)}function U(G){G===void 0&&(G=!1),b.style.pointerEvents=C.props.interactive&&!G?"":"none",b.style.zIndex=""+C.props.zIndex}function B(G,ae,de){if(de===void 0&&(de=!0),R.forEach(function(Qe){Qe[G]&&Qe[G].apply(Qe,ae)}),de){var Se;(Se=C.props)[G].apply(Se,ae)}}function w(){var G=C.props.aria;if(G.content){var ae="aria-"+G.content,de=b.id,Se=bs(C.props.triggerTarget||s);Se.forEach(function(Qe){var $e=Qe.getAttribute(ae);if(C.state.isVisible)Qe.setAttribute(ae,$e?$e+" "+de:de);else{var Ct=$e&&$e.replace(de,"").trim();Ct?Qe.setAttribute(ae,Ct):Qe.removeAttribute(ae)}})}}function N(){if(!(P||!C.props.aria.expanded)){var G=bs(C.props.triggerTarget||s);G.forEach(function(ae){C.props.interactive?ae.setAttribute("aria-expanded",C.state.isVisible&&ae===te()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function H(){ee().removeEventListener("mousemove",g),Pn=Pn.filter(function(G){return G!==g})}function K(G){if(!(ii.isTouch&&(A||G.type==="mousedown"))){var ae=G.composedPath&&G.composedPath()[0]||G.target;if(!(C.props.interactive&&xu(b,ae))){if(bs(C.props.triggerTarget||s).some(function(de){return xu(de,ae)})){if(ii.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else B("onClickOutside",[C,G]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||Ae())}}}function X(){A=!0}function se(){A=!1}function ue(){var G=ee();G.addEventListener("mousedown",K,!0),G.addEventListener("touchend",K,ns),G.addEventListener("touchstart",se,ns),G.addEventListener("touchmove",X,ns)}function Ae(){var G=ee();G.removeEventListener("mousedown",K,!0),G.removeEventListener("touchend",K,ns),G.removeEventListener("touchstart",se,ns),G.removeEventListener("touchmove",X,ns)}function Ce(G,ae){Re(G,function(){!C.state.isVisible&&b.parentNode&&b.parentNode.contains(b)&&ae()})}function be(G,ae){Re(G,ae)}function Re(G,ae){var de=S().box;function Se(Qe){Qe.target===de&&(Wa(de,"remove",Se),ae())}if(G===0)return ae();Wa(de,"remove",h),Wa(de,"add",Se),h=Se}function ne(G,ae,de){de===void 0&&(de=!1);var Se=bs(C.props.triggerTarget||s);Se.forEach(function(Qe){Qe.addEventListener(G,ae,de),d.push({node:Qe,eventType:G,handler:ae,options:de})})}function Ie(){q()&&(ne("touchstart",he,{passive:!0}),ne("touchend",oe,{passive:!0})),Nm(C.props.trigger).forEach(function(G){if(G!=="manual")switch(ne(G,he),G){case"mouseenter":ne("mouseleave",oe);break;case"focus":ne(qm?"focusout":"blur",we);break;case"focusin":ne("focusout",we);break}})}function Be(){d.forEach(function(G){var ae=G.node,de=G.eventType,Se=G.handler,Qe=G.options;ae.removeEventListener(de,Se,Qe)}),d=[]}function he(G){var ae,de=!1;if(!(!C.state.isEnabled||Oe(G)||a)){var Se=((ae=c)==null?void 0:ae.type)==="focus";c=G,f=G.currentTarget,N(),!C.state.isVisible&&Um(G)&&Pn.forEach(function(Qe){return Qe(G)}),G.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?de=!0:ve(G),G.type==="click"&&(o=!de),de&&!Se&&He(G)}}function le(G){var ae=G.target,de=te().contains(ae)||b.contains(ae);if(!(G.type==="mousemove"&&de)){var Se=xe().concat(b).map(function(Qe){var $e,Ct=Qe._tippy,yt=($e=Ct.popperInstance)==null?void 0:$e.state;return yt?{popperRect:Qe.getBoundingClientRect(),popperState:yt,props:t}:null}).filter(Boolean);Ym(Se,G)&&(H(),He(G))}}function oe(G){var ae=Oe(G)||C.props.trigger.indexOf("click")>=0&&o;if(!ae){if(C.props.interactive){C.hideWithInteractivity(G);return}He(G)}}function we(G){C.props.trigger.indexOf("focusin")<0&&G.target!==te()||C.props.interactive&&G.relatedTarget&&b.contains(G.relatedTarget)||He(G)}function Oe(G){return ii.isTouch?q()!==G.type.indexOf("touch")>=0:!1}function Le(){Me();var G=C.props,ae=G.popperOptions,de=G.placement,Se=G.offset,Qe=G.getReferenceClientRect,$e=G.moveTransition,Ct=$()?ja(b).arrow:null,yt=Qe?{getBoundingClientRect:Qe,contextElement:Qe.contextElement||te()}:s,Ds={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Rs){var Gi=Rs.state;if($()){var xr=S(),Dr=xr.box;["placement","reference-hidden","escaped"].forEach(function(Ls){Ls==="placement"?Dr.setAttribute("data-placement",Gi.placement):Gi.attributes.popper["data-popper-"+Ls]?Dr.setAttribute("data-"+Ls,""):Dr.removeAttribute("data-"+Ls)}),Gi.attributes.popper={}}}},vt=[{name:"offset",options:{offset:Se}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!$e}},Ds];$()&&Ct&&vt.push({name:"arrow",options:{element:Ct,padding:3}}),vt.push.apply(vt,(ae==null?void 0:ae.modifiers)||[]),C.popperInstance=_m(yt,b,Object.assign({},ae,{placement:de,onFirstUpdate:u,modifiers:vt}))}function Me(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Pe(){var G=C.props.appendTo,ae,de=te();C.props.interactive&&G===Bu||G==="parent"?ae=de.parentNode:ae=Qu(G,[de]),ae.contains(b)||ae.appendChild(b),C.state.isMounted=!0,Le()}function xe(){return Mn(b.querySelectorAll("[data-tippy-root]"))}function ve(G){C.clearDelayTimeouts(),G&&B("onTrigger",[C,G]),ue();var ae=D(!0),de=k(),Se=de[0],Qe=de[1];ii.isTouch&&Se==="hold"&&Qe&&(ae=Qe),ae?i=setTimeout(function(){C.show()},ae):C.show()}function He(G){if(C.clearDelayTimeouts(),B("onUntrigger",[C,G]),!C.state.isVisible){Ae();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(G.type)>=0&&o)){var ae=D(!1);ae?r=setTimeout(function(){C.state.isVisible&&C.hide()},ae):n=requestAnimationFrame(function(){C.hide()})}}function We(){C.state.isEnabled=!0}function at(){C.hide(),C.state.isEnabled=!1}function Xe(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function It(G){if(!C.state.isDestroyed){B("onBeforeUpdate",[C,G]),Be();var ae=C.props,de=_u(s,Object.assign({},ae,wu(G),{ignoreAttributes:!0}));C.props=de,Ie(),ae.interactiveDebounce!==de.interactiveDebounce&&(H(),g=bu(le,de.interactiveDebounce)),ae.triggerTarget&&!de.triggerTarget?bs(ae.triggerTarget).forEach(function(Se){Se.removeAttribute("aria-expanded")}):de.triggerTarget&&s.removeAttribute("aria-expanded"),N(),U(),L&&L(ae,de),C.popperInstance&&(Le(),xe().forEach(function(Se){requestAnimationFrame(Se._tippy.popperInstance.forceUpdate)})),B("onAfterUpdate",[C,G])}}function Ci(G){C.setProps({content:G})}function mt(){var G=C.state.isVisible,ae=C.state.isDestroyed,de=!C.state.isEnabled,Se=ii.isTouch&&!C.props.touch,Qe=Ka(C.props.duration,0,Vt.duration);if(!(G||ae||de||Se)&&!te().hasAttribute("disabled")&&(B("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,$()&&(b.style.visibility="visible"),U(),ue(),C.state.isMounted||(b.style.transition="none"),$()){var $e=S(),Ct=$e.box,yt=$e.content;Ja([Ct,yt],0)}u=function(){var vt;if(!(!C.state.isVisible||l)){if(l=!0,b.offsetHeight,b.style.transition=C.props.moveTransition,$()&&C.props.animation){var ls=S(),Rs=ls.box,Gi=ls.content;Ja([Rs,Gi],Qe),Tu([Rs,Gi],"visible")}w(),N(),Su(Xa,C),(vt=C.popperInstance)==null||vt.forceUpdate(),B("onMount",[C]),C.props.animation&&$()&&be(Qe,function(){C.state.isShown=!0,B("onShown",[C])})}},Pe()}}function oi(){var G=!C.state.isVisible,ae=C.state.isDestroyed,de=!C.state.isEnabled,Se=Ka(C.props.duration,1,Vt.duration);if(!(G||ae||de)&&(B("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,$()&&(b.style.visibility="hidden"),H(),Ae(),U(!0),$()){var Qe=S(),$e=Qe.box,Ct=Qe.content;C.props.animation&&(Ja([$e,Ct],Se),Tu([$e,Ct],"hidden"))}w(),N(),C.props.animation?$()&&Ce(Se,C.unmount):C.unmount()}}function ai(G){ee().addEventListener("mousemove",g),Su(Pn,g),g(G)}function Ai(){C.state.isVisible&&C.hide(),C.state.isMounted&&(Me(),xe().forEach(function(G){G._tippy.unmount()}),b.parentNode&&b.parentNode.removeChild(b),Xa=Xa.filter(function(G){return G!==C}),C.state.isMounted=!1,B("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),Be(),delete s._tippy,C.state.isDestroyed=!0,B("onDestroy",[C]))}}function os(s,e){e===void 0&&(e={});var t=Vt.plugins.concat(e.plugins||[]);Jm();var i=Object.assign({},e,{plugins:t}),r=Hm(s),n=r.reduce(function(o,a){var A=a&&sC(a,i);return A&&o.push(A),o},[]);return On(s)?n[0]:n}os.defaultProps=Vt,os.setDefaultProps=Zm,os.currentInput=ii,Object.assign({},ru,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),os.setDefaultProps({render:Nu});class si extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const rC=5;class nC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=lt(),this._controls=lt(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-rC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=Zl((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=cn(c)&&d<=cn(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return ct(this._canvas)}controls(){return ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,u.currentTime):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new si("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function oC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function aC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function za(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!oC()&&Ei.isSupported()){let l=!1;a=new Ei({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,g,f){g.toString().includes("?")||(g+="?"+u),h.apply(this,[d,g,f])}}}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);a.startLevel=a.firstLevel,a.startLoad(c),l=!0,a.currentLevel=u!==-1?u:a.firstLevel}},a.on(Ei.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})})}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function Mu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const AC=Li(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let lC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._resolveVideo=Li(async t=>{const{id:i,key:r}=t,n=await za(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=Li(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Mu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new si(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Hr(this.host,async([e,t,i,r,n,o])=>{try{let a=null;if(this.host._errors=[],i||e){if(this.host._processing=!0,i){let c=null;if(r)try{c=await(await fetch(r,{method:"GET"})).text()}catch(d){const g=new si("Track failed to fetch",d);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:g,message:g.message}))}const u={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:c}}}]}};try{this.scenes=await gs({data:u,template:t,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await gs({data:u,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new si("Fatal source template error",g,!0)}a=new si("Source template error",d)}}else try{this.scenes=await gs({data:e,template:t,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(c){try{this.scenes=await gs({data:e,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(h){throw new si("Fatal data template error",h,!0)}a=new si("Data template error",c)}Object.keys(this.videos).forEach(c=>{this.scenes.scenes.find(({video:h})=>c===(h==null?void 0:h.key))||this._videos[c].node.pause()});const A=this.scenes.scenes.reduce((c,{video:h})=>(h&&(c[h.key]=h),c),{});Object.keys(this.videos).join("|")!==Object.keys(A).join("|")&&this.host.reset(0,!1),this.videos=A,this.videoState={...this.videoState,...this.scenes.scenes.reduce((c,{video:h,start:u,duration:d})=>{var g;const f=(h==null?void 0:h.key)??`${u}-${d}`,p=this._getBufferSegments({key:f,node:h==null?void 0:h.node,duration:this.scenes.duration});return c[f]={initialised:!h,waiting:!!h,...this.videoState[f],buffered:h?p:(g=this.videoState[f])==null?void 0:g.buffered},c},{})},this.videoMeta=this.scenes.scenes.reduce((c,{video:h,videoMeta:u})=>(h&&u&&(c[h.key]=u),c),{}),(await Promise.all(this.scenes.fonts.map(c=>AC(c)))).forEach(c=>{document.fonts.add(c)}),this.duration=this.scenes.duration,this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}a&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}catch(a){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function cC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function hC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Za=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],uC={id:"captions",event:"captions:click",label:"Closed Captions"},dC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Ou={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}]},gC={id:"playbackRate",label:"Playback playbackRate",subItems:Ou};class fC extends ol{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==us.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)),Ti}}const eA=ds(fC),pC=TI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=jl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ri={"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"},EC={colors:ri,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 ${ri["dark-100"]}`,medium:`0 .125rem .625rem ${ri["dark-100"]}`,large:`0 .25rem 1rem ${ri["dark-50"]}`,xl:`.25rem .25rem 1rem ${ri["dark-250"]}`,xxl:`0 .25rem 2rem ${ri["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ri["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ri["dark-50"]}`,text:`0 0 .25rem ${ri["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ri["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Pu=bI.flatten(EC,{delimiter:"-"}),IC=Object.keys(Pu).map(s=>Ps(`:host { --${s}: ${Pu[s]}; }`)),ke=(s=>{class e extends s{firstUpdated(){pC().forEach(({load:r,font:n})=>{document.fonts.add(n),r&&n.load()})}}return e.styles=[(s==null?void 0:s.styles)??[],IC,Ze`
208
+ */const eu=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},tu=ds(class extends Ws{constructor(s){if(super(s),s.type!==us.CHILD)throw Error("repeat() can only be used in text expressions")}ht(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.ht(s,e,t).values}update(s,[e,t,i]){const r=zd(s),{values:n,keys:o}=this.ht(e,t,i);if(!Array.isArray(r))return this.dt=o,n;const a=this.dt??(this.dt=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=qi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=qi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=qi(r[h],n[g]),Js(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=qi(r[u],n[d]),Js(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=eu(o,d,g),c=eu(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const y=Js(s,r[h]);qi(y,n[d]),A[d]=y}else A[d]=qi(p,n[d]),Js(s,r[h],p),r[f]=null;d++}else uo(r[u]),u--;else uo(r[h]),h++;for(;d<=g;){const f=Js(s,A[g+1]);qi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&uo(f)}return this.dt=o,Xd(s,A),Si}});var xt="top",Pt="bottom",Ut="right",Dt="left",Na="auto",pr=[xt,Pt,Ut,Dt],ys="start",Er="end",DI="clippingParents",iu="viewport",Ir="popper",RI="reference",su=pr.reduce(function(s,e){return s.concat([e+"-"+ys,e+"-"+Er])},[]),ru=[].concat(pr,[Na]).reduce(function(s,e){return s.concat([e,e+"-"+ys,e+"-"+Er])},[]),LI="beforeRead",_I="read",kI="afterRead",FI="beforeMain",NI="main",MI="afterMain",OI="beforeWrite",PI="write",UI="afterWrite",GI=[LI,_I,kI,FI,NI,MI,OI,PI,UI];function ei(s){return s?(s.nodeName||"").toLowerCase():null}function _t(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function ss(s){var e=_t(s).Element;return s instanceof e||s instanceof Element}function Gt(s){var e=_t(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ma(s){if(typeof ShadowRoot>"u")return!1;var e=_t(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function HI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Gt(n)||!ei(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function $I(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Gt(r)||!ei(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const nu={name:"applyStyles",enabled:!0,phase:"write",fn:HI,effect:$I,requires:["computeStyles"]};function ti(s){return s.split("-")[0]}var rs=Math.max,_n=Math.min,vs=Math.round;function Oa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ou(){return!/^((?!chrome|android).)*safari/i.test(Oa())}function Bs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Gt(s)&&(r=s.offsetWidth>0&&vs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&vs(i.height)/s.offsetHeight||1);var o=ss(s)?_t(s):window,a=o.visualViewport,A=!ou()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Pa(s){var e=Bs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function au(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ma(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function mi(s){return _t(s).getComputedStyle(s)}function YI(s){return["table","td","th"].indexOf(ei(s))>=0}function Mi(s){return((ss(s)?s.ownerDocument:s.document)||window.document).documentElement}function kn(s){return ei(s)==="html"?s:s.assignedSlot||s.parentNode||(Ma(s)?s.host:null)||Mi(s)}function Au(s){return!Gt(s)||mi(s).position==="fixed"?null:s.offsetParent}function KI(s){var e=/firefox/i.test(Oa()),t=/Trident/i.test(Oa());if(t&&Gt(s)){var i=mi(s);if(i.position==="fixed")return null}var r=kn(s);for(Ma(r)&&(r=r.host);Gt(r)&&["html","body"].indexOf(ei(r))<0;){var n=mi(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function mr(s){for(var e=_t(s),t=Au(s);t&&YI(t)&&mi(t).position==="static";)t=Au(t);return t&&(ei(t)==="html"||ei(t)==="body"&&mi(t).position==="static")?e:t||KI(s)||e}function Ua(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function Cr(s,e,t){return rs(s,_n(e,t))}function VI(s,e,t){var i=Cr(s,e,t);return i>t?t:i}function lu(){return{top:0,right:0,bottom:0,left:0}}function cu(s){return Object.assign({},lu(),s)}function hu(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var JI=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,cu(typeof e!="number"?e:hu(e,pr))};function WI(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=ti(t.placement),A=Ua(a),l=[Dt,Ut].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=JI(r.padding,t),u=Pa(n),d=A==="y"?xt:Dt,g=A==="y"?Pt:Ut,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],y=mr(n),v=y?A==="y"?y.clientHeight||0:y.clientWidth||0:0,Q=f/2-p/2,C=h[d],T=v-u[c]-h[g],b=v/2-u[c]/2+Q,L=Cr(C,b,T),R=A;t.modifiersData[i]=(e={},e[R]=L,e.centerOffset=L-b,e)}}function qI(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||au(e.elements.popper,r)&&(e.elements.arrow=r))}const jI={name:"arrow",enabled:!0,phase:"main",fn:WI,effect:qI,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Qs(s){return s.split("-")[1]}var XI={top:"auto",right:"auto",bottom:"auto",left:"auto"};function zI(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:vs(t*r)/r||0,y:vs(i*r)/r||0}}function uu(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),Q=Dt,C=xt,T=window;if(l){var b=mr(t),L="clientHeight",R="clientWidth";if(b===_t(t)&&(b=Mi(t),mi(b).position!=="static"&&a==="absolute"&&(L="scrollHeight",R="scrollWidth")),b=b,r===xt||(r===Dt||r===Ut)&&n===Er){C=Pt;var P=h&&b===T&&T.visualViewport?T.visualViewport.height:b[L];f-=P-i.height,f*=A?1:-1}if(r===Dt||(r===xt||r===Pt)&&n===Er){Q=Ut;var k=h&&b===T&&T.visualViewport?T.visualViewport.width:b[R];d-=k-i.width,d*=A?1:-1}}var q=Object.assign({position:a},l&&XI),$=c===!0?zI({x:d,y:f},_t(t)):{x:d,y:f};if(d=$.x,f=$.y,A){var te;return Object.assign({},q,(te={},te[C]=v?"0":"",te[Q]=y?"0":"",te.transform=(T.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",te))}return Object.assign({},q,(e={},e[C]=v?f+"px":"",e[Q]=y?d+"px":"",e.transform="",e))}function ZI(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:ti(e.placement),variation:Qs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,uu(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,uu(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const em={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ZI,data:{}};var Fn={passive:!0};function tm(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=_t(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,Fn)}),a&&A.addEventListener("resize",t.update,Fn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,Fn)}),a&&A.removeEventListener("resize",t.update,Fn)}}const im={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:tm,data:{}};var sm={left:"right",right:"left",bottom:"top",top:"bottom"};function Nn(s){return s.replace(/left|right|bottom|top/g,function(e){return sm[e]})}var rm={start:"end",end:"start"};function du(s){return s.replace(/start|end/g,function(e){return rm[e]})}function Ga(s){var e=_t(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ha(s){return Bs(Mi(s)).left+Ga(s).scrollLeft}function nm(s,e){var t=_t(s),i=Mi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=ou();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ha(s),y:A}}function om(s){var e,t=Mi(s),i=Ga(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=rs(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=rs(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Ha(s),A=-i.scrollTop;return mi(r||t).direction==="rtl"&&(a+=rs(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function $a(s){var e=mi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function gu(s){return["html","body","#document"].indexOf(ei(s))>=0?s.ownerDocument.body:Gt(s)&&$a(s)?s:gu(kn(s))}function yr(s,e){var t;e===void 0&&(e=[]);var i=gu(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=_t(i),o=r?[n].concat(n.visualViewport||[],$a(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(yr(kn(o)))}function Ya(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function am(s,e){var t=Bs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function fu(s,e,t){return e===iu?Ya(nm(s,t)):ss(e)?am(e,t):Ya(om(Mi(s)))}function Am(s){var e=yr(kn(s)),t=["absolute","fixed"].indexOf(mi(s).position)>=0,i=t&&Gt(s)?mr(s):s;return ss(i)?e.filter(function(r){return ss(r)&&au(r,i)&&ei(r)!=="body"}):[]}function lm(s,e,t,i){var r=e==="clippingParents"?Am(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=fu(s,l,i);return A.top=rs(c.top,A.top),A.right=_n(c.right,A.right),A.bottom=_n(c.bottom,A.bottom),A.left=rs(c.left,A.left),A},fu(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function pu(s){var e=s.reference,t=s.element,i=s.placement,r=i?ti(i):null,n=i?Qs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case xt:A={x:o,y:e.y-t.height};break;case Pt:A={x:o,y:e.y+e.height};break;case Ut:A={x:e.x+e.width,y:a};break;case Dt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ua(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case ys:A[l]=A[l]-(e[c]/2-t[c]/2);break;case Er:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function vr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?DI:a,l=t.rootBoundary,c=l===void 0?iu:l,h=t.elementContext,u=h===void 0?Ir:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,y=cu(typeof p!="number"?p:hu(p,pr)),v=u===Ir?RI:Ir,Q=s.rects.popper,C=s.elements[g?v:u],T=lm(ss(C)?C:C.contextElement||Mi(s.elements.popper),A,c,o),b=Bs(s.elements.reference),L=pu({reference:b,element:Q,strategy:"absolute",placement:r}),R=Ya(Object.assign({},Q,L)),P=u===Ir?R:b,k={top:T.top-P.top+y.top,bottom:P.bottom-T.bottom+y.bottom,left:T.left-P.left+y.left,right:P.right-T.right+y.right},q=s.modifiersData.offset;if(u===Ir&&q){var $=q[r];Object.keys(k).forEach(function(te){var Z=[Ut,Pt].indexOf(te)>=0?1:-1,S=[xt,Pt].indexOf(te)>=0?"y":"x";k[te]+=$[S]*Z})}return k}function cm(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?ru:A,c=Qs(i),h=c?a?su:su.filter(function(g){return Qs(g)===c}):pr,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=vr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[ti(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function hm(s){if(ti(s)===Na)return[];var e=Nn(s);return[du(s),e,du(e)]}function um(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,y=ti(p),v=y===p,Q=A||(v||!g?[Nn(p)]:hm(p)),C=[p].concat(Q).reduce(function(se,ue){return se.concat(ti(ue)===Na?cm(e,{placement:ue,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ue)},[]),T=e.rects.reference,b=e.rects.popper,L=new Map,R=!0,P=C[0],k=0;k<C.length;k++){var q=C[k],$=ti(q),te=Qs(q)===ys,Z=[xt,Pt].indexOf($)>=0,S=Z?"width":"height",D=vr(e,{placement:q,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),U=Z?te?Ut:Dt:te?Pt:xt;T[S]>b[S]&&(U=Nn(U));var B=Nn(U),w=[];if(n&&w.push(D[$]<=0),a&&w.push(D[U]<=0,D[B]<=0),w.every(function(se){return se})){P=q,R=!1;break}L.set(q,w)}if(R)for(var N=g?3:1,H=function(ue){var le=C.find(function(Ce){var Se=L.get(Ce);if(Se)return Se.slice(0,ue).every(function(Le){return Le})});if(le)return P=le,"break"},K=N;K>0;K--){var X=H(K);if(X==="break")break}e.placement!==P&&(e.modifiersData[i]._skip=!0,e.placement=P,e.reset=!0)}}const dm={name:"flip",enabled:!0,phase:"main",fn:um,requiresIfExists:["offset"],data:{_skip:!1}};function Eu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function Iu(s){return[xt,Ut,Pt,Dt].some(function(e){return s[e]>=0})}function gm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=vr(e,{elementContext:"reference"}),a=vr(e,{altBoundary:!0}),A=Eu(o,i),l=Eu(a,r,n),c=Iu(A),h=Iu(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const fm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:gm};function pm(s,e,t){var i=ti(s),r=[Dt,xt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Dt,Ut].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Em(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=ru.reduce(function(c,h){return c[h]=pm(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Im={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Em};function mm(s){var e=s.state,t=s.name;e.modifiersData[t]=pu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Cm={name:"popperOffsets",enabled:!0,phase:"read",fn:mm,data:{}};function ym(s){return s==="x"?"y":"x"}function vm(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,p=vr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),y=ti(e.placement),v=Qs(e.placement),Q=!v,C=Ua(y),T=ym(C),b=e.modifiersData.popperOffsets,L=e.rects.reference,R=e.rects.popper,P=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,k=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(b){if(n){var te,Z=C==="y"?xt:Dt,S=C==="y"?Pt:Ut,D=C==="y"?"height":"width",U=b[C],B=U+p[Z],w=U-p[S],N=d?-R[D]/2:0,H=v===ys?L[D]:R[D],K=v===ys?-R[D]:-L[D],X=e.elements.arrow,se=d&&X?Pa(X):{width:0,height:0},ue=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:lu(),le=ue[Z],Ce=ue[S],Se=Cr(0,L[D],se[D]),Le=Q?L[D]/2-N-Se-le-k.mainAxis:H-Se-le-k.mainAxis,oe=Q?-L[D]/2+N+Se+Ce+k.mainAxis:K+Se+Ce+k.mainAxis,Ie=e.elements.arrow&&mr(e.elements.arrow),ve=Ie?C==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,ce=(te=q==null?void 0:q[C])!=null?te:0,Ae=U+Le-ce-ve,ne=U+oe-ce,be=Cr(d?_n(B,Ae):B,U,d?rs(w,ne):w);b[C]=be,$[C]=be-U}if(a){var Oe,Te=C==="x"?xt:Dt,ke=C==="x"?Pt:Ut,Pe=b[T],De=T==="y"?"height":"width",Be=Pe+p[Te],He=Pe-p[ke],We=[xt,Dt].indexOf(y)!==-1,at=(Oe=q==null?void 0:q[T])!=null?Oe:0,Xe=We?Be:Pe-L[De]-R[De]-at+k.altAxis,It=We?Pe+L[De]+R[De]-at-k.altAxis:He,yi=d&&We?VI(Xe,Pe,It):Cr(d?Xe:Be,Pe,d?It:He);b[T]=yi,$[T]=yi-Pe}e.modifiersData[i]=$}}const Bm={name:"preventOverflow",enabled:!0,phase:"main",fn:vm,requiresIfExists:["offset"]};function Qm(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function bm(s){return s===_t(s)||!Gt(s)?Ga(s):Qm(s)}function Sm(s){var e=s.getBoundingClientRect(),t=vs(e.width)/s.offsetWidth||1,i=vs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function wm(s,e,t){t===void 0&&(t=!1);var i=Gt(e),r=Gt(e)&&Sm(e),n=Mi(e),o=Bs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ei(e)!=="body"||$a(n))&&(a=bm(e)),Gt(e)?(A=Bs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ha(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function Tm(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function xm(s){var e=Tm(s);return GI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Dm(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function Rm(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var mu={placement:"bottom",modifiers:[],strategy:"absolute"};function Cu(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Lm(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?mu:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},mu,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(y){var v=typeof y=="function"?y(c.options):y;f(),c.options=Object.assign({},n,c.options,v),c.scrollParents={reference:ss(a)?yr(a):a.contextElement?yr(a.contextElement):[],popper:yr(A)};var Q=xm(Rm([].concat(i,c.options.modifiers)));return c.orderedModifiers=Q.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var y=c.elements,v=y.reference,Q=y.popper;if(Cu(v,Q)){c.rects={reference:wm(v,mr(Q),c.options.strategy==="fixed"),popper:Pa(Q)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(k){return c.modifiersData[k.name]=Object.assign({},k.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var T=c.orderedModifiers[C],b=T.fn,L=T.options,R=L===void 0?{}:L,P=T.name;typeof b=="function"&&(c=b({state:c,options:R,name:P,instance:d})||c)}}}},update:Dm(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!Cu(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var y=p.name,v=p.options,Q=v===void 0?{}:v,C=p.effect;if(typeof C=="function"){var T=C({state:c,name:y,instance:d,options:Q}),b=function(){};h.push(T||b)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var _m=[im,Cm,em,nu,Im,dm,Bm,jI,fm],km=Lm({defaultModifiers:_m}),Fm="tippy-box",yu="tippy-content",Nm="tippy-backdrop",vu="tippy-arrow",Bu="tippy-svg-arrow",ns={passive:!0,capture:!0},Qu=function(){return document.body};function Ka(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Va(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function bu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function Su(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function Mm(s){return s.split(/\s+/).filter(Boolean)}function bs(s){return[].concat(s)}function wu(s,e){s.indexOf(e)===-1&&s.push(e)}function Om(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function Pm(s){return s.split("-")[0]}function Mn(s){return[].slice.call(s)}function Tu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function Br(){return document.createElement("div")}function On(s){return["Element","Fragment"].some(function(e){return Va(s,e)})}function Um(s){return Va(s,"NodeList")}function Gm(s){return Va(s,"MouseEvent")}function Hm(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function $m(s){return On(s)?[s]:Um(s)?Mn(s):Array.isArray(s)?s:Mn(document.querySelectorAll(s))}function Ja(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function xu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Ym(s){var e,t=bs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function Km(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=Pm(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,p=i-n.bottom-u>A,y=n.left-t+d>A,v=t-n.right-g>A;return f||p||y||v})}function Wa(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function Du(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var ii={isTouch:!1},Ru=0;function Vm(){ii.isTouch||(ii.isTouch=!0,window.performance&&document.addEventListener("mousemove",Lu))}function Lu(){var s=performance.now();s-Ru<20&&(ii.isTouch=!1,document.removeEventListener("mousemove",Lu)),Ru=s}function Jm(){var s=document.activeElement;if(Hm(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function Wm(){document.addEventListener("touchstart",Vm,ns),window.addEventListener("blur",Jm)}var qm=typeof window<"u"&&typeof document<"u",jm=qm?!!window.msCrypto:!1,Xm={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},zm={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Vt=Object.assign({appendTo:Qu,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},Xm,zm),Zm=Object.keys(Vt),eC=function(e){var t=Object.keys(e);t.forEach(function(i){Vt[i]=e[i]})};function _u(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Vt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function tC(s,e){var t=e?Object.keys(_u(Object.assign({},Vt,{plugins:e}))):Zm,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function ku(s,e){var t=Object.assign({},e,{content:bu(e.content,[s])},e.ignoreAttributes?{}:tC(s,e.plugins));return t.aria=Object.assign({},Vt.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 iC=function(){return"innerHTML"};function qa(s,e){s[iC()]=e}function Fu(s){var e=Br();return s===!0?e.className=vu:(e.className=Bu,On(s)?e.appendChild(s):qa(e,s)),e}function Nu(s,e){On(e.content)?(qa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?qa(s,e.content):s.textContent=e.content)}function ja(s){var e=s.firstElementChild,t=Mn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(yu)}),arrow:t.find(function(i){return i.classList.contains(vu)||i.classList.contains(Bu)}),backdrop:t.find(function(i){return i.classList.contains(Nm)})}}function Mu(s){var e=Br(),t=Br();t.className=Fm,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=Br();i.className=yu,i.setAttribute("data-state","hidden"),Nu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=ja(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&Nu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Fu(o.arrow))):A.appendChild(Fu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}Mu.$$tippy=!0;var sC=1,Pn=[],Xa=[];function rC(s,e){var t=ku(s,Object.assign({},Vt,_u(Tu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=Su(Ae,t.interactiveDebounce),f,p=sC++,y=null,v=Om(t.plugins),Q={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:Br(),popperInstance:y,props:t,state:Q,plugins:v,clearDelayTimeouts:Xe,setProps:It,setContent:yi,show:mt,hide:oi,hideWithInteractivity:ai,enable:We,disable:at,unmount:Ai,destroy:gt};if(!t.render)return C;var T=t.render(C),b=T.popper,L=T.onUpdate;b.setAttribute("data-tippy-root",""),b.id="tippy-"+C.id,C.popper=b,s._tippy=C,b._tippy=C;var R=v.map(function(G){return G.fn(C)}),P=s.hasAttribute("aria-expanded");return Ie(),N(),U(),B("onCreate",[C]),t.showOnCreate&&Be(),b.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),b.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&Z().addEventListener("mousemove",g)}),C;function k(){var G=C.props.touch;return Array.isArray(G)?G:[G,0]}function q(){return k()[0]==="hold"}function $(){var G;return!!((G=C.props.render)!=null&&G.$$tippy)}function te(){return f||s}function Z(){var G=te().parentNode;return G?Ym(G):document}function S(){return ja(b)}function D(G){return C.state.isMounted&&!C.state.isVisible||ii.isTouch||c&&c.type==="focus"?0:Ka(C.props.delay,G?0:1,Vt.delay)}function U(G){G===void 0&&(G=!1),b.style.pointerEvents=C.props.interactive&&!G?"":"none",b.style.zIndex=""+C.props.zIndex}function B(G,ae,de){if(de===void 0&&(de=!0),R.forEach(function(Qe){Qe[G]&&Qe[G].apply(Qe,ae)}),de){var we;(we=C.props)[G].apply(we,ae)}}function w(){var G=C.props.aria;if(G.content){var ae="aria-"+G.content,de=b.id,we=bs(C.props.triggerTarget||s);we.forEach(function(Qe){var $e=Qe.getAttribute(ae);if(C.state.isVisible)Qe.setAttribute(ae,$e?$e+" "+de:de);else{var Ct=$e&&$e.replace(de,"").trim();Ct?Qe.setAttribute(ae,Ct):Qe.removeAttribute(ae)}})}}function N(){if(!(P||!C.props.aria.expanded)){var G=bs(C.props.triggerTarget||s);G.forEach(function(ae){C.props.interactive?ae.setAttribute("aria-expanded",C.state.isVisible&&ae===te()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function H(){Z().removeEventListener("mousemove",g),Pn=Pn.filter(function(G){return G!==g})}function K(G){if(!(ii.isTouch&&(A||G.type==="mousedown"))){var ae=G.composedPath&&G.composedPath()[0]||G.target;if(!(C.props.interactive&&Du(b,ae))){if(bs(C.props.triggerTarget||s).some(function(de){return Du(de,ae)})){if(ii.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else B("onClickOutside",[C,G]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||le())}}}function X(){A=!0}function se(){A=!1}function ue(){var G=Z();G.addEventListener("mousedown",K,!0),G.addEventListener("touchend",K,ns),G.addEventListener("touchstart",se,ns),G.addEventListener("touchmove",X,ns)}function le(){var G=Z();G.removeEventListener("mousedown",K,!0),G.removeEventListener("touchend",K,ns),G.removeEventListener("touchstart",se,ns),G.removeEventListener("touchmove",X,ns)}function Ce(G,ae){Le(G,function(){!C.state.isVisible&&b.parentNode&&b.parentNode.contains(b)&&ae()})}function Se(G,ae){Le(G,ae)}function Le(G,ae){var de=S().box;function we(Qe){Qe.target===de&&(Wa(de,"remove",we),ae())}if(G===0)return ae();Wa(de,"remove",h),Wa(de,"add",we),h=we}function oe(G,ae,de){de===void 0&&(de=!1);var we=bs(C.props.triggerTarget||s);we.forEach(function(Qe){Qe.addEventListener(G,ae,de),d.push({node:Qe,eventType:G,handler:ae,options:de})})}function Ie(){q()&&(oe("touchstart",ce,{passive:!0}),oe("touchend",ne,{passive:!0})),Mm(C.props.trigger).forEach(function(G){if(G!=="manual")switch(oe(G,ce),G){case"mouseenter":oe("mouseleave",ne);break;case"focus":oe(jm?"focusout":"blur",be);break;case"focusin":oe("focusout",be);break}})}function ve(){d.forEach(function(G){var ae=G.node,de=G.eventType,we=G.handler,Qe=G.options;ae.removeEventListener(de,we,Qe)}),d=[]}function ce(G){var ae,de=!1;if(!(!C.state.isEnabled||Oe(G)||a)){var we=((ae=c)==null?void 0:ae.type)==="focus";c=G,f=G.currentTarget,N(),!C.state.isVisible&&Gm(G)&&Pn.forEach(function(Qe){return Qe(G)}),G.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?de=!0:Be(G),G.type==="click"&&(o=!de),de&&!we&&He(G)}}function Ae(G){var ae=G.target,de=te().contains(ae)||b.contains(ae);if(!(G.type==="mousemove"&&de)){var we=De().concat(b).map(function(Qe){var $e,Ct=Qe._tippy,yt=($e=Ct.popperInstance)==null?void 0:$e.state;return yt?{popperRect:Qe.getBoundingClientRect(),popperState:yt,props:t}:null}).filter(Boolean);Km(we,G)&&(H(),He(G))}}function ne(G){var ae=Oe(G)||C.props.trigger.indexOf("click")>=0&&o;if(!ae){if(C.props.interactive){C.hideWithInteractivity(G);return}He(G)}}function be(G){C.props.trigger.indexOf("focusin")<0&&G.target!==te()||C.props.interactive&&G.relatedTarget&&b.contains(G.relatedTarget)||He(G)}function Oe(G){return ii.isTouch?q()!==G.type.indexOf("touch")>=0:!1}function Te(){ke();var G=C.props,ae=G.popperOptions,de=G.placement,we=G.offset,Qe=G.getReferenceClientRect,$e=G.moveTransition,Ct=$()?ja(b).arrow:null,yt=Qe?{getBoundingClientRect:Qe,contextElement:Qe.contextElement||te()}:s,Ds={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Rs){var Gi=Rs.state;if($()){var xr=S(),Dr=xr.box;["placement","reference-hidden","escaped"].forEach(function(Ls){Ls==="placement"?Dr.setAttribute("data-placement",Gi.placement):Gi.attributes.popper["data-popper-"+Ls]?Dr.setAttribute("data-"+Ls,""):Dr.removeAttribute("data-"+Ls)}),Gi.attributes.popper={}}}},vt=[{name:"offset",options:{offset:we}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!$e}},Ds];$()&&Ct&&vt.push({name:"arrow",options:{element:Ct,padding:3}}),vt.push.apply(vt,(ae==null?void 0:ae.modifiers)||[]),C.popperInstance=km(yt,b,Object.assign({},ae,{placement:de,onFirstUpdate:u,modifiers:vt}))}function ke(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Pe(){var G=C.props.appendTo,ae,de=te();C.props.interactive&&G===Qu||G==="parent"?ae=de.parentNode:ae=bu(G,[de]),ae.contains(b)||ae.appendChild(b),C.state.isMounted=!0,Te()}function De(){return Mn(b.querySelectorAll("[data-tippy-root]"))}function Be(G){C.clearDelayTimeouts(),G&&B("onTrigger",[C,G]),ue();var ae=D(!0),de=k(),we=de[0],Qe=de[1];ii.isTouch&&we==="hold"&&Qe&&(ae=Qe),ae?i=setTimeout(function(){C.show()},ae):C.show()}function He(G){if(C.clearDelayTimeouts(),B("onUntrigger",[C,G]),!C.state.isVisible){le();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(G.type)>=0&&o)){var ae=D(!1);ae?r=setTimeout(function(){C.state.isVisible&&C.hide()},ae):n=requestAnimationFrame(function(){C.hide()})}}function We(){C.state.isEnabled=!0}function at(){C.hide(),C.state.isEnabled=!1}function Xe(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function It(G){if(!C.state.isDestroyed){B("onBeforeUpdate",[C,G]),ve();var ae=C.props,de=ku(s,Object.assign({},ae,Tu(G),{ignoreAttributes:!0}));C.props=de,Ie(),ae.interactiveDebounce!==de.interactiveDebounce&&(H(),g=Su(Ae,de.interactiveDebounce)),ae.triggerTarget&&!de.triggerTarget?bs(ae.triggerTarget).forEach(function(we){we.removeAttribute("aria-expanded")}):de.triggerTarget&&s.removeAttribute("aria-expanded"),N(),U(),L&&L(ae,de),C.popperInstance&&(Te(),De().forEach(function(we){requestAnimationFrame(we._tippy.popperInstance.forceUpdate)})),B("onAfterUpdate",[C,G])}}function yi(G){C.setProps({content:G})}function mt(){var G=C.state.isVisible,ae=C.state.isDestroyed,de=!C.state.isEnabled,we=ii.isTouch&&!C.props.touch,Qe=Ka(C.props.duration,0,Vt.duration);if(!(G||ae||de||we)&&!te().hasAttribute("disabled")&&(B("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,$()&&(b.style.visibility="visible"),U(),ue(),C.state.isMounted||(b.style.transition="none"),$()){var $e=S(),Ct=$e.box,yt=$e.content;Ja([Ct,yt],0)}u=function(){var vt;if(!(!C.state.isVisible||l)){if(l=!0,b.offsetHeight,b.style.transition=C.props.moveTransition,$()&&C.props.animation){var ls=S(),Rs=ls.box,Gi=ls.content;Ja([Rs,Gi],Qe),xu([Rs,Gi],"visible")}w(),N(),wu(Xa,C),(vt=C.popperInstance)==null||vt.forceUpdate(),B("onMount",[C]),C.props.animation&&$()&&Se(Qe,function(){C.state.isShown=!0,B("onShown",[C])})}},Pe()}}function oi(){var G=!C.state.isVisible,ae=C.state.isDestroyed,de=!C.state.isEnabled,we=Ka(C.props.duration,1,Vt.duration);if(!(G||ae||de)&&(B("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,$()&&(b.style.visibility="hidden"),H(),le(),U(!0),$()){var Qe=S(),$e=Qe.box,Ct=Qe.content;C.props.animation&&(Ja([$e,Ct],we),xu([$e,Ct],"hidden"))}w(),N(),C.props.animation?$()&&Ce(we,C.unmount):C.unmount()}}function ai(G){Z().addEventListener("mousemove",g),wu(Pn,g),g(G)}function Ai(){C.state.isVisible&&C.hide(),C.state.isMounted&&(ke(),De().forEach(function(G){G._tippy.unmount()}),b.parentNode&&b.parentNode.removeChild(b),Xa=Xa.filter(function(G){return G!==C}),C.state.isMounted=!1,B("onHidden",[C]))}function gt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),ve(),delete s._tippy,C.state.isDestroyed=!0,B("onDestroy",[C]))}}function os(s,e){e===void 0&&(e={});var t=Vt.plugins.concat(e.plugins||[]);Wm();var i=Object.assign({},e,{plugins:t}),r=$m(s),n=r.reduce(function(o,a){var A=a&&rC(a,i);return A&&o.push(A),o},[]);return On(s)?n[0]:n}os.defaultProps=Vt,os.setDefaultProps=eC,os.currentInput=ii,Object.assign({},nu,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),os.setDefaultProps({render:Mu});class si extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const nC=5;class oC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=lt(),this._controls=lt(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this._currentTime=a,this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:c,duration:h})=>a>=c&&a<c+h))??[],this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:c})=>a>=c-nC&&a<c))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const A=this.activeScenes[0],l=ec((n=A==null?void 0:A.videoMeta)==null?void 0:n.captions);this.caption=((o=l.find(({start:c,end:h})=>{var u;const d=a-A.start+(((u=A.videoMeta)==null?void 0:u.start)??0);return c&&h&&d>=cn(c)&&d<=cn(h)}))==null?void 0:o.text)??"",this.draw(a),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return ct(this._canvas)}controls(){return ct(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,u.currentTime):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new si("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function aC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function AC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function za(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!aC()&&Ii.isSupported()){let l=!1;a=new Ii({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,g,f){g.toString().includes("?")||(g+="?"+u),h.apply(this,[d,g,f])}}}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);a.startLevel=a.firstLevel,a.startLoad(c),l=!0,a.currentLevel=u!==-1?u:a.firstLevel}},a.on(Ii.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})})}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function Ou(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const lC=ui(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let cC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._resolveVideo=ui(async t=>{const{id:i,key:r}=t,n=await za(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Ou(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new si(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Hr(this.host,async([e,t,i,r,n,o])=>{try{let a=null;if(this.host._errors=[],i||e){if(this.host._processing=!0,i){let c=null;if(r)try{c=await(await fetch(r,{method:"GET"})).text()}catch(d){const g=new si("Track failed to fetch",d);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:g,message:g.message}))}const u={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:c}}}]}};try{this.scenes=await gs({data:u,template:t,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(d){try{this.scenes=await gs({data:u,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new si("Fatal source template error",g,!0)}a=new si("Source template error",d)}}else try{this.scenes=await gs({data:e,template:t,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(c){try{this.scenes=await gs({data:e,burnCaptions:n,debug:o},this._resolveVideo,this._resolveVideoMeta)}catch(h){throw new si("Fatal data template error",h,!0)}a=new si("Data template error",c)}Object.keys(this.videos).forEach(c=>{this.scenes.scenes.find(({video:h})=>c===(h==null?void 0:h.key))||this._videos[c].node.pause()});const A=this.scenes.scenes.reduce((c,{video:h})=>(h&&(c[h.key]=h),c),{});Object.keys(this.videos).join("|")!==Object.keys(A).join("|")&&this.host.reset(0,!1),this.videos=A,this.videoState={...this.videoState,...this.scenes.scenes.reduce((c,{video:h,start:u,duration:d})=>{var g;const f=(h==null?void 0:h.key)??`${u}-${d}`,p=this._getBufferSegments({key:f,node:h==null?void 0:h.node,duration:this.scenes.duration});return c[f]={initialised:!h,waiting:!!h,...this.videoState[f],buffered:h?p:(g=this.videoState[f])==null?void 0:g.buffered},c},{})},this.videoMeta=this.scenes.scenes.reduce((c,{video:h,videoMeta:u})=>(h&&u&&(c[h.key]=u),c),{}),(await Promise.all(this.scenes.fonts.map(c=>lC(c)))).forEach(c=>{document.fonts.add(c)}),this.duration=this.scenes.duration,this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}a&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}catch(a){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}finally{this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function hC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function uC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Za=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],dC={id:"captions",event:"captions:click",label:"Closed Captions"},gC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Pu={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}]},fC={id:"playbackRate",label:"Playback playbackRate",subItems:Pu};class pC extends ol{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==us.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)),xi}}const eA=ds(pC),EC=xI(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=jl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),ri={"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"},IC={colors:ri,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 ${ri["dark-100"]}`,medium:`0 .125rem .625rem ${ri["dark-100"]}`,large:`0 .25rem 1rem ${ri["dark-50"]}`,xl:`.25rem .25rem 1rem ${ri["dark-250"]}`,xxl:`0 .25rem 2rem ${ri["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ri["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ri["dark-50"]}`,text:`0 0 .25rem ${ri["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ri["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Uu=SI.flatten(IC,{delimiter:"-"}),mC=Object.keys(Uu).map(s=>Ps(`:host { --${s}: ${Uu[s]}; }`)),Fe=(s=>{class e extends s{firstUpdated(){EC().forEach(({load:r,font:n})=>{document.fonts.add(n),r&&n.load()})}}return e.styles=[(s==null?void 0:s.styles)??[],mC,Ze`
209
209
  :host {
210
210
  font-family: var(--fontFamilies-sans);
211
211
  font-size: var(--fontSizes-medium);
@@ -286,12 +286,12 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
286
286
  scroll-behavior: auto !important;
287
287
  }
288
288
  }
289
- `],e})(hi),mC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),CC=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},Bt=s=>e=>typeof e=="function"?mC(s,e):CC(s,e);class yC{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._resolveVideo=Li(async t=>{const i=await za(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=Li(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await za(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=Li(async(t,i)=>{const{id:r,duration:n,startOffset:o,endOffset:a}=t,A=n??await Mu(i),l=(o??0)*A,c=(1-(a??0))*A;return{id:r,start:l,duration:c-l}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Hr(this.host,async([e,t,i])=>{var r,n;try{if(e){const o=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await gs({data:{questions:{items:[{answer:{id:"source",media:{[o]:e}}}]}},template:i},this._resolveVideo,this._resolveVideoMeta)}catch(a){throw new si("Video preview source template error",a)}this._video=((n=(r=this.scenes.scenes[0])==null?void 0:r.video)==null?void 0:n.node)??null}else if(t)try{this.scenes=await gs({data:t,template:i},this._resolveAnswer,this._resolveVideoMeta)}catch(o){throw new si("Video preview data template error",o)}}catch(o){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:o,message:o.message}))}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function Uu(s,e,t){return Math.min(Math.max(e,s),t)}function tA(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var vC=Object.defineProperty,BC=Object.getOwnPropertyDescriptor,Ss=(s,e,t,i)=>{for(var r=i>1?void 0:i?BC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&vC(e,t,r),r};let Oi=class extends ke{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ge`<button
289
+ `],e})(hi),CC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),yC=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},Bt=s=>e=>typeof e=="function"?CC(s,e):yC(s,e);class vC{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._resolveVideo=ui(async t=>{const i=await za(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=ui(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await za(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=ui(async(t,i)=>{const{id:r,duration:n,startOffset:o,endOffset:a}=t,A=n??await Ou(i),l=(o??0)*A,c=(1-(a??0))*A;return{id:r,start:l,duration:c-l}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Hr(this.host,async([e,t,i])=>{var r,n;try{if(e){const o=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await gs({data:{questions:{items:[{answer:{id:"source",media:{[o]:e}}}]}},template:i},this._resolveVideo,this._resolveVideoMeta)}catch(a){throw new si("Video preview source template error",a)}this._video=((n=(r=this.scenes.scenes[0])==null?void 0:r.video)==null?void 0:n.node)??null}else if(t)try{this.scenes=await gs({data:t,template:i},this._resolveAnswer,this._resolveVideoMeta)}catch(o){throw new si("Video preview data template error",o)}}catch(o){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:o,message:o.message}))}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function Gu(s,e,t){return Math.min(Math.max(e,s),t)}function tA(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var BC=Object.defineProperty,QC=Object.getOwnPropertyDescriptor,Ss=(s,e,t,i)=>{for(var r=i>1?void 0:i?QC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&BC(e,t,r),r};let Oi=class extends Fe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ge`<button
290
290
  class=${Ue({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"})}
291
291
  >
292
292
  <slot></slot>
293
293
  ${this.icon&&ge`<vmp-icon icon=${this.icon}></vmp-icon>`}
294
- </button>`}};Oi.styles=[ke.styles??[],Ze`
294
+ </button>`}};Oi.styles=[Fe.styles??[],Ze`
295
295
  :host {
296
296
  --button-padding: var(--vu-button-padding, var(--space-s));
297
297
  --button-color: var(--vu-button-color, var(--colors-dark-640));
@@ -367,7 +367,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
367
367
  .weight-light:focus {
368
368
  --button-background: var(--vu-button-background-hover, #9d9d9d);
369
369
  }
370
- `],Ss([J({type:Boolean})],Oi.prototype,"active",2),Ss([J({type:String})],Oi.prototype,"size",2),Ss([J({type:String})],Oi.prototype,"rounded",2),Ss([J({type:String})],Oi.prototype,"weight",2),Ss([J({type:String})],Oi.prototype,"icon",2),Oi=Ss([Bt("vmp-button")],Oi);const Gu={"arrow-left":()=>ge`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
370
+ `],Ss([J({type:Boolean})],Oi.prototype,"active",2),Ss([J({type:String})],Oi.prototype,"size",2),Ss([J({type:String})],Oi.prototype,"rounded",2),Ss([J({type:String})],Oi.prototype,"weight",2),Ss([J({type:String})],Oi.prototype,"icon",2),Oi=Ss([Bt("vmp-button")],Oi);const Hu={"arrow-left":()=>ge`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
371
371
  <path
372
372
  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"
373
373
  fill="currentColor"
@@ -528,14 +528,14 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
528
528
  <path
529
529
  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"
530
530
  />
531
- </svg>`};var QC=Object.defineProperty,bC=Object.getOwnPropertyDescriptor,Hu=(s,e,t,i)=>{for(var r=i>1?void 0:i?bC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&QC(e,t,r),r};let Un=class extends ke{render(){return!this.icon||!Object.keys(Gu).includes(this.icon)?null:Gu[this.icon]()}};Un.styles=[ke.styles??[],Ze`
531
+ </svg>`};var bC=Object.defineProperty,SC=Object.getOwnPropertyDescriptor,$u=(s,e,t,i)=>{for(var r=i>1?void 0:i?SC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&bC(e,t,r),r};let Un=class extends Fe{render(){return!this.icon||!Object.keys(Hu).includes(this.icon)?null:Hu[this.icon]()}};Un.styles=[Fe.styles??[],Ze`
532
532
  :host {
533
533
  display: flex;
534
534
  align-items: center;
535
535
  justify-content: center;
536
536
  flex-shrink: 0;
537
537
  }
538
- `],Hu([J({type:String})],Un.prototype,"icon",2),Un=Hu([Bt("vmp-icon")],Un);var SC=Object.defineProperty,wC=Object.getOwnPropertyDescriptor,ws=(s,e,t,i)=>{for(var r=i>1?void 0:i?wC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&SC(e,t,r),r};let Pi=class extends ke{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ge`
538
+ `],$u([J({type:String})],Un.prototype,"icon",2),Un=$u([Bt("vmp-icon")],Un);var wC=Object.defineProperty,TC=Object.getOwnPropertyDescriptor,ws=(s,e,t,i)=>{for(var r=i>1?void 0:i?TC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&wC(e,t,r),r};let Pi=class extends Fe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return ge`
539
539
  <vmp-button
540
540
  ?active=${this.active}
541
541
  size=${et(this.size)}
@@ -547,7 +547,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
547
547
  icon=${et(this.icon)}
548
548
  ></vmp-icon>
549
549
  </vmp-button>
550
- `}};Pi.styles=[ke.styles??[],Ze`
550
+ `}};Pi.styles=[Fe.styles??[],Ze`
551
551
  .tiny::part(svg) {
552
552
  height: 12px;
553
553
  width: 12px;
@@ -562,7 +562,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
562
562
  height: 32px;
563
563
  width: 32px;
564
564
  }
565
- `],ws([J({type:Boolean})],Pi.prototype,"active",2),ws([J({type:String})],Pi.prototype,"size",2),ws([J({type:String})],Pi.prototype,"rounded",2),ws([J({type:String})],Pi.prototype,"weight",2),ws([J({type:String})],Pi.prototype,"icon",2),Pi=ws([Bt("vmp-icon-button")],Pi);var TC=Object.defineProperty,xC=Object.getOwnPropertyDescriptor,Rt=(s,e,t,i)=>{for(var r=i>1?void 0:i?xC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&TC(e,t,r),r};let mi=class extends ke{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=No,this._currentTime=0,this._sceneController=new yC(this),this._canvasRef=lt(),this._previewRef=lt(),this._previewTimeRef=lt(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Uu(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const u=(A=(a=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:d,duration:g,video:f})=>f&&s>=d&&s<=d+g))==null?void 0:a.video)==null?void 0:A.node;if(u&&(u.currentTime=s),this._draw(),(l=this._previewRef)!=null&&l.value){const d=this._previewRef.value.getBoundingClientRect(),g=(c=this._previewRef.value.getRootNode().host)==null?void 0:c.getBoundingClientRect();if(d&&g){const f=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,p]=Array.from(f.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Uu(t-g.left,e-g.left-d.width/2,i-g.left-d.width)}px, ${p[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",tA(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback(),document.addEventListener("scrubber:resize",this._handleScrubberResize),document.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scrubber:resize",this._handleScrubberResize),document.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var s;const{height:e,width:t}=Mo({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?ge`
565
+ `],ws([J({type:Boolean})],Pi.prototype,"active",2),ws([J({type:String})],Pi.prototype,"size",2),ws([J({type:String})],Pi.prototype,"rounded",2),ws([J({type:String})],Pi.prototype,"weight",2),ws([J({type:String})],Pi.prototype,"icon",2),Pi=ws([Bt("vmp-icon-button")],Pi);var xC=Object.defineProperty,DC=Object.getOwnPropertyDescriptor,Rt=(s,e,t,i)=>{for(var r=i>1?void 0:i?DC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&xC(e,t,r),r};let Ci=class extends Fe{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=No,this._currentTime=0,this._sceneController=new vC(this),this._canvasRef=lt(),this._previewRef=lt(),this._previewTimeRef=lt(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Gu(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const u=(A=(a=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:d,duration:g,video:f})=>f&&s>=d&&s<=d+g))==null?void 0:a.video)==null?void 0:A.node;if(u&&(u.currentTime=s),this._draw(),(l=this._previewRef)!=null&&l.value){const d=this._previewRef.value.getBoundingClientRect(),g=(c=this._previewRef.value.getRootNode().host)==null?void 0:c.getBoundingClientRect();if(d&&g){const f=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,p]=Array.from(f.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Gu(t-g.left,e-g.left-d.width/2,i-g.left-d.width)}px, ${p[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",tA(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback(),document.addEventListener("scrubber:resize",this._handleScrubberResize),document.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scrubber:resize",this._handleScrubberResize),document.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var s;const{height:e,width:t}=Mo({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?ge`
566
566
  <div
567
567
  ${ct(this._previewRef)}
568
568
  class="preview"
@@ -571,7 +571,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
571
571
  <canvas ${ct(this._canvasRef)} class="preview-canvas" width=${t} height=${e}></canvas>
572
572
  <vmp-text ${ct(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
573
573
  </div>
574
- `:null}};mi.styles=[ke.styles??[],Ze`
574
+ `:null}};Ci.styles=[Fe.styles??[],Ze`
575
575
  .preview {
576
576
  position: absolute;
577
577
  display: flex;
@@ -602,7 +602,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
602
602
  color: var(--colors-light-1000);
603
603
  font-variant-numeric: tabular-nums;
604
604
  }
605
- `],Rt([J({type:String})],mi.prototype,"src",2),Rt([J({type:Object})],mi.prototype,"data",2),Rt([J({type:Object})],mi.prototype,"template",2),Rt([J({type:Boolean})],mi.prototype,"disabled",2),Rt([J({type:Number})],mi.prototype,"aspectRatio",2),Rt([J({attribute:!1})],mi.prototype,"compilation",2),mi=Rt([Bt("vmp-video-preview-content")],mi);let Ui=class extends ke{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=No}render(){return ge`
605
+ `],Rt([J({type:String})],Ci.prototype,"src",2),Rt([J({type:Object})],Ci.prototype,"data",2),Rt([J({type:Object})],Ci.prototype,"template",2),Rt([J({type:Boolean})],Ci.prototype,"disabled",2),Rt([J({type:Number})],Ci.prototype,"aspectRatio",2),Rt([J({attribute:!1})],Ci.prototype,"compilation",2),Ci=Rt([Bt("vmp-video-preview-content")],Ci);let Ui=class extends Fe{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=No}render(){return ge`
606
606
  <vmp-video-preview-content
607
607
  ?disabled=${this.disabled}
608
608
  .src=${this.src}
@@ -611,7 +611,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
611
611
  .aspectRatio=${this.aspectRatio}
612
612
  .compilation=${this.compilation}
613
613
  ></vmp-video-preview-content>
614
- `}};Rt([J({type:String})],Ui.prototype,"src",2),Rt([J({type:Object})],Ui.prototype,"data",2),Rt([J({type:Object})],Ui.prototype,"template",2),Rt([J({type:Boolean})],Ui.prototype,"disabled",2),Rt([J({type:Number})],Ui.prototype,"aspectRatio",2),Rt([J({attribute:!1})],Ui.prototype,"compilation",2),Ui=Rt([Bt("vmp-video-preview")],Ui);class DC extends Ws{constructor(e){if(super(e),e.type!==us.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Ti}}const $u=ds(DC);class RC{constructor(e){this.hiddenControls=[],this._measureRef=lt(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var i,r,n;const o=this._measureRef.value,a=(n=(r=(i=t==null?void 0:t[0])==null?void 0:i.borderBoxSize)==null?void 0:r[0])==null?void 0:n.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;o.scrollWidth>o.offsetWidth;){const l=Object.keys(this._hideables).find(h=>this._hideables[h].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(h=>{this._showables[h].showOn.some(u=>A.includes(u))&&(this._showables[h].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return ct(this._measureRef)}contain(){return eA(this._onResize)}hide(e,t){return $u(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return $u(i=>{this._showables[e]={element:i,showOn:t}})}}const iA=".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 LC=Object.defineProperty,_C=Object.getOwnPropertyDescriptor,Qr=(s,e,t,i)=>{for(var r=i>1?void 0:i?_C(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&LC(e,t,r),r};let as=class extends ke{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return ge`
614
+ `}};Rt([J({type:String})],Ui.prototype,"src",2),Rt([J({type:Object})],Ui.prototype,"data",2),Rt([J({type:Object})],Ui.prototype,"template",2),Rt([J({type:Boolean})],Ui.prototype,"disabled",2),Rt([J({type:Number})],Ui.prototype,"aspectRatio",2),Rt([J({attribute:!1})],Ui.prototype,"compilation",2),Ui=Rt([Bt("vmp-video-preview")],Ui);class RC extends Ws{constructor(e){if(super(e),e.type!==us.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),xi}}const Yu=ds(RC);class LC{constructor(e){this.hiddenControls=[],this._measureRef=lt(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var i,r,n;const o=this._measureRef.value,a=(n=(r=(i=t==null?void 0:t[0])==null?void 0:i.borderBoxSize)==null?void 0:r[0])==null?void 0:n.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;o.scrollWidth>o.offsetWidth;){const l=Object.keys(this._hideables).find(h=>this._hideables[h].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(h=>{this._showables[h].showOn.some(u=>A.includes(u))&&(this._showables[h].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return ct(this._measureRef)}contain(){return eA(this._onResize)}hide(e,t){return Yu(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Yu(i=>{this._showables[e]={element:i,showOn:t}})}}const iA=".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 _C=Object.defineProperty,kC=Object.getOwnPropertyDescriptor,Qr=(s,e,t,i)=>{for(var r=i>1?void 0:i?kC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&_C(e,t,r),r};let as=class extends Fe{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return ge`
615
615
  <div
616
616
  part="content"
617
617
  class=${Ue({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
@@ -619,7 +619,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
619
619
  >
620
620
  ${this.content}
621
621
  </div>
622
- `}};as.styles=[ke.styles??[],Ze`
622
+ `}};as.styles=[Fe.styles??[],Ze`
623
623
  :host {
624
624
  --text-size: var(--fontSizes-medium);
625
625
  --text-line-height: var(--lineHeights-medium);
@@ -656,7 +656,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
656
656
  text-overflow: ellipsis;
657
657
  overflow: hidden;
658
658
  }
659
- `],Qr([J({type:Boolean})],as.prototype,"semibold",2),Qr([J({type:Boolean})],as.prototype,"truncate",2),Qr([J({type:String})],as.prototype,"size",2),Qr([J({type:String})],as.prototype,"content",2),as=Qr([Bt("vmp-text")],as);var kC=Object.defineProperty,FC=Object.getOwnPropertyDescriptor,br=(s,e,t,i)=>{for(var r=i>1?void 0:i?FC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&kC(e,t,r),r};let As=class extends ke{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=lt()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var s,e;const t=(e=(s=this.items)==null?void 0:s.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=os(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return ge`
659
+ `],Qr([J({type:Boolean})],as.prototype,"semibold",2),Qr([J({type:Boolean})],as.prototype,"truncate",2),Qr([J({type:String})],as.prototype,"size",2),Qr([J({type:String})],as.prototype,"content",2),as=Qr([Bt("vmp-text")],as);var FC=Object.defineProperty,NC=Object.getOwnPropertyDescriptor,br=(s,e,t,i)=>{for(var r=i>1?void 0:i?NC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&FC(e,t,r),r};let As=class extends Fe{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=lt()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var s,e;const t=(e=(s=this.items)==null?void 0:s.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=os(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return ge`
660
660
  <slot></slot>
661
661
  <div ${ct(this._contentRef)} class="content">
662
662
  <div class="title">
@@ -672,7 +672,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
672
672
  .content=${((s=this.visibleItems)==null?void 0:s.title)??"Sub Menu"}
673
673
  ></vmp-text>
674
674
  </div>
675
- ${eu(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>ge`
675
+ ${tu(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>ge`
676
676
  <button
677
677
  class="item"
678
678
  @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}))}}
@@ -682,7 +682,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
682
682
  </button>
683
683
  `)}
684
684
  </div>
685
- `}};As.styles=[ke.styles??[],Ps(iA),Ze`
685
+ `}};As.styles=[Fe.styles??[],Ps(iA),Ze`
686
686
  :host {
687
687
  display: flex;
688
688
  }
@@ -744,12 +744,12 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
744
744
  height: 20px;
745
745
  width: 20px;
746
746
  }
747
- `],br([J({type:Object})],As.prototype,"items",2),br([J({type:Array})],As.prototype,"activeItems",2),br([rt()],As.prototype,"visibleItems",2),br([rt()],As.prototype,"subItemsActive",2),As=br([Bt("vmp-menu")],As);var NC=Object.defineProperty,MC=Object.getOwnPropertyDescriptor,sA=(s,e,t,i)=>{for(var r=i>1?void 0:i?MC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&NC(e,t,r),r};let Sr=class extends ke{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=lt()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=os(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return ge`
747
+ `],br([J({type:Object})],As.prototype,"items",2),br([J({type:Array})],As.prototype,"activeItems",2),br([rt()],As.prototype,"visibleItems",2),br([rt()],As.prototype,"subItemsActive",2),As=br([Bt("vmp-menu")],As);var MC=Object.defineProperty,OC=Object.getOwnPropertyDescriptor,sA=(s,e,t,i)=>{for(var r=i>1?void 0:i?OC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&MC(e,t,r),r};let Sr=class extends Fe{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=lt()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=os(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return ge`
748
748
  <slot></slot>
749
749
  <div ${ct(this._contentRef)} class="content">
750
750
  <vmp-text content=${this.content}></vmp-text>
751
751
  </div>
752
- `}};Sr.styles=[ke.styles??[],Ps(iA),Ze`
752
+ `}};Sr.styles=[Fe.styles??[],Ps(iA),Ze`
753
753
  :host {
754
754
  display: flex;
755
755
  }
@@ -763,7 +763,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
763
763
  background: var(--colors-dark-800);
764
764
  border-radius: var(--radii-medium);
765
765
  }
766
- `],sA([J({type:String})],Sr.prototype,"content",2),sA([J({type:Boolean})],Sr.prototype,"disabled",2),Sr=sA([Bt("vmp-tooltip")],Sr);var OC=Object.defineProperty,PC=Object.getOwnPropertyDescriptor,rA=(s,e,t,i)=>{for(var r=i>1?void 0:i?PC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&OC(e,t,r),r};let wr=class extends ke{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=lt(),this._anchorRef=lt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=os(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return ge`
766
+ `],sA([J({type:String})],Sr.prototype,"content",2),sA([J({type:Boolean})],Sr.prototype,"disabled",2),Sr=sA([Bt("vmp-tooltip")],Sr);var PC=Object.defineProperty,UC=Object.getOwnPropertyDescriptor,rA=(s,e,t,i)=>{for(var r=i>1?void 0:i?UC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&PC(e,t,r),r};let wr=class extends Fe{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=lt(),this._anchorRef=lt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=os(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return ge`
767
767
  <vmp-icon-button
768
768
  ${ct(this._anchorRef)}
769
769
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -783,7 +783,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
783
783
  @blur=${()=>{var s;return(s=this.tippy)==null?void 0:s.hide()}}
784
784
  />
785
785
  </div>
786
- `}};wr.styles=[ke.styles??[],Ps(iA),Ze`
786
+ `}};wr.styles=[Fe.styles??[],Ps(iA),Ze`
787
787
  .content {
788
788
  --volume-slider-height: 4px;
789
789
  --volume-slider-width: 78px;
@@ -911,7 +911,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
911
911
  --volume-slider-height: 8px;
912
912
  color: var(--colors-light-800);
913
913
  }
914
- `],rA([J({type:Number})],wr.prototype,"volume",2),rA([J({type:Boolean})],wr.prototype,"muted",2),wr=rA([Bt("vmp-volume-button")],wr);var UC=Object.defineProperty,GC=Object.getOwnPropertyDescriptor,Gn=(s,e,t,i)=>{for(var r=i>1?void 0:i?GC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&UC(e,t,r),r};let Ts=class extends ke{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=lt(),this._handleContainerResize=()=>{var s;const e=(s=this._containerRef.value)==null?void 0:s.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),r=(s.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:r*this.duration,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var s;const e=((s=this.buffer)==null?void 0:s.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return ge`
914
+ `],rA([J({type:Number})],wr.prototype,"volume",2),rA([J({type:Boolean})],wr.prototype,"muted",2),wr=rA([Bt("vmp-volume-button")],wr);var GC=Object.defineProperty,HC=Object.getOwnPropertyDescriptor,Gn=(s,e,t,i)=>{for(var r=i>1?void 0:i?HC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&GC(e,t,r),r};let Ts=class extends Fe{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=lt(),this._handleContainerResize=()=>{var s;const e=(s=this._containerRef.value)==null?void 0:s.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),r=(s.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:r*this.duration,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var s;const e=((s=this.buffer)==null?void 0:s.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return ge`
915
915
  <div
916
916
  class="container"
917
917
  ${ct(this._containerRef)}
@@ -930,11 +930,11 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
930
930
  .value=${this.currentTime.toString()}
931
931
  data-testid="scrubber"
932
932
  />
933
- ${eu(e,({id:t})=>t,t=>ge`
933
+ ${tu(e,({id:t})=>t,t=>ge`
934
934
  <div class="buffer" style=${`left: ${t.start}%; width: ${t.end-t.start}%`}></div>
935
935
  `)}
936
936
  </div>
937
- `}};Ts.styles=[ke.styles??[],Ze`
937
+ `}};Ts.styles=[Fe.styles??[],Ze`
938
938
  :host {
939
939
  --player-scrubber-height: 8px;
940
940
  --player-scrubber-shadow-width: 4000px;
@@ -1067,7 +1067,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1067
1067
  --player-scrubber-height: 16px;
1068
1068
  color: var(--colors-light-800);
1069
1069
  }
1070
- `],Gn([J({type:Number})],Ts.prototype,"duration",2),Gn([J({type:Number})],Ts.prototype,"currentTime",2),Gn([J({type:Array})],Ts.prototype,"buffer",2),Ts=Gn([Bt("vmp-progress-scrubber")],Ts);var HC=Object.defineProperty,$C=Object.getOwnPropertyDescriptor,ut=(s,e,t,i)=>{for(var r=i>1?void 0:i?$C(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&HC(e,t,r),r};let it=class extends ke{constructor(){super(...arguments),this.resizeHider=new RC(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.level=-1,this.playbackRate=1,this.buffer=[],this.levels=[],this.captions=!1,this.fullscreen=!1,this.controls=Za,this.volumeMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var s,e,t,i,r,n,o,a,A,l,c,h,u;const d=((s=this.levels)==null?void 0:s.map((S,D)=>{const U=Math.min(S.width,S.height);return{id:`level-${D.toString()}`,event:"level:click",label:`${U}p`,value:{resolution:U,level:D}}}))??[],g={title:"Quality",items:[...d.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},f={id:"levels",label:"Quality",subItems:g},p=(e=g.items)==null?void 0:e.find(({value:S})=>S.level===this.level),y=["levels","playback-rate","captions","fullscreen"].filter(S=>{var D;return(D=this.controls)==null?void 0:D.includes(S)}),v={title:"Settings",items:[uC,dC,f,gC].filter(({id:S})=>y.includes(S)&&this.resizeHider.hiddenControls.includes(S))},Q=(t=this.controls)==null?void 0:t.includes("progress"),C=(i=this.controls)==null?void 0:i.includes("navigation"),T=(r=this.controls)==null?void 0:r.includes("play"),b=(n=this.controls)==null?void 0:n.includes("volume"),L=(o=this.controls)==null?void 0:o.includes("current-time"),R=(a=this.controls)==null?void 0:a.includes("duration"),P=(A=this.controls)==null?void 0:A.includes("levels"),k=(l=this.controls)==null?void 0:l.includes("speed"),q=(c=this.controls)==null?void 0:c.includes("captions"),$=(h=this.controls)==null?void 0:h.includes("fullscreen"),te=T||b||L||R||P||k||q||$,ee=[`level-${(u=this.level)==null?void 0:u.toString()}`,`playback-rate-${this.playbackRate.toString()}`,this.captions&&"captions",this.fullscreen&&"fullscreen"].filter(Boolean);return ge`
1070
+ `],Gn([J({type:Number})],Ts.prototype,"duration",2),Gn([J({type:Number})],Ts.prototype,"currentTime",2),Gn([J({type:Array})],Ts.prototype,"buffer",2),Ts=Gn([Bt("vmp-progress-scrubber")],Ts);var $C=Object.defineProperty,YC=Object.getOwnPropertyDescriptor,ut=(s,e,t,i)=>{for(var r=i>1?void 0:i?YC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&$C(e,t,r),r};let it=class extends Fe{constructor(){super(...arguments),this.resizeHider=new LC(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.level=-1,this.playbackRate=1,this.buffer=[],this.levels=[],this.captions=!1,this.fullscreen=!1,this.controls=Za,this.volumeMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var s,e,t,i,r,n,o,a,A,l,c,h,u;const d=((s=this.levels)==null?void 0:s.map((S,D)=>{const U=Math.min(S.width,S.height);return{id:`level-${D.toString()}`,event:"level:click",label:`${U}p`,value:{resolution:U,level:D}}}))??[],g={title:"Quality",items:[...d.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},f={id:"levels",label:"Quality",subItems:g},p=(e=g.items)==null?void 0:e.find(({value:S})=>S.level===this.level),y=["levels","playback-rate","captions","fullscreen"].filter(S=>{var D;return(D=this.controls)==null?void 0:D.includes(S)}),v={title:"Settings",items:[dC,gC,f,fC].filter(({id:S})=>y.includes(S)&&this.resizeHider.hiddenControls.includes(S))},Q=(t=this.controls)==null?void 0:t.includes("progress"),C=(i=this.controls)==null?void 0:i.includes("navigation"),T=(r=this.controls)==null?void 0:r.includes("play"),b=(n=this.controls)==null?void 0:n.includes("volume"),L=(o=this.controls)==null?void 0:o.includes("current-time"),R=(a=this.controls)==null?void 0:a.includes("duration"),P=(A=this.controls)==null?void 0:A.includes("levels"),k=(l=this.controls)==null?void 0:l.includes("speed"),q=(c=this.controls)==null?void 0:c.includes("captions"),$=(h=this.controls)==null?void 0:h.includes("fullscreen"),te=T||b||L||R||P||k||q||$,Z=[`level-${(u=this.level)==null?void 0:u.toString()}`,`playback-rate-${this.playbackRate.toString()}`,this.captions&&"captions",this.fullscreen&&"fullscreen"].filter(Boolean);return ge`
1071
1071
  <div
1072
1072
  ${this.resizeHider.measure()}
1073
1073
  ${this.resizeHider.contain()}
@@ -1139,7 +1139,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1139
1139
  ${this.resizeHider.hide("levels",0)}
1140
1140
  class=${Ue({hidden:!P||d.length<=0})}
1141
1141
  .items=${g}
1142
- .activeItems=${ee}
1142
+ .activeItems=${Z}
1143
1143
  @menu:toggle=${this._handleLevelsMenuOpen}
1144
1144
  >
1145
1145
  <vmp-tooltip content="Quality" ?disabled=${this.levelsMenuOpen}>
@@ -1149,8 +1149,8 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1149
1149
  <vmp-menu
1150
1150
  ${this.resizeHider.hide("playback-rate",4)}
1151
1151
  class=${Ue({hidden:!k})}
1152
- .items=${Ou}
1153
- .activeItems=${ee}
1152
+ .items=${Pu}
1153
+ .activeItems=${Z}
1154
1154
  @menu:toggle=${this._handlePlaybackMenuToggle}
1155
1155
  >
1156
1156
  <vmp-tooltip content="Playback speed" ?disabled=${this.playbackRateMenuOpen}>
@@ -1187,7 +1187,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1187
1187
  <vmp-menu
1188
1188
  ${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
1189
1189
  .items=${v}
1190
- .activeItems=${ee}
1190
+ .activeItems=${Z}
1191
1191
  @menu:toggle=${this._handleSettingsMenuToggle}
1192
1192
  >
1193
1193
  <vmp-tooltip content="Settings" ?disabled=${this.settingsMenuOpen}>
@@ -1197,7 +1197,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1197
1197
  </div>
1198
1198
  </div>
1199
1199
  </div>
1200
- `}};it.styles=[ke.styles??[],Ze`
1200
+ `}};it.styles=[Fe.styles??[],Ze`
1201
1201
  :host {
1202
1202
  --controls-border-radius: var(--player-border-radius, 0px);
1203
1203
 
@@ -1268,17 +1268,17 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1268
1268
  .hidden {
1269
1269
  display: none;
1270
1270
  }
1271
- `],ut([J({type:Boolean})],it.prototype,"playing",2),ut([J({type:Number})],it.prototype,"volume",2),ut([J({type:Boolean})],it.prototype,"muted",2),ut([J({type:Number})],it.prototype,"currentTime",2),ut([J({type:Number})],it.prototype,"duration",2),ut([J({type:Number})],it.prototype,"level",2),ut([J({type:Number})],it.prototype,"playbackRate",2),ut([J({type:Array})],it.prototype,"buffer",2),ut([J({type:Array,attribute:!1})],it.prototype,"levels",2),ut([J({type:Boolean})],it.prototype,"captions",2),ut([J({type:Boolean})],it.prototype,"fullscreen",2),ut([J({type:Array})],it.prototype,"controls",2),ut([rt()],it.prototype,"volumeMenuOpen",2),ut([rt()],it.prototype,"levelsMenuOpen",2),ut([rt()],it.prototype,"playbackRateMenuOpen",2),ut([rt()],it.prototype,"settingsMenuOpen",2),it=ut([Bt("vmp-player-controls")],it);var YC=Object.defineProperty,KC=Object.getOwnPropertyDescriptor,VC=(s,e,t,i)=>{for(var r=i>1?void 0:i?KC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&YC(e,t,r),r};let nA=class extends ke{render(){return ge`<vmp-icon icon="loading"></vmp-icon>`}};nA.styles=[ke.styles??[],Ze`
1271
+ `],ut([J({type:Boolean})],it.prototype,"playing",2),ut([J({type:Number})],it.prototype,"volume",2),ut([J({type:Boolean})],it.prototype,"muted",2),ut([J({type:Number})],it.prototype,"currentTime",2),ut([J({type:Number})],it.prototype,"duration",2),ut([J({type:Number})],it.prototype,"level",2),ut([J({type:Number})],it.prototype,"playbackRate",2),ut([J({type:Array})],it.prototype,"buffer",2),ut([J({type:Array,attribute:!1})],it.prototype,"levels",2),ut([J({type:Boolean})],it.prototype,"captions",2),ut([J({type:Boolean})],it.prototype,"fullscreen",2),ut([J({type:Array})],it.prototype,"controls",2),ut([rt()],it.prototype,"volumeMenuOpen",2),ut([rt()],it.prototype,"levelsMenuOpen",2),ut([rt()],it.prototype,"playbackRateMenuOpen",2),ut([rt()],it.prototype,"settingsMenuOpen",2),it=ut([Bt("vmp-player-controls")],it);var KC=Object.defineProperty,VC=Object.getOwnPropertyDescriptor,JC=(s,e,t,i)=>{for(var r=i>1?void 0:i?VC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&KC(e,t,r),r};let nA=class extends Fe{render(){return ge`<vmp-icon icon="loading"></vmp-icon>`}};nA.styles=[Fe.styles??[],Ze`
1272
1272
  :host {
1273
1273
  display: flex;
1274
1274
  align-items: center;
1275
1275
  justify-content: center;
1276
1276
  }
1277
- `],nA=VC([Bt("vmp-loading-spinner")],nA);var JC=Object.defineProperty,WC=Object.getOwnPropertyDescriptor,Yu=(s,e,t,i)=>{for(var r=i>1?void 0:i?WC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&JC(e,t,r),r};let Hn=class extends ke{constructor(){super(...arguments),this.caption=""}render(){return ge`
1277
+ `],nA=JC([Bt("vmp-loading-spinner")],nA);var WC=Object.defineProperty,qC=Object.getOwnPropertyDescriptor,Ku=(s,e,t,i)=>{for(var r=i>1?void 0:i?qC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&WC(e,t,r),r};let Hn=class extends Fe{constructor(){super(...arguments),this.caption=""}render(){return ge`
1278
1278
  <div class="container">
1279
1279
  <vmp-text content=${this.caption} size="large"></vmp-text>
1280
1280
  </div>
1281
- `}};Hn.styles=[ke.styles??[],Ze`
1281
+ `}};Hn.styles=[Fe.styles??[],Ze`
1282
1282
  .container {
1283
1283
  display: block;
1284
1284
  margin: 0 var(--space-small);
@@ -1297,7 +1297,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1297
1297
  /* Line height controls the spacing between the cloned boxes so has to override the default */
1298
1298
  line-height: 2.2;
1299
1299
  }
1300
- `],Yu([J({type:String})],Hn.prototype,"caption",2),Hn=Yu([Bt("vmp-captions")],Hn);var qC=Object.defineProperty,jC=Object.getOwnPropertyDescriptor,Et=(s,e,t,i)=>{for(var r=i>1?void 0:i?jC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&qC(e,t,r),r};const XC=3e3;let ot=class extends ke{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Za,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=lt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},XC)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var s;const e=(s=this.controls)==null?void 0:s.includes("play-large"),t=this.playing&&!this.showControls,i=!!(e&&!this.playing);return ge`
1300
+ `],Ku([J({type:String})],Hn.prototype,"caption",2),Hn=Ku([Bt("vmp-captions")],Hn);var jC=Object.defineProperty,XC=Object.getOwnPropertyDescriptor,Et=(s,e,t,i)=>{for(var r=i>1?void 0:i?XC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&jC(e,t,r),r};const zC=3e3;let ot=class extends Fe{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Za,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=lt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},zC)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var s;const e=(s=this.controls)==null?void 0:s.includes("play-large"),t=this.playing&&!this.showControls,i=!!(e&&!this.playing);return ge`
1301
1301
  <div
1302
1302
  class=${Ue({container:!0,hide:t})}
1303
1303
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
@@ -1343,7 +1343,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1343
1343
  ></vmp-player-controls>
1344
1344
  </div>
1345
1345
  </div>
1346
- `}};ot.styles=[ke.styles??[],Ze`
1346
+ `}};ot.styles=[Fe.styles??[],Ze`
1347
1347
  :host {
1348
1348
  --overlay-border-radius: var(--player-border-radius, 0px);
1349
1349
  }
@@ -1415,7 +1415,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1415
1415
  vmp-captions.hiddenControls {
1416
1416
  transform: translateY(calc(var(--space-small) * -1));
1417
1417
  }
1418
- `],Et([J({type:Boolean})],ot.prototype,"loading",2),Et([J({type:Boolean})],ot.prototype,"playing",2),Et([J({type:Number})],ot.prototype,"volume",2),Et([J({type:Boolean})],ot.prototype,"muted",2),Et([J({type:Number})],ot.prototype,"currentTime",2),Et([J({type:Number})],ot.prototype,"duration",2),Et([J({type:Array,attribute:!1})],ot.prototype,"levels",2),Et([J({type:Number})],ot.prototype,"level",2),Et([J({type:Number})],ot.prototype,"playbackRate",2),Et([J({type:String})],ot.prototype,"caption",2),Et([J({type:Array})],ot.prototype,"buffer",2),Et([J({type:Boolean})],ot.prototype,"captions",2),Et([J({type:Boolean})],ot.prototype,"fullscreen",2),Et([J({type:Array})],ot.prototype,"controls",2),Et([rt()],ot.prototype,"showControls",2),ot=Et([Bt("vmp-player-overlay")],ot);var zC=Object.defineProperty,ZC=Object.getOwnPropertyDescriptor,je=(s,e,t,i)=>{for(var r=i>1?void 0:i?ZC(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&zC(e,t,r),r};const ey=1e3/60;let Je=class extends ke{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=No,this._sceneController=new lC(this),this._drawController=new nC(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=lt(),this._canvasRef=lt(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,ey):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{this.sceneConfig&&this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate,this._lastTimestamp=s),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{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 captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new si(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?hC():this._playerRef.value&&cC(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(){this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this.processing&&!this._sceneController.hasPlayed&&s.has("_processing")&&this.play()}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?ge`
1418
+ `],Et([J({type:Boolean})],ot.prototype,"loading",2),Et([J({type:Boolean})],ot.prototype,"playing",2),Et([J({type:Number})],ot.prototype,"volume",2),Et([J({type:Boolean})],ot.prototype,"muted",2),Et([J({type:Number})],ot.prototype,"currentTime",2),Et([J({type:Number})],ot.prototype,"duration",2),Et([J({type:Array,attribute:!1})],ot.prototype,"levels",2),Et([J({type:Number})],ot.prototype,"level",2),Et([J({type:Number})],ot.prototype,"playbackRate",2),Et([J({type:String})],ot.prototype,"caption",2),Et([J({type:Array})],ot.prototype,"buffer",2),Et([J({type:Boolean})],ot.prototype,"captions",2),Et([J({type:Boolean})],ot.prototype,"fullscreen",2),Et([J({type:Array})],ot.prototype,"controls",2),Et([rt()],ot.prototype,"showControls",2),ot=Et([Bt("vmp-player-overlay")],ot);var ZC=Object.defineProperty,ey=Object.getOwnPropertyDescriptor,je=(s,e,t,i)=>{for(var r=i>1?void 0:i?ey(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ZC(e,t,r),r};const ty=1e3/60;let Je=class extends Fe{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=No,this._sceneController=new cC(this),this._drawController=new oC(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=lt(),this._canvasRef=lt(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,ty):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{this.sceneConfig&&this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate,this._lastTimestamp=s),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{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 captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new si(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?uC():this._playerRef.value&&hC(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(){this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this.processing&&!this._sceneController.hasPlayed&&s.has("_processing")&&this.play()}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?ge`
1419
1419
  <style>
1420
1420
  :host {
1421
1421
  aspect-ratio: ${this.propAspectRatio};
@@ -1436,7 +1436,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1436
1436
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
1437
1437
  <vmp-text semibold content="Please try again later."></vmp-text>
1438
1438
  </div>
1439
- </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=Mo({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??720,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((v,Q)=>v.concat(this.sceneVideoState[Q].buffered??[]),[]),c=o?[]:(e=this.controls??Za)==null?void 0:e.filter(v=>!(v==="fullscreen"&&aC()||v==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=!(c!=null&&c.includes("preview")),u=(((t=this.scenes)==null?void 0:t.length)??0)-1,d=((i=this.scenes)==null?void 0:i.findIndex(v=>v===this._drawController.activeScenes[0]))??0,g=(n=(r=this._drawController.activeScenes[0])==null?void 0:r.video)==null?void 0:n.hls,f=this.loading||this.waiting||this.processing,p=!this.src&&!this.data,y=!!this.errors.find(v=>v.fatal);return ge`
1439
+ </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=Mo({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??720,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((v,Q)=>v.concat(this.sceneVideoState[Q].buffered??[]),[]),c=o?[]:(e=this.controls??Za)==null?void 0:e.filter(v=>!(v==="fullscreen"&&AC()||v==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=!(c!=null&&c.includes("preview")),u=(((t=this.scenes)==null?void 0:t.length)??0)-1,d=((i=this.scenes)==null?void 0:i.findIndex(v=>v===this._drawController.activeScenes[0]))??0,g=(n=(r=this._drawController.activeScenes[0])==null?void 0:r.video)==null?void 0:n.hls,f=this.loading||this.waiting||this.processing,p=!this.src&&!this.data,y=!!this.errors.find(v=>v.fatal);return ge`
1440
1440
  ${this._renderStyles()}
1441
1441
  <div
1442
1442
  ${ct(this._playerRef)}
@@ -1489,7 +1489,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1489
1489
  .compilation=${this.compilation}
1490
1490
  ></vmp-video-preview>`}
1491
1491
  </div>
1492
- `}};Je.styles=[ke.styles??[],Ze`
1492
+ `}};Je.styles=[Fe.styles??[],Ze`
1493
1493
  :host {
1494
1494
  --player-border-radius: var(--vouch-media-player-border-radius, 0px);
1495
1495
 
@@ -1550,7 +1550,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1550
1550
  top: 0;
1551
1551
  left: 0;
1552
1552
  }
1553
- `],je([J({type:Object})],Je.prototype,"data",2),je([J({type:Object})],Je.prototype,"template",2),je([J({type:Boolean})],Je.prototype,"burnCaptions",2),je([J({type:Boolean})],Je.prototype,"debug",2),je([J({type:String})],Je.prototype,"src",2),je([J({type:String})],Je.prototype,"track",2),je([J({type:Number,attribute:"aspectratio"})],Je.prototype,"propAspectRatio",2),je([J({type:String})],Je.prototype,"preload",2),je([J({type:Boolean})],Je.prototype,"autoplay",2),je([J({type:Boolean})],Je.prototype,"loading",2),je([J({type:Array})],Je.prototype,"controls",2),je([J({attribute:!1})],Je.prototype,"compilation",2),je([rt()],Je.prototype,"_pageHidden",2),je([rt()],Je.prototype,"_aspectRatio",2),je([rt()],Je.prototype,"_processing",2),je([rt()],Je.prototype,"_waiting",2),je([rt()],Je.prototype,"_errors",2),je([rt()],Je.prototype,"_seeking",2),je([rt()],Je.prototype,"_captions",2),je([rt()],Je.prototype,"_fullscreen",2),Je=je([Bt("vmp-media-player")],Je);var ty=Object.defineProperty,iy=Object.getOwnPropertyDescriptor,Qt=(s,e,t,i)=>{for(var r=i>1?void 0:i?iy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ty(e,t,r),r};let dt=class extends hi{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 sg(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","seeking","seeked","timeupdate","volumechange","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new Qg(this),this._trackingController=new Zf(this),this._mediaPlayerRef=lt()}get fetching(){return this._fetcherController.fetching}get waiting(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.waiting}get initialised(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.initialised}get seeking(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.seeking}get paused(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.paused}get captions(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.captions}get fullscreen(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.fullscreen}get duration(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.duration}set currentTime(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=s)}get currentTime(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.currentTime)??0}set playbackRate(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=s)}get playbackRate(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.playbackRate)??1}set volume(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=s)}get volume(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.volume)??1}set muted(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=s)}get muted(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.muted)??!1}get scene(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scene)??null}get scenes(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scenes)??[]}get sceneConfig(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.sceneConfig)??null}get videoState(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var s;(s=this._mediaPlayerRef.value)==null||s.play()}pause(){var s;(s=this._mediaPlayerRef.value)==null||s.pause()}reset(s=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(s,e)}setScene(s){var e;(e=this._mediaPlayerRef.value)==null||e.setScene(s)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?ge`
1553
+ `],je([J({type:Object})],Je.prototype,"data",2),je([J({type:Object})],Je.prototype,"template",2),je([J({type:Boolean})],Je.prototype,"burnCaptions",2),je([J({type:Boolean})],Je.prototype,"debug",2),je([J({type:String})],Je.prototype,"src",2),je([J({type:String})],Je.prototype,"track",2),je([J({type:Number,attribute:"aspectratio"})],Je.prototype,"propAspectRatio",2),je([J({type:String})],Je.prototype,"preload",2),je([J({type:Boolean})],Je.prototype,"autoplay",2),je([J({type:Boolean})],Je.prototype,"loading",2),je([J({type:Array})],Je.prototype,"controls",2),je([J({attribute:!1})],Je.prototype,"compilation",2),je([rt()],Je.prototype,"_pageHidden",2),je([rt()],Je.prototype,"_aspectRatio",2),je([rt()],Je.prototype,"_processing",2),je([rt()],Je.prototype,"_waiting",2),je([rt()],Je.prototype,"_errors",2),je([rt()],Je.prototype,"_seeking",2),je([rt()],Je.prototype,"_captions",2),je([rt()],Je.prototype,"_fullscreen",2),Je=je([Bt("vmp-media-player")],Je);var iy=Object.defineProperty,sy=Object.getOwnPropertyDescriptor,Qt=(s,e,t,i)=>{for(var r=i>1?void 0:i?sy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&iy(e,t,r),r};let dt=class extends hi{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 rg(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","seeking","seeked","timeupdate","volumechange","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new bg(this),this._trackingController=new e0(this),this._mediaPlayerRef=lt()}get fetching(){return this._fetcherController.fetching}get waiting(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.waiting}get initialised(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.initialised}get seeking(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.seeking}get paused(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.paused}get captions(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.captions}get fullscreen(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.fullscreen}get duration(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.duration}set currentTime(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=s)}get currentTime(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.currentTime)??0}set playbackRate(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=s)}get playbackRate(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.playbackRate)??1}set volume(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=s)}get volume(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.volume)??1}set muted(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=s)}get muted(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.muted)??!1}get scene(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scene)??null}get scenes(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scenes)??[]}get sceneConfig(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.sceneConfig)??null}get videoState(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var s;(s=this._mediaPlayerRef.value)==null||s.play()}pause(){var s;(s=this._mediaPlayerRef.value)==null||s.pause()}reset(s=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(s,e)}setScene(s){var e;(e=this._mediaPlayerRef.value)==null||e.setScene(s)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?ge`
1554
1554
  <style>
1555
1555
  :host {
1556
1556
  aspect-ratio: ${this.aspectRatio};
@@ -1580,12 +1580,12 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1580
1580
  :host {
1581
1581
  display: flex;
1582
1582
  }
1583
- `],Qt([J({type:Object})],dt.prototype,"data",2),Qt([J({type:String})],dt.prototype,"vouchId",2),Qt([J({type:String})],dt.prototype,"templateId",2),Qt([J({type:Array})],dt.prototype,"questions",2),Qt([J({type:String})],dt.prototype,"env",2),Qt([J({type:String})],dt.prototype,"apiKey",2),Qt([J({type:Boolean})],dt.prototype,"disableTracking",2),Qt([J({type:String})],dt.prototype,"trackingSource",2),Qt([J({type:Array})],dt.prototype,"controls",2),Qt([J({type:String})],dt.prototype,"preload",2),Qt([J({type:Boolean})],dt.prototype,"autoplay",2),Qt([J({type:Number})],dt.prototype,"aspectRatio",2),Qt([rt()],dt.prototype,"vouch",2),Qt([rt()],dt.prototype,"template",2),dt=Qt([Or("vouch-embed-player")],dt);function $n(s,e,t,i=20,r=0){let n=[];if(r>=i)return n;const o=A=>{const l=A.assignedNodes().filter(c=>c.nodeType===1);return l.length>0?$n(l[0].parentElement,e,t,i,r+1):[]},a=Array.from(s.children||[]);for(const A of a)e(A)||(t(A)&&n.push(A),A.shadowRoot!=null?n.push(...$n(A.shadowRoot,e,t,i,r+1)):A.tagName==="SLOT"?n.push(...o(A)):n.push(...$n(A,e,t,i,r+1)));return n}function Ku(s){return s.hasAttribute("hidden")||s.hasAttribute("aria-hidden")&&s.getAttribute("aria-hidden")!=="false"||s.style.display==="none"||s.style.opacity==="0"||s.style.visibility==="hidden"||s.style.visibility==="collapse"}function sy(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function ry(s){return s.getAttribute("tabindex")==="-1"||Ku(s)||sy(s)?!1:s.hasAttribute("tabindex")||(s instanceof HTMLAnchorElement||s instanceof HTMLAreaElement)&&s.hasAttribute("href")||s instanceof HTMLButtonElement||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement||s instanceof HTMLIFrameElement}const oA=new Map;function ny(s,e,t){const i=oA.get(t);i!=null&&window.clearTimeout(i),oA.set(t,window.setTimeout(()=>{s(),oA.delete(t)},e))}const Vu=document.createElement("template");Vu.innerHTML=`
1583
+ `],Qt([J({type:Object})],dt.prototype,"data",2),Qt([J({type:String})],dt.prototype,"vouchId",2),Qt([J({type:String})],dt.prototype,"templateId",2),Qt([J({type:Array})],dt.prototype,"questions",2),Qt([J({type:String})],dt.prototype,"env",2),Qt([J({type:String})],dt.prototype,"apiKey",2),Qt([J({type:Boolean})],dt.prototype,"disableTracking",2),Qt([J({type:String})],dt.prototype,"trackingSource",2),Qt([J({type:Array})],dt.prototype,"controls",2),Qt([J({type:String})],dt.prototype,"preload",2),Qt([J({type:Boolean})],dt.prototype,"autoplay",2),Qt([J({type:Number})],dt.prototype,"aspectRatio",2),Qt([rt()],dt.prototype,"vouch",2),Qt([rt()],dt.prototype,"template",2),dt=Qt([Or("vouch-embed-player")],dt);function $n(s,e,t,i=20,r=0){let n=[];if(r>=i)return n;const o=A=>{const l=A.assignedNodes().filter(c=>c.nodeType===1);return l.length>0?$n(l[0].parentElement,e,t,i,r+1):[]},a=Array.from(s.children||[]);for(const A of a)e(A)||(t(A)&&n.push(A),A.shadowRoot!=null?n.push(...$n(A.shadowRoot,e,t,i,r+1)):A.tagName==="SLOT"?n.push(...o(A)):n.push(...$n(A,e,t,i,r+1)));return n}function Vu(s){return s.hasAttribute("hidden")||s.hasAttribute("aria-hidden")&&s.getAttribute("aria-hidden")!=="false"||s.style.display==="none"||s.style.opacity==="0"||s.style.visibility==="hidden"||s.style.visibility==="collapse"}function ry(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function ny(s){return s.getAttribute("tabindex")==="-1"||Vu(s)||ry(s)?!1:s.hasAttribute("tabindex")||(s instanceof HTMLAnchorElement||s instanceof HTMLAreaElement)&&s.hasAttribute("href")||s instanceof HTMLButtonElement||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement||s instanceof HTMLIFrameElement}const oA=new Map;function oy(s,e,t){const i=oA.get(t);i!=null&&window.clearTimeout(i),oA.set(t,window.setTimeout(()=>{s(),oA.delete(t)},e))}const Ju=document.createElement("template");Ju.innerHTML=`
1584
1584
  <div id="start"></div>
1585
1585
  <div id="backup"></div>
1586
1586
  <slot></slot>
1587
1587
  <div id="end"></div>
1588
- `;class oy extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Vu.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 $n(this,Ku,ry)}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){ny(()=>{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",oy);var ay=Object.defineProperty,Ay=Object.getOwnPropertyDescriptor,aA=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ay(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ay(e,t,r),r};let Tr=class extends hi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ge`
1588
+ `;class ay extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ju.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 $n(this,Vu,ny)}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){oy(()=>{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",ay);var Ay=Object.defineProperty,ly=Object.getOwnPropertyDescriptor,aA=(s,e,t,i)=>{for(var r=i>1?void 0:i?ly(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Ay(e,t,r),r};let Tr=class extends hi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return ge`
1589
1589
  <div
1590
1590
  class=${Ue({container:!0,hidden:!this.open})}
1591
1591
  >
@@ -1672,7 +1672,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1672
1672
  right: 0;
1673
1673
  margin: 10px;
1674
1674
  }
1675
- `],aA([J({type:Boolean})],Tr.prototype,"open",2),aA([J({type:Number})],Tr.prototype,"aspectRatio",2),Tr=aA([Or("vouch-embed-dialog-overlay")],Tr);var ly=Object.defineProperty,cy=Object.getOwnPropertyDescriptor,kt=(s,e,t,i)=>{for(var r=i>1?void 0:i?cy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&ly(e,t,r),r};let Lt=class extends hi{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=lt(),this.open=!1,this._handleToggle=({detail:s})=>{var e,t,i;this.id===s&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(i=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||i.pause())},this._handleClose=()=>{var s,e;this.open=!1,(e=(s=this._mediaPlayerRef)==null?void 0:s.value)==null||e.pause()},this._handleDocumentKeyUp=s=>{s.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 s=document.createElement("div");return document.body.appendChild(s),s}render(){return ge`
1675
+ `],aA([J({type:Boolean})],Tr.prototype,"open",2),aA([J({type:Number})],Tr.prototype,"aspectRatio",2),Tr=aA([Or("vouch-embed-dialog-overlay")],Tr);var cy=Object.defineProperty,hy=Object.getOwnPropertyDescriptor,kt=(s,e,t,i)=>{for(var r=i>1?void 0:i?hy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&cy(e,t,r),r};let Lt=class extends hi{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=lt(),this.open=!1,this._handleToggle=({detail:s})=>{var e,t,i;this.id===s&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(i=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||i.pause())},this._handleClose=()=>{var s,e;this.open=!1,(e=(s=this._mediaPlayerRef)==null?void 0:s.value)==null||e.pause()},this._handleDocumentKeyUp=s=>{s.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 s=document.createElement("div");return document.body.appendChild(s),s}render(){return ge`
1676
1676
  <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
1677
1677
  <vouch-embed-player
1678
1678
  ${ct(this._mediaPlayerRef)}
@@ -1690,7 +1690,7 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1690
1690
  aspectRatio=${this.aspectRatio}
1691
1691
  ></vouch-embed-player>
1692
1692
  </vouch-embed-dialog-overlay>
1693
- `}};kt([J({type:String})],Lt.prototype,"vouchId",2),kt([J({type:String})],Lt.prototype,"templateId",2),kt([J({type:Array})],Lt.prototype,"questions",2),kt([J({type:String})],Lt.prototype,"env",2),kt([J({type:String})],Lt.prototype,"apiKey",2),kt([J({type:Boolean})],Lt.prototype,"disableTracking",2),kt([J({type:String})],Lt.prototype,"trackingSource",2),kt([J({type:Array})],Lt.prototype,"controls",2),kt([J({type:String})],Lt.prototype,"preload",2),kt([J({type:Boolean})],Lt.prototype,"disableAutoplay",2),kt([J({type:Number})],Lt.prototype,"aspectRatio",2),kt([rt()],Lt.prototype,"open",2),Lt=kt([Or("vouch-embed-dialog-portal")],Lt);var hy=Object.defineProperty,uy=Object.getOwnPropertyDescriptor,Ht=(s,e,t,i)=>{for(var r=i>1?void 0:i?uy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&hy(e,t,r),r};Ye.DialogEmbed=class extends hi{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=xi(),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 ge`
1693
+ `}};kt([J({type:String})],Lt.prototype,"vouchId",2),kt([J({type:String})],Lt.prototype,"templateId",2),kt([J({type:Array})],Lt.prototype,"questions",2),kt([J({type:String})],Lt.prototype,"env",2),kt([J({type:String})],Lt.prototype,"apiKey",2),kt([J({type:Boolean})],Lt.prototype,"disableTracking",2),kt([J({type:String})],Lt.prototype,"trackingSource",2),kt([J({type:Array})],Lt.prototype,"controls",2),kt([J({type:String})],Lt.prototype,"preload",2),kt([J({type:Boolean})],Lt.prototype,"disableAutoplay",2),kt([J({type:Number})],Lt.prototype,"aspectRatio",2),kt([rt()],Lt.prototype,"open",2),Lt=kt([Or("vouch-embed-dialog-portal")],Lt);var uy=Object.defineProperty,dy=Object.getOwnPropertyDescriptor,Ht=(s,e,t,i)=>{for(var r=i>1?void 0:i?dy(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&uy(e,t,r),r};Ye.DialogEmbed=class extends hi{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=Di(),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 ge`
1694
1694
  <slot>
1695
1695
  <vmp-button size="large">Play</vmp-button>
1696
1696
  </slot>
@@ -1718,5 +1718,5 @@ ${e}`,Cf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yf=Objec
1718
1718
  width: fit-content;
1719
1719
  height: fit-content;
1720
1720
  }
1721
- `],Ht([J({type:String})],Ye.DialogEmbed.prototype,"vouchId",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"templateId",2),Ht([J({type:Array})],Ye.DialogEmbed.prototype,"questions",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"env",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"apiKey",2),Ht([J({type:Boolean})],Ye.DialogEmbed.prototype,"disableTracking",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"trackingSource",2),Ht([J({type:Array})],Ye.DialogEmbed.prototype,"controls",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"preload",2),Ht([J({type:Boolean})],Ye.DialogEmbed.prototype,"disableAutoplay",2),Ht([J({type:Number})],Ye.DialogEmbed.prototype,"aspectRatio",2),Ye.DialogEmbed=Ht([Or("vouch-embed-dialog")],Ye.DialogEmbed);function ni(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Ju(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function dy(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var xs={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),ni(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=Ju(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(ni(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Ju(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return ni(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];ni(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xs.normalize(e)},relative:function(e,t){if(ni(e),ni(t),e===t||(e=xs.resolve(e),t=xs.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,h=0;h<=l;++h){if(h===l){if(A>l){if(t.charCodeAt(o+h)===47)return t.slice(o+h+1);if(h===0)return t.slice(o+h)}else n>l&&(e.charCodeAt(i+h)===47?c=h:h===0&&(c=0));break}var u=e.charCodeAt(i+h),d=t.charCodeAt(o+h);if(u!==d)break;u===47&&(c=h)}var g="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(ni(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ni(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){ni(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return dy("/",e)},parse:function(e){ni(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};xs.posix=xs;var gy=xs;const{basename:Wu,extname:fy}=gy;class py{constructor(){let e=(()=>typeof qr>"u")(),t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function Ey(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new py,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||fy(e),f=c(h(g)||g),p=h(f),y=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${u})`);if(!y)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let v,Q,C=e.replace(/{(\d*)}/g,(b,L)=>(Q=!0,L=parseInt(L,10),v=isFinite(L)?L:isFinite(v)?v:-1,"{}")),T=r>0?r-1:r<0?y+r:void 0;if(isFinite(T)&&T<0||T>=y)throw new RangeError(y==1?`Canvas only has a ‘page 1’ (${T} is out of bounds)`:`Canvas has pages 1–${y} (${T} is out of bounds)`);if(s=isFinite(T)?[s[T]]:Q||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let b=(t||Wu(e,g)).match(/@(\d+)x$/i);a=b?parseInt(b[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:C,format:f,mime:p,pages:s,padding:v,quality:n,matte:o,density:a,outline:A,archive:d}}class Yn{static for(e){return new Yn().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Yn.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function AA(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const Kn=class Kn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=Kn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=AA(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Yn.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let h=AA(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,h.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:h}),this.offset=l}toBuffer(){let e=this.files.reduce((h,{name:u})=>46+u.length+h,0),t=AA(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};ld(Kn,"encoder",new TextEncoder);let lA=Kn;const cA=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},Iy=(...s)=>cA(...s).then(e=>e.arrayBuffer()),my=async(s,e,t,i,r)=>{qu(r,await cA(s,e,t,i))},Cy=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Wu(r,".zip")||"archive",l=new lA(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await cA(c,e,t,i))})),qu(`${A}.zip`,l.blob)},qu=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var yy={asBuffer:Iy,asDownload:my,asZipDownload:Cy,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:Ey};const{asBuffer:hA,asDownload:vy,asZipDownload:By,atScale:uA,options:dA}=yy,ju=Symbol.for("toDataURL"),Qy=s=>{let e=Object.assign(new Xu,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class by{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>hA(i,"image/png"),jpg:()=>hA(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:p}=l,y=uA(l.pages,f);return h==null?vy(y[0],u,d,g,a):By(y,u,d,g,p,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0];return hA(f,c,h,u)},[ju]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0],p=f[f===i?ju:"toDataURL"](c,h);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:Sy,CanvasGradient:wy,CanvasPattern:Ty,Image:Xu,ImageData:xy,Path2D:Dy,DOMMatrix:Ry,DOMRect:Ly,DOMPoint:_y}=window;var zu={Canvas:by,loadImage:Qy,CanvasRenderingContext2D:Sy,CanvasGradient:wy,CanvasPattern:Ty,Image:Xu,ImageData:xy,Path2D:Dy,DOMMatrix:Ry,DOMRect:Ly,DOMPoint:_y};const Zu=li({__proto__:null,default:xo(zu)},[zu]);return Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"}),Ye}({});
1721
+ `],Ht([J({type:String})],Ye.DialogEmbed.prototype,"vouchId",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"templateId",2),Ht([J({type:Array})],Ye.DialogEmbed.prototype,"questions",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"env",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"apiKey",2),Ht([J({type:Boolean})],Ye.DialogEmbed.prototype,"disableTracking",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"trackingSource",2),Ht([J({type:Array})],Ye.DialogEmbed.prototype,"controls",2),Ht([J({type:String})],Ye.DialogEmbed.prototype,"preload",2),Ht([J({type:Boolean})],Ye.DialogEmbed.prototype,"disableAutoplay",2),Ht([J({type:Number})],Ye.DialogEmbed.prototype,"aspectRatio",2),Ye.DialogEmbed=Ht([Or("vouch-embed-dialog")],Ye.DialogEmbed);function ni(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Wu(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function gy(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var xs={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),ni(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=Wu(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(ni(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Wu(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return ni(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];ni(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xs.normalize(e)},relative:function(e,t){if(ni(e),ni(t),e===t||(e=xs.resolve(e),t=xs.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,h=0;h<=l;++h){if(h===l){if(A>l){if(t.charCodeAt(o+h)===47)return t.slice(o+h+1);if(h===0)return t.slice(o+h)}else n>l&&(e.charCodeAt(i+h)===47?c=h:h===0&&(c=0));break}var u=e.charCodeAt(i+h),d=t.charCodeAt(o+h);if(u!==d)break;u===47&&(c=h)}var g="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(ni(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ni(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){ni(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return gy("/",e)},parse:function(e){ni(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};xs.posix=xs;var fy=xs;const{basename:qu,extname:py}=fy;class Ey{constructor(){let e=(()=>typeof qr>"u")(),t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function Iy(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new Ey,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||py(e),f=c(h(g)||g),p=h(f),y=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${u})`);if(!y)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let v,Q,C=e.replace(/{(\d*)}/g,(b,L)=>(Q=!0,L=parseInt(L,10),v=isFinite(L)?L:isFinite(v)?v:-1,"{}")),T=r>0?r-1:r<0?y+r:void 0;if(isFinite(T)&&T<0||T>=y)throw new RangeError(y==1?`Canvas only has a ‘page 1’ (${T} is out of bounds)`:`Canvas has pages 1–${y} (${T} is out of bounds)`);if(s=isFinite(T)?[s[T]]:Q||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let b=(t||qu(e,g)).match(/@(\d+)x$/i);a=b?parseInt(b[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:C,format:f,mime:p,pages:s,padding:v,quality:n,matte:o,density:a,outline:A,archive:d}}class Yn{static for(e){return new Yn().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Yn.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function AA(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const Kn=class Kn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=Kn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=AA(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Yn.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let h=AA(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,h.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:h}),this.offset=l}toBuffer(){let e=this.files.reduce((h,{name:u})=>46+u.length+h,0),t=AA(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};cd(Kn,"encoder",new TextEncoder);let lA=Kn;const cA=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},my=(...s)=>cA(...s).then(e=>e.arrayBuffer()),Cy=async(s,e,t,i,r)=>{ju(r,await cA(s,e,t,i))},yy=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=qu(r,".zip")||"archive",l=new lA(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await cA(c,e,t,i))})),ju(`${A}.zip`,l.blob)},ju=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var vy={asBuffer:my,asDownload:Cy,asZipDownload:yy,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:Iy};const{asBuffer:hA,asDownload:By,asZipDownload:Qy,atScale:uA,options:dA}=vy,Xu=Symbol.for("toDataURL"),by=s=>{let e=Object.assign(new zu,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class Sy{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>hA(i,"image/png"),jpg:()=>hA(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:p}=l,y=uA(l.pages,f);return h==null?By(y[0],u,d,g,a):Qy(y,u,d,g,p,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0];return hA(f,c,h,u)},[Xu]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0],p=f[f===i?Xu:"toDataURL"](c,h);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:wy,CanvasGradient:Ty,CanvasPattern:xy,Image:zu,ImageData:Dy,Path2D:Ry,DOMMatrix:Ly,DOMRect:_y,DOMPoint:ky}=window;var Zu={Canvas:Sy,loadImage:by,CanvasRenderingContext2D:wy,CanvasGradient:Ty,CanvasPattern:xy,Image:zu,ImageData:Dy,Path2D:Ry,DOMMatrix:Ly,DOMRect:_y,DOMPoint:ky};const ed=li({__proto__:null,default:xo(Zu)},[Zu]);return Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"}),Ye}({});
1722
1722
  //# sourceMappingURL=embed.iife.js.map