@vouchfor/embeds 0.0.0-experiment.8c5a3f8 → 0.0.0-experiment.8cafed9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/browser-DfO9Pnu7.js +921 -0
- package/dist/es/browser-DfO9Pnu7.js.map +1 -0
- package/dist/es/embeds.js +1 -1599
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/index-5G8orrrP.js +2609 -0
- package/dist/es/index-5G8orrrP.js.map +1 -0
- package/dist/es/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
- package/dist/es/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
- package/dist/es/src/components/DialogEmbed/index.d.ts +38 -0
- package/dist/es/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
- package/dist/es/src/components/{Embed → PlayerEmbed}/controllers/fetcher.d.ts +5 -4
- package/dist/es/src/components/{Embed/controllers/tracking.d.ts → PlayerEmbed/controllers/tracking/index.d.ts} +14 -11
- package/dist/es/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
- package/dist/es/src/components/{Embed → PlayerEmbed}/index.d.ts +28 -21
- package/dist/es/src/components/PlayerEmbed/tests/data.d.ts +3 -0
- package/dist/es/src/index.d.ts +2 -1
- package/dist/iife/dialog-embed/browser-DCzTItVw.js +429 -0
- package/dist/iife/dialog-embed/browser-DCzTItVw.js.map +1 -0
- package/dist/iife/dialog-embed/embed.iife.js +1750 -0
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -0
- package/dist/iife/dialog-embed/embed.js +5 -0
- package/dist/iife/dialog-embed/embed.js.map +1 -0
- package/dist/iife/dialog-embed/index-CgdXxP5z.js +27698 -0
- package/dist/iife/dialog-embed/index-CgdXxP5z.js.map +1 -0
- package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
- package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
- package/dist/iife/dialog-embed/src/components/DialogEmbed/index.d.ts +38 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +14 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +36 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/index.d.ts +74 -0
- package/dist/iife/dialog-embed/src/components/PlayerEmbed/tests/data.d.ts +3 -0
- package/dist/iife/dialog-embed/src/index.d.ts +2 -0
- package/dist/iife/dialog-embed/src/utils/env.d.ts +12 -0
- package/dist/iife/dialog-embed/src/utils/events.d.ts +2 -0
- package/dist/iife/embeds.iife.js +661 -456
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/browser-BBSMddCs.js +429 -0
- package/dist/iife/player-embed/browser-BBSMddCs.js.map +1 -0
- package/dist/iife/player-embed/embed.iife.js +1612 -0
- package/dist/iife/player-embed/embed.iife.js.map +1 -0
- package/dist/iife/player-embed/embed.js +5 -0
- package/dist/iife/player-embed/embed.js.map +1 -0
- package/dist/iife/player-embed/index-BGZl_iqR.js +27255 -0
- package/dist/iife/player-embed/index-BGZl_iqR.js.map +1 -0
- package/dist/iife/player-embed/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
- package/dist/iife/player-embed/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
- package/dist/iife/player-embed/src/components/DialogEmbed/index.d.ts +38 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +14 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +36 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/index.d.ts +74 -0
- package/dist/iife/player-embed/src/components/PlayerEmbed/tests/data.d.ts +3 -0
- package/dist/iife/player-embed/src/index.d.ts +2 -0
- package/dist/iife/player-embed/src/utils/env.d.ts +12 -0
- package/dist/iife/player-embed/src/utils/events.d.ts +2 -0
- package/package.json +43 -31
- package/src/components/DialogEmbed/Dialog.stories.ts +91 -0
- package/src/components/DialogEmbed/DialogOverlay.ts +131 -0
- package/src/components/DialogEmbed/DialogPortal.ts +126 -0
- package/src/components/DialogEmbed/index.ts +97 -0
- package/src/components/{Embed/Embed.stories.ts → PlayerEmbed/PlayerEmbed.stories.ts} +26 -14
- package/src/components/{Embed → PlayerEmbed}/controllers/event-forwarder.ts +6 -5
- package/src/components/{Embed → PlayerEmbed}/controllers/fetcher.ts +33 -14
- package/src/components/{Embed/controllers/tracking.ts → PlayerEmbed/controllers/tracking/index.ts} +47 -115
- package/src/components/PlayerEmbed/controllers/tracking/utils.ts +95 -0
- package/src/components/{Embed → PlayerEmbed}/index.ts +71 -27
- package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +80 -0
- package/src/components/PlayerEmbed/tests/data.ts +183 -0
- package/src/index.ts +2 -1
@@ -0,0 +1,1612 @@
|
|
1
|
+
var playerEmbed=async function(Ke){"use strict";var Ka=typeof document<"u"?document.currentScript:null;function ku(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
|
+
* @license
|
3
|
+
* Copyright 2019 Google LLC
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
5
|
+
*/const hr=globalThis,bn=hr.ShadowRoot&&(hr.ShadyCSS===void 0||hr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rn=Symbol(),Ya=new WeakMap;let Va=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Rn)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(bn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=Ya.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ya.set(t,e))}return e}toString(){return this.cssText}};const Ts=s=>new Va(typeof s=="string"?s:s+"",void 0,Rn),lt=(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 Va(t,s,Rn)},Mu=(s,e)=>{if(bn)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=hr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},Ja=bn?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Ts(t)})(s):s;/**
|
6
|
+
* @license
|
7
|
+
* Copyright 2017 Google LLC
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
9
|
+
*/const{is:_u,defineProperty:Fu,getOwnPropertyDescriptor:Nu,getOwnPropertyNames:Ou,getOwnPropertySymbols:Uu,getPrototypeOf:Pu}=Object,ur=globalThis,Wa=ur.trustedTypes,Gu=Wa?Wa.emptyScript:"",Hu=ur.reactiveElementPolyfillSupport,Ls=(s,e)=>s,dr={toAttribute(s,e){switch(e){case Boolean:s=s?Gu: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}},gr=(s,e)=>!_u(s,e),qa={attribute:!0,type:String,converter:dr,reflect:!1,hasChanged:gr};Symbol.metadata??=Symbol("metadata"),ur.litPropertyMetadata??=new WeakMap;class ji extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=qa){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&&Fu(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Nu(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r?.call(this)},set(o){const a=r?.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??qa}static _$Ei(){if(this.hasOwnProperty(Ls("elementProperties")))return;const e=Pu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ls("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ls("properties"))){const t=this.properties,i=[...Ou(t),...Uu(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(Ja(r))}else e!==void 0&&t.push(Ja(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(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Mu(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const n=(i.converter?.toAttribute!==void 0?i.converter:dr).toAttribute(t,i.type);this._$Em=e,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const n=i.getPropertyOptions(r),o=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:dr;this._$Em=r,this[r]=o.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??=this.constructor.getPropertyOptions(e),!(i.hasChanged??gr)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,n]of i)n.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(t)):this._$EU()}catch(i){throw e=!1,this._$EU(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach(t=>this._$EC(t,this[t])),this._$EU()}updated(e){}firstUpdated(e){}}ji.elementStyles=[],ji.shadowRootOptions={mode:"open"},ji[Ls("elementProperties")]=new Map,ji[Ls("finalized")]=new Map,Hu?.({ReactiveElement:ji}),(ur.reactiveElementVersions??=[]).push("2.0.4");/**
|
10
|
+
* @license
|
11
|
+
* Copyright 2017 Google LLC
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
13
|
+
*/const xn=globalThis,fr=xn.trustedTypes,ja=fr?fr.createPolicy("lit-html",{createHTML:s=>s}):void 0,Tn="$lit$",li=`lit$${(Math.random()+"").slice(9)}$`,Ln="?"+li,$u=`<${Ln}>`,Ti=document,ks=()=>Ti.createComment(""),Ms=s=>s===null||typeof s!="object"&&typeof s!="function",Xa=Array.isArray,Za=s=>Xa(s)||typeof s?.[Symbol.iterator]=="function",kn=`[
|
14
|
+
\f\r]`,_s=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,za=/-->/g,eA=/>/g,Li=RegExp(`>|${kn}(?:([^\\s"'>=/]+)(${kn}*=${kn}*(?:[^
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),tA=/'/g,iA=/"/g,sA=/^(?:script|style|textarea|title)$/i,Ku=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),fe=Ku(1),Ft=Symbol.for("lit-noChange"),Ge=Symbol.for("lit-nothing"),rA=new WeakMap,ki=Ti.createTreeWalker(Ti,129);function nA(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ja!==void 0?ja.createHTML(e):e}const oA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=_s;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===_s?c[1]==="!--"?o=za:c[1]!==void 0?o=eA:c[2]!==void 0?(sA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Li):c[3]!==void 0&&(o=Li):o===Li?c[0]===">"?(o=r??_s,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Li:c[3]==='"'?iA:tA):o===iA||o===tA?o=Li:o===za||o===eA?o=_s:(o=Li,r=void 0);const d=o===Li&&s[a+1].startsWith("/>")?" ":"";n+=o===_s?A+$u:h>=0?(i.push(l),A.slice(0,h)+Tn+A.slice(h)+li+d):A+li+(h===-2?a:d)}return[nA(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Fs{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]=oA(e,t);if(this.el=Fs.createElement(l,i),ki.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=ki.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Tn)){const u=c[o++],d=r.getAttribute(h).split(li),f=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:f[2],strings:d,ctor:f[1]==="."?AA:f[1]==="?"?lA:f[1]==="@"?cA:Ns}),r.removeAttribute(h)}else h.startsWith(li)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(sA.test(r.tagName)){const h=r.textContent.split(li),u=h.length-1;if(u>0){r.textContent=fr?fr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],ks()),ki.nextNode(),A.push({type:2,index:++n});r.append(h[u],ks())}}}else if(r.nodeType===8)if(r.data===Ln)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(li,h+1))!==-1;)A.push({type:7,index:n}),h+=li.length-1}n++}}static createElement(e,t){const i=Ti.createElement("template");return i.innerHTML=e,i}}function Mi(s,e,t=s,i){if(e===Ft)return e;let r=i!==void 0?t._$Co?.[i]:t._$Cl;const n=Ms(e)?void 0:e._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??=[])[i]=r:t._$Cl=r),r!==void 0&&(e=Mi(s,r._$AS(s,e.values),r,i)),e}class aA{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=(e?.creationScope??Ti).importNode(t,!0);ki.currentNode=r;let n=ki.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new Xi(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new hA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==A?.index&&(n=ki.nextNode(),o++)}return ki.currentNode=Ti,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 Xi{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Ge,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Mi(this,e,t),Ms(e)?e===Ge||e==null||e===""?(this._$AH!==Ge&&this._$AR(),this._$AH=Ge):e!==this._$AH&&e!==Ft&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Za(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==Ge&&Ms(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ti.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Fs.createElement(nA(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(t);else{const n=new aA(r,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=rA.get(e.strings);return t===void 0&&rA.set(e.strings,t=new Fs(e)),t}k(e){Xa(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 Xi(this.S(ks()),this.S(ks()),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){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class Ns{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=Ge,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=Ge}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Mi(this,e,t,0),o=!Ms(e)||e!==this._$AH&&e!==Ft,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Mi(this,a[i+A],t,A),l===Ft&&(l=this._$AH[A]),o||=!Ms(l)||l!==this._$AH[A],l===Ge?e=Ge:e!==Ge&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===Ge?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class AA extends Ns{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ge?void 0:e}}class lA extends Ns{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ge)}}class cA extends Ns{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Mi(this,e,t,0)??Ge)===Ft)return;const i=this._$AH,r=e===Ge&&i!==Ge||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Ge&&(i===Ge||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class hA{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){Mi(this,e)}}const Yu={P:Tn,A:li,C:Ln,M:1,L:oA,R:aA,D:Za,V:Mi,I:Xi,H:Ns,N:lA,U:cA,B:AA,F:hA},Vu=xn.litHtmlPolyfillSupport;Vu?.(Fs,Xi),(xn.litHtmlVersions??=[]).push("3.1.2");const Ju=(s,e,t)=>{const i=t?.renderBefore??e;let r=i._$litPart$;if(r===void 0){const n=t?.renderBefore??null;i._$litPart$=r=new Xi(e.insertBefore(ks(),n),n,void 0,t??{})}return r._$AI(s),r};/**
|
16
|
+
* @license
|
17
|
+
* Copyright 2017 Google LLC
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
19
|
+
*/let Zi=class extends ji{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ju(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ft}};Zi._$litElement$=!0,Zi.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Zi});const Wu=globalThis.litElementPolyfillSupport;Wu?.({LitElement:Zi}),(globalThis.litElementVersions??=[]).push("4.0.4");/**
|
20
|
+
* @license
|
21
|
+
* Copyright 2017 Google LLC
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
23
|
+
*/const qu=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
24
|
+
* @license
|
25
|
+
* Copyright 2017 Google LLC
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
27
|
+
*/const ju={attribute:!0,type:String,converter:dr,reflect:!1,hasChanged:gr},Xu=(s=ju,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function Z(s){return(e,t)=>typeof t=="object"?Xu(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
|
28
|
+
* @license
|
29
|
+
* Copyright 2017 Google LLC
|
30
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
31
|
+
*/function je(s){return Z({...s,state:!0,attribute:!1})}/**
|
32
|
+
* @license
|
33
|
+
* Copyright 2018 Google LLC
|
34
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
35
|
+
*/const _i=s=>s??Ge;/**
|
36
|
+
* @license
|
37
|
+
* Copyright 2020 Google LLC
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
39
|
+
*/const{I:Zu}=Yu,zu=s=>s.strings===void 0,uA=()=>document.createComment(""),Os=(s,e,t)=>{const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const n=i.insertBefore(uA(),r),o=i.insertBefore(uA(),r);t=new Zu(n,o,s,s.options)}else{const n=t._$AB.nextSibling,o=t._$AM,a=o!==s;if(a){let A;t._$AQ?.(s),t._$AM=s,t._$AP!==void 0&&(A=s._$AU)!==o._$AU&&t._$AP(A)}if(n!==r||a){let A=t._$AA;for(;A!==n;){const l=A.nextSibling;i.insertBefore(A,r),A=l}}}return t},Fi=(s,e,t=s)=>(s._$AI(e,t),s),ed={},td=(s,e=ed)=>s._$AH=e,id=s=>s._$AH,Mn=s=>{s._$AP?.(!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const i=e.nextSibling;e.remove(),e=i}};/**
|
40
|
+
* @license
|
41
|
+
* Copyright 2017 Google LLC
|
42
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
43
|
+
*/const zi={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},es=s=>(...e)=>({_$litDirective$:s,values:e});let Us=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
|
44
|
+
* @license
|
45
|
+
* Copyright 2017 Google LLC
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
47
|
+
*/const Ps=(s,e)=>{const t=s._$AN;if(t===void 0)return!1;for(const i of t)i._$AO?.(e,!1),Ps(i,e);return!0},Ir=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while(t?.size===0)},dA=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),nd(e)}};function sd(s){this._$AN!==void 0?(Ir(this),this._$AM=s,dA(this)):this._$AM=s}function rd(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++)Ps(i[n],!1),Ir(i[n]);else i!=null&&(Ps(i,!1),Ir(i));else Ps(this,s)}const nd=s=>{s.type==zi.CHILD&&(s._$AP??=rd,s._$AQ??=sd)};class gA extends Us{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),dA(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ps(this,e),Ir(this))}setValue(e){if(zu(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
|
48
|
+
* @license
|
49
|
+
* Copyright 2020 Google LLC
|
50
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
51
|
+
*/const dt=()=>new od;let od=class{};const _n=new WeakMap,gt=es(class extends gA{render(s){return Ge}update(s,[e]){const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=s.options?.host,this.rt(this.ct=s.element)),Ge}rt(s){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=_n.get(e);t===void 0&&(t=new WeakMap,_n.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){return typeof this.Y=="function"?_n.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function ad(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class Ad{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=dt(),this.host=e,this._events=t,e.addController(this)}register(){return gt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(ad(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
|
52
|
+
* @license
|
53
|
+
* Copyright 2017 Google LLC
|
54
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
55
|
+
*/const ld=Symbol();class Er{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){this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??cd,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=this.A?.())}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){let t,i;e??=this.A(),this.k=e,this.status===1?this.T?.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(o){n=!0,i=o}if(this.u===r){if(t===ld)this.status=0;else{if(n===!1){try{this.m?.(t)}catch{}this.status=2,this.i?.(t)}else{try{this.g?.(i)}catch{}this.status=3,this.o?.(i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){this.status===1&&this.T?.abort(e)}get value(){return this.l}get error(){return this.h}render(e){switch(this.status){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.status)}}}const cd=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!gr(t,e[i]));let pr;const hd=new Uint8Array(16);function ud(){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(hd)}const ct=[];for(let s=0;s<256;++s)ct.push((s+256).toString(16).slice(1));function dd(s,e=0){return ct[s[e+0]]+ct[s[e+1]]+ct[s[e+2]]+ct[s[e+3]]+"-"+ct[s[e+4]]+ct[s[e+5]]+"-"+ct[s[e+6]]+ct[s[e+7]]+"-"+ct[s[e+8]]+ct[s[e+9]]+"-"+ct[s[e+10]]+ct[s[e+11]]+ct[s[e+12]]+ct[s[e+13]]+ct[s[e+14]]+ct[s[e+15]]}const fA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ni(s,e,t){if(fA.randomUUID&&!e&&!s)return fA.randomUUID();s=s||{};const i=s.random||(s.rng||ud)();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 dd(i)}const IA="https://d2rxhdlm2q91uk.cloudfront.net",gd="https://d1ix11aj5kfygl.cloudfront.net",fd="https://d157jlwnudd93d.cloudfront.net",EA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Id="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Ed="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",pd="http://localhost:6060/v2",Cd="https://embed-dev.vouchfor.com/v2",md="https://embed-staging.vouchfor.com/v2",Bd="https://embed.vouchfor.com/v2";function Cr(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:IA,publicApiUrl:EA,embedApiUrl:pd};if(s==="dev")return{videoUrl:IA,publicApiUrl:EA,embedApiUrl:Cd};if(s==="staging")return{videoUrl:gd,publicApiUrl:Id,embedApiUrl:md};if(s==="prod")return{videoUrl:fd,publicApiUrl:Ed,embedApiUrl:Bd}}class yd{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{const{embedApiUrl:n}=Cr(t),o=Ni(),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?.id})),a?.headers?.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)=>{const{embedApiUrl:n}=Cr(t),o=Ni(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return a?.headers?.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 Er(this.host,async([t,i,r,n,o])=>{try{if(e.vouch=void 0,e.template=void 0,r){let a;o&&(this.fetching=!0,a=await this.getTemplate(t,i,o)),this._vouch=r,e.template=a??r?.settings?.template?.instance}else if(n){this.fetching=!0;const[a,A]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=a,e.template=A??a?.settings?.template?.instance}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Er(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t?.questions.items.filter((r,n)=>!i?.length||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 Qd=(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);!vd(r,n)&&i||Object.defineProperty(s,t,n)},vd=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)},Sd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Dd=(s,e)=>`/* Wrapped ${s}*/
|
56
|
+
${e}`,wd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),bd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Rd=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Dd.bind(null,i,e.toString());Object.defineProperty(r,"name",bd);const{writable:n,enumerable:o,configurable:a}=wd;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function xd(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Qd(s,e,r,t);return Sd(s,e),Rd(s,e,i),s}const Td=new WeakMap,pA=new WeakMap;function Fn(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){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 l=setTimeout(()=>{t.delete(o)},i);l.unref?.();const c=pA.get(s)??new Set;c.add(l),pA.set(s,c)}return A};return xd(r,s,{ignoreNonConfigurable:!0}),Td.set(r,t),r}var Ld=(()=>{var s=Ka&&Ka.src||new URL("embed.iife.js",document.baseURI).href;return function(e){e=e||{};var t;t||(t=typeof e<"u"?e:{});var i,r;t.ready=new Promise(function(p,C){i=p,r=C});var n=Object.assign({},t),o="";typeof document<"u"&&document.currentScript&&(o=document.currentScript.src),s&&(o=s),o.indexOf("blob:")!==0?o=o.substr(0,o.replace(/[?#].*/,"").lastIndexOf("/")+1):o="";var a=t.print||console.log.bind(console),A=t.printErr||console.warn.bind(console);Object.assign(t,n),n=null;var l;t.wasmBinary&&(l=t.wasmBinary),t.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var c,h=!1;function u(p,C,x){x=C+x;for(var M="";!(C>=x);){var O=p[C++];if(!O)break;if(O&128){var J=p[C++]&63;if((O&224)==192)M+=String.fromCharCode((O&31)<<6|J);else{var z=p[C++]&63;O=(O&240)==224?(O&15)<<12|J<<6|z:(O&7)<<18|J<<12|z<<6|p[C++]&63,65536>O?M+=String.fromCharCode(O):(O-=65536,M+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else M+=String.fromCharCode(O)}return M}var d,f,g,I,B,S,Q,m,y;function D(){var p=c.buffer;d=p,t.HEAP8=f=new Int8Array(p),t.HEAP16=I=new Int16Array(p),t.HEAP32=S=new Int32Array(p),t.HEAPU8=g=new Uint8Array(p),t.HEAPU16=B=new Uint16Array(p),t.HEAPU32=Q=new Uint32Array(p),t.HEAPF32=m=new Float32Array(p),t.HEAPF64=y=new Float64Array(p)}var v,k=[],P=[],_=[];function U(){var p=t.preRun.shift();k.unshift(p)}var K=0,Y=null;function X(p){throw t.onAbort&&t.onAbort(p),p="Aborted("+p+")",A(p),h=!0,p=new WebAssembly.RuntimeError(p+". Build with -sASSERTIONS for more info."),r(p),p}function R(p){return p.startsWith("data:application/octet-stream;base64,")}var L;if(L="data:application/octet-stream;base64,AGFzbQEAAAABrAM2YAF/AGABfwF/YAJ/fwBgA39/fwBgAn98AGACf38Bf2ADf39/AX9gBH9/f30BfWAAAGADf398AGAEf39/fwBgAX8BfGACf38BfGAFf39/f38Bf2AAAX9gA39/fwF9YAZ/f31/fX8AYAJ/fwF9YAV/f39/fwBgAX8BfWADf35/AX5gB39/f39/f38AYAZ/f39/f38AYAR/f39/AX9gBH9/fX8AYAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA1/fX1/f399fX9/f39/AX9gBn9/fX1/fwBgAn5/AX9gA399fQF9YAN/f30BfWABfAF8YAN/fHwAYAV/f319fQBgBX9/fX19AX1gDX99f31/fX99fX19fX8Bf2ALf39/f39/f319fX0AYAh/f39/f399fQBgBH9/fn4AYAd/f39/f39/AX9gAnx/AXxgBX9/fHx/AGADf39/AXxgBH9/f3wAYAN/f30AYAZ/f31/fX8BfwK1AR4BYQFhABwBYQFiAAMBYQFjAAgBYQFkABUBYQFlABIBYQFmAB0BYQFnAAABYQFoAB4BYQFpAAMBYQFqAAABYQFrABYBYQFsAAoBYQFtAAUBYQFuAAMBYQFvAAIBYQFwABYBYQFxAAYBYQFyAAABYQFzAB8BYQF0AAoBYQF1AA0BYQF2ABUBYQF3AAEBYQF4AAMBYQF5ABcBYQF6AAEBYQFBAAIBYQFCABIBYQFDAAIBYQFEAAADiwKJAgEDEQ8PBwcHBwgAAwoSBiAKBgIGIQcYD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gIIQwAAAACUQwrXIzyUIQQLIANBEGokACAEQwAAAACXQwAAAAAgBCAEWxsLVAACQAJAAkACQAJAIAIOBAQAAQIDCyAAIAEgAUHCAGoQRA8LIAAgASABQcIAaiADEEUPCyAAIAEgAUHCAGoQQw8LECcACyAAIAEgAUHCAGogAxBGC84BAgN/An0jAEEQayIDJABBASEEIANBCGogAEH8AGoiBSAAIAFBAXRqQfYAaiIBLwEAEB8CQAJAIAMqAggiByACKgIAIgZcBEAgByAHWwRAIAItAAQhAgwCCyAGIAZcIQQLIAItAAQhAiAERQ0AIAMtAAwgAkH/AXFGDQELIAUgASAGIAIQNANAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAtwDIgANAAsLIANBEGokAAvOAQIDfwJ9IwBBEGsiAyQAQQEhBCADQQhqIABB/ABqIgUgACABQQF0akHyAGoiAS8BABAfAkACQCADKgIIIgcgAioCACIGXARAIAcgB1sEQCACLQAEIQIMAgsgBiAGXCEECyACLQAEIQIgBEUNACADLQAMIAJB/wFxRg0BCyAFIAEgBiACEDQDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALcAyIADQALCyADQRBqJAALCgAgAEEwa0EKSQsFABACAAsEACAACxQAIAAEQCAAIAAoAgAoAgQRAAALCysBAX8gACgCDCIBBEAgARAoCyAAKAIAIgEEQCAAIAE2AgQgARAoCyAAECgL8QMBA38jAEEQayIDJAAgAEIANwIEIABBwSA7ABUgAEIANwIMIABCgICAgICAgAI3AhggACAALQAXQfgBcToAFyAAIAAtAABB4AFxQQFyOgAAIAAgAC0AFEGAAXE6ABQgAEEgakEAQc4AEC8aIABCADcCkAEgAEGEgBA2AW4gAEIANwFyIABBADYBeiAAQQA6AKQBIABBADYCoAEgAEKAgICAgICA4P8ANwKYASAAQagBakEAQcQBEC8aIABB7AJqIQQgAEGsAWohAgNAIAJCgICA/IuAgM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qKwMACwsAIAAEQCAAECgLCwYAIAAQKAuWAwIDfgJ/IAC9IgJCNIinQf8PcSIEQf8PRgRAIABEAAAAAAAA8D+iIgAgAKMPCyACQgGGIgFCgICAgICAgPD/AFgEQCAARAAAAAAAAAAAoiAAIAFCgICAgICAgPD/AFEbDwsCfiAERQRAQQAhBCACQgyGIgFCAFkEQANAIARBAWshBCABQgGGIgFCAFkNAAsLIAJBASAEa62GDAELIAJC/////////weDQoCAgICAgIAIhAshASAEQf8HSgRAA0ACQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQgGGIQEgBEEBayIEQf8HSg0AC0H/ByEECwJAIAFCgICAgICAgAh9IgNCAFMNACADIgFCAFINACAARAAAAAAAAAAAog8LIAFC/////////wdYBEADQCAEQQFrIQQgAUKAgICAgICABFQhBSABQgGGIQEgBQ0ACwsgAkKAgICAgICAgIB/gyABQoCAgICAgIAIfSAErUI0hoQgAUEBIARrrYggBEEAShuEvwuLAQEDfwNAIABBBHQiAUGkMWogAUGgMWoiAjYCACABQagxaiACNgIAIABBAWoiAEHAAEcNAAtBMBBaGkHUOUEGNgIAQdg5QQA2AgAQkgFB2DlBhDooAgA2AgBBhDpB1Dk2AgBBiDpBuwE2AgBBjDpBADYCABCDAUGMOkGEOigCADYCAEGEOkGIOjYCAAu9AwEHfyAABEAjAEEgayIGJAAgACgCACIBKALcAyIDBEAgAyABEGgaIAFBADYC3AMLIAEoAuQDIgIgASgC4AMiA0cEQEEBIAIgA2tBAnUiAiACQQFNGyEEQQAhAgNAIAMgAkECdGooAgBBADYC3AMgAkEBaiICIARHDQALCyABIAM2AuQDAkAgAyABQegDaiICKAIARg0AIAZBCGpBAEEAIAIQQiICKAIEIAEoAuQDIAEoAuADIgRrIgVrIgMgBCAFEDEhBSABKALgAyEEIAEgBTYC4AMgAiAENgIEIAEoAuQDIQUgASACKAIINgLkAyACIAU2AgggASgC6AMhByABIAIoAgw2AugDIAIgBDYCACACI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AQQELC8QCAAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAFBCWsOEgAKCwwKCwIDBAUMCwwMCgsHCAkLIAIgAigCACIBQQRqNgIAIAAgASgCADYCAA8LAAsgAiACKAIAIgFBBGo2AgAgACABMgEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMwEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMAAANwMADwsgAiACKAIAIgFBBGo2AgAgACABMQAANwMADwsACyACIAIoAgBBB2pBeHEiAUEIajYCACAAIAErAwA5AwAPCyAAIAIgAxECAAsPCyACIAIoAgAiAUEEajYCACAAIAE0AgA3AwAPCyACIAIoAgAiAUEEajYCACAAIAE1AgA3AwAPCyACIAIoAgBBB2pBeHEiAUEIajYCACAAIAEpAwA3AwALXQEEfyAAKAIAIQIDQCACLAAAIgMQTwRAQX8hBCAAIAJBAWoiAjYCACABQcyZs+YATQR/QX8gA0EwayIDIAFBCmwiBGogAyAEQf////8Hc0obBSAECyEBDAELCyABC6gUAhJ/AX4jAEHQAGsiCCQAIAggATYCTCAIQTdqIRcgCEE4aiEUAkACQAJAAkADQCABIQ0gByAOQf////8Hc0oNASAHIA5qIQ4CQAJAAkAgDSIHLQAAIgkEQANAAkACQCAJQf8BcSIBRQRAIAchAQwBCyABQSVHDQEgByEJA0AgCS0AAUElRwRAIAkhAQwCCyAHQQFqIQcgCS0AAiEKIAlBAmoiASEJIApBJUYNAAsLIAcgDWsiByAOQf////8HcyIYSg0HIAAEQCAAIA0gBxApCyAHDQYgCCABNgJMIAFBAWohB0F/IRICQCABLAABIgoQT0UNACABLQACQSRHDQAgAUEDaiEHIApBMGshEkEBIRULIAggBzYCTEEAIQwCQCAHLAAAIglBIGsiAUEfSwRAIAchCgwBCyAHIQpBASABdCIBQYnRBHFFDQADQCAIIAdBAWoiCjYCTCABIAxyIQwgBywAASIJQSBrIgFBIE8NASAKIQdBASABdCIBQYnRBHENAAsLAkAgCUEqRgRAAn8CQCAKLAABIgEQT0UNACAKLQACQS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CBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhAsGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBAsGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8iIQhAiAIKQMQIAgpAxiEQgBSrSADQv//////////D4OEIgNCgYCAgICAgIAIWgRAIAJCAXwhAgwBCyADQoCAgICAgICACFINACACQgGDIAJ8IQILIAhBIGokACAJIAIgBkKAgICAgICAgIB/g4S/OQMAC5kYAxJ/AXwDfiMAQbAEayIMJAAgDEEANgIsAkAgAb0iGUIAUwRAQQEhEUGZCSETIAGaIg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gCBCIFQQF1aiEBIAAoAgAhACABIAIgAyAEIAVBAXEEfyABKAIAIABqKAIABSAACxEbAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEREACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRDAALNQEBfyABIAAoAgQiAkEBdWohASAAKAIAIQAgASACQQFxBH8gASgCACAAaigCAAUgAAsRCwALYQECfyMAQRBrIgIkACABIAAoAgQiA0EBdWohASAAKAIAIQAgAiABIANBAXEEfyABKAIAIABqKAIABSAACxECAEEQEB4iACACKQMINwMIIAAgAikDADcDACACQRBqJAAgAAtjAQJ/IwBBEGsiAyQAIAEgACgCBCIEQQF1aiEBIAAoAgAhACADIAEgAiAEQQFxBH8gASgCACAAaigCAAUgAAsRAwBBEBAeIgAgAykDCDcDCCAAIAMpAwA3AwAgA0EQaiQAIAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEEAAs5AQF/IAEgACgCBCIEQQF1aiEBIAAoAgAhACABIAIgAyAEQQFxBH8gASgCACAAaigCAAUgAAsRCQALCQAgASAAEQEACwUAQf85Cw8AIAEgACgCAGogAjYCAAsNACABIAAoAgBqKAIACxgBAX9BEBAeIgBCADcDCCAAQQA2AgAgAAsYAQF/QRAQHiIAQgA3AwAgAEIANwMIIAALDABBMBAeQQBBMBAvCzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRGgALBQBB+jkLIQAgACABKAIAIAEgASwAC0EASBtB9zkgAigCABAQNgIACyoBAX9BDBAeIgFBADoABCABIAAoAgA2AgggAEEANgIAIAFBmCY2AgAgAQsFAEH3OQsFAEH0OQshACAAIAEoAgAgASABLAALQQBIG0HgOSACKAIAEBA2AgAL2AEBBH8jAEEgayIDJAAgASgCACIEQfD///8HSQRAA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FIAJBFGohAQNAIAFCgICA/IuAgMC/fzcCECABQoGAgIAQNwIIIAFCgICA/IuAgMC/fzcCACABQRhqIgEgBUcNAAsgAkKAgID8i4CAwL9/NwLkASACQoGAgIAQNwLcASACQoCAgPyLgIDAv383AtQBIAJCgICA/oeAgOD/ADcD+AEgAkKAgID+h4CA4P8ANwPwASACIAItAOwBQfgBcToA7AEgAkGAAmpBAEHAABAvGiADQZgBaiACQcACECwaIANBADYC3AMLA0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC3AMiAA0ACwsgBEHAAmokAAuyBwEIfyMAQdAAayIHJAAgACgCACEAAkACQCABKAIAIggoAtwDRQRAIAAoAggNASAAKALgAyIBIAJBAnRqIQYCQCAAKALkAyIEIABB6ANqIgMoAgAiBUkEQCAEIAZGBEAgBiAINgIAIAAgBkEEajYC5AMMAgsgBCAEIgJBBGsiAUsEQANAIAIgASgCADYCACACQQRqIQIgAUEEaiIBIARJDQALCyAAIAI2AuQDIAZBBGoiASAERwRAIAQgBCABayIBQXxxayAGIAEQMRoLIAYgCDYCAAwBCyAEIAFrQQJ1QQFqIgRBgICAgARPDQMCQCAHQSBqQf////8DIAUgAWsiAUEBdSIFIAQgBCAFSRsgAUH8////B08bIAIgAxBCIgMoAggiAiADKAIMRw0AIAMoAgQiASADKAIAIgRLBEAgAyABIAEgBGtBAnVBAWpBfm1BAnQiBGogASACIAFrIgEQMSABaiICNgIIIAMgAygCBCAEajYCBAwBCyAHQThqQQEgAiAEa0EBdSACIARGGyIBIAFBAnYgAygCEBBCIgUoAgghBAJ/IAMoAggiAiADKAIEIgFGBEAgBCECIAEMAQsgBCACIAFraiECA0AgBCABKAIANgIAIAFBBGohASAEQQRqIgQgAkcNAAsgAygCCCEBIAMoAgQLIQQgAygCACEJIAMgBSgCADYCACAFIAk2AgAgAyAFKAIENgIEIAUgBDYCBCADIAI2AgggBSABNgIIIAMoAgwhCiADIAUoAg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File?t.locateFile(W,o):o+W}function b(){var p=L;try{if(p==L&&l)return new Uint8Array(l);if(R(p))try{var C=TB(p.slice(37)),x=new Uint8Array(C.length);for(p=0;p<C.length;++p)x[p]=C.charCodeAt(p);var M=x}catch{throw Error("Converting base64 string to bytes failed.")}else M=void 0;var O=M;if(O)return O;throw"both async and sync fetching of the wasm failed"}catch(J){X(J)}}function w(){return l||typeof fetch!="function"?Promise.resolve().then(function(){return b()}):fetch(L,{credentials:"same-origin"}).then(function(p){if(!p.ok)throw"failed to load wasm binary file at '"+L+"'";return p.arrayBuffer()}).catch(function(){return b()})}function T(p){for(;0<p.length;)p.shift()(t)}function V(p){if(p===void 0)return"_unknown";p=p.replace(/[^a-zA-Z0-9_]/g,"$");var C=p.charCodeAt(0);return 48<=C&&57>=C?"_"+p:p}function H(p,C){return p=V(p),function(){return C.apply(this,arguments)}}var q=[{},{value:void 0},{value:null},{value:!0},{value:!1}],se=[];function ce(p){var C=Error,x=H(p,function(M){this.name=p,this.message=M,M=Error(M).stack,M!==void 0&&(this.stack=this.toString()+`
|
57
|
+
`+M.replace(/^Error(:[^\n]*)?\n/,""))});return x.prototype=Object.create(C.prototype),x.prototype.constructor=x,x.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},x}var de=void 0;function re(p){throw new de(p)}var me=p=>(p||re("Cannot use deleted val. handle = "+p),q[p].value),Te=p=>{switch(p){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var C=se.length?se.pop():q.length;return q[C]={ga:1,value:p},C}},Le=void 0,Ce=void 0;function Ie(p){for(var C="";g[p];)C+=Ce[g[p++]];return C}var Be=[];function He(){for(;Be.length;){var p=Be.pop();p.M.$=!1,p.delete()}}var ye=void 0,_e={};function Ze(p,C){for(C===void 0&&re("ptr should not be undefined");p.R;)C=p.ba(C),p=p.R;return C}var We={};function Ht(p){p=Ru(p);var C=Ie(p);return Bi(p),C}function ut(p,C){var x=We[p];return x===void 0&&re(C+" has unknown type "+Ht(p)),x}function at(){}var Qe=!1;function At(p){--p.count.value,p.count.value===0&&(p.T?p.U.W(p.T):p.P.N.W(p.O))}function vt(p,C,x){return C===x?p:x.R===void 0?null:(p=vt(p,C,x.R),p===null?null:x.na(p))}var wt={};function ze(p,C){return C=Ze(p,C),_e[C]}var It=void 0;function $t(p){throw new It(p)}function et(p,C){return C.P&&C.O||$t("makeClassHandle requires ptr and ptrType"),!!C.U!=!!C.T&&$t("Both smartPtrType and smartPtr must be specified"),C.count={value:1},St(Object.create(p,{M:{value:C}}))}function St(p){return typeof FinalizationRegistry>"u"?(St=C=>C,p):(Qe=new FinalizationRegistry(C=>{At(C.M)}),St=C=>{var x=C.M;return x.T&&Qe.register(C,{M:x},C),C},at=C=>{Qe.unregister(C)},St(p))}var ai={};function Ci(p){for(;p.length;){var C=p.pop();p.pop()(C)}}function Et(p){return this.fromWireType(S[p>>2])}var $={},ae={};function Ae(p,C,x){function M(ee){ee=x(ee),ee.length!==p.length&&$t("Mismatched type converter count");for(var ie=0;ie<p.length;++ie)pe(p[ie],ee[ie])}p.forEach(function(ee){ae[ee]=C});var O=Array(C.length),J=[],z=0;C.forEach((ee,ie)=>{We.hasOwnProperty(ee)?O[ie]=We[ee]:(J.push(ee),$.hasOwnProperty(ee)||($[ee]=[]),$[ee].push(()=>{O[ie]=We[ee],++z,z===J.length&&M(O)}))}),J.length===0&&M(O)}function Se(p){switch(p){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+p)}}function pe(p,C,x={}){if(!("argPackAdvance"in C))throw new TypeError("registerType registeredInstance requires argPackAdvance");var M=C.name;if(p||re('type "'+M+'" must have a positive integer typeid pointer'),We.hasOwnProperty(p)){if(x.ua)return;re("Cannot register type '"+M+"' twice")}We[p]=C,delete ae[p],$.hasOwnProperty(p)&&(C=$[p],delete $[p],C.forEach(O=>O()))}function tt(p){re(p.M.P.N.name+" instance already deleted")}function $e(){}function Ai(p,C,x){if(p[C].S===void 0){var M=p[C];p[C]=function(){return p[C].S.hasOwnProperty(arguments.length)||re("Function '"+x+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+p[C].S+")!"),p[C].S[arguments.length].apply(this,arguments)},p[C].S=[],p[C].S[M.Z]=M}}function Qn(p,C){t.hasOwnProperty(p)?(re("Cannot register public name '"+p+"' twice"),Ai(t,p,p),t.hasOwnProperty(void 0)&&re("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),t[p].S[void 0]=C):t[p]=C}function mi(p,C,x,M,O,J,z,ee){this.name=p,this.constructor=C,this.X=x,this.W=M,this.R=O,this.pa=J,this.ba=z,this.na=ee,this.ja=[]}function qi(p,C,x){for(;C!==x;)C.ba||re("Expected null or instance of "+x.name+", got an instance of "+C.name),p=C.ba(p),C=C.R;return p}function Rs(p,C){return C===null?(this.ea&&re("null is not a valid "+this.name),0):(C.M||re('Cannot pass "'+Ha(C)+'" as a '+this.name),C.M.O||re("Cannot pass deleted object as a pointer of type "+this.name),qi(C.M.O,C.M.P.N,this.N))}function xi(p,C){if(C===null){if(this.ea&&re("null is not a valid "+this.name),this.da){var x=this.fa();return p!==null&&p.push(this.W,x),x}return 0}if(C.M||re('Cannot pass "'+Ha(C)+'" as a '+this.name),C.M.O||re("Cannot pass deleted object as a pointer of type "+this.name),!this.ca&&C.M.P.ca&&re("Cannot convert argument of type "+(C.M.U?C.M.U.name:C.M.P.name)+" to parameter type "+this.name),x=qi(C.M.O,C.M.P.N,this.N),this.da)switch(C.M.T===void 0&&re("Passing raw pointer to smart pointer is illegal"),this.Ba){case 0:C.M.U===this?x=C.M.T:re("Cannot convert argument of type "+(C.M.U?C.M.U.name:C.M.P.name)+" to parameter type "+this.name);break;case 1:x=C.M.T;break;case 2:if(C.M.U===this)x=C.M.T;else{var M=C.clone();x=this.xa(x,Te(function(){M.delete()})),p!==null&&p.push(this.W,x)}break;default:re("Unsupporting sharing policy")}return x}function Oa(p,C){return C===null?(this.ea&&re("null is not a valid "+this.name),0):(C.M||re('Cannot pass "'+Ha(C)+'" as a '+this.name),C.M.O||re("Cannot pass deleted object as a pointer of type "+this.name),C.M.P.ca&&re("Cannot convert argument of type "+C.M.P.name+" to parameter type "+this.name),qi(C.M.O,C.M.P.N,this.N))}function bt(p,C,x,M){this.name=p,this.N=C,this.ea=x,this.ca=M,this.da=!1,this.W=this.xa=this.fa=this.ka=this.Ba=this.wa=void 0,C.R!==void 0?this.toWireType=xi:(this.toWireType=M?Rs:Oa,this.V=null)}function xs(p,C){t.hasOwnProperty(p)||$t("Replacing nonexistant public symbol"),t[p]=C,t[p].Z=void 0}function pB(p,C){var x=[];return function(){if(x.length=0,Object.assign(x,arguments),p.includes("j")){var M=t["dynCall_"+p];M=x&&x.length?M.apply(null,[C].concat(x)):M.call(null,C)}else M=v.get(C).apply(null,x);return M}}function Kt(p,C){p=Ie(p);var x=p.includes("j")?pB(p,C):v.get(C);return typeof x!="function"&&re("unknown function pointer with signature "+p+": "+C),x}var Su=void 0;function vn(p,C){function x(J){O[J]||We[J]||(ae[J]?ae[J].forEach(x):(M.push(J),O[J]=!0))}var M=[],O={};throw C.forEach(x),new Su(p+": "+M.map(Ht).join([", "]))}function Ua(p,C,x,M,O){var J=C.length;2>J&&re("argTypes array size mismatch! Must at least get return value and 'this' types!");var z=C[1]!==null&&x!==null,ee=!1;for(x=1;x<C.length;++x)if(C[x]!==null&&C[x].V===void 0){ee=!0;break}var ie=C[0].name!=="void",te=J-2,ne=Array(te),ge=[],we=[];return function(){if(arguments.length!==te&&re("function "+p+" called with "+arguments.length+" arguments, expected "+te+" args!"),we.length=0,ge.length=z?2:1,ge[0]=O,z){var qe=C[1].toWireType(we,this);ge[1]=qe}for(var xe=0;xe<te;++xe)ne[xe]=C[xe+2].toWireType(we,arguments[xe]),ge.push(ne[xe]);if(xe=M.apply(null,ge),ee)Ci(we);else for(var Rt=z?1:2;Rt<C.length;Rt++){var Yt=Rt===1?qe:ne[Rt-2];C[Rt].V!==null&&C[Rt].V(Yt)}return qe=ie?C[0].fromWireType(xe):void 0,qe}}function Pa(p,C){for(var x=[],M=0;M<p;M++)x.push(Q[C+4*M>>2]);return x}function Ga(p){4<p&&--q[p].ga===0&&(q[p]=void 0,se.push(p))}function Ha(p){if(p===null)return"null";var C=typeof p;return C==="object"||C==="array"||C==="function"?p.toString():""+p}function CB(p,C){switch(C){case 2:return function(x){return this.fromWireType(m[x>>2])};case 3:return function(x){return this.fromWireType(y[x>>3])};default:throw new TypeError("Unknown float type: "+p)}}function mB(p,C,x){switch(C){case 0:return x?function(M){return f[M]}:function(M){return g[M]};case 1:return x?function(M){return I[M>>1]}:function(M){return B[M>>1]};case 2:return x?function(M){return S[M>>2]}:function(M){return Q[M>>2]};default:throw new TypeError("Unknown integer type: "+p)}}function BB(p,C){for(var x="",M=0;!(M>=C/2);++M){var O=I[p+2*M>>1];if(O==0)break;x+=String.fromCharCode(O)}return x}function yB(p,C,x){if(x===void 0&&(x=2147483647),2>x)return 0;x-=2;var M=C;x=x<2*p.length?x/2:p.length;for(var O=0;O<x;++O)I[C>>1]=p.charCodeAt(O),C+=2;return I[C>>1]=0,C-M}function QB(p){return 2*p.length}function vB(p,C){for(var x=0,M="";!(x>=C/4);){var O=S[p+4*x>>2];if(O==0)break;++x,65536<=O?(O-=65536,M+=String.fromCharCode(55296|O>>10,56320|O&1023)):M+=String.fromCharCode(O)}return M}function SB(p,C,x){if(x===void 0&&(x=2147483647),4>x)return 0;var M=C;x=M+x-4;for(var O=0;O<p.length;++O){var J=p.charCodeAt(O);if(55296<=J&&57343>=J){var z=p.charCodeAt(++O);J=65536+((J&1023)<<10)|z&1023}if(S[C>>2]=J,C+=4,C+4>x)break}return S[C>>2]=0,C-M}function DB(p){for(var C=0,x=0;x<p.length;++x){var M=p.charCodeAt(x);55296<=M&&57343>=M&&++x,C+=4}return C}var wB={};function Du(p){var C=wB[p];return C===void 0?Ie(p):C}var Sn=[];function bB(p){var C=Sn.length;return Sn.push(p),C}function RB(p,C){for(var x=Array(p),M=0;M<p;++M)x[M]=ut(Q[C+4*M>>2],"parameter "+M);return x}var wu=[],xB=[null,[],[]];de=t.BindingError=ce("BindingError"),t.count_emval_handles=function(){for(var p=0,C=5;C<q.length;++C)q[C]!==void 0&&++p;return p},t.get_first_emval=function(){for(var p=5;p<q.length;++p)if(q[p]!==void 0)return q[p];return null},Le=t.PureVirtualError=ce("PureVirtualError");for(var bu=Array(256),Dn=0;256>Dn;++Dn)bu[Dn]=String.fromCharCode(Dn);Ce=bu,t.getInheritedInstanceCount=function(){return Object.keys(_e).length},t.getLiveInheritedInstances=function(){var p=[],C;for(C in _e)_e.hasOwnProperty(C)&&p.push(_e[C]);return p},t.flushPendingDeletes=He,t.setDelayFunction=function(p){ye=p,Be.length&&ye&&ye(He)},It=t.InternalError=ce("InternalError"),$e.prototype.isAliasOf=function(p){if(!(this instanceof $e&&p instanceof $e))return!1;var C=this.M.P.N,x=this.M.O,M=p.M.P.N;for(p=p.M.O;C.R;)x=C.ba(x),C=C.R;for(;M.R;)p=M.ba(p),M=M.R;return C===M&&x===p},$e.prototype.clone=function(){if(this.M.O||tt(this),this.M.aa)return this.M.count.value+=1,this;var p=St,C=Object,x=C.create,M=Object.getPrototypeOf(this),O=this.M;return p=p(x.call(C,M,{M:{value:{count:O.count,$:O.$,aa:O.aa,O:O.O,P:O.P,T:O.T,U:O.U}}})),p.M.count.value+=1,p.M.$=!1,p},$e.prototype.delete=function(){this.M.O||tt(this),this.M.$&&!this.M.aa&&re("Object already scheduled for deletion"),at(this),At(this.M),this.M.aa||(this.M.T=void 0,this.M.O=void 0)},$e.prototype.isDeleted=function(){return!this.M.O},$e.prototype.deleteLater=function(){return this.M.O||tt(this),this.M.$&&!this.M.aa&&re("Object already scheduled for deletion"),Be.push(this),Be.length===1&&ye&&ye(He),this.M.$=!0,this},bt.prototype.qa=function(p){return this.ka&&(p=this.ka(p)),p},bt.prototype.ha=function(p){this.W&&this.W(p)},bt.prototype.argPackAdvance=8,bt.prototype.readValueFromPointer=Et,bt.prototype.deleteObject=function(p){p!==null&&p.delete()},bt.prototype.fromWireType=function(p){function C(){return this.da?et(this.N.X,{P:this.wa,O:x,U:this,T:p}):et(this.N.X,{P:this,O:p})}var x=this.qa(p);if(!x)return this.ha(p),null;var M=ze(this.N,x);if(M!==void 0)return M.M.count.value===0?(M.M.O=x,M.M.T=p,M.clone()):(M=M.clone(),this.ha(p),M);if(M=this.N.pa(x),M=wt[M],!M)return C.call(this);M=this.ca?M.la:M.pointerType;var O=vt(x,this.N,M.N);return O===null?C.call(this):this.da?et(M.N.X,{P:M,O,U:this,T:p}):et(M.N.X,{P:M,O})},Su=t.UnboundTypeError=ce("UnboundTypeError");var TB=typeof atob=="function"?atob:function(p){var C="",x=0;p=p.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(p.charAt(x++)),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(p.charAt(x++)),J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(p.charAt(x++)),z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(p.charAt(x++));M=M<<2|O>>4,O=(O&15)<<4|J>>2;var ee=(J&3)<<6|z;C+=String.fromCharCode(M),J!==64&&(C+=String.fromCharCode(O)),z!==64&&(C+=String.fromCharCode(ee))}while(x<p.length);return C},LB={l:function(p,C,x,M){X("Assertion failed: "+(p?u(g,p):"")+", at: "+[C?C?u(g,C):"":"unknown filename",x,M?M?u(g,M):"":"unknown function"])},q:function(p,C,x){p=Ie(p),C=ut(C,"wrapper"),x=me(x);var M=[].slice,O=C.N,J=O.X,z=O.R.X,ee=O.R.constructor;p=H(p,function(){O.R.ja.forEach(function(te){if(this[te]===z[te])throw new Le("Pure virtual function "+te+" must be implemented in JavaScript")}.bind(this)),Object.defineProperty(this,"__parent",{value:J}),this.__construct.apply(this,M.call(arguments))}),J.__construct=function(){this===J&&re("Pass correct 'this' to __construct");var te=ee.implement.apply(void 0,[this].concat(M.call(arguments)));at(te);var ne=te.M;te.notifyOnDestruction(),ne.aa=!0,Object.defineProperties(this,{M:{value:ne}}),St(this),te=ne.O,te=Ze(O,te),_e.hasOwnProperty(te)?re("Tried to register registered instance: "+te):_e[te]=this},J.__destruct=function(){this===J&&re("Pass correct 'this' to __destruct"),at(this);var te=this.M.O;te=Ze(O,te),_e.hasOwnProperty(te)?delete _e[te]:re("Tried to unregister unregistered instance: "+te)},p.prototype=Object.create(J);for(var ie in x)p.prototype[ie]=x[ie];return Te(p)},j:function(p){var C=ai[p];delete ai[p];var x=C.fa,M=C.W,O=C.ia,J=O.map(z=>z.ta).concat(O.map(z=>z.za));Ae([p],J,z=>{var ee={};return O.forEach((ie,te)=>{var ne=z[te],ge=ie.ra,we=ie.sa,qe=z[te+O.length],xe=ie.ya,Rt=ie.Aa;ee[ie.oa]={read:Yt=>ne.fromWireType(ge(we,Yt)),write:(Yt,cr)=>{var yi=[];xe(Rt,Yt,qe.toWireType(yi,cr)),Ci(yi)}}}),[{name:C.name,fromWireType:function(ie){var te={},ne;for(ne in ee)te[ne]=ee[ne].read(ie);return M(ie),te},toWireType:function(ie,te){for(var ne in ee)if(!(ne in te))throw new TypeError('Missing field: "'+ne+'"');var ge=x();for(ne in ee)ee[ne].write(ge,te[ne]);return ie!==null&&ie.push(M,ge),ge},argPackAdvance:8,readValueFromPointer:Et,V:M}]})},v:function(){},B:function(p,C,x,M,O){var J=Se(x);C=Ie(C),pe(p,{name:C,fromWireType:function(z){return!!z},toWireType:function(z,ee){return ee?M:O},argPackAdvance:8,readValueFromPointer:function(z){if(x===1)var ee=f;else if(x===2)ee=I;else if(x===4)ee=S;else throw new TypeError("Unknown boolean type size: "+C);return this.fromWireType(ee[z>>J])},V:null})},f:function(p,C,x,M,O,J,z,ee,ie,te,ne,ge,we){ne=Ie(ne),J=Kt(O,J),ee&&(ee=Kt(z,ee)),te&&(te=Kt(ie,te)),we=Kt(ge,we);var qe=V(ne);Qn(qe,function(){vn("Cannot construct "+ne+" due to unbound types",[M])}),Ae([p,C,x],M?[M]:[],function(xe){if(xe=xe[0],M)var Rt=xe.N,Yt=Rt.X;else Yt=$e.prototype;xe=H(qe,function(){if(Object.getPrototypeOf(this)!==cr)throw new de("Use 'new' to construct "+ne);if(yi.Y===void 0)throw new de(ne+" has no accessible constructor");var Lu=yi.Y[arguments.length];if(Lu===void 0)throw new de("Tried to invoke ctor of "+ne+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(yi.Y).toString()+") parameters instead!");return Lu.apply(this,arguments)});var cr=Object.create(Yt,{constructor:{value:xe}});xe.prototype=cr;var yi=new mi(ne,xe,cr,we,Rt,J,ee,te);Rt=new bt(ne,yi,!0,!1),Yt=new bt(ne+"*",yi,!1,!1);var Tu=new bt(ne+" const*",yi,!1,!0);return wt[p]={pointerType:Yt,la:Tu},xs(qe,xe),[Rt,Yt,Tu]})},d:function(p,C,x,M,O,J,z){var ee=Pa(x,M);C=Ie(C),J=Kt(O,J),Ae([],[p],function(ie){function te(){vn("Cannot call "+ne+" due to unbound types",ee)}ie=ie[0];var ne=ie.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]);var ge=ie.N.constructor;return ge[C]===void 0?(te.Z=x-1,ge[C]=te):(Ai(ge,C,ne),ge[C].S[x-1]=te),Ae([],ee,function(we){return we=Ua(ne,[we[0],null].concat(we.slice(1)),null,J,z),ge[C].S===void 0?(we.Z=x-1,ge[C]=we):ge[C].S[x-1]=we,[]}),[]})},p:function(p,C,x,M,O,J){0<C||X();var z=Pa(C,x);O=Kt(M,O),Ae([],[p],function(ee){ee=ee[0];var ie="constructor "+ee.name;if(ee.N.Y===void 0&&(ee.N.Y=[]),ee.N.Y[C-1]!==void 0)throw new de("Cannot register multiple constructors with identical number of parameters ("+(C-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.N.Y[C-1]=()=>{vn("Cannot construct "+ee.name+" due to unbound types",z)},Ae([],z,function(te){return te.splice(1,0,null),ee.N.Y[C-1]=Ua(ie,te,null,O,J),[]}),[]})},a:function(p,C,x,M,O,J,z,ee){var ie=Pa(x,M);C=Ie(C),J=Kt(O,J),Ae([],[p],function(te){function ne(){vn("Cannot call "+ge+" due to unbound types",ie)}te=te[0];var ge=te.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]),ee&&te.N.ja.push(C);var we=te.N.X,qe=we[C];return qe===void 0||qe.S===void 0&&qe.className!==te.name&&qe.Z===x-2?(ne.Z=x-2,ne.className=te.name,we[C]=ne):(Ai(we,C,ge),we[C].S[x-2]=ne),Ae([],ie,function(xe){return xe=Ua(ge,xe,te,J,z),we[C].S===void 0?(xe.Z=x-2,we[C]=xe):we[C].S[x-2]=xe,[]}),[]})},A:function(p,C){C=Ie(C),pe(p,{name:C,fromWireType:function(x){var M=me(x);return Ga(x),M},toWireType:function(x,M){return Te(M)},argPackAdvance:8,readValueFromPointer:Et,V:null})},n:function(p,C,x){x=Se(x),C=Ie(C),pe(p,{name:C,fromWireType:function(M){return M},toWireType:function(M,O){return O},argPackAdvance:8,readValueFromPointer:CB(C,x),V:null})},e:function(p,C,x,M,O){C=Ie(C),O===-1&&(O=4294967295),O=Se(x);var J=ee=>ee;if(M===0){var z=32-8*x;J=ee=>ee<<z>>>z}x=C.includes("unsigned")?function(ee,ie){return ie>>>0}:function(ee,ie){return ie},pe(p,{name:C,fromWireType:J,toWireType:x,argPackAdvance:8,readValueFromPointer:mB(C,O,M!==0),V:null})},b:function(p,C,x){function M(J){J>>=2;var z=Q;return new O(d,z[J+1],z[J])}var O=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][C];x=Ie(x),pe(p,{name:x,fromWireType:M,argPackAdvance:8,readValueFromPointer:M},{ua:!0})},o:function(p,C){C=Ie(C);var x=C==="std::string";pe(p,{name:C,fromWireType:function(M){var O=Q[M>>2],J=M+4;if(x)for(var z=J,ee=0;ee<=O;++ee){var ie=J+ee;if(ee==O||g[ie]==0){if(z=z?u(g,z,ie-z):"",te===void 0)var te=z;else te+="\0",te+=z;z=ie+1}}else{for(te=Array(O),ee=0;ee<O;++ee)te[ee]=String.fromCharCode(g[J+ee]);te=te.join("")}return Bi(M),te},toWireType:function(M,O){O instanceof ArrayBuffer&&(O=new Uint8Array(O));var J,z=typeof O=="string";if(z||O instanceof Uint8Array||O instanceof Uint8ClampedArray||O instanceof Int8Array||re("Cannot pass non-string to std::string"),x&&z){var ee=0;for(J=0;J<O.length;++J){var ie=O.charCodeAt(J);127>=ie?ee++:2047>=ie?ee+=2:55296<=ie&&57343>=ie?(ee+=4,++J):ee+=3}J=ee}else J=O.length;if(ee=$a(4+J+1),ie=ee+4,Q[ee>>2]=J,x&&z){if(z=ie,ie=J+1,J=g,0<ie){ie=z+ie-1;for(var te=0;te<O.length;++te){var ne=O.charCodeAt(te);if(55296<=ne&&57343>=ne){var ge=O.charCodeAt(++te);ne=65536+((ne&1023)<<10)|ge&1023}if(127>=ne){if(z>=ie)break;J[z++]=ne}else{if(2047>=ne){if(z+1>=ie)break;J[z++]=192|ne>>6}else{if(65535>=ne){if(z+2>=ie)break;J[z++]=224|ne>>12}else{if(z+3>=ie)break;J[z++]=240|ne>>18,J[z++]=128|ne>>12&63}J[z++]=128|ne>>6&63}J[z++]=128|ne&63}}J[z]=0}}else if(z)for(z=0;z<J;++z)te=O.charCodeAt(z),255<te&&(Bi(ie),re("String has UTF-16 code units that do not fit in 8 bits")),g[ie+z]=te;else for(z=0;z<J;++z)g[ie+z]=O[z];return M!==null&&M.push(Bi,ee),ee},argPackAdvance:8,readValueFromPointer:Et,V:function(M){Bi(M)}})},i:function(p,C,x){if(x=Ie(x),C===2)var M=BB,O=yB,J=QB,z=()=>B,ee=1;else C===4&&(M=vB,O=SB,J=DB,z=()=>Q,ee=2);pe(p,{name:x,fromWireType:function(ie){for(var te=Q[ie>>2],ne=z(),ge,we=ie+4,qe=0;qe<=te;++qe){var xe=ie+4+qe*C;(qe==te||ne[xe>>ee]==0)&&(we=M(we,xe-we),ge===void 0?ge=we:(ge+="\0",ge+=we),we=xe+C)}return Bi(ie),ge},toWireType:function(ie,te){typeof te!="string"&&re("Cannot pass non-string to C++ string type "+x);var ne=J(te),ge=$a(4+ne+C);return Q[ge>>2]=ne>>ee,O(te,ge+4,ne+C),ie!==null&&ie.push(Bi,ge),ge},argPackAdvance:8,readValueFromPointer:Et,V:function(ie){Bi(ie)}})},k:function(p,C,x,M,O,J){ai[p]={name:Ie(C),fa:Kt(x,M),W:Kt(O,J),ia:[]}},h:function(p,C,x,M,O,J,z,ee,ie,te){ai[p].ia.push({oa:Ie(C),ta:x,ra:Kt(M,O),sa:J,za:z,ya:Kt(ee,ie),Aa:te})},C:function(p,C){C=Ie(C),pe(p,{va:!0,name:C,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(p,C,x,M,O){p=Sn[p],C=me(C),x=Du(x);var J=[];return Q[M>>2]=Te(J),p(C,x,J,O)},t:function(p,C,x,M){p=Sn[p],C=me(C),x=Du(x),p(C,x,null,M)},g:Ga,m:function(p,C){var x=RB(p,C),M=x[0];C=M.name+"_$"+x.slice(1).map(function(z){return z.name}).join("_")+"$";var O=wu[C];if(O!==void 0)return O;var J=Array(p-1);return O=bB((z,ee,ie,te)=>{for(var ne=0,ge=0;ge<p-1;++ge)J[ge]=x[ge+1].readValueFromPointer(te+ne),ne+=x[ge+1].argPackAdvance;for(z=z[ee].apply(z,J),ge=0;ge<p-1;++ge)x[ge+1].ma&&x[ge+1].ma(J[ge]);if(!M.va)return M.toWireType(ie,z)}),wu[C]=O},D:function(p){4<p&&(q[p].ga+=1)},r:function(p){var C=me(p);Ci(C),Ga(p)},c:function(){X("")},x:function(p,C,x){g.copyWithin(p,C,C+x)},w:function(p){var C=g.length;if(p>>>=0,2147483648<p)return!1;for(var x=1;4>=x;x*=2){var M=C*(1+.2/x);M=Math.min(M,p+100663296);var O=Math;M=Math.max(p,M),O=O.min.call(O,2147483648,M+(65536-M%65536)%65536);e:{try{c.grow(O-d.byteLength+65535>>>16),D();var J=1;break e}catch{}J=void 0}if(J)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(p,C,x,M){for(var O=0,J=0;J<x;J++){var z=Q[C>>2],ee=Q[C+4>>2];C+=8;for(var ie=0;ie<ee;ie++){var te=g[z+ie],ne=xB[p];te===0||te===10?((p===1?a:A)(u(ne,0)),ne.length=0):ne.push(te)}O+=ee}return Q[M>>2]=O,0}};(function(){function p(O){t.asm=O.exports,c=t.asm.E,D(),v=t.asm.J,P.unshift(t.asm.F),K--,t.monitorRunDependencies&&t.monitorRunDependencies(K),K==0&&Y&&(O=Y,Y=null,O())}function C(O){p(O.instance)}function x(O){return w().then(function(J){return WebAssembly.instantiate(J,M)}).then(function(J){return J}).then(O,function(J){A("failed to asynchronously prepare wasm: "+J),X(J)})}var M={a:LB};if(K++,t.monitorRunDependencies&&t.monitorRunDependencies(K),t.instantiateWasm)try{return t.instantiateWasm(M,p)}catch(O){A("Module.instantiateWasm callback failed with error: "+O),r(O)}return function(){return l||typeof WebAssembly.instantiateStreaming!="function"||R(L)||typeof fetch!="function"?x(C):fetch(L,{credentials:"same-origin"}).then(function(O){return WebAssembly.instantiateStreaming(O,M).then(C,function(J){return A("wasm streaming compile failed: "+J),A("falling back to ArrayBuffer instantiation"),x(C)})})}().catch(r),{}})(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.F).apply(null,arguments)};var Ru=t.___getTypeName=function(){return(Ru=t.___getTypeName=t.asm.G).apply(null,arguments)};t.__embind_initialize_bindings=function(){return(t.__embind_initialize_bindings=t.asm.H).apply(null,arguments)};var $a=t._malloc=function(){return($a=t._malloc=t.asm.I).apply(null,arguments)},Bi=t._free=function(){return(Bi=t._free=t.asm.K).apply(null,arguments)};t.dynCall_jiji=function(){return(t.dynCall_jiji=t.asm.L).apply(null,arguments)};var wn;Y=function p(){wn||xu(),wn||(Y=p)};function xu(){function p(){if(!wn&&(wn=!0,t.calledRun=!0,!h)){if(T(P),i(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;){var C=t.postRun.shift();_.unshift(C)}T(_)}}if(!(0<K)){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)U();T(k),0<K||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),p()},1)):p())}}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);0<t.preInit.length;)t.preInit.pop()();return xu(),e.ready}})();let ci=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[s.SpaceEvenly=8]="SpaceEvenly",s}({}),CA=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({}),mr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({}),mA=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({}),hi=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}({}),ts=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.AbsolutePositioningIncorrect=2]="AbsolutePositioningIncorrect",s[s.AbsolutePercentAgainstInnerSize=4]="AbsolutePercentAgainstInnerSize",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({}),kd=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s}({}),Br=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({}),Nn=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({}),is=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}({}),ss=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}({}),On=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({}),BA=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({}),Un=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({}),Pn=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({}),Vt=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({}),Gn=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});const Md={ALIGN_AUTO:ci.Auto,ALIGN_FLEX_START:ci.FlexStart,ALIGN_CENTER:ci.Center,ALIGN_FLEX_END:ci.FlexEnd,ALIGN_STRETCH:ci.Stretch,ALIGN_BASELINE:ci.Baseline,ALIGN_SPACE_BETWEEN:ci.SpaceBetween,ALIGN_SPACE_AROUND:ci.SpaceAround,ALIGN_SPACE_EVENLY:ci.SpaceEvenly,DIMENSION_WIDTH:CA.Width,DIMENSION_HEIGHT:CA.Height,DIRECTION_INHERIT:mr.Inherit,DIRECTION_LTR:mr.LTR,DIRECTION_RTL:mr.RTL,DISPLAY_FLEX:mA.Flex,DISPLAY_NONE:mA.None,EDGE_LEFT:hi.Left,EDGE_TOP:hi.Top,EDGE_RIGHT:hi.Right,EDGE_BOTTOM:hi.Bottom,EDGE_START:hi.Start,EDGE_END:hi.End,EDGE_HORIZONTAL:hi.Horizontal,EDGE_VERTICAL:hi.Vertical,EDGE_ALL:hi.All,ERRATA_NONE:ts.None,ERRATA_STRETCH_FLEX_BASIS:ts.StretchFlexBasis,ERRATA_ABSOLUTE_POSITIONING_INCORRECT:ts.AbsolutePositioningIncorrect,ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE:ts.AbsolutePercentAgainstInnerSize,ERRATA_ALL:ts.All,ERRATA_CLASSIC:ts.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:kd.WebFlexBasis,FLEX_DIRECTION_COLUMN:Br.Column,FLEX_DIRECTION_COLUMN_REVERSE:Br.ColumnReverse,FLEX_DIRECTION_ROW:Br.Row,FLEX_DIRECTION_ROW_REVERSE:Br.RowReverse,GUTTER_COLUMN:Nn.Column,GUTTER_ROW:Nn.Row,GUTTER_ALL:Nn.All,JUSTIFY_FLEX_START:is.FlexStart,JUSTIFY_CENTER:is.Center,JUSTIFY_FLEX_END:is.FlexEnd,JUSTIFY_SPACE_BETWEEN:is.SpaceBetween,JUSTIFY_SPACE_AROUND:is.SpaceAround,JUSTIFY_SPACE_EVENLY:is.SpaceEvenly,LOG_LEVEL_ERROR:ss.Error,LOG_LEVEL_WARN:ss.Warn,LOG_LEVEL_INFO:ss.Info,LOG_LEVEL_DEBUG:ss.Debug,LOG_LEVEL_VERBOSE:ss.Verbose,LOG_LEVEL_FATAL:ss.Fatal,MEASURE_MODE_UNDEFINED:On.Undefined,MEASURE_MODE_EXACTLY:On.Exactly,MEASURE_MODE_AT_MOST:On.AtMost,NODE_TYPE_DEFAULT:BA.Default,NODE_TYPE_TEXT:BA.Text,OVERFLOW_VISIBLE:Un.Visible,OVERFLOW_HIDDEN:Un.Hidden,OVERFLOW_SCROLL:Un.Scroll,POSITION_TYPE_STATIC:Pn.Static,POSITION_TYPE_RELATIVE:Pn.Relative,POSITION_TYPE_ABSOLUTE:Pn.Absolute,UNIT_UNDEFINED:Vt.Undefined,UNIT_POINT:Vt.Point,UNIT_PERCENT:Vt.Percent,UNIT_AUTO:Vt.Auto,WRAP_NO_WRAP:Gn.NoWrap,WRAP_WRAP:Gn.Wrap,WRAP_WRAP_REVERSE:Gn.WrapReverse};function _d(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={[Vt.Point]:s.Node.prototype[r],[Vt.Percent]:s.Node.prototype[`${r}Percent`],[Vt.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=Vt.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?Vt.Percent:Vt.Point,u=parseFloat(c),c!==void 0&&!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]:mr.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Md}}const De=_d(await Ld());var yA=function(){};const Fd=(s,e,t)=>Math.min(Math.max(t,s),e),QA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},Hn=(s,e,t)=>-t*s+t*e+s,vA=(s,e)=>t=>Math.max(Math.min(t,e),s),Gs=s=>s%1?Number(s.toFixed(5)):s,yr=/(-)?([\d]*\.?[\d])+/g,$n=/(#[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,Nd=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Hs(s){return typeof s=="string"}const Qr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},SA=Object.assign(Object.assign({},Qr),{transform:vA(0,1)});Object.assign(Object.assign({},Qr),{default:1});const $s=(s=>({test:e=>Hs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},$s),{parse:s=>$s.parse(s)/100,transform:s=>$s.transform(s*100)});const Kn=(s,e)=>t=>!!(Hs(t)&&Nd.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),DA=(s,e,t)=>i=>{if(!Hs(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}},Oi={test:Kn("hsl","hue"),parse:DA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+$s.transform(Gs(e))+", "+$s.transform(Gs(t))+", "+Gs(SA.transform(i))+")"},Od=vA(0,255),Yn=Object.assign(Object.assign({},Qr),{transform:s=>Math.round(Od(s))}),Qi={test:Kn("rgb","red"),parse:DA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+Yn.transform(s)+", "+Yn.transform(e)+", "+Yn.transform(t)+", "+Gs(SA.transform(i))+")"};function Ud(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 Vn={test:Kn("#"),parse:Ud,transform:Qi.transform},vr={test:s=>Qi.test(s)||Vn.test(s)||Oi.test(s),parse:s=>Qi.test(s)?Qi.parse(s):Oi.test(s)?Oi.parse(s):Vn.parse(s),transform:s=>Hs(s)?s:s.hasOwnProperty("red")?Qi.transform(s):Oi.transform(s)},wA="${c}",bA="${n}";function Pd(s){var e,t,i,r;return isNaN(s)&&Hs(s)&&((t=(e=s.match(yr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match($n))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function RA(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match($n);i&&(t=i.length,s=s.replace($n,wA),e.push(...i.map(vr.parse)));const r=s.match(yr);return r&&(s=s.replace(yr,bA),e.push(...r.map(Qr.parse))),{values:e,numColors:t,tokenised:s}}function xA(s){return RA(s).values}function TA(s){const{values:e,numColors:t,tokenised:i}=RA(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?wA:bA,a<t?vr.transform(n[a]):Gs(n[a]));return o}}const Gd=s=>typeof s=="number"?0:s;function Hd(s){const e=xA(s);return TA(s)(e.map(Gd))}const LA={test:Pd,parse:xA,createTransformer:TA,getAnimatableNone:Hd};function Jn(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function kA({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=Jn(A,a,s+.3333333333333333),n=Jn(A,a,s),o=Jn(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const $d=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},Kd=[Vn,Qi,Oi],MA=s=>Kd.find(e=>e.test(s)),_A=(s,e)=>{let t=MA(s),i=MA(e),r=t.parse(s),n=i.parse(e);t===Oi&&(r=kA(r),t=Qi),i===Oi&&(n=kA(n),i=Qi);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=$d(r[A],n[A],a));return o.alpha=Hn(r.alpha,n.alpha,a),t.transform(o)}},Yd=s=>typeof s=="number",Vd=(s,e)=>t=>e(s(t)),FA=(...s)=>s.reduce(Vd);function NA(s,e){return Yd(s)?t=>Hn(s,e,t):vr.test(s)?_A(s,e):PA(s,e)}const OA=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>NA(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},Jd=(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]=NA(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function UA(s){const e=LA.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 PA=(s,e)=>{const t=LA.createTransformer(e),i=UA(s),r=UA(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?FA(OA(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},Wd=(s,e)=>t=>Hn(s,e,t);function qd(s){if(typeof s=="number")return Wd;if(typeof s=="string")return vr.test(s)?_A:PA;if(Array.isArray(s))return OA;if(typeof s=="object")return Jd}function jd(s,e,t){const i=[],r=t||qd(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=FA(A,a)}i.push(a)}return i}function Xd([s,e],[t]){return i=>t(QA(s,e,i))}function Zd(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=QA(s[n],s[n+1],r);return e[n](a)}}function zd(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;yA(n===e.length),yA(!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=jd(e,i,r),a=n===2?Xd(s,o):Zd(s,o);return t?A=>a(Fd(s[0],s[n-1],A)):a}const Sr=s=>e=>1-s(1-e),Wn=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,eg=s=>e=>Math.pow(e,s),GA=s=>e=>e*e*((s+1)*e-s),tg=s=>{const e=GA(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},HA=1.525,ig=4/11,sg=8/11,rg=9/10,ng=s=>s,qn=eg(2),og=Sr(qn),ag=Wn(qn),$A=s=>1-Math.sin(Math.acos(s)),KA=Sr($A),Ag=Wn(KA),jn=GA(HA),lg=Sr(jn),cg=Wn(jn),hg=tg(HA),ug=4356/361,dg=35442/1805,gg=16061/1805,Dr=s=>{if(s===1||s===0)return s;const e=s*s;return s<ig?7.5625*e:s<sg?9.075*e-9.9*s+3.4:s<rg?ug*e-dg*s+gg:10.8*s*s-20.52*s+10.72},fg=Sr(Dr),Ig=s=>s<.5?.5*(1-Dr(1-s*2)):.5*Dr(s*2-1)+.5;var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function YA(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Xn={exports:{}};(function(s,e){(function(t,i){i(e)})(wr,function(t){function i(b){var w,T,V=new Error(b);return w=V,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,T):w.__proto__=T,V}function r(b,w,T){var V=w.slice(0,T).split(/\n/),H=V.length,q=V[H-1].length+1;throw i(b+=" at line "+H+" col "+q+`:
|
58
|
+
|
59
|
+
`+w.split(/\n/)[H-1]+`
|
60
|
+
`+Array(q).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,T){for(var V in w)a(w,V)&&(w[V]==null||typeof w[V]!="object"||V!=="storage"&&V!=="prefixes"||T?b[V]=w[V]:b[V]=A({},w[V]));return b}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function f(b){return d.test(b)?b.replace(d,"\\$&"):b}function g(b,w){w.rmWhitespace&&(b=b.replace(/[\r\n]+/g,`
|
61
|
+
`).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,h.lastIndex=0,u.lastIndex=0;var T=w.prefixes,V=[T.h,T.b,T.i,T.r,T.c,T.e].reduce(function(Le,Ce){return Le&&Ce?Le+"|"+f(Ce):Ce?f(Ce):Le},""),H=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(w.tags[1])+")","g"),q=new RegExp("([^]*?)"+f(w.tags[0])+"(-|_)?\\s*("+V+")?\\s*","g"),se=0,ce=!1;function de(Le,Ce){var Ie,Be={f:[]},He=0,ye="c";function _e(vt){var wt=b.slice(se,vt),ze=wt.trim();if(ye==="f")ze==="safe"?Be.raw=!0:w.async&&l.test(ze)?(ze=ze.replace(l,""),Be.f.push([ze,"",!0])):Be.f.push([ze,""]);else if(ye==="fp")Be.f[Be.f.length-1][1]+=ze;else if(ye==="err"){if(ze){var It=wt.search(/\S/);r("invalid syntax",b,se+It)}}else Be[ye]=ze;se=vt+1}for(Ce==="h"||Ce==="b"||Ce==="c"?ye="n":Ce==="r"&&(Be.raw=!0,Ce="i"),H.lastIndex=se;(Ie=H.exec(b))!==null;){var Ze=Ie[1],We=Ie[2],Ht=Ie[3],ut=Ie[4],at=Ie[5],Qe=Ie.index;if(Ze)Ze==="("?(He===0&&(ye==="n"?(_e(Qe),ye="p"):ye==="f"&&(_e(Qe),ye="fp")),He++):Ze===")"?--He===0&&ye!=="c"&&(_e(Qe),ye="err"):He===0&&Ze==="|"?(_e(Qe),ye="f"):Ze==="=>"&&(_e(Qe),se+=1,ye="res");else if(We)if(We==="/*"){var At=b.indexOf("*/",H.lastIndex);At===-1&&r("unclosed comment",b,Ie.index),H.lastIndex=At+2}else We==="'"?(h.lastIndex=Ie.index,h.exec(b)?H.lastIndex=h.lastIndex:r("unclosed string",b,Ie.index)):We==='"'?(u.lastIndex=Ie.index,u.exec(b)?H.lastIndex=u.lastIndex:r("unclosed string",b,Ie.index)):We==="`"&&(c.lastIndex=Ie.index,c.exec(b)?H.lastIndex=c.lastIndex:r("unclosed string",b,Ie.index));else if(Ht)return _e(Qe),se=Qe+Ie[0].length,q.lastIndex=se,ce=at,ut&&Ce==="h"&&(Ce="s"),Be.t=Ce,Be}return r("unclosed tag",b,Le),Be}var re=function Le(Ce,Ie){Ce.b=[],Ce.d=[];var Be,He=!1,ye=[];function _e(It,$t){It&&(It=function(et,St,ai,Ci){var Et,$;return typeof St.autoTrim=="string"?Et=$=St.autoTrim:Array.isArray(St.autoTrim)&&(Et=St.autoTrim[1],$=St.autoTrim[0]),(ai||ai===!1)&&(Et=ai),(Ci||Ci===!1)&&($=Ci),Et==="slurp"&&$==="slurp"?et.trim():(Et==="_"||Et==="slurp"?et=String.prototype.trimLeft?et.trimLeft():et.replace(/^[\s\uFEFF\xA0]+/,""):Et!=="-"&&Et!=="nl"||(et=et.replace(/^(?:\n|\r|\r\n)/,"")),$==="_"||$==="slurp"?et=String.prototype.trimRight?et.trimRight():et.replace(/[\s\uFEFF\xA0]+$/,""):$!=="-"&&$!=="nl"||(et=et.replace(/(?:\n|\r|\r\n)$/,"")),et)}(It,w,ce,$t))&&(It=It.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),ye.push(It))}for(;(Be=q.exec(b))!==null;){var Ze,We=Be[1],Ht=Be[2],ut=Be[3]||"";for(var at in T)if(T[at]===ut){Ze=at;break}_e(We,Ht),se=Be.index+Be[0].length,Ze||r("unrecognized tag type: "+ut,b,se);var Qe=de(Be.index,Ze),At=Qe.t;if(At==="h"){var vt=Qe.n||"";w.async&&l.test(vt)&&(Qe.a=!0,Qe.n=vt.replace(l,"")),Qe=Le(Qe),ye.push(Qe)}else if(At==="c"){if(Ce.n===Qe.n)return He?(He.d=ye,Ce.b.push(He)):Ce.d=ye,Ce;r("Helper start and end don't match",b,Be.index+Be[0].length)}else if(At==="b"){He?(He.d=ye,Ce.b.push(He)):Ce.d=ye;var wt=Qe.n||"";w.async&&l.test(wt)&&(Qe.a=!0,Qe.n=wt.replace(l,"")),He=Qe,ye=[]}else if(At==="s"){var ze=Qe.n||"";w.async&&l.test(ze)&&(Qe.a=!0,Qe.n=ze.replace(l,"")),ye.push(Qe)}else ye.push(Qe)}if(!Ie)throw i('unclosed helper "'+Ce.n+'"');return _e(b.slice(se,b.length),!1),Ce.d=ye,Ce}({f:[]},!0);if(w.plugins)for(var me=0;me<w.plugins.length;me++){var Te=w.plugins[me];Te.processAST&&(re.d=Te.processAST(re.d,w))}return re.d}function I(b,w){var T=g(b,w),V="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+y(T,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var H=0;H<w.plugins.length;H++){var q=w.plugins[H];q.processFnString&&(V=q.processFnString(V,w))}return V}function B(b,w){for(var T=0;T<w.length;T++){var V=w[T][0],H=w[T][1];b=(w[T][2]?"await ":"")+"c.l('F','"+V+"')("+b,H&&(b+=","+H),b+=")"}return b}function S(b,w,T,V,H,q){var se="{exec:"+(H?"async ":"")+m(T,w,b)+",params:["+V+"]";return q&&(se+=",name:'"+q+"'"),H&&(se+=",async:true"),se+="}"}function Q(b,w){for(var T="[",V=0;V<b.length;V++){var H=b[V];T+=S(w,H.res||"",H.d,H.p||"",H.a,H.n),V<b.length&&(T+=",")}return T+="]"}function m(b,w,T){return"function("+w+"){var tR='';"+y(b,T)+"return tR}"}function y(b,w){for(var T=0,V=b.length,H="";T<V;T++){var q=b[T];if(typeof q=="string")H+="tR+='"+q+"';";else{var se=q.t,ce=q.c||"",de=q.f,re=q.n||"",me=q.p||"",Te=q.res||"",Le=q.b,Ce=!!q.a;if(se==="i"){w.defaultFilter&&(ce="c.l('F','"+w.defaultFilter+"')("+ce+")");var Ie=B(ce,de);!q.raw&&w.autoEscape&&(Ie="c.l('F','e')("+Ie+")"),H+="tR+="+Ie+";"}else if(se==="h")if(w.storage.nativeHelpers.get(re))H+=w.storage.nativeHelpers.get(re)(q,w);else{var Be=(Ce?"await ":"")+"c.l('H','"+re+"')("+S(w,Te,q.d,me,Ce);Be+=Le?","+Q(Le,w):",[]",H+="tR+="+B(Be+=",c)",de)+";"}else se==="s"?H+="tR+="+B((Ce?"await ":"")+"c.l('H','"+re+"')({params:["+me+"]},[],c)",de)+";":se==="e"&&(H+=ce+`
|
62
|
+
`)}}return H}var D=function(){function b(w){this.cache=w}return b.prototype.define=function(w,T){this.cache[w]=T},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 v(b,w,T,V){if(w&&w.length>0)throw i((V?"Native":"")+"Helper '"+b+"' doesn't accept blocks");if(T&&T.length>0)throw i((V?"Native":"")+"Helper '"+b+"' doesn't accept filters")}var k={"&":"&","<":"<",">":">",'"':""","'":"'"};function P(b){return k[b]}var _=new D({}),U=new D({each:function(b,w){var T="",V=b.params[0];if(v("each",w,!1),b.async)return new Promise(function(q){(function se(ce,de,re,me,Te){re(ce[de],de).then(function(Le){me+=Le,de===ce.length-1?Te(me):se(ce,de+1,re,me,Te)})})(V,0,b.exec,T,q)});for(var H=0;H<V.length;H++)T+=b.exec(V[H],H);return T},foreach:function(b,w){var T=b.params[0];if(v("foreach",w,!1),b.async)return new Promise(function(q){(function se(ce,de,re,me,Te,Le){me(de[re],ce[de[re]]).then(function(Ce){Te+=Ce,re===de.length-1?Le(Te):se(ce,de,re+1,me,Te,Le)})})(T,Object.keys(T),0,b.exec,"",q)});var V="";for(var H in T)a(T,H)&&(V+=b.exec(H,T[H]));return V},include:function(b,w,T){v("include",w,!1);var V=T.storage.templates.get(b.params[0]);if(!V)throw i('Could not fetch template "'+b.params[0]+'"');return V(b.params[1],T)},extends:function(b,w,T){var V=b.params[1]||{};V.content=b.exec();for(var H=0;H<w.length;H++){var q=w[H];V[q.name]=q.exec()}var se=T.storage.templates.get(b.params[0]);if(!se)throw i('Could not fetch template "'+b.params[0]+'"');return se(V,T)},useScope:function(b,w){return v("useScope",w,!1),b.exec(b.params[0])}}),K=new D({if:function(b,w){v("if",!1,b.f,!0);var T="if("+b.p+"){"+y(b.d,w)+"}";if(b.b)for(var V=0;V<b.b.length;V++){var H=b.b[V];H.n==="else"?T+="else{"+y(H.d,w)+"}":H.n==="elif"&&(T+="else if("+H.p+"){"+y(H.d,w)+"}")}return T},try:function(b,w){if(v("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 T="try{"+y(b.d,w)+"}",V=b.b[0];return T+="catch"+(V.res?"("+V.res+")":"")+"{"+y(V.d,w)+"}"},block:function(b,w){return v("block",b.b,b.f,!0),"if(!"+w.varName+"["+b.p+"]){tR+=("+m(b.d,"",w)+")()}else{tR+="+w.varName+"["+b.p+"]}"}}),Y=new D({e:function(b){var w=String(b);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,P):w}}),X={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(b,w){if(b==="H"){var T=this.storage.helpers.get(w);if(T)return T;throw i("Can't find helper '"+w+"'")}if(b==="F"){var V=this.storage.filters.get(w);if(V)return V;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:U,nativeHelpers:K,filters:Y,templates:_},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(b,w){var T={};return A(T,X),w&&A(T,w),b&&A(T,b),T.l.bind(T),T}function L(b,w){var T=R(w||{}),V=Function;if(T.async){if(!o)throw i("This environment doesn't support async/await");V=o}try{return new V(T.varName,"c","cb",I(b,T))}catch(H){throw H instanceof SyntaxError?i(`Bad template syntax
|
63
|
+
|
64
|
+
`+H.message+`
|
65
|
+
`+Array(H.message.length+1).join("=")+`
|
66
|
+
`+I(b,T)):H}}function W(b,w){var T;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(T=typeof b=="function"?b:L(b,w),w.cache&&w.name&&w.storage.templates.define(w.name,T),T)}X.l.bind(X),t.compile=L,t.compileScope=y,t.compileScopeIntoFunction=m,t.compileToString=I,t.defaultConfig=X,t.filters=Y,t.getConfig=R,t.helpers=U,t.nativeHelpers=K,t.parse=g,t.render=function(b,w,T,V){var H=R(T||{});if(!H.async)return W(b,H)(w,H);if(!V){if(typeof n=="function")return new n(function(q,se){try{q(W(b,H)(w,H))}catch(ce){se(ce)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{W(b,H)(w,H,V)}catch(q){return V(q)}},t.templates=_,Object.defineProperty(t,"__esModule",{value:!0})})})(Xn,Xn.exports);var Zn=Xn.exports;const Eg=(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);!pg(r,n)&&i||Object.defineProperty(s,t,n)},pg=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)},Cg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},mg=(s,e)=>`/* Wrapped ${s}*/
|
67
|
+
${e}`,Bg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),yg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Qg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=mg.bind(null,i,e.toString());Object.defineProperty(r,"name",yg),Object.defineProperty(s,"toString",{...Bg,value:r})};function vg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Eg(s,e,r,t);return Cg(s,e),Qg(s,e,i),s}const Sg=new WeakMap;function vi(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 vg(r,s,{ignoreNonConfigurable:!0}),Sg.set(r,t),r}function zn({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,f=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!f&&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 Dg(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function wg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function eo({resolution:s,aspectRatio:e}){const t=Dg(s),i=wg(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 bg({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=eo({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const f=Math.min(o,n);l=i>=r?f/r:f/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 Ks({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=s?.naturalWidth??s?.videoWidth??s?.width,c=s?.naturalHeight??s?.videoHeight??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),f=Math.min(t+r,c),g=a/i,I=A/r;return[s,h,d,u-h,f-d,e<0?n-e*g:n,t<0?o-t*I:o,(u-h)*g,(f-d)*I]}function VA({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:f,height:g}=t??{},I=A*(u??0),B=l*(d??0),S=A*Math.min(1-(u??0),f??1),Q=l*Math.min(1-(d??0),g??1),m=c.getContext("2d");if(m){c.width=S,c.height=Q;const L=Ks({source:e,sx:I,sy:B,sw:S,sh:Q,dx:0,dy:0,dw:S,dh:Q});m.drawImage(...L)}const y=S/Q,{sx:D,sy:v,sWidth:k,sHeight:P,scale:_}=bg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:S,sourceHeight:Q}),U=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!U){if(D<0){const L=Math.abs(D)*_;s.fillStyle="black",s.beginPath(),s.rect(r,n,L,a),s.rect(r+o-L,n,L,a),s.fill(),s.closePath()}if(v<0){const L=Math.abs(v)*_;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,L),s.rect(r,n+a-L,o,L),s.fill(),s.closePath()}}if(i==="letterbox-video"&&U){const L=h.getContext("2d");if(L){h.width=S,h.height=Q,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const W=Ks({source:c,sx:D,sy:v,sw:k,sh:P,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...W),L.save();const b=1.2,w=-(S*b-S)/2,T=-(Q*b-Q)/2,V=Math.min(S/20,Q/20);if(L.filter=`blur(${V}px) brightness(20%)`,L.translate(w,T),L.scale(b,b),L.drawImage(c,0,0,S,Q),L.restore(),s.globalCompositeOperation="destination-over",D<0){const H=o/y,q=a/H,se=Ks({source:h,sy:(1-q)*Q/2,sh:q*Q,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}if(v<0){const H=a*y,q=o/H,se=Ks({source:h,sx:(1-q)*S/2,sw:q*S,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}s.restore()}}else{const L=Ks({source:c,sx:D,sy:v,sw:k,sh:P,dx:r,dy:n,dw:o,dh:a});s.drawImage(...L)}const K=D*-1*_,Y=v*-1*_,X=o-K*2,R=a-Y*2;return{dx:K,dy:Y,dw:X,dh:R}}function JA({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?.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 WA=Fn(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{let A=0;if(a){A=(o??0)*e;let c=0;for(;a*e>A+1;){A+=1;const h=Tr({context:t,font:s,fontSize:A,text:n,maxW:i});if(c=h.reduce((u,d)=>(d.metrics.width>u&&(u=d.metrics.width),u),0),c>i||h.length*A>r){A-=1;break}}}else A=parseFloat(s.match(xr)?.groups?.value??"0")*e;return A},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`});function Rg(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 qA(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 jA(s,{layout:e,scale:t=1}){const{position:i="relative",inset:r,width:n,height:o,minWidth:a,minHeight:A,maxWidth:l,maxHeight:c,flex:h,gap:u,margin:d,padding:f,direction:g="column",align:I="start",alignSelf:B,justify:S="start"}=e,Q={static:De.POSITION_TYPE_STATIC,relative:De.POSITION_TYPE_RELATIVE,absolute:De.POSITION_TYPE_ABSOLUTE};if(s.setPositionType(Q[i]),r){const{top:v,right:k,bottom:P,left:_}=Rg(r,t);v&&s.setPosition(De.EDGE_TOP,v),k&&s.setPosition(De.EDGE_RIGHT,k),P&&s.setPosition(De.EDGE_BOTTOM,P),_&&s.setPosition(De.EDGE_LEFT,_)}const m={row:De.FLEX_DIRECTION_ROW,column:De.FLEX_DIRECTION_COLUMN,"row-reverse":De.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":De.FLEX_DIRECTION_COLUMN_REVERSE};s.setFlexDirection(m[g]);const y={start:De.ALIGN_FLEX_START,end:De.ALIGN_FLEX_END,center:De.ALIGN_CENTER,stretch:De.ALIGN_STRETCH};s.setAlignItems(y[I]),B&&s.setAlignSelf(y[B]);const D={start:De.JUSTIFY_FLEX_START,end:De.JUSTIFY_FLEX_END,center:De.JUSTIFY_CENTER,"space-between":De.JUSTIFY_SPACE_BETWEEN,"space-around":De.JUSTIFY_SPACE_AROUND,"space-evenly":De.JUSTIFY_SPACE_EVENLY};if(s.setJustifyContent(D[S]),d){const{top:v,right:k,bottom:P,left:_}=qA(d,t);s.setMargin(De.EDGE_TOP,v),s.setMargin(De.EDGE_RIGHT,k),s.setMargin(De.EDGE_BOTTOM,P),s.setMargin(De.EDGE_LEFT,_)}if(f){const{top:v,right:k,bottom:P,left:_}=qA(f,t);s.setPadding(De.EDGE_TOP,v),s.setPadding(De.EDGE_RIGHT,k),s.setPadding(De.EDGE_BOTTOM,P),s.setPadding(De.EDGE_LEFT,_)}h&&s.setFlex(h),s.setGap(De.GUTTER_ALL,(u??0)*t),n&&s.setWidth(typeof n=="number"?n*t:n),o&&(typeof o=="function"?s.setHeight("100%"):s.setHeight(typeof o=="number"?o*t:o)),a&&s.setMinWidth(typeof a=="number"?a*t:a),A&&s.setMinHeight(typeof A=="number"?A*t:A),l&&s.setMaxWidth(typeof l=="number"?l*t:l),c&&s.setMaxHeight(typeof c=="number"?c*t:c)}function XA({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))),XA({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function ZA(s,e,t){const i=e.map((r,n)=>{const o=De.Node.create(),{radius:a,elements:A=[],draw:l,...c}=r;return jA(o,{layout:c,scale:t}),s.insertChild(o,n),{node:o,element:r,childNodes:ZA(o,A,t)}});return s.calculateLayout(void 0,void 0),i}function zA(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,f=i+l;return{x:n+d,y:r+f,width:h,height:u,element:a,childNodes:zA(s,A,d,f)}})}function el(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)}el(r,e)})}function xg({canvas:s,origin:e,elements:t,...i}){const r={inset:{top:0,left:0},width:s.width,height:s.height,...e},n=De.Node.create();jA(n,{layout:r}),n.calculateLayout(void 0,void 0);const{width:o,height:a}=n.getComputedLayout(),A=Math.min(o,a)/1080,l=ZA(n,t,A);el(l,A),n.calculateLayout(void 0,void 0);const c=zA(n,l);return XA({...i,scale:A,canvas:s,position:c})}const Tg={linear:ng,easeIn:qn,easeInOut:ag,easeOut:og,circIn:$A,circInOut:Ag,circOut:KA,backIn:jn,backInOut:cg,backOut:lg,anticipate:hg,bounceIn:fg,bounceInOut:Ig,bounceOut:Dr},br=Fn((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>zd(s,e,{...r,clamp:t,ease:Tg[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),tl=[{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 Rr({text:s,font:e}){let t=e;return tl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const ui=1.8,xr=/(?<value>\d+\.?\d*)(?=px)/;function il(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:(s?.topLeft??0)*e,topRight:(s?.topRight??0)*e,bottomRight:(s?.bottomRight??0)*e,bottomLeft:(s?.bottomLeft??0)*e}}function sl(s){const{visible:e,node:t}=s,i=[...t?.elements??[],...s?.elements??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i?.some(r=>sl(r)))}function rl({debug:s=!1,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n=[],currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h}){return n.map(u=>{const{node:d,transient:f=[{from:0,duration:1/0}]}=u,g=e.getContext("2d"),I={total:o,content:a,scene:A},B={total:l,content:c,scene:h},S=f.reduce((Q,{type:m="scene",from:y,duration:D,animation:v})=>{const k=y<0?B[m]+y:y;return I[m]>=k&&I[m]<=k+D&&Q.push({type:m,animation:v,duration:D,from:k}),Q},[]);if(g&&S.length>0&&sl(u)){let Q=u.width,m=u.height;if(d?.type==="text"&&d.value){const{align:y="left"}=d,D=Rr({text:d.value,font:d.font});g.save(),g.font=D,g.textBaseline="top",g.textAlign=y,d.wrap?m=({width:v,maxHeight:k,scale:P})=>{const _=WA({font:D,scale:P,context:g,maxW:v,maxH:k,text:d.value??"",minSize:d.fill?.minSize,maxSize:d.fill?.maxSize});return Tr({context:g,font:D,fontSize:_,text:d.value??"",maxW:v}).length*_}:(Q=g.measureText(d.value).width,m=parseFloat(D.match(xr)?.groups?.value??"0")),g.restore()}if(d?.type==="image"&&d.image&&d.size){const y=d.image?.naturalWidth??d.image?.width,D=d.image?.naturalHeight??d.image?.height,v=y/D,k=d.size?.width,P=d.size?.height;Q=k??(v>=1?(P??0)*v:(P??0)/v),m=P??(v<1?(k??0)*v:(k??0)/v)}return{...u,width:Q,height:m,elements:rl({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:u.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h}),draw:({dx:y,dy:D,dw:v,dh:k,scale:P})=>{if(S.forEach(_=>{const{type:U="scene",from:K,duration:Y,animation:X={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=_;if(X){const{type:R,duration:L,easing:{in:W="easeOut",out:b="easeOut"}={}}=X;if(K>0&&I[U]<=K+L)switch(R){case"fade":{const w=br([K,K+L],[0,1],{ease:W});g.globalAlpha=w(I[U]);break}case"slide":{const{options:w}=X,T={up:[{x:0,y:k},{x:0,y:0}],right:[{x:v,y:0},{x:0,y:0}],down:[{x:0,y:-k},{x:0,y:0}],left:[{x:-v,y:0},{x:0,y:0}]},V=br([K,K+L],T[w.direction.in],{ease:W}),{x:H,y:q}=V(I[U]);g.translate(H,q);break}}if(K+Y<B[U]&&K+Y-L<=I[U])switch(R){case"fade":{const w=br([K+Y-L,K+Y],[1,0],{ease:b});g.globalAlpha=w(I[U]);break}case"slide":{const{options:w}=X,T={up:[{x:0,y:0},{x:0,y:-k}],right:[{x:0,y:0},{x:v,y:0}],down:[{x:0,y:0},{x:0,y:k}],left:[{x:0,y:0},{x:-v,y:0}]},V=br([K+Y-L,K+Y],T[w.direction.out],{ease:b}),{x:H,y:q}=V(I[U]);g.translate(H,q);break}}}}),d){const{type:_}=d;if(_==="box"){const{shadow:{color:U="rgba(0, 0, 0, 0.5)",blur:K=0,offset:{x:Y=0,y:X=0}={}}={}}=d;if(g.save(),g.fillStyle=U,g.shadowColor=U,g.shadowBlur=K,g.shadowOffsetX=Y+v+e.width,g.shadowOffsetY=X+k+e.height,g.beginPath(),!u.radius)g.rect(y-v-e.width,D-k-e.height,v,k);else{const{topLeft:R,topRight:L,bottomRight:W,bottomLeft:b}=il(u.radius,P);g.roundRect(y-v-e.width,D-k-e.height,v,k,[R,L,W,b])}g.fill(),g.closePath(),g.restore()}if(u.radius){const{topLeft:U,topRight:K,bottomRight:Y,bottomLeft:X}=il(u.radius,P);g.beginPath(),g.moveTo(y+Math.min(k/ui,U),D),g.lineTo(y+v-Math.min(k/ui,K),D),g.quadraticCurveTo(y+v,D,y+v,D+Math.min(k/ui,K)),g.lineTo(y+v,D+k-Math.min(k/ui,Y)),g.quadraticCurveTo(y+v,D+k,y+v-Math.min(k/ui,Y),D+k),g.lineTo(y+Math.min(k/ui,X),D+k),g.quadraticCurveTo(y,D+k,y,D+k-Math.min(k/ui,X)),g.lineTo(y,D+Math.min(k/ui,U)),g.quadraticCurveTo(y,D,y+Math.min(k/ui,U),D),g.closePath(),s&&(g.strokeStyle="blue",g.stroke()),g.clip()}if(_==="box"&&(g.save(),g.fillStyle=d.background,g.fillRect(y,D,v,k),g.restore()),_==="text"&&d.value){const{align:U="left"}=d,K=Rr({text:d.value,font:d.font}),Y=WA({font:K,scale:P,context:g,maxW:v,maxH:k,text:d.value??"",minSize:d.fill?.minSize,maxSize:d.fill?.maxSize});g.font=K.replace(xr,Y.toString()),g.textBaseline="top",g.fillStyle=d.color,g.textAlign=U;const X={left:y,center:y+v/2,right:y+v};d.wrap?Tr({context:g,font:K,fontSize:Y,text:d.value,maxW:v}).forEach((L,W)=>{g.fillText(L.text,X[U],D+Y*W)}):g.fillText(d.value,X[U],D)}if(_==="image"&&d.image&&g.drawImage(d.image,y,D,v,k),_==="video"&&(d.video?.node||d.video?.getSource)){const U=d.format??"letterbox",K=d.video?.getSource?.(A)??d.video.node,Y=K?.videoWidth??K?.naturalWidth??K?.width,X=K?.videoHeight??K?.naturalHeight??K?.height;if(Y&&X){const{dx:L,dy:W,dw:b,dh:w}=VA({context:g,cropCanvas:t,letterboxCanvas:r,source:K,format:U,crop:d?.value?.crop,sourceWidth:Y,sourceHeight:X,posX:y,posY:D,drawAreaWidth:v,drawAreaHeight:k});d.elements&&to({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:d.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,origin:{inset:{top:Math.max(D,D+W),left:Math.max(y,y+L)},width:Math.min(v,b),height:Math.min(k,w)}})}const R=1/3;if(d.poster&&o>=0&&o<=R){g.save(),g.globalAlpha=1-o/R;const L=d.poster?.naturalWidth??d.poster?.width,W=d.poster?.naturalHeight??d.poster?.height;i.width=i.height=0,i.width=v,i.height=k;const b=i.getContext("2d");if(b&&L&&W){const{dx:w,dy:T,dw:V,dh:H}=VA({context:b,cropCanvas:t,letterboxCanvas:r,source:d.poster,format:U,crop:d?.value?.crop,sourceWidth:L,sourceHeight:W,posX:0,posY:0,drawAreaWidth:v,drawAreaHeight:k});d.elements&&to({debug:s,canvas:i,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:d.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,origin:{inset:{top:Math.max(0,T),left:Math.max(0,w)},width:Math.min(v,V),height:Math.min(k,H)}}),g.drawImage(i,y,D,v,k),g.restore()}}}if(_==="gradient"&&d.value){const U=g.createLinearGradient(y+v,D,y+v,D+k);d.value?.forEach(K=>{U.addColorStop(K.percent,K.color)}),g.fillStyle=U,g.fillRect(y,D,v,k)}}}}}}).filter(Boolean)}function to({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,...u}){return xg({...u,debug:s,canvas:e,elements:rl({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h})})}const Tr=Fn(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(xr,t.toString()),i.split(`
|
68
|
+
`).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...JA({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},JA({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}`}),Lg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,kg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function nl(s){if(!s)return[];const e=s.match(Lg);return e?e?.map(t=>{const[i,r]=t.replace(`\r
|
69
|
+
`,`
|
70
|
+
`).split(`
|
71
|
+
`),[n,o]=i.match(kg)||[];return{start:n,end:o,text:r}}):[]}function Lr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Mg({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){if(o){const A=nl(o).find(({start:l,end:c})=>l&&c&&n>=Lr(l)&&n<Lr(c));if(A){const l=s.getContext("2d");if(l){const c=Math.min(i,r),h=c*.04,u=Rr({text:o,font:`400 ${h}px Roobert Captions`});l.font=u,l.textBaseline="middle";const d=i*.9,f=Tr({context:l,font:u,fontSize:h,text:A.text,maxW:d});f.forEach(({text:g,metrics:I},B)=>{const S=e+(i-I.width)/2,Q=t+(r*.85-(h+c*.03)*(f.length-1-B)),m=h*.8,y=h/1.5,D=e+(i-I.width-y)/2,v=Q-m,k=I.width+y,P=m*2,_=l.globalAlpha;l.save(),l.globalAlpha=.8*_,l.fillStyle="#000000",l.beginPath(),l.roundRect(D,v,k,P,c*.01),l.fill(),l.closePath(),l.globalAlpha=_,l.fillStyle="#FFFFFF",l.fillText(g,S,Q),l.restore()})}}}}const _g={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"3",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
|
72
|
+
{
|
73
|
+
"width": "100%",
|
74
|
+
"height": "100%",
|
75
|
+
"node": {
|
76
|
+
"type": "video",
|
77
|
+
"format": {{ it.videoFormat }},
|
78
|
+
"value": {
|
79
|
+
"id": {{ it.id }},
|
80
|
+
"key": {{ it.key }},
|
81
|
+
"src": {{ it.src }},
|
82
|
+
"playlist": {{ it.playlist }},
|
83
|
+
"poster": {{ it.poster }},
|
84
|
+
"captions": {{ it.captions }},
|
85
|
+
"duration": {{ it.duration }},
|
86
|
+
"startOffset": {{ it.startOffset }},
|
87
|
+
"endOffset": {{ it.endOffset }},
|
88
|
+
"crop": {
|
89
|
+
"x": {{ it.crop?.x }},
|
90
|
+
"y": {{ it.crop?.y }},
|
91
|
+
"width": {{ it.crop?.width }},
|
92
|
+
"height": {{ it.crop?.height }}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
]`}],content:[{scenes:[{layout:"none",data:`{
|
98
|
+
"id": {{ it._root?.answer?.id }},
|
99
|
+
"key": {{ it._root?.answer?.id + '-intro' }},
|
100
|
+
"poster": {{ it._root?.answer?.media?.thumbnail }},
|
101
|
+
"duration": {{ it._root?.answer?.metadata?.duration }},
|
102
|
+
"startOffset": {{ it._root?.answer?.settings?.startOffset }},
|
103
|
+
"endOffset": {{ it._root?.answer?.settings?.endOffset }},
|
104
|
+
"crop": {
|
105
|
+
"x": {{ it._root?.answer?.settings?.crop?.x }},
|
106
|
+
"y": {{ it._root?.answer?.settings?.crop?.y }},
|
107
|
+
"width": {{ it._root?.answer?.settings?.crop?.width }},
|
108
|
+
"height": {{ it._root?.answer?.settings?.crop?.height }}
|
109
|
+
}
|
110
|
+
}`,derived:`{
|
111
|
+
"src": {{ it._derived?.src }},
|
112
|
+
"playlist": {{ it._derived?.playlist }},
|
113
|
+
"captions": {{ it._derived?.captions }}
|
114
|
+
}`}],root:"{{ it.intro?.questions?.items }}"},{scenes:[{layout:"none",data:`{
|
115
|
+
"id": {{ it._root?.answer?.id }},
|
116
|
+
"key": {{ it._root?.answer?.id + '-' + it._index }},
|
117
|
+
"poster": {{ it._root?.answer?.media?.thumbnail }},
|
118
|
+
"duration": {{ it._root?.answer?.metadata?.duration }},
|
119
|
+
"startOffset": {{ it._root?.answer?.settings?.startOffset }},
|
120
|
+
"endOffset": {{ it._root?.answer?.settings?.endOffset }},
|
121
|
+
"crop": {
|
122
|
+
"x": {{ it._root?.answer?.settings?.crop?.x }},
|
123
|
+
"y": {{ it._root?.answer?.settings?.crop?.y }},
|
124
|
+
"width": {{ it._root?.answer?.settings?.crop?.width }},
|
125
|
+
"height": {{ it._root?.answer?.settings?.crop?.height }}
|
126
|
+
}
|
127
|
+
}`,derived:`{
|
128
|
+
"src": {{ it._derived?.src }},
|
129
|
+
"playlist": {{ it._derived?.playlist }},
|
130
|
+
"captions": {{ it._derived?.captions }}
|
131
|
+
}`}],root:"{{ it.questions?.items }}"},{scenes:[{layout:"none",data:`{
|
132
|
+
"id": {{ it._root?.answer?.id }},
|
133
|
+
"key": {{ it._root?.answer?.id + '-outro' }},
|
134
|
+
"poster": {{ it._root?.answer?.media?.thumbnail }},
|
135
|
+
"duration": {{ it._root?.answer?.metadata?.duration }},
|
136
|
+
"startOffset": {{ it._root?.answer?.settings?.startOffset }},
|
137
|
+
"endOffset": {{ it._root?.answer?.settings?.endOffset }},
|
138
|
+
"crop": {
|
139
|
+
"x": {{ it._root?.answer?.settings?.crop?.x }},
|
140
|
+
"y": {{ it._root?.answer?.settings?.crop?.y }},
|
141
|
+
"width": {{ it._root?.answer?.settings?.crop?.width }},
|
142
|
+
"height": {{ it._root?.answer?.settings?.crop?.height }}
|
143
|
+
}
|
144
|
+
}`,derived:`{
|
145
|
+
"src": {{ it._derived?.src }},
|
146
|
+
"playlist": {{ it._derived?.playlist }},
|
147
|
+
"captions": {{ it._derived?.captions }}
|
148
|
+
}`}],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 Fg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>vu);return new s.Image}return new Image}const ol=vi(async function(e){return e?new Promise((t,i)=>{Fg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function io({element:s,meta:e},t,i){let r={...s};const{node:n}=s;if(n?.type==="video"&&(n?.value?.src||n?.value?.playlist)){const o=await t(n.value,e);let a;try{a=await ol(n.value.poster)}catch{a=null}r={...r,node:{...n,video:o,poster:a,meta:await i(n.value,o.node,e)}}}if(n?.type==="image"&&n.value){let o;try{o=await ol(n.value)}catch{o=null}r={...r,node:{...n,image:o}}}return r.node&&s.node?.elements&&(r.node.elements=await Promise.all(s.node.elements.map(o=>io({element:o,meta:e},t,i)))),s.elements&&(r.elements=await Promise.all(s.elements.map(o=>io({element:o,meta:e},t,i)))),r}async function kr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>vu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function Ys(s=[]){for(const e of s){if(e?.node?.type==="video")return e.node;const t=Ys(e?.elements);if(t)return t}}function Ng(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 Og(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 Ug(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 Mr(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}Zn.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Ug(s)}"`:Og(s)||Array.isArray(s)?JSON.stringify(s):s);const rs=(s,e,t)=>Zn.render(s,e,Zn.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function ns({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){const a=e??_g;if(!a.templates?.length)throw new Error(`No templates found for template instance: ${a.id}`);let A=a.templates.find(({version:Q})=>Q===so);if(!A){const Q=a.templates.map(({version:m})=>`"${m}"`).join(", ");console.warn(`Template renderer expects template version "${so}" but got ${Q}`),A=a.templates[a.templates.length-1]}const l=await Promise.all(A.content.map(async({scenes:Q,root:m})=>{const y={...a.options,...s,intro:a.intro,outro:a.outro};async function D(v,k){return Promise.all(Q.map(async({layout:P,duration:_,data:U,derived:K,options:Y})=>{const X={...y,_index:k,_root:v,_derived:await r({data:s,rootData:v,index:k})},R=U?JSON.parse(await rs(U,X)):{},L=K?JSON.parse(await rs(K,X)):{},W=Y?JSON.parse(await rs(Y,X)):{},b=_?parseFloat(await rs(_,X)):NaN,w=A.layouts.find(se=>se.name===P)?.tree;if(!w)throw new Error(`Layout tree "${P}" not found in template "${A.id}" layouts.`);const T=JSON.parse(await rs(w,{...R,...L,...W})),V=await Promise.all(T.flatMap(se=>io({element:se,meta:a.meta},n,o))),H=Ys(V);return{duration:(isNaN(b)?null:b)??H?.meta?.duration??0,captions:H?.meta?.captions,elements:V}}))}if(m){const v=JSON.parse(await rs(m,y));return Array.isArray(v)?(await Promise.all(v.map(async(k,P)=>D(k,P)))).flatMap(k=>k):D(v,null)}return D(s,null)}));if(l.every(Q=>Q.every(m=>{const y=Ys(m.elements);return!y?.value.src&&!y?.value.playlist}))){const Q=l.flatMap(m=>m.map(y=>{const D=Ys(y.elements);return!D?.value.src&&!D?.value.playlist&&D?.value.id}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${Q} failed to load, video can not be processed`)}if(l.every(Q=>Q.every(m=>m.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const u=l.reduce((Q,m)=>{const y=m.filter(D=>D.duration>0);return y.length>0&&(Q=[...Q,y]),Q},[]),d=a.meta?.frameRate??30,f=a.meta?.resolution??720,g=a.meta?.transitionDuration??1/3,I=Ng(u,g),B=Mr(I);return{scenes:(await Promise.all(u.map((Q,m)=>{const y=Mr(I[m]),D=Mr(I.slice(0,m));return Promise.all(Q.map(async({duration:v,captions:k,elements:P},_)=>{const U=await kr(),K=await kr(),Y=await kr(),X=await kr(),R=Ys(P),L=Mr([...I.slice(0,m),...I[m].slice(0,_)]);return{draw:({canvas:b,currentTime:w})=>{const T=Math.max(0,w-D),V=Math.max(0,w-L);to({debug:i,canvas:b,cropCanvas:U,posterCanvas:X,letterboxCanvas:K,elements:P,currentTime:w,contentTime:T,sceneTime:V,totalDuration:B,contentDuration:y,sceneDuration:v}),k&&t&&Mg({canvas:b,dx:0,dy:0,dw:b.width,dh:b.height,vttCaptions:k,sceneTime:V+(R?.meta.start??0)})},duration:v,transitionCanvas:Y,start:L,video:R?.video,videoMeta:R?.meta,audio:{duration:v,src:R?.value?.src,start:R?.meta?.start}}}))}))).flatMap(Q=>Q),frameRate:d,resolution:f,transitionDuration:g,fonts:A.fonts??[],duration:B}}const so="3",Pg={name:"@vouchfor/embeds",version:"0.0.0-experiment.8cafed9",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"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":"0.0.0-experiment.8cafed9",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.2","@storybook/addon-links":"^8.0.2","@storybook/blocks":"^8.0.2","@storybook/web-components":"^8.0.2","@storybook/web-components-vite":"^8.0.2","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.8cafed9","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-internal":"^1.0.4","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.2",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function Gg(s){const{publicApiUrl:e}=Cr(s),t=Ni();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Hg(s){if(typeof window>"u")return{client:null,tab:null,request:Ni()};let e=window.localStorage?.getItem?.("vouch-uid-visitor"),t=window.localStorage?.getItem?.("vouch-uid-client"),i=window.sessionStorage?.getItem?.("vouch-uid-tab");const r=Ni();return e||(e=Gg(s),window.localStorage?.setItem?.("vouch-uid-visitor",e)),t||(t=Ni(),window.localStorage?.setItem?.("vouch-uid-client",t)),i||(i=Ni(),window.sessionStorage?.setItem?.("vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function $g(s,e){return s&&"vouchId"in s?s.vouchId:e?.id??null}function Kg(s="embedded_player"){const[e,t]=Intl.DateTimeFormat().resolvedOptions().timeZone?.split?.("/")??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([r,n])=>{if(/utm/.test(r)){const o=r.toLowerCase().replace(/[-_][a-z0-9]/g,a=>a.slice(-1).toUpperCase());i[o]=n}}),{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:Pg.version,templateVersion:so,...i}}const al=1;class Yg{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=$g(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}=Cr(this.host.env),{client:i,tab:r,request:n,visitor:o}=Hg(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":Kg(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+al&&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}})=>{!this.host.paused&&t===this.host.scene?.video?.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]+al&&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(()=>{"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),this.host.mediaPlayer?.addEventListener("play",this._handlePlay),this.host.mediaPlayer?.addEventListener("video:play",this._handleVideoPlay),this.host.mediaPlayer?.addEventListener("video:pause",this._handleVideoPause),this.host.mediaPlayer?.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),this.host.mediaPlayer?.removeEventListener("play",this._handlePlay),this.host.mediaPlayer?.removeEventListener("video:play",this._handleVideoPlay),this.host.mediaPlayer?.removeEventListener("video:pause",this._handleVideoPause),this.host.mediaPlayer?.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ro={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof wr<"u"&&wr,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(R){return R&&DataView.prototype.isPrototypeOf(R)}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(R){return R&&c.indexOf(Object.prototype.toString.call(R))>-1};function u(R){if(typeof R!="string"&&(R=String(R)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(R)||R==="")throw new TypeError('Invalid character in header field name: "'+R+'"');return R.toLowerCase()}function d(R){return typeof R!="string"&&(R=String(R)),R}function f(R){var L={next:function(){var W=R.shift();return{done:W===void 0,value:W}}};return A.iterable&&(L[Symbol.iterator]=function(){return L}),L}function g(R){this.map={},R instanceof g?R.forEach(function(L,W){this.append(W,L)},this):Array.isArray(R)?R.forEach(function(L){this.append(L[0],L[1])},this):R&&Object.getOwnPropertyNames(R).forEach(function(L){this.append(L,R[L])},this)}g.prototype.append=function(R,L){R=u(R),L=d(L);var W=this.map[R];this.map[R]=W?W+", "+L:L},g.prototype.delete=function(R){delete this.map[u(R)]},g.prototype.get=function(R){return R=u(R),this.has(R)?this.map[R]:null},g.prototype.has=function(R){return this.map.hasOwnProperty(u(R))},g.prototype.set=function(R,L){this.map[u(R)]=d(L)},g.prototype.forEach=function(R,L){for(var W in this.map)this.map.hasOwnProperty(W)&&R.call(L,this.map[W],W,this)},g.prototype.keys=function(){var R=[];return this.forEach(function(L,W){R.push(W)}),f(R)},g.prototype.values=function(){var R=[];return this.forEach(function(L){R.push(L)}),f(R)},g.prototype.entries=function(){var R=[];return this.forEach(function(L,W){R.push([W,L])}),f(R)},A.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function I(R){if(R.bodyUsed)return Promise.reject(new TypeError("Already read"));R.bodyUsed=!0}function B(R){return new Promise(function(L,W){R.onload=function(){L(R.result)},R.onerror=function(){W(R.error)}})}function S(R){var L=new FileReader,W=B(L);return L.readAsArrayBuffer(R),W}function Q(R){var L=new FileReader,W=B(L);return L.readAsText(R),W}function m(R){for(var L=new Uint8Array(R),W=new Array(L.length),b=0;b<L.length;b++)W[b]=String.fromCharCode(L[b]);return W.join("")}function y(R){if(R.slice)return R.slice(0);var L=new Uint8Array(R.byteLength);return L.set(new Uint8Array(R)),L.buffer}function D(){return this.bodyUsed=!1,this._initBody=function(R){this.bodyUsed=this.bodyUsed,this._bodyInit=R,R?typeof R=="string"?this._bodyText=R:A.blob&&Blob.prototype.isPrototypeOf(R)?this._bodyBlob=R:A.formData&&FormData.prototype.isPrototypeOf(R)?this._bodyFormData=R:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)?this._bodyText=R.toString():A.arrayBuffer&&A.blob&&l(R)?(this._bodyArrayBuffer=y(R.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(R)||h(R))?this._bodyArrayBuffer=y(R):this._bodyText=R=Object.prototype.toString.call(R):this._bodyText="",this.headers.get("content-type")||(typeof R=="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(R)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var R=I(this);if(R)return R;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 R=I(this);return R||(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(S)}),this.text=function(){var R=I(this);if(R)return R;if(this._bodyBlob)return Q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(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(_)}),this.json=function(){return this.text().then(JSON.parse)},this}var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function k(R){var L=R.toUpperCase();return v.indexOf(L)>-1?L:R}function P(R,L){if(!(this instanceof P))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L=L||{};var W=L.body;if(R instanceof P){if(R.bodyUsed)throw new TypeError("Already read");this.url=R.url,this.credentials=R.credentials,L.headers||(this.headers=new g(R.headers)),this.method=R.method,this.mode=R.mode,this.signal=R.signal,!W&&R._bodyInit!=null&&(W=R._bodyInit,R.bodyUsed=!0)}else this.url=String(R);if(this.credentials=L.credentials||this.credentials||"same-origin",(L.headers||!this.headers)&&(this.headers=new g(L.headers)),this.method=k(L.method||this.method||"GET"),this.mode=L.mode||this.mode||null,this.signal=L.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&W)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(W),(this.method==="GET"||this.method==="HEAD")&&(L.cache==="no-store"||L.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 _(R){var L=new FormData;return R.trim().split("&").forEach(function(W){if(W){var b=W.split("="),w=b.shift().replace(/\+/g," "),T=b.join("=").replace(/\+/g," ");L.append(decodeURIComponent(w),decodeURIComponent(T))}}),L}function U(R){var L=new g,W=R.replace(/\r?\n[\t ]+/g," ");return W.split("\r").map(function(b){return b.indexOf(`
|
149
|
+
`)===0?b.substr(1,b.length):b}).forEach(function(b){var w=b.split(":"),T=w.shift().trim();if(T){var V=w.join(":").trim();L.append(T,V)}}),L}D.call(P.prototype);function K(R,L){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L||(L={}),this.type="default",this.status=L.status===void 0?200:L.status,this.ok=this.status>=200&&this.status<300,this.statusText=L.statusText===void 0?"":""+L.statusText,this.headers=new g(L.headers),this.url=L.url||"",this._initBody(R)}D.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},K.error=function(){var R=new K(null,{status:0,statusText:""});return R.type="error",R};var Y=[301,302,303,307,308];K.redirect=function(R,L){if(Y.indexOf(L)===-1)throw new RangeError("Invalid status code");return new K(null,{status:L,headers:{location:R}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(L,W){this.message=L,this.name=W;var b=Error(L);this.stack=b.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(R,L){return new Promise(function(W,b){var w=new P(R,L);if(w.signal&&w.signal.aborted)return b(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function V(){T.abort()}T.onload=function(){var q={status:T.status,statusText:T.statusText,headers:U(T.getAllResponseHeaders()||"")};q.url="responseURL"in T?T.responseURL:q.headers.get("X-Request-URL");var se="response"in T?T.response:T.responseText;setTimeout(function(){W(new K(se,q))},0)},T.onerror=function(){setTimeout(function(){b(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){b(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){b(new o.DOMException("Aborted","AbortError"))},0)};function H(q){try{return q===""&&a.location.href?a.location.href:q}catch{return q}}T.open(w.method,H(w.url),!0),w.credentials==="include"?T.withCredentials=!0:w.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),L&&typeof L.headers=="object"&&!(L.headers instanceof g)?Object.getOwnPropertyNames(L.headers).forEach(function(q){T.setRequestHeader(q,d(L.headers[q]))}):w.headers.forEach(function(q,se){T.setRequestHeader(se,q)}),w.signal&&(w.signal.addEventListener("abort",V),T.onreadystatechange=function(){T.readyState===4&&w.signal.removeEventListener("abort",V)}),T.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return X.polyfill=!0,a.fetch||(a.fetch=X,a.Headers=g,a.Request=P,a.Response=K),o.Headers=g,o.Request=P,o.Response=K,o.fetch=X,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(ro,ro.exports);var Vg=ro.exports;const Al=YA(Vg);async function Jg(s){var e;try{if((e=await Al(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function ll({sources:s}){let e=null;const t=s?.filter(Boolean),i=t?.find(n=>n.startsWith("blob:")),r=t?.find(n=>n.startsWith("file:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>Jg(o));e=(await Promise.all(n)).find(Boolean)}return e}async function Wg(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")||s.startsWith("file")?(await Al(s)).text():s}const qg=vi(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{const o={[t.split("-")[0]]:s,[i.split("-")[0]]:e}[r]??s;return o?Wg(o):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});async function jg(s){var e,t,i,r,n,o;const a=(t=(e=s?.answer)==null?void 0:e.media)==null?void 0:t.input,A=(r=(i=s?.answer)==null?void 0:i.media)==null?void 0:r.video,l=(o=(n=s?.answer)==null?void 0:n.media)==null?void 0:o.playlist;return{src:await ll({sources:[a,A]}),playlist:await ll({sources:[l]})}}function Xg(s){var e,t,i,r,n,o,a,A,l,c,h,u;const d=((t=(e=s?.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":(r=(i=s?.answer)==null?void 0:i.contact)==null?void 0:r.name,f=((o=(n=s?.answer)==null?void 0:n.client)==null?void 0:o.name)==="Not Supplied"?"":(A=(a=s?.answer)==null?void 0:a.client)==null?void 0:A.name;return{name:d,companyName:f,firstName:(l=d?.split(" "))==null?void 0:l[0],lastName:(c=d?.split(" "))==null?void 0:c[1],companyRoleTitle:[f,(u=(h=s?.answer)==null?void 0:h.contact)==null?void 0:u.roleTitle].filter(Boolean).join(", ")}}async function no({rootData:s,index:e},t){var i,r,n,o,a,A,l,c,h,u,d,f,g,I;return{...Xg(s),...await jg(s),key:`${s?.id}-${e}`,captions:await qg({original:((r=(i=s?.answer)==null?void 0:i.media)==null?void 0:r.captions)??((o=(n=s?.answer)==null?void 0:n.captions)==null?void 0:o.current),translation:((A=(a=s?.answer)==null?void 0:a.media)==null?void 0:A.translation)??((c=(l=s?.answer)==null?void 0:l.captions)==null?void 0:c.translation),originalLanguage:(u=(h=s?.answer)==null?void 0:h.transcriptions)==null?void 0:u.language,translationLanguage:(g=(f=(d=s?.answer)==null?void 0:d.transcriptions)==null?void 0:f.translation)==null?void 0:g.language},t),answerLabel:((I=s?.answer)==null?void 0:I.label)??s?.title}}const _r={af:"Afrikaans",ar:"Arabic",da:"Danish",de:"German",en:"English",es:"Spanish",fa:"Farsi",fr:"French",gd:"Scottish Gaelic",he:"Hebrew",hi:"Hindi, Indian",id:"Indonesian",it:"Italian",ja:"Japanese",ko:"Korean",ms:"Malay",nl:"Dutch",pt:"Portuguese",ru:"Russian",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",zh:"Chinese"};function Zg({data:s}){var e,t;return((t=(e=s?.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,h;const u=(a=(o=(n=r?.answer)==null?void 0:n.transcriptions)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(l=(A=r?.answer)==null?void 0:A.transcriptions)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&_r[u]&&!i.find(f=>f.value===u)&&i.push({value:u,label:_r[u]}),d&&_r[d]&&!i.find(f=>f.value===d)&&i.push({value:d,label:_r[d]}),i},[]))??[]}/**
|
150
|
+
* @license
|
151
|
+
* Copyright 2018 Google LLC
|
152
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
153
|
+
*/const Fe=es(class extends Us{constructor(s){if(super(s),s.type!==zi.ATTRIBUTE||s.name!=="class"||s.strings?.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]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in e)e[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(e)}const t=s.element.classList;for(const i of this.st)i in e||(t.remove(i),this.st.delete(i));for(const i in e){const r=!!e[i];r===this.st.has(i)||this.nt?.has(i)||(r?(t.add(i),this.st.add(i)):(t.remove(i),this.st.delete(i)))}return Ft}});/**
|
154
|
+
* @license
|
155
|
+
* Copyright 2018 Google LLC
|
156
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
157
|
+
*/const cl="important",zg=" !"+cl,oo=es(class extends Us{constructor(s){if(super(s),s.type!==zi.ATTRIBUTE||s.name!=="style"||s.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(zg);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?cl:""):t[i]=r}}return Ft}});var hl=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function ef(s,e){return!!(s===e||hl(s)&&hl(e))}function tf(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!ef(s[t],e[t]))return!1;return!0}function ul(s,e){e===void 0&&(e=tf);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}function sf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var dl={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 f=r.exec(d.path);d.netLoc=f[1],d.path=f[2]}d.netLoc&&!d.path&&(d.path="/");var g={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(g.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)g.path=d.path,u.params||(g.params=d.params,u.query||(g.query=d.query));else{var I=d.path,B=I.substring(0,I.lastIndexOf("/")+1)+u.path;g.path=a.normalizePath(B)}return g.path===null&&(g.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(g)},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})()})(dl);var ao=dl.exports;function gl(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 it(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gl(Object(t),!0).forEach(function(i){of(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):gl(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function rf(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function nf(s){var e=rf(s,"string");return typeof e=="symbol"?e:String(e)}function of(s,e,t){return e=nf(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Ye(){return Ye=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},Ye.apply(this,arguments)}const oe=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},af=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=Af},Af=Number.MAX_SAFE_INTEGER||9007199254740991;let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),ue=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}({}),G=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 Ui=function(){},Ao={trace:Ui,debug:Ui,log:Ui,warn:Ui,info:Ui,error:Ui};let Vs=Ao;function lf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Ui}function cf(s,...e){e.forEach(function(t){Vs[t]=s[t]?s[t].bind(s):lf(t)})}function hf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){cf(s,"debug","log","info","warn","error");try{Vs.log(`Debug logs enabled for "${e}" in hls.js version 1.5.7`)}catch{Vs=Ao}}else Vs=Ao}const F=Vs,uf=/^(\d+)x(\d+)$/,fl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ue{constructor(e){typeof e=="string"&&(e=Ue.parseAttrList(e)),Ye(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=uf.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(fl.lastIndex=0;(t=fl.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 df(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function gf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Il{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=Ye(new Ue({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);oe(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(oe(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Fr{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 be={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class El{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[be.AUDIO]:null,[be.VIDEO]:null,[be.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ao.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class lo extends El{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 Fr,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!oe(this.programDateTime))return null;const e=oe(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[be.AUDIO]=null,e[be.VIDEO]=null,e[be.AUDIOVIDEO]=null}}class ff extends El{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 Fr,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 If=10;class Ef{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?oe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||If}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 co(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function pf(s){const e=ho(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Cf(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 mf(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=co(o)):t=pf(o)}}return t}function ho(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const os=typeof self<"u"?self:void 0;var Ne={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},mt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function pl(s){switch(s){case mt.FAIRPLAY:return Ne.FAIRPLAY;case mt.PLAYREADY:return Ne.PLAYREADY;case mt.WIDEVINE:return Ne.WIDEVINE;case mt.CLEARKEY:return Ne.CLEARKEY}}var Cl={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Bf(s){if(s===Cl.WIDEVINE)return Ne.WIDEVINE}function ml(s){switch(s){case Ne.FAIRPLAY:return mt.FAIRPLAY;case Ne.PLAYREADY:return mt.PLAYREADY;case Ne.WIDEVINE:return mt.WIDEVINE;case Ne.CLEARKEY:return mt.CLEARKEY}}function uo(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ne.FAIRPLAY,Ne.WIDEVINE,Ne.PLAYREADY,Ne.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ne.WIDEVINE]&&t&&i.push(Ne.WIDEVINE),i}const Bl=function(s){return os!=null&&(s=os.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function yf(s,e,t,i){let r;switch(s){case Ne.FAIRPLAY:r=["cenc","sinf"];break;case Ne.WIDEVINE:case Ne.PLAYREADY:r=["cenc"];break;case Ne.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return Qf(r,e,t,i)}function Qf(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Pi(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const go=(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,yl=(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,Js=(s,e)=>{const t=e;let i=0;for(;go(s,e);){i+=10;const r=Nr(s,e+6);i+=r,yl(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},Nr=(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},vf=(s,e)=>go(s,e)&&Nr(s,e+6)+10<=s.length-e,fo=s=>{const e=vl(s);for(let t=0;t<e.length;t++){const i=e[t];if(Ql(i))return xf(i)}},Ql=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",Sf=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Nr(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},vl=s=>{let e=0;const t=[];for(;go(s,e);){const i=Nr(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=Sf(s.subarray(e)),o=Df(n);o&&t.push(o),e+=n.size+10}yl(s,e)&&(e+=10)}return t},Df=s=>s.type==="PRIV"?wf(s):s.type[0]==="W"?Rf(s):bf(s),wf=s=>{if(s.size<2)return;const e=Jt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},bf=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Jt(s.data.subarray(t),!0);t+=i.length+1;const r=Jt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Jt(s.data.subarray(1));return{key:s.type,data:e}},Rf=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Jt(s.data.subarray(t),!0);t+=i.length+1;const r=Jt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Jt(s.data);return{key:s.type,data:e}},xf=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)}},Jt=(s,e=!1)=>{const t=Tf();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 Io;function Tf(){if(!navigator.userAgent.includes("PlayStation 4"))return!Io&&typeof self.TextDecoder<"u"&&(Io=new self.TextDecoder("utf-8")),Io}const Wt={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}},Or=Math.pow(2,32)-1,Lf=[].push,Sl={video:1,audio:2,id3:3,text:4};function Xe(s){return String.fromCharCode.apply(null,s)}function Dl(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function le(s,e){const t=bl(s,e);return t<0?4294967296+t:t}function wl(s,e){let t=le(s,e);return t*=Math.pow(2,32),t+=le(s,e+4),t}function bl(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Eo(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 kf(s){const e=s.byteLength;for(let t=0;t<e;){const i=le(s,t);if(i>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function Ee(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=le(s,r),o=Xe(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=Ee(s.subarray(r+8,a),e.slice(1));A.length&&Lf.apply(t,A)}r=a}return t}function Mf(s){const e=[],t=s[0];let i=8;const r=le(s,i);i+=4;let n=0,o=0;t===0?(n=le(s,i),o=le(s,i+4),i+=8):(n=wl(s,i),o=wl(s,i+8),i+=16),i+=2;let a=s.length+o;const A=Dl(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=le(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return F.warn("SIDX has hierarchical references (not supported)"),null;const f=le(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:f,info:{duration:f/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 Rl(s){const e=[],t=Ee(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=Ee(n,["tkhd"])[0];if(o){let a=o[0];const A=le(o,a===0?12:20),l=Ee(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=le(l,a===0?12:20),h=Ee(n,["mdia","hdlr"])[0];if(h){const u=Xe(h.subarray(8,12)),d={soun:be.AUDIO,vide:be.VIDEO}[u];if(d){const f=Ee(n,["mdia","minf","stbl","stsd"])[0],g=_f(f);e[A]={timescale:c,type:d},e[d]=it({timescale:c,id:A},g)}}}}}return Ee(s,["moov","mvex","trex"]).forEach(r=>{const n=le(r,4),o=e[n];o&&(o.default={duration:le(r,12),flags:le(r,20)})}),e}function _f(s){const e=s.subarray(8),t=e.subarray(86),i=Xe(e.subarray(4,8));let r=i;const n=i==="enca"||i==="encv";if(n){const a=Ee(e,[i])[0].subarray(i==="enca"?28:78);Ee(a,["sinf"]).forEach(l=>{const c=Ee(l,["schm"])[0];if(c){const h=Xe(c.subarray(4,8));if(h==="cbcs"||h==="cenc"){const u=Ee(l,["frma"])[0];u&&(r=Xe(u))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=Ee(t,["avcC"])[0];r+="."+Ur(o[1])+Ur(o[2])+Ur(o[3]);break}case"mp4a":{const o=Ee(e,[i])[0],a=Ee(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=po(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=po(a,A);const c=a[A++];if(c===64)r+="."+Ur(c);else break;if(A+=12,a[A++]!==5)break;A=po(a,A);const h=a[A++];let u=(h&248)>>3;u===31&&(u+=1+((h&7)<<3)+((a[A]&224)>>5)),r+="."+u}break}case"hvc1":case"hev1":{const o=Ee(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=le(o,2),h=(a&32)>>5?"H":"L",u=o[12],d=o.subarray(6,12);r+="."+A+l,r+="."+c.toString(16).toUpperCase(),r+="."+h+u;let f="";for(let g=d.length;g--;){const I=d[g];(I||f)&&(f="."+I.toString(16).toUpperCase()+f)}r+=f;break}case"dvh1":case"dvhe":{const o=Ee(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+qt(a)+"."+qt(A);break}case"vp09":{const o=Ee(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+qt(a)+"."+qt(A)+"."+qt(l);break}case"av01":{const o=Ee(t,["av1C"])[0],a=o[1]>>>5,A=o[1]&31,l=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,h=(o[2]&32)>>5,u=a===2&&c?h?12:10:c?10:8,d=(o[2]&16)>>4,f=(o[2]&8)>>3,g=(o[2]&4)>>2,I=o[2]&3;r+="."+a+"."+qt(A)+l+"."+qt(u)+"."+d+"."+f+g+I+"."+qt(1)+"."+qt(1)+"."+qt(1)+"."+0;break}}return{codec:r,encrypted:n}}function po(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Ur(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function qt(s){return(s<10?"0":"")+s}function Ff(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&Ee(s,["moov","trak"]).forEach(r=>{const o=Ee(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=Ee(o,["enca"]);const A=a.length>0;A||(a=Ee(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);Ee(c,["sinf"]).forEach(u=>{const d=xl(u);if(d){const f=d.subarray(8,24);f.some(g=>g!==0)||(F.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${Wt.hexDump(f)} -> ${Wt.hexDump(t)}`),d.set(t,8))}})})}),s}function xl(s){const e=Ee(s,["schm"])[0];if(e){const t=Xe(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return Ee(s,["schi","tenc"])[0]}return F.error("[eme] missing 'schm' box"),null}function Nf(s,e){return Ee(e,["moof","traf"]).reduce((t,i)=>{const r=Ee(i,["tfdt"])[0],n=r[0],o=Ee(i,["tfhd"]).reduce((a,A)=>{const l=le(A,4),c=s[l];if(c){let h=le(r,4);if(n===1){if(h===Or)return F.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=Or+1,h+=le(r,8)}const u=c.timescale||9e4,d=h/u;if(oe(d)&&(a===null||d<a))return d}return a},null);return o!==null&&oe(o)&&(t===null||o<t)?o:t},null)}function Of(s,e){let t=0,i=0,r=0;const n=Ee(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=Ee(a,["tfhd"])[0],l=le(A,4),c=e[l];if(!c)continue;const h=c.default,u=le(A,0)|h?.flags;let d=h?.duration;u&8&&(u&2?d=le(A,12):d=le(A,8));const f=c.timescale||9e4,g=Ee(a,["trun"]);for(let I=0;I<g.length;I++){if(t=Uf(g[I]),!t&&d){const B=le(g[I],4);t=d*B}c.type===be.VIDEO?i+=t/f:c.type===be.AUDIO&&(r+=t/f)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=Ee(s,["sidx"]);for(let c=0;c<l.length;c++){const h=Mf(l[c]);if(h!=null&&h.references){o=Math.min(o,h.earliestPresentationTime/h.timescale);const u=h.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,u+h.earliestPresentationTime/h.timescale),A=a-o}}if(A&&oe(A))return A}return i||r}function Uf(s){const e=le(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=le(s,4);for(let n=0;n<r;n++){if(e&256){const o=le(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Pf(s,e,t){Ee(e,["moof","traf"]).forEach(i=>{Ee(i,["tfhd"]).forEach(r=>{const n=le(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;Ee(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let h=le(A,4);if(l===0)h-=c,h=Math.max(h,0),Eo(A,4,h);else{h*=Math.pow(2,32),h+=le(A,8),h-=c,h=Math.max(h,0);const u=Math.floor(h/(Or+1)),d=Math.floor(h%(Or+1));Eo(A,4,u),Eo(A,8,d)}}})})})}function Gf(s){const e={valid:null,remainder:null},t=Ee(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=Pi(s,0,i.byteOffset-8),e.remainder=Pi(s,i.byteOffset-8),e}function xt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Tl(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return Ee(i,["moof"]).map(A=>{const l=A.byteOffset-8;Ee(A,["traf"]).map(h=>{const u=Ee(h,["tfdt"]).map(d=>{const f=d[0];let g=le(d,4);return f===1&&(g*=Math.pow(2,32),g+=le(d,8)),g/r})[0];return u!==void 0&&(s=u),Ee(h,["tfhd"]).map(d=>{const f=le(d,4),g=le(d,0)&16777215,I=(g&1)!==0,B=(g&2)!==0,S=(g&8)!==0;let Q=0;const m=(g&16)!==0;let y=0;const D=(g&32)!==0;let v=8;f===n&&(I&&(v+=8),B&&(v+=4),S&&(Q=le(d,v),v+=4),m&&(y=le(d,v),v+=4),D&&(v+=4),e.type==="video"&&(o=Hf(e.codec)),Ee(h,["trun"]).map(k=>{const P=k[0],_=le(k,0)&16777215,U=(_&1)!==0;let K=0;const Y=(_&4)!==0,X=(_&256)!==0;let R=0;const L=(_&512)!==0;let W=0;const b=(_&1024)!==0,w=(_&2048)!==0;let T=0;const V=le(k,4);let H=8;U&&(K=le(k,H),H+=4),Y&&(H+=4);let q=K+l;for(let se=0;se<V;se++){if(X?(R=le(k,H),H+=4):R=Q,L?(W=le(k,H),H+=4):W=y,b&&(H+=4),w&&(P===0?T=le(k,H):T=bl(k,H),H+=4),e.type===be.VIDEO){let ce=0;for(;ce<W;){const de=le(i,q);if(q+=4,$f(o,i[q])){const re=i.subarray(q,q+de);Ll(re,o?2:1,s+T/r,t)}q+=de,ce+=de+4}}s+=R/r}}))})})}),t}function Hf(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 $f(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Ll(s,e,t,i){const r=kl(s);let n=0;n+=e;let o=0,a=0,A=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;A=r[n++],o+=A}while(A===255);a=0;do{if(n>=r.length)break;A=r[n++],a+=A}while(A===255);const l=r.length-n;let c=n;if(a<l)n+=a;else if(a>l){F.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(r[c++]===181){const u=Dl(r,c);if(c+=2,u===49){const d=le(r,c);if(c+=4,d===1195456820){const f=r[c++];if(f===3){const g=r[c++],I=31&g,B=64&g,S=B?2+I*3:0,Q=new Uint8Array(S);if(B){Q[0]=g;for(let m=1;m<S;m++)Q[m]=r[c++]}i.push({type:f,payloadType:o,pts:t,bytes:Q})}}}}}else if(o===5&&a>16){const h=[];for(let f=0;f<16;f++){const g=r[c++].toString(16);h.push(g.length==1?"0"+g:g),(f===3||f===5||f===7||f===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let f=0;f<u;f++)d[f]=r[c++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Jt(d),userDataBytes:d})}}}function kl(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function Kf(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;Xe(s.subarray(l,l+1))!=="\0";)t+=Xe(s.subarray(l,l+1)),l+=1;for(t+=Xe(s.subarray(l,l+1)),l+=1;Xe(s.subarray(l,l+1))!=="\0";)i+=Xe(s.subarray(l,l+1)),l+=1;i+=Xe(s.subarray(l,l+1)),l+=1,r=le(s,12),n=le(s,16),a=le(s,20),A=le(s,24),l=28}else if(e===1){l+=4,r=le(s,l),l+=4;const h=le(s,l);l+=4;const u=le(s,l);for(l+=4,o=4294967296*h+u,af(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=le(s,l),l+=4,A=le(s,l),l+=4;Xe(s.subarray(l,l+1))!=="\0";)t+=Xe(s.subarray(l,l+1)),l+=1;for(t+=Xe(s.subarray(l,l+1)),l+=1;Xe(s.subarray(l,l+1))!=="\0";)i+=Xe(s.subarray(l,l+1)),l+=1;i+=Xe(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 Yf(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 Vf(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),Yf([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function Jf(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=Wt.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 Pr={};class Ws{static clearKeyUriToKeyIdMap(){Pr={}}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 mt.FAIRPLAY:case mt.WIDEVINE:case mt.PLAYREADY:case mt.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=Wf(e);return new Ws(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=mf(this.uri);if(t)switch(this.keyFormat){case mt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case mt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Vf(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=co(c).subarray(0,16);Cf(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=Pr[this.uri];if(!i){const r=Object.keys(Pr).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),Pr[this.uri]=i}this.keyId=i}return this}}function Wf(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Ml=/\{\$([a-zA-Z0-9-_]+)\}/g;function _l(s){return Ml.test(s)}function Bt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=Co(s,n))}}function Co(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Ml,i=>{const r=i.substring(2,i.length-1),n=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 Fl(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 qf(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 as(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const Gr={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function jf(s,e){const t=Gr[e];return!!t&&!!t[s.slice(0,4)]}function mo(s,e,t=!0){return!s.split(",").some(i=>!Nl(i,e,t))}function Nl(s,e,t=!0){var i;const r=as(t);return(i=r?.isTypeSupported(qs(s,e)))!=null?i:!1}function qs(s,e){return`${e}/mp4;codecs="${s}"`}function Ol(s){if(s){const e=s.substring(0,4);return Gr.video[e]}return 2}function Hr(s){return s.split(",").reduce((e,t)=>{const i=Gr.video[t];return i?(i*2+e)/(e?3:2):(Gr.audio[t]+e)/(e?2:1)},0)}const Bo={};function Xf(s,e=!0){if(Bo[s])return Bo[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(Nl(t[i],"audio",e))return Bo[s]=t[i],t[i];return s}const Zf=/flac|opus/i;function $r(s,e=!0){return s.replace(Zf,t=>Xf(t.toLowerCase(),e))}function Ul(s,e){return s&&s!=="mp4a"?s:e}function zf(s){const e=s.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return s}const Pl=/#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,Gl=/#EXT-X-MEDIA:(.*)/g,eI=/^#EXT(?:INF|-X-TARGETDURATION):/m,Hl=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),tI=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class jt{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return ao.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return eI.test(e)}static parseMasterPlaylist(e,t){const i=_l(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];Pl.lastIndex=0;let o;for(;(o=Pl.exec(e))!=null;)if(o[1]){var a;const l=new Ue(o[1]);Bt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Co(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:jt.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),iI(l.CODECS,h),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new Ue(c);Bt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=$l(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 Ue(c);Bt(r,h,["NAME","VALUE","QUERYPARAM"]),Fl(r,h,t)}break}case"CONTENT-STEERING":{const h=new Ue(c);Bt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:jt.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Kl(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(Gl.lastIndex=0;(r=Gl.exec(e))!==null;){const l=new Ue(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,Bt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=l.LANGUAGE,f=l["ASSOC-LANGUAGE"],g=l.CHANNELS,I=l.CHARACTERISTICS,B=l["INSTREAM-ID"],S={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?jt.resolve(l.URI,t):""};if(f&&(S.assocLang=f),g&&(S.channels=g),I&&(S.characteristics=I),B&&(S.instreamId=B),h!=null&&h.length){const Q=jt.findGroup(h,S.groupId)||h[0];Yl(S,Q,"audioCodec"),Yl(S,Q,"textCodec")}u.push(S)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new Ef(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,f=null,g=new lo(r,t),I,B,S,Q=-1,m=!1,y=null;for(Hl.lastIndex=0,a.m3u8=e,a.hasVariableRefs=_l(e);(I=Hl.exec(e))!==null;){m&&(m=!1,g=new lo(r,t),g.start=u,g.sn=c,g.cc=d,g.level=i,l&&(g.initSegment=l,g.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null,y&&(g.setByteRange(y),y=null)));const P=I[1];if(P){g.duration=parseFloat(P);const _=(" "+I[2]).slice(1);g.title=_||null,g.tagList.push(_?["INF",P,_]:["INF",P])}else if(I[3]){if(oe(g.duration)){g.start=u,S&&Wl(g,S,a),g.sn=c,g.level=i,g.cc=d,A.push(g);const _=(" "+I[3]).slice(1);g.relurl=Co(a,_),Vl(g,f),f=g,u+=g.duration,c++,h=0,m=!0}}else if(I[4]){const _=(" "+I[4]).slice(1);f?g.setByteRange(_,f):g.setByteRange(_)}else if(I[5])g.rawProgramDateTime=(" "+I[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),Q===-1&&(Q=A.length);else{if(I=I[0].match(tI),!I){F.warn("No matches on slow regex match for level playlist!");continue}for(B=1;B<I.length&&!(typeof I[B]<"u");B++);const _=(" "+I[B]).slice(1),U=(" "+I[B+1]).slice(1),K=I[B+2]?(" "+I[B+2]).slice(1):"";switch(_){case"PLAYLIST-TYPE":a.type=U.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(U);break;case"SKIP":{const Y=new Ue(U);Bt(a,Y,["RECENTLY-REMOVED-DATERANGES"]);const X=Y.decimalInteger("SKIPPED-SEGMENTS");if(oe(X)){a.skippedSegments=X;for(let L=X;L--;)A.unshift(null);c+=X}const R=Y.enumeratedString("RECENTLY-REMOVED-DATERANGES");R&&(a.recentlyRemovedDateranges=R.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(U),1);break;case"VERSION":a.version=parseInt(U);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(U||K)&&g.tagList.push(K?[U,K]:[U]);break;case"DISCONTINUITY":d++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([_]);break;case"BITRATE":g.tagList.push([_,U]);break;case"DATERANGE":{const Y=new Ue(U);Bt(a,Y,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Bt(a,Y,Y.clientAttrs);const X=new Il(Y,a.dateRanges[Y.ID]);X.isValid||a.skippedSegments?a.dateRanges[X.id]=X:F.warn(`Ignoring invalid DATERANGE tag: "${U}"`),g.tagList.push(["EXT-X-DATERANGE",U]);break}case"DEFINE":{{const Y=new Ue(U);Bt(a,Y,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Y?qf(a,Y,o):Fl(a,Y,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(U);break;case"KEY":{const Y=$l(U,t,a);if(Y.isSupported()){if(Y.method==="NONE"){S=void 0;break}S||(S={}),S[Y.keyFormat]&&(S=Ye({},S)),S[Y.keyFormat]=Y}else F.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${U}"`);break}case"START":a.startTimeOffset=Kl(U);break;case"MAP":{const Y=new Ue(U);if(Bt(a,Y,["BYTERANGE","URI"]),g.duration){const X=new lo(r,t);Jl(X,Y,i,S),l=X,g.initSegment=l,l.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=l.rawProgramDateTime)}else{const X=g.byteRangeEndOffset;if(X){const R=g.byteRangeStartOffset;y=`${X-R}@${R}`}else y=null;Jl(g,Y,i,S),l=g,m=!0}break}case"SERVER-CONTROL":{const Y=new Ue(U);a.canBlockReload=Y.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=Y.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&Y.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=Y.optionalFloat("PART-HOLD-BACK",0),a.holdBack=Y.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const Y=new Ue(U);a.partTarget=Y.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Y=a.partList;Y||(Y=a.partList=[]);const X=h>0?Y[Y.length-1]:void 0,R=h++,L=new Ue(U);Bt(a,L,["BYTERANGE","URI"]);const W=new ff(L,g,t,R,X);Y.push(W),g.duration+=W.duration;break}case"PRELOAD-HINT":{const Y=new Ue(U);Bt(a,Y,["URI"]),a.preloadHint=Y;break}case"RENDITION-REPORT":{const Y=new Ue(U);Bt(a,Y,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(Y);break}default:F.warn(`line parsed but not handled: ${I}`);break}}}f&&!f.relurl?(A.pop(),u-=f.duration,a.partList&&(a.fragmentHint=f)):a.partList&&(Vl(g,f),g.cc=d,a.fragmentHint=g,S&&Wl(g,S,a));const D=A.length,v=A[0],k=A[D-1];if(u+=a.skippedSegments*a.targetduration,u>0&&D&&k){a.averagetargetduration=u/D;const P=k.sn;a.endSN=P!=="initSegment"?P:0,a.live||(k.endList=!0),v&&(a.startCC=v.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,Q>0&&sI(A,Q),a}}function $l(s,e,t){var i,r;const n=new Ue(s);Bt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&F.error(`Invalid IV: ${n.IV}`);const h=a?jt.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new Ws(o,h,c,u,A)}function Kl(s){const t=new Ue(s).decimalFloatingPoint("TIME-OFFSET");return oe(t)?t:null}function iI(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>jf(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function Yl(s,e,t){const i=e[t];i&&(s[t]=i)}function sI(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 Vl(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),oe(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Jl(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 Wl(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 ve={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},he={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function ql(s){const{type:e}=s;switch(e){case ve.AUDIO_TRACK:return he.AUDIO;case ve.SUBTITLE_TRACK:return he.SUBTITLE;default:return he.MAIN}}function yo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class rI{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:ve.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:o,deliveryDirectives:a}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:ve.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:ve.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:ve.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url&&l.level===e.level){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===ve.MANIFEST?n=i.manifestLoadPolicy.default:n=Ye({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),oe((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===ve.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===ve.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===ve.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=Ye({},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 f=l.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),jt.isMediaPlaylist(f)?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=yo(e,i),A=jt.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:f}=A;this.variableList=f;const{AUDIO:g=[],SUBTITLES:I,"CLOSED-CAPTIONS":B}=jt.parseMasterPlaylistMedia(o,a,A);g.length&&!g.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"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ue({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:I,captions:B,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=yo(e,i),h=0,u=oe(A)?A:oe(a)?a:0,d=ql(i),f=jt.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===ve.MANIFEST){const g={attrs:new Ue({}),bitrate:0,details:f,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=f,this.handlePlaylistLoaded(f,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:ue.NETWORK_ERROR,details:G.MANIFEST_PARSING_ERROR,fatal:t.type===ve.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===ve.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===ve.AUDIO_TRACK||e.type===ve.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);F.warn(`[playlist-loader]: ${o}`);let A=G.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case ve.MANIFEST:A=i?G.MANIFEST_LOAD_TIMEOUT:G.MANIFEST_LOAD_ERROR,l=!0;break;case ve.LEVEL:A=i?G.LEVEL_LOAD_TIMEOUT:G.LEVEL_LOAD_ERROR,l=!1;break;case ve.AUDIO_TRACK:A=i?G.AUDIO_TRACK_LOAD_TIMEOUT:G.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case ve.SUBTITLE_TRACK:A=i?G.SUBTITLE_TRACK_LOAD_TIMEOUT:G.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:ue.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=t?.url||e.url;h.response=it({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=yo(t,r),f=ql(r),g=typeof r.level=="number"&&f===he.MAIN?l:void 0;if(!e.fragments.length){const B=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:ue.NETWORK_ERROR,details:G.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:B,reason:B.message,response:t,context:r,level:g,parent:f,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const I=e.playlistParsingError;if(I){a.trigger(E.ERROR,{type:ue.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:I,reason:I.message,response:t,context:r,level:g,parent:f,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 ve.MANIFEST:case ve.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case ve.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case ve.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function jl(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 Xl(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 As(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 Qo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=oI(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 nI(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 oI(s,e,t){const i=[],r=nI(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}function Kr(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}var Nt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const aI=.25;function vo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Zl(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?it({type:r},i):i))}return n}const Yr=(()=>{const s=vo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function So(s,e){return s.getTime()/1e3-e}function AI(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class lI{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&&(As(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 jl(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=vo();if(o)for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Nt.emsg&&!i||!r)continue;const l=vl(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>Yr&&(h=Yr),h-c<=0&&(h=c+aI);for(let d=0;d<l.length;d++){const f=l[d];if(!Ql(f)){this.updateId3CueEnds(c,A);const g=Zl(o,c,h,f,A);g&&this.id3Track.addCue(g)}}}}}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===Yr&&(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===Nt.audioId3&&A:r==="video"?l=c=>c.type===Nt.emsg&&a:l=c=>c.type===Nt.audioId3&&A||c.type===Nt.emsg&&a,Qo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!oe(a?.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=vo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=So(u.startDate,A),f=i[h],g=f?.cues||{};let I=f?.durationKnown||!1,B=Yr;const S=u.endDate;if(S)B=So(S,A),I=!0;else if(u.endOnNext&&!I){const m=o.reduce((y,D)=>{if(D!==u.id){const v=n[D];if(v.class===u.class&&v.startDate>u.startDate&&(!y||u.startDate<y.startDate))return v}return y},null);m&&(B=So(m.startDate,A),I=!0)}const Q=Object.keys(u.attr);for(let m=0;m<Q.length;m++){const y=Q[m];if(!df(y))continue;const D=g[y];if(D)I&&!f.durationKnown&&(D.endTime=B);else if(l){let v=u.attr[y];gf(y)&&(v=AI(v));const k=Zl(l,d,B,{key:y,data:v},Nt.dateRange);k&&(k.id=h,this.id3Track.addCue(k),g[y]=k)}}i[h]={cues:g,dateRange:u,durationKnown:I}}}}class cI{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r;return l+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===G.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||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration);if(a<A&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const Do=["NONE","TYPE-0","TYPE-1",null];function hI(s){return Do.indexOf(s)>-1}const Vr=["SDR","PQ","HLG"];function uI(s){return!!s&&Vr.indexOf(s)>-1}var js={No:"",Yes:"YES",v2:"v2"};function dI(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?js.v2:js.Yes:js.No}class zl{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 ls{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return ec(this._audioGroups,e)}hasSubtitleGroup(e){return ec(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function ec(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function wo(s,e){const t=e.startPTS;if(oe(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function tc(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(oe(l)){const I=Math.abs(l-t);oe(e.deltaPTS)?e.deltaPTS=Math.max(I,e.deltaPTS):e.deltaPTS=I,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 f=u-s.startSN,g=s.fragments;for(g[f]=e,d=f;d>0;d--)wo(g[d],g[d-1]);for(d=f;d<g.length-1;d++)wo(g[d],g[d+1]);return s.fragmentHint&&wo(g[g.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function gI(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(EI(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),oe(A.startPTS)&&oe(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;l&&(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){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=fI(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),II(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?tc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):ic(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 fI(s,e,t){const i=Ye({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Il(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 II(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 EI(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 ic(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||bo(e,i[t].start)}function bo(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 pI(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function CI(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 sc(s,e,t){var i;return s!=null&&s.details?rc((i=s.details)==null?void 0:i.partList,e,t):null}function rc(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 nc(s){s.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(r=>{r.level=t})})}function Jr(s){switch(s.details){case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_TIMEOUT:case G.LEVEL_LOAD_TIMEOUT:case G.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function oc(s,e){const t=Jr(e);return s.default[`${t?"timeout":"error"}Retry`]}function Ro(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function ac(s){return it(it({},s),{errorRetry:null,timeoutRetry:null})}function Wr(s,e,t,i){if(!s)return!1;const r=i?.code,n=e<s.maxNumRetry&&(mI(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function mI(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Ac={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 BI(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!oe(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(yI(e,t,o))return o}return null}function qr(s,e,t=0,i=0){let r=null;if(s){r=e[s.sn-e[0].sn+1]||null;const o=s.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&(!s||s.level===r.level)&&xo(t,i,r)===0)return r;const n=Ac.search(e,xo.bind(null,t,i));return n&&(n!==s||!r)?n:r}function xo(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 yI(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function QI(s,e){return Ac.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var ht={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ot={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class vI{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){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===he.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 G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case G.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:ht.DoNothing,flags:Ot.None};return}case G.FRAG_GAP:case G.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=ht.SendAlternateToPenaltyBox;return}case G.LEVEL_EMPTY_ERROR:case G.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===he.MAIN?t.level:n.loadLevel;t.details===G.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 G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:typeof o?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.SUBTITLE_LOAD_ERROR:case G.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===ve.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===ve.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ht.SendAlternateToPenaltyBox,t.errorAction.flags=Ot.MoveAllAlternatesMatchingHost;return}}return;case G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l?.attrs["HDCP-LEVEL"];c?t.errorAction={action:ht.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case G.BUFFER_ADD_CODEC_ERROR:case G.REMUX_ALLOC_ERROR:case G.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case G.INTERNAL_EXCEPTION:case G.BUFFER_APPENDING_ERROR:case G.BUFFER_FULL_ERROR:case G.LEVEL_SWITCH_ERROR:case G.BUFFER_STALLED_ERROR:case G.BUFFER_SEEK_OVER_HOLE:case G.BUFFER_NUDGE_ON_STALL:t.errorAction={action:ht.DoNothing,flags:Ot.None};return}t.type===ue.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=oc(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(Wr(r,n,Jr(e),e.response))return{action:ht.RetryRequest,flags:Ot.None,retryConfig:r,retryCount:n};const a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=oc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,h)=>c+h.fragmentError,0);if(r&&(e.details!==G.FRAG_GAP&&r.fragmentError++,Wr(a,A,Jr(e),e.response)))return{action:ht.RetryRequest,flags:Ot.None,retryConfig:a,retryCount:A};const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=A),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,o;const l=e.details;r.loadError++,l===G.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:h,loadLevel:u,minAutoLevel:d,maxAutoLevel:f}=i;i.autoLevelEnabled||(i.loadLevel=-1);const g=(n=e.frag)==null?void 0:n.type,B=(g===he.AUDIO&&l===G.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===G.BUFFER_ADD_CODEC_ERROR||l===G.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:D})=>r.audioCodec!==D),Q=e.sourceBufferName==="video"&&(l===G.BUFFER_ADD_CODEC_ERROR||l===G.BUFFER_APPEND_ERROR)&&h.some(({codecSet:D,audioCodec:v})=>r.codecSet!==D&&r.audioCodec===v),{type:m,groupId:y}=(o=e.context)!=null?o:{};for(let D=h.length;D--;){const v=(D+u)%h.length;if(v!==u&&v>=d&&v<=f&&h[v].loadError===0){var a,A;const k=h[v];if(l===G.FRAG_GAP&&e.frag){const P=h[v].details;if(P){const _=qr(e.frag,P.fragments,e.frag.start);if(_!=null&&_.gap)continue}}else{if(m===ve.AUDIO_TRACK&&k.hasAudioGroup(y)||m===ve.SUBTITLE_TRACK&&k.hasSubtitleGroup(y))continue;if(g===he.AUDIO&&(a=r.audioGroups)!=null&&a.some(P=>k.hasAudioGroup(P))||g===he.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(P=>k.hasSubtitleGroup(P))||B&&r.audioCodec===k.audioCodec||!B&&r.audioCodec!==k.audioCodec||Q&&r.codecSet===k.codecSet)continue}c=v;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:ht.SendAlternateToPenaltyBox,flags:Ot.None,nextAutoLevel:c}}return{action:ht.SendAlternateToPenaltyBox,flags:Ot.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case ht.DoNothing:break;case ht.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==G.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Ot.None:this.switchLevel(e,o);break;case Ot.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=Do[Do.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class To{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(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t?.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?.lastPartSn;let a=parseInt(n["LAST-PART"])||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 zl(o,a>=0?a:void 0,js.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&&gI(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const I=this.hls.config.lowLatencyMode,B=r.lastPartSn,S=r.endSN,Q=r.lastPartIndex,m=Q!==-1,y=B===S,D=I?0:Q;m?(l=y?S+1:B,c=y?D:Q+1):l=S+1;const v=r.age,k=v+r.ageHeader;let P=Math.min(k-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 _=Math.floor(P/r.targetduration);if(l+=_,c!==void 0){const U=Math.round(P%r.targetduration/r.partTarget);c+=U}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${v.toFixed(2)}s goal: ${P} skip sn ${_} to part ${c}`)}r.tuneInGoal=P}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),I||!y){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,f=pI(r,d);r.updated&&o>this.requestScheduled+f&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+f-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+f<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=f);let g=this.requestScheduled-o;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),g)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=dI(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=js.No),new zl(i,r,n)}checkRetry(e){const t=e.details,i=Jr(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===ht.RetryRequest||!r.resolved&&n===ht.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=Ro(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}class cs{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 SI{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 cs(e),this.fast_=new cs(t),this.defaultTTFB_=r,this.ttfb_=new cs(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new cs(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new cs(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new cs(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const lc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},cc={};function DI(s,e,t,i,r,n){const o=s.audioCodec?s.audioGroups:null,a=n?.audioCodec,A=n?.channels,l=A?parseInt(A):a?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,u)=>{if(u){const d=e.groups[u];if(!d)throw new Error(`Audio track group ${u} not found`);Object.keys(d.channels).forEach(f=>{h[f]=(h[f]||0)+d.channels[f]})}return h},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(r,8e6))||!!c&&oe(l)&&Object.keys(c).some(h=>parseInt(h)>l)}function wI(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(lc);const n={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},o=s.videoRange;o!=="SDR"&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map(A=>({type:"media-source",video:it(it({},n),{},{contentType:qs(A,"video")})}));return r&&s.audioGroups&&s.audioGroups.forEach(A=>{var l;A&&((l=e.groups[A])==null||l.tracks.forEach(c=>{if(c.groupId===A){const h=c.channels||"",u=parseFloat(h);oe(u)&&u>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:qs(d,"audio"),channels:""+u}})))}}))}),Promise.all(a.map(A=>{const l=bI(A);return cc[l]||(cc[l]=t.decodingInfo(A))})).then(A=>({supported:!A.some(l=>!l.supported),configurations:a,decodingInfoResults:A})).catch(A=>({supported:!1,configurations:a,decodingInfoResults:[],error:A}))}function bI(s){const{audio:e,video:t}=s,i=t||e;if(i){const r=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function RI(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function xI(s,e){let t=!1,i=[];return s&&(t=s!=="SDR",i=[s]),e&&(i=e.allowedVideoRanges||Vr.slice(0),t=e.preferHDR!==void 0?e.preferHDR:RI(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function TI(s,e,t,i,r){const n=Object.keys(s),o=i?.channels,a=i?.audioCodec,A=o&&parseInt(o)===2;let l=!0,c=!1,h=1/0,u=1/0,d=1/0,f=0,g=[];const{preferHDR:I,allowedVideoRanges:B}=xI(e,r);for(let y=n.length;y--;){const D=s[n[y]];l=D.channels[2]>0,h=Math.min(h,D.minHeight),u=Math.min(u,D.minFramerate),d=Math.min(d,D.minBitrate);const v=B.filter(k=>D.videoRanges[k]>0);v.length>0&&(c=!0,g=v)}h=oe(h)?h:0,u=oe(u)?u:0;const S=Math.max(1080,h),Q=Math.max(30,u);return d=oe(d)?d:t,t=Math.max(d,t),c||(e=void 0,g=[]),{codecSet:n.reduce((y,D)=>{const v=s[D];if(D===y)return y;if(v.minBitrate>t)return di(D,`min bitrate of ${v.minBitrate} > current estimate of ${t}`),y;if(!v.hasDefaultAudio)return di(D,"no renditions with default or auto-select sound found"),y;if(a&&D.indexOf(a.substring(0,4))%5!==0)return di(D,`audio codec preference "${a}" not found`),y;if(o&&!A){if(!v.channels[o])return di(D,`no renditions with ${o} channel sound found (channels options: ${Object.keys(v.channels)})`),y}else if((!a||A)&&l&&v.channels[2]===0)return di(D,"no renditions with stereo sound found"),y;return v.minHeight>S?(di(D,`min resolution of ${v.minHeight} > maximum of ${S}`),y):v.minFramerate>Q?(di(D,`min framerate of ${v.minFramerate} > maximum of ${Q}`),y):g.some(k=>v.videoRanges[k]>0)?v.maxScore<f?(di(D,`max score of ${v.maxScore} < selected max of ${f}`),y):y&&(Hr(D)>=Hr(y)||v.fragmentError>s[y].fragmentError)?y:(f=v.maxScore,D):(di(D,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),y)},void 0),videoRanges:g,preferHDR:I,minFramerate:u,minBitrate:d}}function di(s,e){F.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function LI(s){return s.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function kI(s,e,t,i){return s.slice(t,i+1).reduce((r,n)=>{if(!n.codecSet)return r;const o=n.audioGroups;let a=r[n.codecSet];a||(r[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);const A=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,A),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,o&&o.forEach(l=>{if(!l)return;const c=e.groups[l];a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{a.channels[h]=(a.channels[h]||0)+c.channels[h]})}),r},{})}function Xt(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(hs(s,r,t))return i}return-1}function hs(s,e,t){const{groupId:i,name:r,lang:n,assocLang:o,characteristics:a,default:A}=s,l=s.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===o)&&(A===void 0||e.default===A)&&(l===void 0||e.forced===l)&&(a===void 0||MI(a,e.characteristics))&&(t===void 0||t(s,e))}function MI(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function us(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function _I(s,e,t,i,r){const n=e[i],a=e.reduce((u,d,f)=>{const g=d.uri;return(u[g]||(u[g]=[])).push(f),u},{})[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const A=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),h=hc(e,i,u=>{if(u.videoRange!==A||u.frameRate!==l||u.codecSet.substring(0,4)!==c)return!1;const d=u.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return Xt(s,f,r)>-1});return h>-1?h:hc(e,i,u=>{const d=u.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return Xt(s,f,r)>-1})}function hc(s,e,t){for(let i=e;i;i--)if(t(s[i]))return i;for(let i=e+1;i<s.length;i++)if(t(s[i]))return i;return-1}class FI{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:n,media:o}=r;if(!t||!o)return;const a=performance.now(),A=i?i.stats:t.stats,l=i?i.duration:t.duration,c=a-A.loading.start,h=r.minAutoLevel;if(A.aborted||A.loaded&&A.loaded===A.total||t.level<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||o.paused||!o.playbackRate||!o.readyState)return;const u=r.mainForwardBufferInfo;if(u===null)return;const d=this.bwEstimator.getEstimateTTFB(),f=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(l/(f*2))))return;const g=u.len/f,I=A.loading.first?A.loading.first-A.loading.start:-1,B=A.loaded&&I>-1,S=this.getBwEstimate(),Q=r.levels,m=Q[t.level],y=A.total||Math.max(A.loaded,Math.round(l*m.averageBitrate/8));let D=B?c-I:c;D<1&&B&&(D=Math.min(c,A.loaded*8/S));const v=B?A.loaded*1e3/D:0,k=v?(y-A.loaded)/v:y*8/S+d/1e3;if(k<=g)return;const P=v?v*8:S;let _=Number.POSITIVE_INFINITY,U;for(U=t.level-1;U>h;U--){const Y=Q[U].maxBitrate;if(_=this.getTimeToLoadFrag(d/1e3,P,l*Y,!Q[U].details),_<g)break}if(_>=k||_>l*10)return;r.nextLoadLevel=r.nextAutoLevel=U,B?this.bwEstimator.sample(c-Math.min(d,I),A.loaded):this.bwEstimator.sampleTTFB(c);const K=Q[U].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>K&&this.resetEstimator(K),this.clearTimer(),F.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
|
158
|
+
Time to underbuffer: ${g.toFixed(3)} s
|
159
|
+
Estimated load time for current fragment: ${k.toFixed(3)} s
|
160
|
+
Estimated load time for down switch fragment: ${_.toFixed(3)} s
|
161
|
+
TTFB estimate: ${I|0} ms
|
162
|
+
Current BW estimate: ${oe(S)?S|0:"Unknown"} bps
|
163
|
+
New BW estimate: ${this.getBwEstimate()|0} bps
|
164
|
+
Switching to level ${U} @ ${K|0} bps`),r.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:A})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(F.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new SI(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case G.BUFFER_ADD_CODEC_ERROR:case G.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case G.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const o=performance.now(),a=n?n.stats:i.stats,A=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(A-Math.min(h,l),a.loaded)}else this.bwEstimator.sampleTTFB(A)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;oe(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===he.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==he.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return F.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,n)&&o[e].loadError<=o[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,A=this.getBwEstimate(),l=this.getStarvationDelay();let c=n.abrBandWidthFactor,h=n.abrBandWidthUpFactor;if(l){const I=this.findBestLevel(A,o,r,l,0,c,h);if(I>=0)return I}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const I=this.bitrateTestDelay;I&&(u=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-I,F.info(`[abr] bitrate test took ${Math.round(1e3*I)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),c=h=1)}const d=this.findBestLevel(A,o,r,l,u,c,h);if(F.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=i.levels[o],g=i.levels[i.loadLevel];return f?.bitrate<g?.bitrate?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,o,a){var A;const l=r+n,c=this.lastLoadedFragLevel,h=c===-1?this.hls.firstLevel:c,{fragCurrent:u,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:I,config:B}=this.hls;if(f.length===1)return 0;const S=f[h],Q=!!(S!=null&&(A=S.details)!=null&&A.live),m=I===-1||c===-1;let y,D="SDR",v=S?.frameRate||0;const{audioPreference:k,videoPreference:P}=B,_=this.audioTracksByGroup||(this.audioTracksByGroup=LI(g));if(m){if(this.firstSelection!==-1)return this.firstSelection;const R=this.codecTiers||(this.codecTiers=kI(f,_,t,i)),L=TI(R,D,e,k,P),{codecSet:W,videoRanges:b,minFramerate:w,minBitrate:T,preferHDR:V}=L;y=W,D=V?b[b.length-1]:b[0],v=w,e=Math.max(e,T),F.log(`[abr] picked start tier ${JSON.stringify(L)}`)}else y=S?.codecSet,D=S?.videoRange;const U=d?d.duration:u?u.duration:0,K=this.bwEstimator.getEstimateTTFB()/1e3,Y=[];for(let R=i;R>=t;R--){var X;const L=f[R],W=R>h;if(!L)continue;if(B.useMediaCapabilities&&!L.supportedResult&&!L.supportedPromise){const se=navigator.mediaCapabilities;typeof se?.decodingInfo=="function"&&DI(L,_,D,v,e,k)?(L.supportedPromise=wI(L,_,se),L.supportedPromise.then(ce=>{if(!this.hls)return;L.supportedResult=ce;const de=this.hls.levels,re=de.indexOf(L);ce.error?F.warn(`[abr] MediaCapabilities decodingInfo error: "${ce.error}" for level ${re} ${JSON.stringify(ce)}`):ce.supported||(F.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${re} ${JSON.stringify(ce)}`),re>-1&&de.length>1&&(F.log(`[abr] Removing unsupported level ${re}`),this.hls.removeLevel(re)))})):L.supportedResult=lc}if(y&&L.codecSet!==y||D&&L.videoRange!==D||W&&v>L.frameRate||!W&&v>0&&v<L.frameRate||L.supportedResult&&!((X=L.supportedResult.decodingInfoResults)!=null&&X[0].smooth)){Y.push(R);continue}const b=L.details,w=(d?b?.partTarget:b?.averagetargetduration)||U;let T;W?T=a*e:T=o*e;const V=U&&r>=U*2&&n===0?f[R].averageBitrate:f[R].maxBitrate,H=this.getTimeToLoadFrag(K,T,V*w,b===void 0);if(T>=V&&(R===c||L.loadError===0&&L.fragmentError===0)&&(H<=K||!oe(H)||Q&&!this.bitrateTestDelay||H<l)){const se=this.forcedAutoLevel;return R!==I&&(se===-1||se!==I)&&(Y.length&&F.trace(`[abr] Skipped level(s) ${Y.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${f[Y[0]].codecs}" ${f[Y[0]].videoRange}; not compatible with "${S.codecs}" ${D}`),F.info(`[abr] switch candidate:${h}->${R} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-V)} ttfb:${K.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${H.toFixed(1)} firstSelection:${m} codecSet:${y} videoRange:${D} hls.loadLevel:${I}`)),m&&(this.firstSelection=R),R}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class NI{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var st={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class OI{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?.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?.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=ds(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),jr(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=ds(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h){const d=Math.max(o,r.start(c)),f=Math.min(a,r.end(c));f>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:f}))}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&&jr(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||jr(t))}getState(e){const t=ds(e),i=this.fragments[t];return i?i.buffered?jr(i)?st.PARTIAL:st.OK:st.APPENDING:st.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=ds(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=ds(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=ds(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 jr(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 ds(s){return`${s.type}_${s.level}_${s.sn}`}const UI={length:0,start:()=>0,end:()=>0};class ke{static isBuffered(e,t){try{if(e){const i=ke.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=ke.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),UI}}}class Lo{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=Xr(),this.buffering={audio:Xr(),video:Xr(),audiovideo:Xr()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function Xr(){return{start:0,executeStart:0,executeEnd:0,end:0}}function Zr(s,e){for(let i=0,r=s.length;i<r;i++){var t;if(((t=s[i])==null?void 0:t.cc)===e)return s[i]}return null}function PI(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function GI(s,e){const t=s.fragments,i=e.fragments;if(!i.length||!t.length){F.log("No fragments to align");return}const r=Zr(t,i[0].cc);if(!r||r&&!r.startPTS){F.log("No frag in previous level to align on");return}return r}function uc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function dc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)uc(t[i],s);e.fragmentHint&&uc(e.fragmentHint,s),e.alignedSliding=!0}function HI(s,e,t){e&&($I(s,t,e),!t.alignedSliding&&e&&zr(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&ic(e,t))}function $I(s,e,t){if(PI(s,t,e)){const i=GI(t,e);i&&oe(i.start)&&(F.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),dc(i.start,e))}}function zr(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(r=Zr(i,o),n=Zr(t,o)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=Zr(t,r.cc)||t[Math.floor(t.length/2)]);const a=r.programDateTime,A=n.programDateTime;if(!a||!A)return;const l=(A-a)/1e3-(n.start-r.start);dc(l,s)}const gc=Math.pow(2,17);class KI{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:ue.NETWORK_ERROR,details:G.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(Ic(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=fc(e),h=ac(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:gc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,f,g,I)=>{this.resetLoader(e,l);let B=d.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(B.slice(0,16)),B=B.slice(16)),a({frag:e,part:null,payload:B,networkDetails:I})},onError:(d,f,g,I)=>{this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:it({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:I}))},onAbort:(d,f,g)=>{this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:g,stats:d}))},onProgress:(d,f,g,I)=>{t&&t({frag:e,part:null,payload:g,networkDetails:I})}})})}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(Ic(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=fc(e,t),h=ac(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:gc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,f,g,I)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const B={frag:e,part:t,payload:d.data,networkDetails:I};i(B),a(B)},onError:(d,f,g,I)=>{this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:it({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:I}))},onAbort:(d,f,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,l),A(new gi({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:g,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 fc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(oe(r)&&oe(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Ic(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:ue.MEDIA_ERROR,details:G.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 YI{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 VI{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 JI(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Pi(s,0,e-t):s}class WI{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 f=0,g=0,I=0;for(I=0;I<256;I++)I<128?d[I]=I<<1:d[I]=I<<1^283;for(I=0;I<256;I++){let B=g^g<<1^g<<2^g<<3^g<<4;B=B>>>8^B&255^99,e[f]=B,t[B]=f;const S=d[f],Q=d[S],m=d[Q];let y=d[B]*257^B*16843008;r[f]=y<<24|y>>>8,n[f]=y<<16|y>>>16,o[f]=y<<8|y>>>24,a[f]=y,y=m*16843009^Q*65537^S*257^f*16843008,l[B]=y<<24|y>>>8,c[B]=y<<16|y>>>16,h[B]=y<<8|y>>>24,u[B]=y,f?(f=S^d[d[d[m^S]]],g^=d[d[g]]):f=g=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,f=d[0],g=d[1],I=d[2],B=d[3];let S,Q;for(a=0;a<o;a++){if(a<n){S=l[a]=t[a];continue}Q=S,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]=S=(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]=f[h[Q>>>24]]^g[h[Q>>>16&255]]^I[h[Q>>>8&255]]^B[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],f=u[1],g=u[2],I=u[3];const B=new Int32Array(e),S=new Int32Array(B.length);let Q,m,y,D,v,k,P,_,U,K,Y,X,R,L;const W=this.networkToHostOrderSwap;for(;t<B.length;){for(U=W(B[t]),K=W(B[t+1]),Y=W(B[t+2]),X=W(B[t+3]),v=U^n[0],k=X^n[1],P=Y^n[2],_=K^n[3],R=4,L=1;L<r;L++)Q=A[v>>>24]^l[k>>16&255]^c[P>>8&255]^h[_&255]^n[R],m=A[k>>>24]^l[P>>16&255]^c[_>>8&255]^h[v&255]^n[R+1],y=A[P>>>24]^l[_>>16&255]^c[v>>8&255]^h[k&255]^n[R+2],D=A[_>>>24]^l[v>>16&255]^c[k>>8&255]^h[P&255]^n[R+3],v=Q,k=m,P=y,_=D,R=R+4;Q=o[v>>>24]<<24^o[k>>16&255]<<16^o[P>>8&255]<<8^o[_&255]^n[R],m=o[k>>>24]<<24^o[P>>16&255]<<16^o[_>>8&255]<<8^o[v&255]^n[R+1],y=o[P>>>24]<<24^o[_>>16&255]<<16^o[v>>8&255]<<8^o[k&255]^n[R+2],D=o[_>>>24]<<24^o[v>>16&255]<<16^o[k>>8&255]<<8^o[P&255]^n[R+3],S[t]=W(Q^d),S[t+1]=W(D^f),S[t+2]=W(y^g),S[t+3]=W(m^I),d=U,f=K,g=Y,I=X,t=t+4}return S.buffer}}const qI=16;class ko{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?JI(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=xt(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 WI),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=Pi(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 VI(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new YI(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%qI;return i!==e.length&&(t=Pi(e,0,i),this.remainderData=Pi(e,i)),t}logOnce(e){this.logEnabled&&(F.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const jI={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},j={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Mo extends NI{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=j.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=F.log.bind(F,`${r}:`),this.warn=F.warn.bind(F,`${r}:`),this.hls=e,this.fragmentLoader=new KI(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ko(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=j.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return ke.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===j.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=ke.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${oe(o)?o.toFixed(3):o}, state: ${n}`),this.state===j.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=j.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=j.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===st.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)===st.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===j.STOPPED||this.state===j.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=j.IDLE,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===he.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?jI.toString(ke.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==he.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(h=>!!c[h])){this.state=j.IDLE;return}}const l=(A=this.levels)==null?void 0:A[e.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=j.IDLE,a&&(!this.loadedmetadata&&e.type==he.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 Lo(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?.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=j.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===j.KEY_LOADING&&(this.state=j.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=j.FRAG_LOADING;let d;return a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(f=>this.handleFragLoadError(f)):d=this.doFragPartsLoad(e,u,t,r).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),oe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c?.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 f=sc(i,e.sn,h.index+1)||rc(l,e.sn,h.index+1);if(f)c(f);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===G.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?sc(a,n,o):null,l=A?A.fragment:CI(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==j.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=xt(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(!ke.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=ke.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return oe(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=ke.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 ke.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=he.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,he.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===st.OK||i===st.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=BI(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=QI(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=qr(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,f=this.fragmentTracker.getState(u);if((f===st.OK||f===st.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const I=o[d+1];u.sn<a&&this.fragmentTracker.getState(I)!==st.OK?u=I:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,o=!t,a=e.alignedSliding&&oe(n);if(o||!a&&!n){const{fragPrevious:A}=this;HI(A,i,e);const l=e.fragments[0].start;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${A?A.sn:"na"} fragments: ${r}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&oe(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===G.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===ht.RetryRequest&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Ro(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=j.FRAG_LOADING_WAITING_RETRY}else if(l&&o)if(this.resetFragmentErrors(e),A<l.maxNumRetry)!n&&a!==ht.RemoveAlternatePermanently&&(o.resolved=!0);else{F.warn(`${t.details} reached or exceeded max retry (${A})`);return}else o?.action===ht.SendAlternateToPenaltyBox?this.state=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===he.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=ke.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=j.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:tc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=j.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Ec{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=XI(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function XI(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}function ZI(){return typeof __HLS_WORKER_BUNDLE__=="function"}function zI(){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 e0(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 _o{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=xt(this.cachedData,e),this.cachedData=null);let i=Js(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?fo(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(A))&&(this.basePTS=t0(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:Nt.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 vf(e,r)?(i=Js(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Nt.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=Pi(e,n);this.cachedData?this.cachedData=xt(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 t0=(s,e,t)=>{if(oe(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function i0(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){const u=new Error(`invalid ADTS sampling index:${h}`);s.emit(E.ERROR,E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!0,error:u,reason:u.message});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 pc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Cc(s,e){return s[e+1]&1?7:9}function Fo(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function s0(s,e){return e+5<s.length}function en(s,e){return e+1<s.length&&pc(s,e)}function r0(s,e){return s0(s,e)&&pc(s,e)&&Fo(s,e)<=s.length-e}function n0(s,e){if(en(s,e)){const t=Cc(s,e);if(e+t>=s.length)return!1;const i=Fo(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||en(s,r)}return!1}function mc(s,e,t,i,r){if(!s.samplerate){const n=i0(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 Bc(s){return 9216e4/s}function o0(s,e){const t=Cc(s,e);if(e+t<=s.length){const i=Fo(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function yc(s,e,t,i,r){const n=Bc(s.samplerate),o=i+r*n,a=o0(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,f=Math.max(0,t+d-e.length);f?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const g={unit:A,pts:o};return f||s.samples.push(g),{sample:g,length:d,missing:f}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}let tn=null;const a0=[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],A0=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],l0=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],c0=[0,1,1,4];function Qc(s,e,t,i,r){if(t+24>e.length)return;const n=vc(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 vc(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=a0[A*14+r-1]*1e3,h=A0[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=l0[t][i],f=c0[i],g=d*8*f,I=Math.floor(d*l/h+o)*f;if(tn===null){const Q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);tn=Q?parseInt(Q[1]):0}return!!tn&&tn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:I,samplesPerFrame:g}}}function No(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Sc(s,e){return e+1<s.length&&No(s,e)}function h0(s,e){return No(s,e)&&4<=s.length-e}function Dc(s,e){if(e+1<s.length&&No(s,e)){const i=vc(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Sc(s,n)}return!1}class u0 extends _o{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Js(e,0);let i=t?.length||0;if(Dc(e,i))return!1;for(let r=e.length;i<r;i++)if(n0(e,i))return F.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return r0(e,t)}appendFrame(e,t,i){mc(e,this.observer,t,i,e.manifestCodec);const r=yc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const d0=/\/emsg[-/]ID3/i;class g0{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=Rl(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=Sl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return kf(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=xt(this.remainderData,e));const a=Gf(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=Tl(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=Tl(e,t),{videoTrack:t,audioTrack:Zt(),id3Track:r,textTrack:Zt()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=Ee(e.samples,["emsg"]);r&&r.forEach(n=>{const o=Kf(n);if(d0.test(o.schemeIdUri)){const a=oe(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Nt.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const wc=(s,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=s[e];const a=Math.min(i,8),A=8-a;n[0]=4278190080>>>24+A<<A,r[0]=(o[0]&n[0])>>A,t=t?t<<a|r[0]:r[0],e+=1,i-=a}return t};class f0 extends _o{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=bc(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=Js(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&fo(t)!==void 0&&wc(e,i)<16}}function bc(s,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],A=e[t+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][A*3+n]*2;if(t+c>e.length)return-1;const h=e[t+6]>>5;let u=0;h===2?u+=2:(h&1&&h!==1&&(u+=2),h&4&&(u+=2));const d=(e[t+6]<<8|e[t+7])>>12-u&1,g=[2,1,2,3,3,4,4,5][h]+d,I=e[t+5]>>3,B=e[t+5]&7,S=new Uint8Array([n<<6|I<<1|B>>2,(B&3)<<6|h<<3|d<<2|A>>4,A<<4&224]),Q=1536/a*9e4,m=i+r*Q,y=e.subarray(t,t+c);return s.config=S,s.channelCount=g,s.samplerate=a,s.samples.push({unit:y,pts:m}),c}class I0{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&F.log(e.pts+"/"+e.dts+":"+e.debug)}}class Rc{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),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);A();const I=A();if(l(5),u(3),A(),f(),I===100||I===110||I===122||I===244||I===44||I===83||I===86||I===118||I===128){const D=c();if(D===3&&u(1),f(),f(),u(1),h())for(o=D!==3?8:12,a=0;a<o;a++)h()&&(a<6?g(16):g(64))}f();const B=c();if(B===0)c();else if(B===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();f(),u(1);const S=c(),Q=c(),m=l(1);m===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let y=[1,1];if(h()&&h())switch(A()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((S+1)*16-e*2-t*2),height:(2-m)*(Q+1)*16-(m?2:4)*(i+r),pixelRatio:y}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class E0 extends I0{parseAVCPES(e,t,i,r,n){const o=this.parseAVCNALu(e,i.data);let a=this.VideoSample,A,l=!1;i.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(c=>{var h;switch(c.type){case 1:{let g=!1;A=!0;const I=c.data;if(l&&I.length>4){const B=new Rc(I).readSliceType();(B===2||B===4||B===7||B===9)&&(g=!0)}if(g){var u;(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.frame=!0,a.key=g;break}case 5:A=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.key=!0,a.frame=!0;break;case 6:{A=!0,Ll(c.data,1,i.pts,t.samples);break}case 7:{var d,f;A=!0,l=!0;const g=c.data,B=new Rc(g).readSPS();if(!e.sps||e.width!==B.width||e.height!==B.height||((d=e.pixelRatio)==null?void 0:d[0])!==B.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==B.pixelRatio[1]){e.width=B.width,e.height=B.height,e.pixelRatio=B.pixelRatio,e.sps=[g],e.duration=n;const S=g.subarray(1,4);let Q="avc1.";for(let m=0;m<3;m++){let y=S[m].toString(16);y.length<2&&(y="0"+y),Q+=y}e.codec=Q}break}case 8:A=!0,e.pps=[c.data];break;case 9:A=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:A=!0;break;default:A=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&A&&a.units.push(c)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(l=a-r-1,h>=0){const d={data:t.subarray(h,l),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l>0&&(d.data=xt(d.data,t.subarray(0,l)),d.state=0))}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=xt(d.data,t))}return e.naluState=r,o}}class p0{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ko(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=kl(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const rt=188;class Si{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new E0}static probe(e){const t=Si.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(rt*5,t-rt)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=rt)if(e[A]===71&&(t-A===rt||e[A+rt]===71)){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+rt*99,e.length-rt)+1)),n||(n=Oo(e,A)===0),n&&a>1&&(o===0&&a>2||A+rt>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:Sl[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Si.createTrack("video"),this._audioTrack=Si.createTrack("audio",r),this._id3Track=Si.createTrack("id3"),this._txtTrack=Si.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const o=this._videoTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,f=a.pesData,g=A.pesData,I=null,B=this.pmtParsed,S=this._pmtId,Q=e.length;if(this.remainderData&&(e=xt(this.remainderData,e),Q=e.length,this.remainderData=null),Q<rt&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const m=Math.max(0,Si.syncOffset(e));Q-=(Q-m)%rt,Q<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,Q,e.buffer.byteLength-Q));let y=0;for(let v=m;v<Q;v+=rt)if(e[v]===71){const k=!!(e[v+1]&64),P=Oo(e,v),_=(e[v+3]&48)>>4;let U;if(_>1){if(U=v+5+e[v+4],U===v+rt)continue}else U=v+4;switch(P){case c:k&&(h&&(n=gs(h))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(U,v+rt)),h.size+=v+rt-U);break;case u:if(k){if(f&&(n=gs(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(U,v+rt)),f.size+=v+rt-U);break;case d:k&&(g&&(n=gs(g))&&this.parseID3PES(A,n),g={data:[],size:0}),g&&(g.data.push(e.subarray(U,v+rt)),g.size+=v+rt-U);break;case 0:k&&(U+=e[U]+1),S=this._pmtId=C0(e,U);break;case S:{k&&(U+=e[U]+1);const K=m0(e,U,this.typeSupported,i);c=K.videoPid,c>0&&(o.pid=c,o.segmentCodec=K.segmentVideoCodec),u=K.audioPid,u>0&&(a.pid=u,a.segmentCodec=K.segmentAudioCodec),d=K.id3Pid,d>0&&(A.pid=d),I!==null&&!B&&(F.warn(`MPEG-TS PMT found at ${v} after unknown PID '${I}'. Backtracking to sync byte @${m} to parse all TS packets.`),I=null,v=m-188),B=this.pmtParsed=!0;break}case 17:case 8191:break;default:I=P;break}}else y++;if(y>0){const v=new Error(`Found ${y} TS packet/s that do not start with 0x47`);this.observer.emit(E.ERROR,E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:v,reason:v.message})}o.pesData=h,a.pesData=f,A.pesData=g;const D={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(D),D}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=gs(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=gs(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&F.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=gs(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 p0(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1)n=xt(r.sample.unit,n);else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!en(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:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,levelRetry:u,error:d,reason:h}),!u)return}mc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=Bc(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=yc(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!en(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(Sc(i,o)){const A=Qc(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){F.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let o=0,a=0,A;for(;a<n&&(A=bc(e,i,a,r,o++))>0;)a+=A}}parseID3PES(e,t){if(t.pts===void 0){F.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ye({},t,{type:this._videoTrack?Nt.emsg:Nt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Oo(s,e){return((s[e+1]&31)<<8)+s[e+2]}function C0(s,e){return(s[e+10]&31)<<8|s[e+11]}function m0(s,e,t,i){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],o=e+3+n-4,a=(s[e+10]&15)<<8|s[e+11];for(e+=12+a;e<o;){const A=Oo(s,e),l=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){Uo("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=A);break;case 21:r.id3Pid===-1&&(r.id3Pid=A);break;case 219:if(!i){Uo("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=A,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?F.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="mp3");break;case 193:if(!i){Uo("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="ac3"):F.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&l>0){let c=e+5,h=l;for(;h>2;){switch(s[c]){case 106:t.ac3!==!0?F.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=A,r.segmentAudioCodec="ac3");break}const d=s[c+1]+2;c+=d,h-=d}}break;case 194:case 135:F.warn("Unsupported EC-3 in M2TS found");break;case 36:F.warn("Unsupported HEVC in M2TS found");break}e+=l+5}return r}function Uo(s){F.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function gs(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=xt(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(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 f=t.byteLength;if(c)if(c>f){c-=f;continue}else t=t.subarray(c),f-=c,c=0;h.set(t,e),e+=f}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}class B0 extends _o{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Js(e,0);let i=t?.length||0;if(t&&e[i]===11&&e[i+1]===119&&fo(t)!==void 0&&wc(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Dc(e,i))return F.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return h0(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Qc(e,t,i,this.basePTS,this.frameIndex)}}class xc{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 Di=Math.pow(2,32)-1;class N{static init(){N.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in N.types)N.types.hasOwnProperty(e)&&(N.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]);N.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]);N.STTS=N.STSC=N.STCO=n,N.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),N.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),N.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),N.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]);N.FTYP=N.box(N.types.ftyp,o,A,o,a),N.DINF=N.box(N.types.dinf,N.box(N.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 N.box(N.types.hdlr,N.HDLR_TYPES[e])}static mdat(e){return N.box(N.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+1));return N.box(N.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 N.box(N.types.mdia,N.mdhd(e.timescale,e.duration),N.hdlr(e.type),N.minf(e))}static mfhd(e){return N.box(N.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"?N.box(N.types.minf,N.box(N.types.smhd,N.SMHD),N.DINF,N.stbl(e)):N.box(N.types.minf,N.box(N.types.vmhd,N.VMHD),N.DINF,N.stbl(e))}static moof(e,t,i){return N.box(N.types.moof,N.mfhd(e),N.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=N.trak(e[t]);return N.box.apply(null,[N.types.moov,N.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(N.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=N.trex(e[t]);return N.box.apply(null,[N.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Di+1)),r=Math.floor(t%(Di+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 N.box(N.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 N.box(N.types.sdtp,i)}static stbl(e){return N.box(N.types.stbl,N.stsd(e),N.box(N.types.stts,N.STTS),N.box(N.types.stsc,N.STSC),N.box(N.types.stsz,N.STSZ),N.box(N.types.stco,N.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=N.box(N.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 N.box(N.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,N.box(N.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),N.box(N.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return N.box(N.types.mp4a,N.audioStsd(e),N.box(N.types.esds,N.esds(e)))}static mp3(e){return N.box(N.types[".mp3"],N.audioStsd(e))}static ac3(e){return N.box(N.types["ac-3"],N.audioStsd(e),N.box(N.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?N.box(N.types.stsd,N.STSD,N.mp3(e)):e.segmentCodec==="ac3"?N.box(N.types.stsd,N.STSD,N.ac3(e)):N.box(N.types.stsd,N.STSD,N.mp4a(e)):N.box(N.types.stsd,N.STSD,N.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Di+1)),a=Math.floor(i%(Di+1));return N.box(N.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=N.sdtp(e),r=e.id,n=Math.floor(t/(Di+1)),o=Math.floor(t%(Di+1));return N.box(N.types.traf,N.box(N.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),N.box(N.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])),N.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,N.box(N.types.trak,N.tkhd(e),N.mdia(e))}static trex(e){const t=e.id;return N.box(N.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 N.box(N.types.trun,o)}static initSegment(e){N.types||N.init();const t=N.moov(e);return xt(N.FTYP,t)}}N.types=void 0,N.HDLR_TYPES=void 0,N.STTS=void 0,N.STSC=void 0,N.STCO=void 0,N.STSZ=void 0,N.VMHD=void 0,N.SMHD=void 0,N.STSD=void 0,N.FTYP=void 0,N.DINF=void 0;const Tc=9e4;function Po(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function y0(s,e,t=1,i=!1){return Po(s,e,1/t,i)}function Xs(s,e=!1){return Po(s,1e3,1/Tc,e)}function Q0(s,e=1){return Po(s,Tc,1/e)}const v0=10*1e3,Lc=1024,S0=1152,D0=1536;let fs=null,Go=null;class sn{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,fs===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fs=o?parseInt(o[1]):0}if(Go===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Go=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}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,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Tt(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,f,g=n,I=n;const B=e.pid>-1,S=t.pid>-1,Q=t.samples.length,m=e.samples.length>0,y=a&&Q>0||Q>1;if((!B||m)&&(!S||y)||this.ISGenerated||a){if(this.ISGenerated){var v,k,P,_;const X=this.videoTrackConfig;X&&(t.width!==X.width||t.height!==X.height||((v=t.pixelRatio)==null?void 0:v[0])!==((k=X.pixelRatio)==null?void 0:k[0])||((P=t.pixelRatio)==null?void 0:P[1])!==((_=X.pixelRatio)==null?void 0:_[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,n,o);const U=this.isVideoContiguous;let K=-1,Y;if(y&&(K=w0(t.samples),!U&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,K>0){F.warn(`[mp4-remuxer]: Dropped ${K} out of ${Q} video samples due to a missing keyframe`);const X=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(K),t.dropped+=K,I+=(t.samples[0].pts-X)/t.inputTimeScale,Y=I}else K===-1&&(F.warn(`[mp4-remuxer]: No keyframe found out of ${Q} video samples`),f=!1);if(this.ISGenerated){if(m&&y){const X=this.getVideoStartPts(t.samples),L=(Tt(e.samples[0].pts,X)-X)/t.inputTimeScale;g+=Math.max(0,L),I+=Math.max(0,-L)}if(m){if(e.samplerate||(F.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,g,this.isAudioContiguous,o,S||y||A===he.AUDIO?I:void 0),y){const X=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,I,U,X)}}else y&&(l=this.remuxVideo(t,I,U,0));l&&(l.firstKeyFrame=K,l.independent=K!==-1,l.firstKeyFramePTS=Y)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=kc(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=Mc(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:f,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,f;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):N.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.inputTimeScale,!l||f!==l.timescale?u=d=n[0].pts-Math.round(f*i):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:N.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.inputTimeScale,!l||f!==l.timescale){const g=this.getVideoStartPts(o),I=Math.round(f*i);d=Math.min(d,Tt(o[0].dts,g)-I),u=Math.min(u,g-I)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:f},this._initDTS={baseTime:d,timescale:f}):u=f=void 0,{tracks:A,initPTS:u,timescale:f}}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,f,g=Number.POSITIVE_INFINITY,I=Number.NEGATIVE_INFINITY,B=!1;if(!i||c===null){const w=t*n,T=o[0].pts-Tt(o[0].dts,o[0].pts);fs&&c!==null&&Math.abs(w-T-c)<15e3?i=!0:c=w-T}const S=l.baseTime*n/l.timescale;for(let w=0;w<A;w++){const T=o[w];T.pts=Tt(T.pts-S,c),T.dts=Tt(T.dts-S,c),T.dts<o[w>0?w-1:w].dts&&(B=!0)}B&&o.sort(function(w,T){const V=w.dts-T.dts,H=w.pts-T.pts;return V||H}),d=o[0].dts,f=o[o.length-1].dts;const Q=f-d,m=Q?Math.round(Q/(A-1)):u||e.inputTimeScale/30;if(i){const w=d-c,T=w>m,V=w<-1;if((T||V)&&(T?F.warn(`AVC: ${Xs(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):F.warn(`AVC: ${Xs(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!V||c>=o[0].pts||fs)){d=c;const H=o[0].pts-w;if(T)o[0].dts=d,o[0].pts=H;else for(let q=0;q<o.length&&!(o[q].dts>H);q++)o[q].dts-=w,o[q].pts-=w;F.log(`Video: Initial PTS/DTS adjusted: ${Xs(H,!0)}/${Xs(d,!0)}, delta: ${Xs(w,!0)} ms`)}}d=Math.max(0,d);let y=0,D=0,v=d;for(let w=0;w<A;w++){const T=o[w],V=T.units,H=V.length;let q=0;for(let se=0;se<H;se++)q+=V[se].data.length;D+=q,y+=H,T.length=q,T.dts<v?(T.dts=v,v+=m/4|0||1):v=T.dts,g=Math.min(T.pts,g),I=Math.max(T.pts,I)}f=o[A-1].dts;const k=D+4*y+8;let P;try{P=new Uint8Array(k)}catch(w){this.observer.emit(E.ERROR,E.ERROR,{type:ue.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:k,reason:`fail allocating video mdat ${k}`});return}const _=new DataView(P.buffer);_.setUint32(0,k),P.set(N.types.mdat,4);let U=!1,K=Number.POSITIVE_INFINITY,Y=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,R=Number.NEGATIVE_INFINITY;for(let w=0;w<A;w++){const T=o[w],V=T.units;let H=0;for(let ce=0,de=V.length;ce<de;ce++){const re=V[ce],me=re.data,Te=re.data.byteLength;_.setUint32(h,Te),h+=4,P.set(me,h),h+=Te,H+=4+Te}let q;if(w<A-1)u=o[w+1].dts-T.dts,q=o[w+1].pts-T.pts;else{const ce=this.config,de=w>0?T.dts-o[w-1].dts:m;if(q=w>0?T.pts-o[w-1].pts:m,ce.stretchShortVideoTrack&&this.nextAudioPts!==null){const re=Math.floor(ce.maxBufferHole*n),me=(r?g+r*n:this.nextAudioPts)-T.pts;me>re?(u=me-de,u<0?u=de:U=!0,F.log(`[mp4-remuxer]: It is approximately ${me/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=de}else u=de}const se=Math.round(T.pts-T.dts);K=Math.min(K,u),X=Math.max(X,u),Y=Math.min(Y,q),R=Math.max(R,q),a.push(new _c(T.key,u,H,se))}if(a.length){if(fs){if(fs<70){const w=a[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(Go&&R-Y<X-K&&m/X<.025&&a[0].cts===0){F.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let w=d;for(let T=0,V=a.length;T<V;T++){const H=w+a[T].duration,q=w+a[T].cts;if(T<V-1){const se=H+a[T+1].cts;a[T].duration=se-q}else a[T].duration=T?a[T-1].duration:m;a[T].cts=0,w=H}}}u=U||!u?m:u,this.nextAvcDts=c=f+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const b={data1:N.moof(e.sequenceNumber++,d,Ye({},e,{samples:a})),data2:P,startPTS:g/n,endPTS:(I+u)/n,startDTS:d/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,b}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return S0;case"ac3":return D0;default:return Lc}}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=this.getSamplesPerFrame(e),c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],f=n!==void 0;let g=e.samples,I=u?0:8,B=this.nextAudioPts||-1;const S=t*o,Q=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||g.length&&B>0&&(r&&Math.abs(S-B)<9e3||Math.abs(Tt(g[0].pts-Q,S)-B)<20*c),g.forEach(function(L){L.pts=Tt(L.pts-Q,S)}),!i||B<0){if(g=g.filter(L=>L.pts>=0),!g.length)return;n===0?B=0:r&&!f?B=Math.max(0,S):B=g[0].pts}if(e.segmentCodec==="aac"){const L=this.config.maxAudioFramesDrift;for(let W=0,b=B;W<g.length;W++){const w=g[W],T=w.pts,V=T-b,H=Math.abs(1e3*V/o);if(V<=-L*c&&f)W===0&&(F.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*V/o)} ms.`),this.nextAudioPts=B=b=T);else if(V>=L*c&&H<v0&&f){let q=Math.round(V/c);b=T-q*c,b<0&&(q--,b+=c),W===0&&(this.nextAudioPts=B=b),F.warn(`[mp4-remuxer]: Injecting ${q} audio frame @ ${(b/o).toFixed(3)}s due to ${Math.round(1e3*V/o)} ms gap.`);for(let se=0;se<q;se++){const ce=Math.max(b,0);let de=xc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);de||(F.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),de=w.unit.subarray()),g.splice(W,0,{unit:de,pts:ce}),b+=c,W++}}w.pts=b,b+=c}}let m=null,y=null,D,v=0,k=g.length;for(;k--;)v+=g[k].unit.byteLength;for(let L=0,W=g.length;L<W;L++){const b=g[L],w=b.unit;let T=b.pts;if(y!==null){const H=d[L-1];H.duration=Math.round((T-y)/A)}else if(i&&e.segmentCodec==="aac"&&(T=B),m=T,v>0){v+=I;try{D=new Uint8Array(v)}catch(H){this.observer.emit(E.ERROR,E.ERROR,{type:ue.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:H,bytes:v,reason:`fail allocating audio mdat ${v}`});return}u||(new DataView(D.buffer).setUint32(0,v),D.set(N.types.mdat,4))}else return;D.set(w,I);const V=w.byteLength;I+=V,d.push(new _c(!0,l,V,0)),y=T}const P=d.length;if(!P)return;const _=d[d.length-1];this.nextAudioPts=B=y+A*_.duration;const U=u?new Uint8Array(0):N.moof(e.sequenceNumber++,m/A,Ye({},e,{samples:d}));e.samples=[];const K=m/o,Y=B/o,R={data1:U,data2:D,startPTS:K,endPTS:Y,startDTS:K,endDTS:Y,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,R}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*Lc,f=Math.ceil((u-h)/d),g=xc.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(F.warn("[mp4-remuxer]: remux empty Audio"),!g){F.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const I=[];for(let B=0;B<f;B++){const S=h+B*d;I.push({unit:g,pts:S,dts:S})}return e.samples=I,this.remuxAudio(e,t,i,!1)}}function Tt(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 w0(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function kc(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Tt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Tt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Mc(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=Tt(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 _c{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class b0{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(Ff(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=Rl(e);r.audio&&(t=Fc(r.audio,be.AUDIO)),r.video&&(i=Fc(r.video,be.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};oe(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let f=this.initData;if((a=f)!=null&&a.length||(this.generateInitSegment(u),f=this.initData),!((A=f)!=null&&A.length))return F.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=Of(u,f),I=Nf(f,u),B=I===null?n:I;(R0(l,B,n,g)||d.timescale!==l.timescale&&o)&&(d.initPTS=B-n,l&&l.timescale===1&&F.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const S=e?B-l.baseTime/l.timescale:c,Q=S+g;Pf(f,u,l.baseTime/l.timescale),g>0?this.lastEndTime=Q:(F.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const m=!!f.audio,y=!!f.video;let D="";m&&(D+="audio"),y&&(D+="video");const v={data1:u,startPTS:S,startDTS:S,endPTS:Q,endDTS:Q,type:D,hasAudio:m,hasVideo:y,nb:1,dropped:0};return h.audio=v.type==="audio"?v:void 0,h.video=v.type!=="audio"?v:void 0,h.initSegment=d,h.id3=kc(i,n,l,l),r.samples.length&&(h.text=Mc(r,n,l)),h}}function R0(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 Fc(s,e){const t=s?.codec;if(t&&t.length>4)return t;if(e===be.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return $r(t,!1);const i="mp4a.40.5";return F.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return F.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let fi;try{fi=self.performance.now.bind(self.performance)}catch{F.debug("Unable to use Performance API on this environment"),fi=os?.Date.now}const rn=[{demux:g0,remux:b0},{demux:Si,remux:sn},{demux:u0,remux:sn},{demux:B0,remux:sn}];rn.splice(2,0,{demux:f0,remux:sn});class Nc{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:f}=r||a,{audioCodec:g,videoCodec:I,defaultInitPts:B,duration:S,initSegmentData:Q}=A,m=x0(o,t);if(m&&m.method==="AES-128"){const k=this.getDecrypter();if(k.isSync()){let P=k.softwareDecrypt(o,m.key.buffer,m.iv.buffer);if(i.part>-1&&(P=k.flush()),!P)return n.executeEnd=fi(),Ho(i);o=new Uint8Array(P)}else return this.decryptionPromise=k.webCryptoDecrypt(o,m.key.buffer,m.iv.buffer).then(P=>{const _=this.push(P,null,i);return this.decryptionPromise=null,_}),this.decryptionPromise}const y=this.needsProbing(c,h);if(y){const k=this.configureTransmuxer(o);if(k)return F.warn(`[transmuxer] ${k.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:k,reason:k.message}),n.executeEnd=fi(),Ho(i)}(c||h||f||y)&&this.resetInitSegment(Q,g,I,S,t),(c||f||y)&&this.resetInitialTimestamp(B),l||this.resetContiguity();const D=this.transmux(o,m,d,u,i),v=this.currentTransmuxState;return v.contiguous=!0,v.discontinuity=!1,v.trackSwitch=!1,n.executeEnd=fi(),D}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(),[Ho(e)];const c=A.flush(a);return nn(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 u=0,d=rn.length;u<d;u++){var a;if((a=rn[u].demux)!=null&&a.probe(e)){o=rn[u];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const A=this.demuxer,l=this.remuxer,c=o.remux,h=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!A||!(A instanceof h))&&(this.demuxer=new h(i,t,r),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ko(this.config)),e}}function x0(s,e){let t=null;return s.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ho=s=>({remuxResult:{},chunkMeta:s});function nn(s){return"then"in s&&s.then instanceof Function}class T0{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 L0{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 Oc={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),f=t?t+l:l;return A._events[f]?A._events[f].fn?A._events[f]=[A._events[f],d]:A._events[f].push(d):(A._events[f]=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,f=new Array(d);u<d;u++)f[u]=h[u].fn;return f},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,f){var g=t?t+l:l;if(!this._events[g])return!1;var I=this._events[g],B=arguments.length,S,Q;if(I.fn){switch(I.once&&this.removeListener(l,I.fn,void 0,!0),B){case 1:return I.fn.call(I.context),!0;case 2:return I.fn.call(I.context,c),!0;case 3:return I.fn.call(I.context,c,h),!0;case 4:return I.fn.call(I.context,c,h,u),!0;case 5:return I.fn.call(I.context,c,h,u,d),!0;case 6:return I.fn.call(I.context,c,h,u,d,f),!0}for(Q=1,S=new Array(B-1);Q<B;Q++)S[Q-1]=arguments[Q];I.fn.apply(I.context,S)}else{var m=I.length,y;for(Q=0;Q<m;Q++)switch(I[Q].once&&this.removeListener(l,I[Q].fn,void 0,!0),B){case 1:I[Q].fn.call(I[Q].context);break;case 2:I[Q].fn.call(I[Q].context,c);break;case 3:I[Q].fn.call(I[Q].context,c,h);break;case 4:I[Q].fn.call(I[Q].context,c,h,u);break;default:if(!S)for(y=1,S=new Array(B-1);y<B;y++)S[y-1]=arguments[y];I[Q].fn.apply(I[Q].context,S)}}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 f=this._events[d];if(f.fn)f.fn===c&&(!u||f.once)&&(!h||f.context===h)&&o(this,d);else{for(var g=0,I=[],B=f.length;g<B;g++)(f[g].fn!==c||u&&!f[g].once||h&&f[g].context!==h)&&I.push(f[g]);I.length?this._events[d]=I.length===1?I[0]:I: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})(Oc);var k0=Oc.exports,$o=sf(k0);class Uc{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===E.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new $o,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a=as(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},A={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')},l=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||ZI())){try{n.workerPath?(F.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=e0(n.workerPath)):(F.log(`injecting Web Worker for "${t}"`),this.workerContext=zI()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const d=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,F.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})},h.postMessage({cmd:"init",typeSupported:A,vendor:l,id:t,config:JSON.stringify(n)})}catch(h){F.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new Nc(this.observer,A,n,l,t)}return}this.transmuxer=new Nc(this.observer,A,n,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=o?o.start:n.start,g=n.decryptdata,I=this.frag,B=!(I&&n.cc===I.cc),S=!(I&&l.level===I.level),Q=I?l.sn-I.sn:-1,m=this.part?l.part-this.part.index:-1,y=Q===0&&l.id>1&&l.id===I?.stats.chunkCount,D=!S&&(Q===1||Q===0&&(m===1||y&&m<=0)),v=self.performance.now();(S||Q||n.stats.parsing.start===0)&&(n.stats.parsing.start=v),o&&(m||!D)&&(o.stats.parsing.start=v);const k=!(I&&((h=n.initSegment)==null?void 0:h.url)===((u=I.initSegment)==null?void 0:u.url)),P=new L0(B,D,A,S,f,k);if(!D||B||k){F.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
|
165
|
+
discontinuity: ${B}
|
166
|
+
trackSwitch: ${S}
|
167
|
+
contiguous: ${D}
|
168
|
+
accurateTimeOffset: ${A}
|
169
|
+
timeOffset: ${f}
|
170
|
+
initSegmentChange: ${k}`);const _=new T0(i,r,t,a,c);this.configureTransmuxer(_)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:P},e instanceof ArrayBuffer?[e]:[]);else if(d){const _=d.push(e,g,l,P);nn(_)?(d.async=!0,_.then(U=>{this.handleTransmuxComplete(U)}).catch(U=>{this.transmuxerError(U,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(_))}}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);nn(i)||t.async?(nn(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:ue.MEDIA_ERROR,details:G.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)}}function Pc(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Is(s[t].attrs,e[t].attrs))return!1;return!0}function Is(s,e,t){const i=s["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>s[r]!==e[r])}function Ko(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const Gc=100;class M0 extends Mo{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",he.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===j.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Gc),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=j.IDLE):(this.loadedmetadata=!1,this.state=j.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=j.WAITING_INIT_PTS}break}case j.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;if(!r||i>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(n?.[o]||null),this.state=j.IDLE}break}case j.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=j.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=ke.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);xo(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=j.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!i&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=j.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,be.AUDIO,he.AUDIO));const l=this.getFwdBufferInfo(A,he.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=j.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,he.MAIN),d=l.len,f=this.getMaxBufferLength(u?.len),g=a.fragments,I=g[0].start;let B=this.flushing?this.getLoadPosition():l.end;if(h&&i){const y=this.getLoadPosition();c&&!Is(h.attrs,c.attrs)&&(B=y),a.PTSKnown&&y<I&&(l.end>I||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=I+.05)}if(d>=f&&!h&&B<g[g.length-1].start)return;let S=this.getNextFragment(B,a),Q=!1;if(S&&this.isLoopLoading(S,B)&&(Q=!!S.gap,S=this.getNextFragmentLoopLoading(S,a,l,he.MAIN,f)),!S){this.bufferFlushed=!0;return}const m=u&&S.start>u.end+a.targetduration;if(m||!(u!=null&&u.len)&&l.len){const y=this.getAppendedFrag(S.start,he.MAIN);if(y===null||(Q||(Q=!!y.gap||!!m&&u.len===0),m&&!Q||Q&&l.nextStart&&l.nextStart<y.end))return}this.loadFragment(S,o,B)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new ls(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(Gc):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=j.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=j.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;if(!a.details&&n.hasProgramDateTime&&c.hasProgramDateTime)zr(n,c),A=n.fragments[0].start;else{var l;A=this.alignPlaylists(n,a.details,(l=this.levelLastLoaded)==null?void 0:l.details)}}a.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,A),this.state===j.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=j.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new Uc(this.hls,he.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],f=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const I=r?r.index:-1,B=I!==-1,S=new Lo(i.level,i.sn,i.stats.chunkCount,n.byteLength,I,B);u.push(n,f,h,"",i,r,c.totalduration,!1,S,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:g}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Ec,complete:!1};g.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=j.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==he.AUDIO){if(!this.loadedmetadata&&i.type===he.MAIN){const n=this.videoBuffer||this.media;n&&ke.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,it({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(he.AUDIO,t);break;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ve.AUDIO_TRACK&&(this.state=j.IDLE);break;case G.BUFFER_APPEND_ERROR:case G.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===G.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==be.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==be.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,he.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:f,initSegment:g}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const I=A.initSegment||A;this._bufferInitSegment(c,g.tracks,I,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:i,tracks:g.tracks})}if(u){const{startPTS:I,endPTS:B,startDTS:S,endDTS:Q}=u;l&&(l.elementaryStreams[be.AUDIO]={startPTS:I,endPTS:B,startDTS:S,endDTS:Q}),A.setElementaryStreamInfo(be.AUDIO,I,B,S,Q),this.bufferFragmentData(u,A,l,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const I=Ye({id:i,frag:A,details:h},f);r.trigger(E.FRAG_PARSING_METADATA,I)}if(d){const I=Ye({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,I)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${o}/${n.codec}]`),o&&o.split(",").length===1&&(n.levelCodec=o),this.hls.trigger(E.BUFFER_CODECS,t);const a=n.initSegment;if(a!=null&&a.byteLength){const A={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(E.BUFFER_APPENDING,A)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===st.NOT_LOADED||r===st.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=j.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&zr(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,r=i?.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,it({},e))}}class _0 extends To{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${o?.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||r?.length!==i?.length||i!=null&&i.some(a=>r?.indexOf(a)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!i||i.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,d)=>{u.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const A=this.hls.config.audioPreference;if(!n&&A){const u=Xt(A,a,us);if(u>-1)n=a[u];else{const d=Xt(A,this.tracks);n=this.tracks[d]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${i?.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,c);const h=this.trackId;if(l!==-1&&h===-1)this.setAudioTrack(l);else if(a.length&&h===-1){var o;const u=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(u.message),this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:u})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ve.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const r=this.currentTrack;if(r&&hs(e,r,us))return r;const n=Xt(e,this.tracksInGroup,us);if(n>-1){const o=this.tracksInGroup[n];return this.setAudioTrack(n),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=_I(e,t.levels,i,o,us);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=Xt(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,it({},r)),n))return;const o=this.switchParams(r.url,i?.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||hs(e,r,us)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A}=e;for(let l=0;l<t.length;l++){const c=t[l];if(hs({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,us))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Is(e.attrs,c.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}const Hc=500;class F0 extends Mo{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",he.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=j.IDLE,this.setInterval(Hc),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=j.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,he.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===he.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;i?.type===he.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Pc(this.levels,t)){this.levels=t.map(i=>new ls(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new ls(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,he.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(Hc)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:o,id:a}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const A=n[r];if(a>=n.length||a!==r||!A)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(i=A.details)!=null&&i.live){const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;const u=h.fragments[0];if(!A.details)o.hasProgramDateTime&&h.hasProgramDateTime?(zr(o,h),l=o.fragments[0].start):u&&(l=u.start,bo(o,l));else{var c;l=this.alignPlaylists(o,A.details,(c=this.levelLastLoaded)==null?void 0:c.details),l===0&&u&&(l=u.start,bo(o,l))}}A.details=o,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===j.IDLE&&(qr(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.IDLE){const{currentTrackId:e,levels:t}=this,i=t?.[e];if(!i||!t.length||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=ke.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,he.MAIN),c=i.details,h=this.getMaxBufferLength(l?.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,f=c.edge;let g=null;const I=this.fragPrevious;if(a<f){const B=r.maxFragLookUpTolerance,S=a>f-B?0:B;g=qr(I,u,Math.max(u[0].start,a),S),!g&&I&&I.start<u[0].start&&(g=u[0])}else g=u[d-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const B=g.sn-c.startSN,S=u[B-1];S&&S.cc===g.cc&&this.fragmentTracker.getState(S)===st.NOT_LOADED&&(g=S)}this.fragmentTracker.getState(g)===st.NOT_LOADED&&this.loadFragment(g,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 N0(this.tracksBuffered[this.currentTrackId]||[])}}class N0{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 O0 extends To{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Kr(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Kr(this.media.textTracks).forEach(t=>{As(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${o?.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||r?.length!==i?.length||i!=null&&i.some(o=>r?.indexOf(o)===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!i||i.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,h)=>{c.id=h});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!n&&a){this.selectDefaultTrack=!1;const c=Xt(a,o);if(c>-1)n=o[c];else{const h=Xt(a,this.tracks);n=this.tracks[h]}}let A=this.findTrackId(n);A===-1&&n&&(A=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i?.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,l),A!==-1&&this.trackId===-1&&this.setSubtitleTrack(A)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||hs(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Is(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(Ko(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ve.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&hs(e,i))return i;const r=Xt(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=Xt(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Kr(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>Ko(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!oe(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:a="",name:A,type:l,url:c}=r;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(r.url,i?.details);this.loadPlaylist(h)}}class U0{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){F.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const $c=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class P0{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:r}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:i,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&F.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource&&typeof self<"u"&&self.ManagedMediaSource,this.log=F.log.bind(F,t),this.warn=F.warn.bind(F,t),this.error=F.error.bind(F,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new U0(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,r=as(this.appendSource);if(i&&r){var n;const o=this.mediaSource=new r;this.log(`created media source: ${(n=o.constructor)==null?void 0:n.name}`),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming));const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const A=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||A&&o instanceof A,Kc(i),G0(i,a),i.load()}catch{i.src=a}else i.src=a;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&Kc(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(o=>{if(i){const A=this.tracks[o];if(A&&typeof A.buffer.changeType=="function"){var a;const{id:l,codec:c,levelCodec:h,container:u,metadata:d}=t[o],f=Ul(A.codec,A.levelCodec),g=f?.replace($c,"$1");let I=Ul(c,h);const B=(a=I)==null?void 0:a.replace($c,"$1");if(I&&g!==B){o.slice(0,5)==="audio"&&(I=$r(I,this.appendSource));const S=`${u};codecs=${I}`;this.appendChangeType(o,S),this.log(`switching codec ${f} to ${I}`),this.tracks[o]={buffer:A.buffer,codec:c,container:u,levelCodec:h,metadata:d,id:l}}}}else this.pendingTracks[o]=t[o]}),i)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,f=l?l.stats.buffering:null;d.start===0&&(d.start=u),f&&f.start===0&&(f.start=u);const g=n.audio;let I=!1;a==="audio"&&g?.container==="audio/mpeg"&&(I=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const B=A.start,S={execute:()=>{if(h.executeStart=self.performance.now(),I){const Q=this.sourceBuffer[a];if(Q){const m=B-Q.timestampOffset;Math.abs(m)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${B} (delta: ${m}) sn: ${A.sn})`),Q.timestampOffset=B)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const Q=self.performance.now();h.executeEnd=h.end=Q,d.first===0&&(d.first=Q),f&&f.first===0&&(f.first=Q);const{sourceBuffer:m}=this,y={};for(const D in m)y[D]=ke.getBuffered(m[D]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:y})},onError:Q=>{const m={type:ue.MEDIA_ERROR,parent:A.type,details:G.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:Q,err:Q,fatal:!1};if(Q.code===DOMException.QUOTA_EXCEEDED_ERR)m.details=G.BUFFER_FULL_ERROR;else{const y=++this.appendErrors[a];m.details=G.BUFFER_APPEND_ERROR,this.warn(`Failed ${y}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),y>=i.config.appendErrorMaxRetry&&(m.fatal=!0)}i.trigger(E.ERROR,m)}};r.append(S,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{this.warn(`Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[be.AUDIOVIDEO]?n.push("audiovideo"):(o[be.AUDIO]&&n.push("audio"),o[be.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,o=i.currentTime,a=t.levelTargetDuration,A=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(oe(A)&&A>0){const l=Math.max(A,a),c=Math.floor(o/a)*a-l;this.flushBackBuffer(o,a,c)}if(oe(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const l=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(l,a),h=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,h)}}flushBackBuffer(e,t,i){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(a=>{const A=n[a];if(A){const l=ke.getBuffered(A);if(l.length>0&&i>l.start(0)){if(this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:i}),r!=null&&r.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(A.ended&&l.end(l.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const a=r[o];if(a){const A=ke.getBuffered(a),l=A.length;if(l<2)return;const c=A.start(l-1),h=A.end(l-1);if(i>c||e>=c&&e<=h)return;if(a.ended&&e-h<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:o})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!oe(o))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${o}.`),t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||r===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);let o=n.levelCodec||n.codec;o&&r.slice(0,5)==="audio"&&(o=$r(o,this.appendSource));const a=`${n.container};codecs=${o}`;this.log(`creating sourceBuffer(${a})`);try{const A=t[r]=i.addSourceBuffer(a),l=r;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(l,"bufferedchange",(c,h)=>{const u=h.removedRanges;u!=null&&u.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:r})}),this.tracks[r]={buffer:A,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:r,mimeType:a})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t?.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=oe(r.duration)?r.duration:1/0,c=oe(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&(!A.ending||A.ended)?(A.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function Kc(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function G0(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const Yc={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},Vc=function(e){let t=e;return Yc.hasOwnProperty(e)&&(t=Yc[e]),String.fromCharCode(t)},Ut=15,Ii=100,H0={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},$0={17:2,18:4,21:6,22:8,23:10,19:13,20:15},K0={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Y0={25:2,26:4,29:6,30:8,31:10,27:13,28:15},V0=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class J0{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 Gi=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Jc{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class W0{constructor(){this.uchar=" ",this.penState=new Jc}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 q0{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Jc,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ii;t++)this.chars.push(new W0);this.logger=e}equals(e){for(let t=0;t<Ii;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ii;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ii;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Ii&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ii)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=Vc(e);if(this.pos>=Ii){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Ii;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<Ii;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Yo{constructor(e){this.rows=[],this.currRow=Ut-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Ut;t++)this.rows.push(new q0(e));this.logger=e}reset(){for(let e=0;e<Ut;e++)this.rows[e].clear();this.currRow=Ut-1}equals(e){let t=!0;for(let i=0;i<Ut;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Ut;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Ut;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<Ut;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a!==null&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<Ut;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
171
|
+
`)),i}getTextAndFormat(){return this.rows}}class Wc{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 Yo(i),this.nonDisplayedMemory=new Yo(i),this.lastOutputScreen=new Yo(i),this.currRollUpRow=this.displayedMemory.rows[Ut-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[Ut-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 qc{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Xc(),this.logger=void 0;const r=this.logger=new J0;this.channels=[null,new Wc(e,t,r),new Wc(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(r=t[a]&127,n=t[a+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+Gi([t[a],t[a+1]])+"] -> ("+Gi([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 "+Gi([r,n])+" orig: "+Gi([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(jc(e,t,i))return Es(null,null,i),this.logger.log(3,"Repeated command ("+Gi([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),Es(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 ("+Gi([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(jc(e,t,r))return Es(null,null,r),!0;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?H0[e]:K0[e]:i=a===1?$0[e]:Y0[e];const A=this.channels[a];return A?(A.setPAC(this.interpretPAC(i,t)),Es(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 '"+Vc(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const o=Gi(r);this.logger.log(3,"Char codes = "+o.join(",")),Es(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=V0[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),Es(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=Xc()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Es(s,e,t){t.a=s,t.b=e}function jc(s,e,t){return t.a===s&&t.b===e}function Xc(){return{a:null,b:null}}class on{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 Vo=function(){if(os!=null&&os.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,f=a,g=A,I=l,B=null,S="",Q=!0,m="auto",y="start",D=50,v="middle",k=50,P="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(_){u=""+_}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(_){d=!!_}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return f},set:function(_){if(typeof _!="number")throw new TypeError("Start time must be set to a number.");f=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return g},set:function(_){if(typeof _!="number")throw new TypeError("End time must be set to a number.");g=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return I},set:function(_){I=""+_,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return B},set:function(_){B=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return S},set:function(_){const U=i(_);if(U===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return Q},set:function(_){Q=!!_,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return m},set:function(_){if(typeof _!="number"&&_!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return y},set:function(_){const U=r(_);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");y=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return D},set:function(_){if(_<0||_>100)throw new Error("Position must be between 0 and 100.");D=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return v},set:function(_){const U=r(_);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");v=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return k},set:function(_){if(_<0||_>100)throw new Error("Size must be between 0 and 100.");k=_,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return P},set:function(_){const U=r(_);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");P=U,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class j0{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Zc(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 X0{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 zc(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 Jo=new Vo(0,0,""),an=Jo.align==="middle"?"middle":"center";function Z0(s,e,t){const i=s;function r(){const a=Zc(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 X0;zc(a,function(u,d){let f;switch(u){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===d){l.set(u,t[g].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":f=d.split(","),l.integer(u,f[0]),l.percent(u,f[0])&&l.set("snapToLines",!1),l.alt(u,f[0],["auto"]),f.length===2&&l.alt("lineAlign",f[1],["start",an,"end"]);break;case"position":f=d.split(","),l.percent(u,f[0]),f.length===2&&l.alt("positionAlign",f[1],["start",an,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",an,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&Jo.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",an);let h=l.get("position","auto");h==="auto"&&Jo.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 eh(s){return s.replace(/<br(?: \/)?>/gi,`
|
172
|
+
`)}class z0{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new j0,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=eh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
|
173
|
+
`;)++o;const a=n.slice(0,o);return n[o]==="\r"&&++o,n[o]===`
|
174
|
+
`&&++o,t.buffer=n.slice(o),a}function r(n){zc(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 Vo(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Z0(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
175
|
+
`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
176
|
+
|
177
|
+
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const eE=/\r\n|\n\r|\n|\r/g,Wo=function(e,t,i=0){return e.slice(i,i+t.length)===t},tE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!oe(t)||!oe(i)||!oe(r)||!oe(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},qo=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function jo(s,e,t){return qo(s.toString())+qo(e.toString())+qo(t)}const iE=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 sE(s,e,t,i,r,n,o){const a=new z0,A=Jt(new Uint8Array(s)).trim().replace(eE,`
|
178
|
+
`).split(`
|
179
|
+
`),l=[],c=e?Q0(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,f,g=!0;a.oncue=function(I){const B=t[i];let S=t.ccOffset;const Q=(u-c)/9e4;if(B!=null&&B.new&&(d!==void 0?S=t.ccOffset=B.start:iE(t,i,Q)),Q){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}S=Q-t.presentationOffset}const m=I.endTime-I.startTime,y=Tt((I.startTime+S-d)*9e4,r*9e4)/9e4;I.startTime=Math.max(y,0),I.endTime=Math.max(y+m,0);const D=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(D)),I.id||(I.id=jo(I.startTime,I.endTime,D)),I.endTime>0&&l.push(I)},a.onparsingerror=function(I){f=I},a.onflush=function(){if(f){o(f);return}n(l)},A.forEach(I=>{if(g)if(Wo(I,"X-TIMESTAMP-MAP=")){g=!1,I.slice(16).split(",").forEach(B=>{Wo(B,"LOCAL:")?h=B.slice(6):Wo(B,"MPEGTS:")&&(u=parseInt(B.slice(7)))});try{d=tE(h)/1e3}catch(B){f=B}return}else I===""&&(g=!1);a.parse(I+`
|
180
|
+
`)}),a.flush()}const Xo="stpp.ttml.im1t",th=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ih=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,rE={left:"start",center:"center",right:"end",start:"start",end:"end"};function sh(s,e,t,i){const r=Ee(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Jt(a)),o=y0(e.baseTime,1,e.timescale);try{n.forEach(a=>t(nE(a,o)))}catch(a){i(a)}}function nE(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=rh(Zo(r,"styling","style")),l=rh(Zo(r,"layout","region")),c=Zo(r,"body","[begin]");return[].map.call(c,h=>{const u=nh(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=ea(h.getAttribute("begin"),o),f=ea(h.getAttribute("dur"),o);let g=ea(h.getAttribute("end"),o);if(d===null)throw oh(h);if(g===null){if(f===null)throw oh(h);g=d+f}const I=new Vo(d-e,g-e,u);I.id=jo(I.startTime,I.endTime,I.text);const B=l[h.getAttribute("region")],S=A[h.getAttribute("style")],Q=oE(B,S,A),{textAlign:m}=Q;if(m){const y=rE[m];y&&(I.lineAlign=y),I.align=m}return Ye(I,Q),I}).filter(h=>h!==null)}function Zo(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function rh(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function nh(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
|
181
|
+
`:(n=i.childNodes)!=null&&n.length?nh(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function oE(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=zo(e,i,A)||zo(s,i,A)||zo(r,i,A);return l&&(a[A]=l),a},{})}function zo(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function oh(s){return new Error(`Could not parse ttml timestamp ${s}`)}function ea(s,e){if(!s)return null;let t=Zc(s);return t===null&&(th.test(s)?t=aE(s,e):ih.test(s)&&(t=AE(s,e))),t}function aE(s,e){const t=th.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 AE(s,e){const t=ih.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 lE{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lh(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new on(this,"textTrack1"),t=new on(this,"textTrack2"),i=new on(this,"textTrack3"),r=new on(this,"textTrack4");this.cea608Parser1=new qc(1,e,t),this.cea608Parser2=new qc(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=cE(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(Ah(n,{name:e,lang:t,attrs:{}}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(n,o);if(a)i[e]=a,As(i[e]),jl(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=>{As(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lh(),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++)As(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===Xo);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Pc(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?Kr(o.textTracks):null;if(this.tracks.forEach((A,l)=>{let c;if(a){let h=null;for(let u=0;u<a.length;u++)if(a[u]&&Ah(a[u],A)){h=a[u],a[u]=null;break}h&&(c=h)}if(c)As(c);else{const h=ah(A);c=this.createTextTrack(h,A.name,A.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const A=a.filter(l=>l!==null).map(l=>l.label);A.length&&F.warn(`Media element contains unused subtitle tracks: ${A.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r,lastCc:n,lastSn:o,lastPartIndex:a}=this;if(!(!this.enabled||!i||!r)&&t.frag.type===he.MAIN){var A,l;const{cc:c,sn:h}=t.frag,u=(A=t==null||(l=t.part)==null?void 0:l.index)!=null?A:-1;h===o+1||h===o&&u===a+1||c===n||(i.reset(),r.reset()),this.lastCc=c,this.lastSn=h,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===he.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===Xo?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;sh(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?xt(i.initSegment.data,new Uint8Array(r)):r;sE(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||sh(t,this.initPTS[e.cc],()=>{i.textCodec=Xo,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=>Xl(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===he.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;const{frag:n,samples:o}=t;if(!(n.type===he.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=>Qo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>Qo(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 ah(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Ah(s,e){return!!s&&s.kind===ah(e)&&Ko(e,s)}function cE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function lh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class ta{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&oe(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&F.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,ta.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(a,A)=>A?a.width!==A.width||a.height!==A.height:!0;let n=e.length-1;const o=Math.max(t,i);for(let a=0;a<e.length;a+=1){const A=e[a];if((A.width>=o||A.height>=o)&&r(A,e[a+1])){n=a;break}}return n}}class hE{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 An="[eme]";class ps{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=ps.CDMCleanupPromise?[ps.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=F.debug.bind(F,An),this.log=F.log.bind(F,An),this.warn=F.warn.bind(F,An),this.error=F.error.bind(F,An),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===Ne.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 Lt?a(h):a(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.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 Bl===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=yf(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=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: ${Wt.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 Wt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${Wt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
|
182
|
+
} (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=uo(this.config),n=e.map(pl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=ml(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(A,"cenc",t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Lt?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=pl(e.keyFormat),n=r?[r]:uo(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=uo(this.config)),e.length===0)throw new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.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[Ne.FAIRPLAY]){const c=Xe(new Uint8Array(i));try{const h=co(JSON.parse(c).sinf),u=xl(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ne.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=Jf(i);if(c===null)return;c.version===0&&c.systemId===Cl.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=Bf(c.systemId)}if(!n||!r)return;const o=Wt.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=Wt.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 Ws("ISO-23001-7",o,(u=ml(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const f=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(f,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 f=a.call(this.hls,t,i,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,i=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var A;if(this.warn(f.message),(A=this.hls)!=null&&A.config.debug)throw f}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 $o,h=e._onmessage=f=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:I,message:B}=f;this.log(`"${I}" message event for session "${g.sessionId}" message size: ${B.byteLength}`),I==="license-request"||I==="license-renewal"?this.renewLicense(e,B).catch(S=>{this.handleError(S),c.emit("error",S)}):I==="license-release"?e.keySystem===Ne.FAIRPLAY&&(this.updateKeySession(e,ho("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${I}"`)},u=e._onkeystatuseschange=f=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const I=e.keyStatus;c.emit("keyStatus",I),I==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);const d=new Promise((f,g)=>{c.on("error",g),c.on("keyStatus",I=>{I.startsWith("usable")?f():I==="output-restricted"?g(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):I==="internal-error"?g(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${I}"`)):I==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${I}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${l}`)}).catch(f=>{throw new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>d).catch(f=>{throw c.removeAllListeners(),this.removeSession(e),f}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Wt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${Wt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,f,g)=>{o(u.data)},onError:(u,d,f,g)=>{a(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:it({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,f)=>{a(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,f)=>{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?.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.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 Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let c;for(let h=0,u=n.length;h<u;h++){var o,a;c=n[h];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,f=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&f&&e.setRequestHeader(d,f)}}const A=r.querySelector("Challenge"),l=A?.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return ho(atob(l))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new Lt({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{e.keySystem==Ne.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(A,l)),A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ws.clearKeyUriToKeyIdMap();const i=t.length;ps.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e?.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}ps.CDMCleanupPromise=void 0;class Lt extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var ft;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(ft||(ft={}));var ia;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(ia||(ia={}));var Hi;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Hi||(Hi={}));const uE={[Hi.OBJECT]:["br","d","ot","tb"],[Hi.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Hi.SESSION]:["cid","pr","sf","sid","st","v"],[Hi.STATUS]:["bs","rtp"]};class Cs{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof Cs?i:new Cs(i))),this.value=e,this.params=t}}class ch{constructor(e){this.description=void 0,this.description=e}}const dE="Dict";function gE(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function fE(s,e,t,i){return new Error(`failed to ${s} "${gE(e)}" as ${t}`,{cause:i})}const hh="Bare Item",IE="Boolean",EE="Byte Sequence",pE="Decimal",CE="Integer";function mE(s){return s<-999999999999999||999999999999999<s}const BE=/[\x00-\x1f\x7f]+/,yE="Token",QE="Key";function zt(s,e,t){return fE("serialize",s,e,t)}function vE(s){if(typeof s!="boolean")throw zt(s,IE);return s?"?1":"?0"}function SE(s){return btoa(String.fromCharCode(...s))}function DE(s){if(ArrayBuffer.isView(s)===!1)throw zt(s,EE);return`:${SE(s)}:`}function uh(s){if(mE(s))throw zt(s,CE);return s.toString()}function wE(s){return`@${uh(s.getTime()/1e3)}`}function dh(s,e){if(s<0)return-dh(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const r=Math.floor(s*t);return(r%2===0?r:r+1)/t}else return Math.round(s*t)/t}function bE(s){const e=dh(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw zt(s,pE);const t=e.toString();return t.includes(".")?t:`${t}.0`}const RE="String";function xE(s){if(BE.test(s))throw zt(s,RE);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function TE(s){return s.description||s.toString().slice(7,-1)}function gh(s){const e=TE(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw zt(e,yE);return e}function sa(s){switch(typeof s){case"number":if(!oe(s))throw zt(s,hh);return Number.isInteger(s)?uh(s):bE(s);case"string":return xE(s);case"symbol":return gh(s);case"boolean":return vE(s);case"object":if(s instanceof Date)return wE(s);if(s instanceof Uint8Array)return DE(s);if(s instanceof ch)return gh(s);default:throw zt(s,hh)}}function ra(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw zt(s,QE);return s}function na(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${ra(e)}`:`;${ra(e)}=${sa(t)}`).join("")}function fh(s){return s instanceof Cs?`${sa(s.value)}${na(s.params)}`:sa(s)}function LE(s){return`(${s.value.map(fh).join(" ")})${na(s.params)}`}function kE(s,e={whitespace:!0}){if(typeof s!="object")throw zt(s,dE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Cs||(n=new Cs(n));let o=ra(r);return n.value===!0?o+=na(n.params):(o+="=",Array.isArray(n.value)?o+=LE(n):o+=fh(n)),o}).join(`,${i}`)}function ME(s,e){return kE(s,e)}const _E=s=>s==="ot"||s==="sf"||s==="st",FE=s=>typeof s=="number"?oe(s):s!=null&&s!==""&&s!==!1;function NE(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function OE(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const ln=s=>Math.round(s),UE=(s,e)=>(e!=null&&e.baseUrl&&(s=NE(s,e.baseUrl)),encodeURIComponent(s)),cn=s=>ln(s/100)*100,PE={br:ln,d:ln,bl:cn,dl:cn,mtp:cn,nor:UE,rtp:cn,tb:ln};function GE(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=Ye({},PE,e?.formatters),n=e?.filter;return i.forEach(o=>{if(n!=null&&n(o))return;let a=s[o];const A=r[o];A&&(a=A(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||FE(a)&&(_E(o)&&typeof a=="string"&&(a=new ch(a)),t[o]=a))}),t}function Ih(s,e={}){return s?ME(GE(s,e),Ye({whitespace:!1},e)):""}function HE(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(uE).concat(Object.entries(e?.customHeaderMap||{})),r=t.reduce((n,o)=>{var a,A;const[l,c]=o,h=((a=i.find(u=>u[1].includes(l)))==null?void 0:a[0])||Hi.REQUEST;return(A=n[h])!=null||(n[h]={}),n[h][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=Ih(a,e),n),{})}function $E(s,e,t){return Ye(s,HE(e,t))}const KE="CMCD";function YE(s,e={}){if(!s)return"";const t=Ih(s,e);return`${KE}=${encodeURIComponent(t)}`}const Eh=/CMCD=[^&#]+/;function VE(s,e,t){const i=YE(e,t);if(!i)return s;if(Eh.test(s))return s.replace(Eh,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class JE{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:ft.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===ft.VIDEO||a===ft.AUDIO||a==ft.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||OE(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:ia.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ye(t,this.createData());const i=t.ot===ft.INIT||t.ot===ft.VIDEO||t.ot===ft.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,o)=>(r.includes(o)&&(n[o]=t[o]),n),{})),this.useHeaders?(e.headers||(e.headers={}),$E(e.headers,t)):e.url=VE(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ft.TIMED_TEXT;if(e.sn==="initSegment")return ft.INIT;if(t==="audio")return ft.AUDIO;if(t==="main")return this.hls.audioTracks.length?ft.VIDEO:ft.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===ft.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===ft.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:ke.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}}const WE=3e5;class qE{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,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if(i?.action===ht.SendAlternateToPenaltyBox&&i.flags===Ot.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:A,type:l}=t.context;a&&r?o=this.getPathwayForGroupId(a,l,o):A&&(o=A)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!n&&r&&(n=r.reduce((a,A)=>(a.indexOf(A.pathwayId)===-1&&a.push(A.pathwayId),a),[])),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==o),i.resolved||F.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>WE&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(o in i)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,nc(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===ve.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===ve.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=new Ue(c.attrs);h["PATHWAY-ID"]=o;const u=h.AUDIO&&`${h.AUDIO}_clone_${o}`,d=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;u&&(i[h.AUDIO]=u,h.AUDIO=u),d&&(r[h.SUBTITLES]=d,h.SUBTITLES=d);const f=Ch(c.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),g=new ls({attrs:h,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:f,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let I=1;I<c.audioGroups.length;I++)g.addGroupId("audio",`${c.audioGroups[I]}_clone_${o}`);if(c.subtitleGroups)for(let I=1;I<c.subtitleGroups.length;I++)g.addGroupId("text",`${c.subtitleGroups[I]}_clone_${o}`);return g});t.push(...l),ph(this.audioTracks,i,A,o),ph(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 f=c.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":I,"PATHWAY-PRIORITY":B}=f;if(g)try{this.uri=new self.URL(g,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||u.url),I&&this.clonePathways(I);const S={steeringManifest:f,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,S),B&&this.updatePathwayPriority(B)},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 f=this.timeToLoad*1e3;if(c.code===429){const g=this.loader;if(typeof g?.getResponseHeader=="function"){const I=g.getResponseHeader("Retry-After");I&&(f=parseFloat(I)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,f)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function ph(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=Ye({},o);return a.details=void 0,a.attrs=new Ue(a.attrs),a.url=a.attrs.URI=Ch(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 Ch(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=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 jE=/^age:\s*[\d.]+\s*$/im;class mh{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Fr,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(i,t.url)}).catch(o=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&oe(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry,c={url:e.url,data:void 0,code:o};Wr(A,l,!1,c)?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(Wr(t,i,!0))this.retry(t);else{var r;F.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Ro(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&&jE.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 XE(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const ZE=/(\d+)-(\d+)\/(\d+)/;class Bh{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||ip,this.controller=new self.AbortController,this.stats=new Fr}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=zE(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&oe(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:f}=h;throw new sp(f||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=tp(h.headers)||r.total,o&&oe(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const u=this.response;if(!u)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const f={url:u.url,data:h,code:u.status};o&&!oe(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(f,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 Ec,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 zE(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ye({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function ep(s){const e=ZE.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function tp(s){const e=s.get("Content-Range");if(e){const i=ep(e);if(oe(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function ip(s,e){return new self.Request(s.url,e)}class sp extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const rp=/\s/,np={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 g=0;g<n.chars.length;g++)rp.test(n.chars[g].uchar)&&a?A++:(l+=n.chars[g].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=eh(l.trim()),f=jo(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(f)||(o=new c(e,t,d),o.id=f,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=>Xl(s,u))),r}},op={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},yh=it(it({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:mh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:FI,bufferController:P0,capLevelController:ta,errorController:vI,fpsController:hE,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Bl,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:op},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},ap()),{},{subtitleStreamController:F0,subtitleTrackController:O0,timelineController:lE,audioStreamController:M0,audioTrackController:_0,emeController:ps,cmcdController:JE,contentSteeringController:qE});function ap(){return{cueHandler:np,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 Ap(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=oa(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])}`)}),it(it({},t),e)}function oa(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(oa):Object.keys(s).reduce((e,t)=>(e[t]=oa(s[t]),e),{}):s}function lp(s){const e=s.loader;e!==Bh&&e!==mh?(F.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):XE()&&(s.loader=Bh,s.progressive=!0,s.enableSoftwareAES=!0,F.log("[config]: Progressive streaming enabled, using FetchLoader"))}let aa;class cp extends To{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,r=[],n={},o={};let a=!1,A=!1,l=!1;t.levels.forEach(c=>{var h,u;const d=c.attrs;let{audioCodec:f,videoCodec:g}=c;((h=f)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(aa||(aa=/chrome|firefox/i.test(navigator.userAgent)),aa&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=$r(f,i)),((u=g)==null?void 0:u.indexOf("avc1"))===0&&(g=c.videoCodec=zf(g));const{width:I,height:B,unknownCodecs:S}=c;if(a||(a=!!(I&&B)),A||(A=!!g),l||(l=!!f),S!=null&&S.length||f&&!mo(f,"audio",i)||g&&!mo(g,"video",i))return;const{CODECS:Q,"FRAME-RATE":m,"HDCP-LEVEL":y,"PATHWAY-ID":D,RESOLUTION:v,"VIDEO-RANGE":k}=d,_=`${`${D||"."}-`}${c.bitrate}-${v}-${m}-${Q}-${k}-${y}`;if(n[_])if(n[_].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const U=o[_]+=1;c.attrs["PATHWAY-ID"]=new Array(U+1).join(".");const K=new ls(c);n[_]=K,r.push(K)}else n[_].addGroupId("audio",d.AUDIO),n[_].addGroupId("text",d.SUBTITLES);else{const U=new ls(c);n[_]=U,o[_]=1,r.push(U)}}),this.filterAndSortMediaOptions(r,t,a,A,l)}filterAndSortMediaOptions(e,t,i,r,n){let o=[],a=[],A=e;if((i||r)&&n&&(A=A.filter(({videoCodec:f,videoRange:g,width:I,height:B})=>(!!f||!!(I&&B))&&uI(g))),A.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:ue.MEDIA_ERROR,details:G.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;o=t.audioTracks.filter(g=>!g.audioCodec||mo(g.audioCodec,"audio",f)),Qh(o)}t.subtitles&&(a=t.subtitles,Qh(a));const l=A.slice(0);A.sort((f,g)=>{if(f.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&f.height!==g.height)return f.height-g.height;if(f.frameRate!==g.frameRate)return f.frameRate-g.frameRate;if(f.videoRange!==g.videoRange)return Vr.indexOf(f.videoRange)-Vr.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const I=Ol(f.videoCodec),B=Ol(g.videoCodec);if(I!==B)return B-I}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const I=Hr(f.codecSet),B=Hr(g.codecSet);if(I!==B)return B-I}return f.averageBitrate!==g.averageBitrate?f.averageBitrate-g.averageBitrate:0});let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let f=0;f<l.length;f++)if(l[f].pathwayId===A[0].pathwayId){c=l[f];break}}this._levels=A;for(let f=0;f<A.length;f++)if(A[f]===c){var h;this._firstLevel=f;const g=c.bitrate,I=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${g}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const B=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);B>I&&I===yh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=B)}break}const u=n&&!r,d={levels:A,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!u&&o.some(f=>!!f.url)};this.hls.trigger(E.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(E.ERROR,{type:ue.OTHER_ERROR,details:G.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r?.details);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ve.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===he.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const n=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${e?.msn!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));nc(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(E.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Qh(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class hp{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=G.KEY_LOAD_ERROR,i,r,n){return new gi({type:ue.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,G.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,G.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,G.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,f,g)=>{const{frag:I,keyInfo:B,url:S}=f;if(!I.decryptdata||B!==this.keyUriToKeyInfo[S])return a(this.createKeyLoadError(I,G.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));B.decryptdata.key=I.decryptdata.key=new Uint8Array(u.data),I.keyLoader=null,B.loader=null,o({frag:I,keyInfo:B})},onError:(u,d,f,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,G.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),f,it({url:A.url,data:void 0},u)))},onTimeout:(u,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,G.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(u,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,G.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function vh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Sh(){if(!as())return!1;const e=vh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function up(){if(!Sh())return!1;const s=as();return typeof s?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(qs(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(qs(e,"audio"))))}function dp(){var s;const e=vh();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const gp=250,hn=2,fp=.1,Ip=.05;class Ep{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),n!==null){if(this.stallReported){const I=self.performance.now()-n;F.warn(`playback not stuck anymore @${o}, after ${Math.round(I)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!ke.getBuffered(r).length){this.nudgeRetry=0;return}const c=ke.bufferInfo(r,o,0),h=c.nextStart||0;if(a){const I=c.len>hn,B=!h||t&&t.start<=o||h-o>hn&&!this.fragmentTracker.getPartialFragment(o);if(I||B)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u;if(!(c.len>0)&&!h)return;const B=Math.max(h,c.start||0)-o,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,m=(S==null||(u=S.details)==null?void 0:u.live)?S.details.targetduration*2:hn,y=this.fragmentTracker.getPartialFragment(o);if(B>0&&(B<=m||y)){r.paused||this._trySkipBufferHole(y);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const f=d-n;if(!a&&f>=gp&&(this._reportStall(c),!this.media))return;const g=ke.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(g,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:ue.MEDIA_ERROR,details:G.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=ke.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 f=u.getAppendedFrag(0,he.MAIN);f&&a<f.end&&(d=!0)}if(!d){const f=e||u.getAppendedFrag(n,he.MAIN);if(f){let g=!1,I=f.end;for(;I<a;){const B=u.getPartialFragment(I);if(B)I+=B.duration;else{g=!0;break}}if(g)return 0}}}const h=Math.max(a+Ip,n+fp);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:ue.MEDIA_ERROR,details:G.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:ue.MEDIA_ERROR,details:G.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:ue.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const pp=100;class Cp extends Mo{constructor(e,t,i){super(e,t,i,"[stream-controller]",he.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(pp),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=j.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=j.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case j.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t?.[i],n=r?.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=j.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=j.IDLE;break}break}case j.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,o=r?.[n];this.resetStartWhenNotLoaded(o||null),this.state=j.IDLE}}break}this.state===j.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(i!=null&&i[n]))return;const o=i[n],a=this.getMainFwdBufferInfo();if(a===null)return;const A=this.getLevelDetails();if(A&&this._streamEnded(a,A)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(E.BUFFER_EOS,g),this.state=j.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=o.details;if(!l||this.state===j.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=j.WAITING_LEVEL;return}const c=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(c>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==st.OK){var f;const I=((f=this.backtrackFragment)!=null?f:d).sn-l.startSN,B=l.fragments[I-1];B&&d.cc===B.cc&&(d=B,this.fragmentTracker.removeFragment(B))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,u)){if(!d.gap){const I=this.audioOnly&&!this.altAudio?be.AUDIO:be.VIDEO,B=(I===be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;B&&this.afterBufferFlushed(B,I,he.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,he.MAIN,h)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,u))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===st.NOT_LOADED||r===st.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,he.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case j.KEY_LOADING:case j.FRAG_LOADING:case j.FRAG_LOADING_WAITING_RETRY:case j.PARSING:case j.PARSED:this.state=j.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new Ep(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;oe(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(n=>{const o=n.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!dp(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==j.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=j.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===j.FRAG_LOADING||this.state===j.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(A.details=o,this.levelLastLoaded=A,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===j.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=j.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Uc(this.hls,he.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=r?r.index:-1,g=f!==-1,I=new Lo(i.level,i.sn,i.stats.chunkCount,n.byteLength,f,g),B=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,I,B)}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!==he.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===j.PARSED&&(this.state=j.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=j.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(he.MAIN,t);break;case G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ve.LEVEL&&(this.state=j.IDLE);break;case G.BUFFER_APPEND_ERROR:case G.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===G.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!ke.getBuffered(e).length){const i=this.state!==j.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=j.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==be.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,he.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=ke.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=j.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:f}=n,{details:g}=c,I=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=j.PARSING,f){if(f!=null&&f.tracks){const Q=A.initSegment||A;this._bufferInitSegment(c,f.tracks,Q,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:f.tracks})}const B=f.initPTS,S=f.timescale;oe(B)&&(this.initPTS[A.cc]={baseTime:B,timescale:S},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:B,timescale:S}))}if(h&&g&&A.sn!=="initSegment"){const B=g.fragments[A.sn-1-g.startSN],S=A.sn===g.startSN,Q=!B||A.cc>B.cc;if(n.independent!==!1){const{startPTS:m,endPTS:y,startDTS:D,endDTS:v}=h;if(l)l.elementaryStreams[h.type]={startPTS:m,endPTS:y,startDTS:D,endDTS:v};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!Q&&(this.couldBacktrack=!0),h.dropped&&h.independent){const k=this.getMainFwdBufferInfo(),P=(k?k.end:this.getLoadPosition())+this.config.maxBufferHole,_=h.firstKeyFramePTS?h.firstKeyFramePTS:m;if(!S&&P<_-this.config.maxBufferHole&&!Q){this.backtrack(A);return}else Q&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,y,A.start,v,!0)}else S&&m>hn&&(A.gap=!0);A.setElementaryStreamInfo(h.type,m,y,D,v),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,S||Q)}else if(S||Q)A.gap=!0;else{this.backtrack(A);return}}if(I){const{startPTS:B,endPTS:S,startDTS:Q,endDTS:m}=I;l&&(l.elementaryStreams[be.AUDIO]={startPTS:B,endPTS:S,startDTS:Q,endDTS:m}),A.setElementaryStreamInfo(be.AUDIO,B,S,Q,m),this.bufferFragmentData(I,A,l,o)}if(g&&d!=null&&(t=d.samples)!=null&&t.length){const B={id:i,frag:A,details:g,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,B)}if(g&&u){const B={id:i,frag:A,details:g,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,B)}}_bufferInitSegment(e,t,i,r){if(this.state!==j.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),n.metadata.channelCount!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")),A&&A.indexOf("mp4a.40.5")!==-1&&l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,he.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=j.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(ke.isBuffered(e,i)?t=this.getAppendedFrag(i):ke.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&oe(t)&&oe(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Ei{static get version(){return"1.5.7"}static isMSESupported(){return Sh()}static isSupported(){return up()}static getMediaSource(){return as()}static get Events(){return E}static get ErrorTypes(){return ue}static get ErrorDetails(){return G}static get DefaultConfig(){return Ei.defaultConfig?Ei.defaultConfig:yh}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.started=!1,this._emitter=new $o,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,hf(e.debug||!1,"Hls instance");const t=this.config=Ap(Ei.DefaultConfig,e);this.userConfig=e,t.progressive&&lp(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 rI(this),f=new lI(this),g=t.contentSteeringController,I=g?new g(this):null,B=this.levelController=new cp(this,I),S=new OI(this),Q=new hp(this.config),m=this.streamController=new Cp(this,S,Q);h.setStreamController(m),u.setStreamController(m);const y=[d,B,m];I&&y.splice(1,0,I),this.networkControllers=y;const D=[l,c,h,u,f,S];this.audioTrackController=this.createController(t.audioTrackController,y);const v=t.audioStreamController;v&&y.push(new v(this,S,Q)),this.subtitleTrackController=this.createController(t.subtitleTrackController,y);const k=t.subtitleStreamController;k&&y.push(new k(this,S,Q)),this.createController(t.timelineController,D),Q.emeController=this.emeController=this.createController(t.emeController,D),this.cmcdController=this.createController(t.cmcdController,D),this.latencyController=this.createController(cI,D),this.coreComponents=D,y.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){if(F.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}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=ao.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,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.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){F.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){F.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){F.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){F.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,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(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}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}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(F.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){hI(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}Ei.defaultConfig=void 0;function mp(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Bp(s){return s}function yp(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||Bp,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),f=mp(h),g=d==="[object Object]"||d==="[object Array]",I=A?A+t+r(c):r(c);if(!u&&!f&&g&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,I,l+1);n[I]=h})}return o(s),n}/**
|
183
|
+
* @license
|
184
|
+
* Copyright 2017 Google LLC
|
185
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
186
|
+
*/const Dh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},wh=es(class extends Us{constructor(s){if(super(s),s.type!==zi.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=id(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??=[],A=[];let l,c,h=0,u=r.length-1,d=0,f=n.length-1;for(;h<=u&&d<=f;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Fi(r[h],n[d]),h++,d++;else if(a[u]===o[f])A[f]=Fi(r[u],n[f]),u--,f--;else if(a[h]===o[f])A[f]=Fi(r[h],n[f]),Os(s,A[f+1],r[h]),h++,f--;else if(a[u]===o[d])A[d]=Fi(r[u],n[d]),Os(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Dh(o,d,f),c=Dh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const g=c.get(o[d]),I=g!==void 0?r[g]:null;if(I===null){const B=Os(s,r[h]);Fi(B,n[d]),A[d]=B}else A[d]=Fi(I,n[d]),Os(s,r[h],I),r[g]=null;d++}else Mn(r[u]),u--;else Mn(r[h]),h++;for(;d<=f;){const g=Os(s,A[f+1]);Fi(g,n[d]),A[d++]=g}for(;h<=u;){const g=r[h++];g!==null&&Mn(g)}return this.ut=o,td(s,A),Ft}});var yt="top",kt="bottom",Mt="right",Qt="left",Aa="auto",Zs=[yt,kt,Mt,Qt],ms="start",zs="end",Qp="clippingParents",bh="viewport",er="popper",vp="reference",Rh=Zs.reduce(function(s,e){return s.concat([e+"-"+ms,e+"-"+zs])},[]),xh=[].concat(Zs,[Aa]).reduce(function(s,e){return s.concat([e,e+"-"+ms,e+"-"+zs])},[]),Sp="beforeRead",Dp="read",wp="afterRead",bp="beforeMain",Rp="main",xp="afterMain",Tp="beforeWrite",Lp="write",kp="afterWrite",Mp=[Sp,Dp,wp,bp,Rp,xp,Tp,Lp,kp];function ei(s){return s?(s.nodeName||"").toLowerCase():null}function Dt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function $i(s){var e=Dt(s).Element;return s instanceof e||s instanceof Element}function _t(s){var e=Dt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function la(s){if(typeof ShadowRoot>"u")return!1;var e=Dt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function _p(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];!_t(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 Fp(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},{});!_t(r)||!ei(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const Th={name:"applyStyles",enabled:!0,phase:"write",fn:_p,effect:Fp,requires:["computeStyles"]};function ti(s){return s.split("-")[0]}var Ki=Math.max,un=Math.min,Bs=Math.round;function ca(){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 Lh(){return!/^((?!chrome|android).)*safari/i.test(ca())}function ys(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&_t(s)&&(r=s.offsetWidth>0&&Bs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Bs(i.height)/s.offsetHeight||1);var o=$i(s)?Dt(s):window,a=o.visualViewport,A=!Lh()&&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 ha(s){var e=ys(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function kh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&la(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function pi(s){return Dt(s).getComputedStyle(s)}function Np(s){return["table","td","th"].indexOf(ei(s))>=0}function wi(s){return(($i(s)?s.ownerDocument:s.document)||window.document).documentElement}function dn(s){return ei(s)==="html"?s:s.assignedSlot||s.parentNode||(la(s)?s.host:null)||wi(s)}function Mh(s){return!_t(s)||pi(s).position==="fixed"?null:s.offsetParent}function Op(s){var e=/firefox/i.test(ca()),t=/Trident/i.test(ca());if(t&&_t(s)){var i=pi(s);if(i.position==="fixed")return null}var r=dn(s);for(la(r)&&(r=r.host);_t(r)&&["html","body"].indexOf(ei(r))<0;){var n=pi(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 tr(s){for(var e=Dt(s),t=Mh(s);t&&Np(t)&&pi(t).position==="static";)t=Mh(t);return t&&(ei(t)==="html"||ei(t)==="body"&&pi(t).position==="static")?e:t||Op(s)||e}function ua(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function ir(s,e,t){return Ki(s,un(e,t))}function Up(s,e,t){var i=ir(s,e,t);return i>t?t:i}function _h(){return{top:0,right:0,bottom:0,left:0}}function Fh(s){return Object.assign({},_h(),s)}function Nh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var Pp=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Fh(typeof e!="number"?e:Nh(e,Zs))};function Gp(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=[Qt,Mt].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=Pp(r.padding,t),u=ha(n),d=A==="y"?yt:Qt,f=A==="y"?kt:Mt,g=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],I=o[A]-t.rects.reference[A],B=tr(n),S=B?A==="y"?B.clientHeight||0:B.clientWidth||0:0,Q=g/2-I/2,m=h[d],y=S-u[c]-h[f],D=S/2-u[c]/2+Q,v=ir(m,D,y),k=A;t.modifiersData[i]=(e={},e[k]=v,e.centerOffset=v-D,e)}}function Hp(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||kh(e.elements.popper,r)&&(e.elements.arrow=r))}const $p={name:"arrow",enabled:!0,phase:"main",fn:Gp,effect:Hp,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Qs(s){return s.split("-")[1]}var Kp={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Yp(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Bs(t*r)/r||0,y:Bs(i*r)/r||0}}function Oh(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,f=o.y,g=f===void 0?0:f,I=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=I.x,g=I.y;var B=o.hasOwnProperty("x"),S=o.hasOwnProperty("y"),Q=Qt,m=yt,y=window;if(l){var D=tr(t),v="clientHeight",k="clientWidth";if(D===Dt(t)&&(D=wi(t),pi(D).position!=="static"&&a==="absolute"&&(v="scrollHeight",k="scrollWidth")),D=D,r===yt||(r===Qt||r===Mt)&&n===zs){m=kt;var P=h&&D===y&&y.visualViewport?y.visualViewport.height:D[v];g-=P-i.height,g*=A?1:-1}if(r===Qt||(r===yt||r===kt)&&n===zs){Q=Mt;var _=h&&D===y&&y.visualViewport?y.visualViewport.width:D[k];d-=_-i.width,d*=A?1:-1}}var U=Object.assign({position:a},l&&Kp),K=c===!0?Yp({x:d,y:g},Dt(t)):{x:d,y:g};if(d=K.x,g=K.y,A){var Y;return Object.assign({},U,(Y={},Y[m]=S?"0":"",Y[Q]=B?"0":"",Y.transform=(y.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",Y))}return Object.assign({},U,(e={},e[m]=S?g+"px":"",e[Q]=B?d+"px":"",e.transform="",e))}function Vp(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,Oh(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,Oh(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 Jp={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Vp,data:{}};var gn={passive:!0};function Wp(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=Dt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,gn)}),a&&A.addEventListener("resize",t.update,gn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,gn)}),a&&A.removeEventListener("resize",t.update,gn)}}const qp={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Wp,data:{}};var jp={left:"right",right:"left",bottom:"top",top:"bottom"};function fn(s){return s.replace(/left|right|bottom|top/g,function(e){return jp[e]})}var Xp={start:"end",end:"start"};function Uh(s){return s.replace(/start|end/g,function(e){return Xp[e]})}function da(s){var e=Dt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function ga(s){return ys(wi(s)).left+da(s).scrollLeft}function Zp(s,e){var t=Dt(s),i=wi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=Lh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+ga(s),y:A}}function zp(s){var e,t=wi(s),i=da(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=Ki(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=Ki(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+ga(s),A=-i.scrollTop;return pi(r||t).direction==="rtl"&&(a+=Ki(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function fa(s){var e=pi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Ph(s){return["html","body","#document"].indexOf(ei(s))>=0?s.ownerDocument.body:_t(s)&&fa(s)?s:Ph(dn(s))}function sr(s,e){var t;e===void 0&&(e=[]);var i=Ph(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=Dt(i),o=r?[n].concat(n.visualViewport||[],fa(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(sr(dn(o)))}function Ia(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function eC(s,e){var t=ys(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 Gh(s,e,t){return e===bh?Ia(Zp(s,t)):$i(e)?eC(e,t):Ia(zp(wi(s)))}function tC(s){var e=sr(dn(s)),t=["absolute","fixed"].indexOf(pi(s).position)>=0,i=t&&_t(s)?tr(s):s;return $i(i)?e.filter(function(r){return $i(r)&&kh(r,i)&&ei(r)!=="body"}):[]}function iC(s,e,t,i){var r=e==="clippingParents"?tC(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=Gh(s,l,i);return A.top=Ki(c.top,A.top),A.right=un(c.right,A.right),A.bottom=un(c.bottom,A.bottom),A.left=Ki(c.left,A.left),A},Gh(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 Hh(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 yt:A={x:o,y:e.y-t.height};break;case kt:A={x:o,y:e.y+e.height};break;case Mt:A={x:e.x+e.width,y:a};break;case Qt: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 ms:A[l]=A[l]-(e[c]/2-t[c]/2);break;case zs:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function rr(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?Qp:a,l=t.rootBoundary,c=l===void 0?bh:l,h=t.elementContext,u=h===void 0?er:h,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,I=g===void 0?0:g,B=Fh(typeof I!="number"?I:Nh(I,Zs)),S=u===er?vp:er,Q=s.rects.popper,m=s.elements[f?S:u],y=iC($i(m)?m:m.contextElement||wi(s.elements.popper),A,c,o),D=ys(s.elements.reference),v=Hh({reference:D,element:Q,strategy:"absolute",placement:r}),k=Ia(Object.assign({},Q,v)),P=u===er?k:D,_={top:y.top-P.top+B.top,bottom:P.bottom-y.bottom+B.bottom,left:y.left-P.left+B.left,right:P.right-y.right+B.right},U=s.modifiersData.offset;if(u===er&&U){var K=U[r];Object.keys(_).forEach(function(Y){var X=[Mt,kt].indexOf(Y)>=0?1:-1,R=[yt,kt].indexOf(Y)>=0?"y":"x";_[Y]+=K[R]*X})}return _}function sC(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?xh:A,c=Qs(i),h=c?a?Rh:Rh.filter(function(f){return Qs(f)===c}):Zs,u=h.filter(function(f){return l.indexOf(f)>=0});u.length===0&&(u=h);var d=u.reduce(function(f,g){return f[g]=rr(s,{placement:g,boundary:r,rootBoundary:n,padding:o})[ti(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function rC(s){if(ti(s)===Aa)return[];var e=fn(s);return[Uh(s),e,Uh(e)]}function nC(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,f=d===void 0?!0:d,g=t.allowedAutoPlacements,I=e.options.placement,B=ti(I),S=B===I,Q=A||(S||!f?[fn(I)]:rC(I)),m=[I].concat(Q).reduce(function(se,ce){return se.concat(ti(ce)===Aa?sC(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:f,allowedAutoPlacements:g}):ce)},[]),y=e.rects.reference,D=e.rects.popper,v=new Map,k=!0,P=m[0],_=0;_<m.length;_++){var U=m[_],K=ti(U),Y=Qs(U)===ms,X=[yt,kt].indexOf(K)>=0,R=X?"width":"height",L=rr(e,{placement:U,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),W=X?Y?Mt:Qt:Y?kt:yt;y[R]>D[R]&&(W=fn(W));var b=fn(W),w=[];if(n&&w.push(L[K]<=0),a&&w.push(L[W]<=0,L[b]<=0),w.every(function(se){return se})){P=U,k=!1;break}v.set(U,w)}if(k)for(var T=f?3:1,V=function(ce){var de=m.find(function(re){var me=v.get(re);if(me)return me.slice(0,ce).every(function(Te){return Te})});if(de)return P=de,"break"},H=T;H>0;H--){var q=V(H);if(q==="break")break}e.placement!==P&&(e.modifiersData[i]._skip=!0,e.placement=P,e.reset=!0)}}const oC={name:"flip",enabled:!0,phase:"main",fn:nC,requiresIfExists:["offset"],data:{_skip:!1}};function $h(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 Kh(s){return[yt,Mt,kt,Qt].some(function(e){return s[e]>=0})}function aC(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=rr(e,{elementContext:"reference"}),a=rr(e,{altBoundary:!0}),A=$h(o,i),l=$h(a,r,n),c=Kh(A),h=Kh(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 AC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:aC};function lC(s,e,t){var i=ti(s),r=[Qt,yt].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,[Qt,Mt].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function cC(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=xh.reduce(function(c,h){return c[h]=lC(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 hC={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:cC};function uC(s){var e=s.state,t=s.name;e.modifiersData[t]=Hh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const dC={name:"popperOffsets",enabled:!0,phase:"read",fn:uC,data:{}};function gC(s){return s==="x"?"y":"x"}function fC(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,f=t.tetherOffset,g=f===void 0?0:f,I=rr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),B=ti(e.placement),S=Qs(e.placement),Q=!S,m=ua(B),y=gC(m),D=e.modifiersData.popperOffsets,v=e.rects.reference,k=e.rects.popper,P=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,_=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,K={x:0,y:0};if(D){if(n){var Y,X=m==="y"?yt:Qt,R=m==="y"?kt:Mt,L=m==="y"?"height":"width",W=D[m],b=W+I[X],w=W-I[R],T=d?-k[L]/2:0,V=S===ms?v[L]:k[L],H=S===ms?-k[L]:-v[L],q=e.elements.arrow,se=d&&q?ha(q):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:_h(),de=ce[X],re=ce[R],me=ir(0,v[L],se[L]),Te=Q?v[L]/2-T-me-de-_.mainAxis:V-me-de-_.mainAxis,Le=Q?-v[L]/2+T+me+re+_.mainAxis:H+me+re+_.mainAxis,Ce=e.elements.arrow&&tr(e.elements.arrow),Ie=Ce?m==="y"?Ce.clientTop||0:Ce.clientLeft||0:0,Be=(Y=U?.[m])!=null?Y:0,He=W+Te-Be-Ie,ye=W+Le-Be,_e=ir(d?un(b,He):b,W,d?Ki(w,ye):w);D[m]=_e,K[m]=_e-W}if(a){var Ze,We=m==="x"?yt:Qt,Ht=m==="x"?kt:Mt,ut=D[y],at=y==="y"?"height":"width",Qe=ut+I[We],At=ut-I[Ht],vt=[yt,Qt].indexOf(B)!==-1,wt=(Ze=U?.[y])!=null?Ze:0,ze=vt?Qe:ut-v[at]-k[at]-wt+_.altAxis,It=vt?ut+v[at]+k[at]-wt-_.altAxis:At,$t=d&&vt?Up(ze,ut,It):ir(d?ze:Qe,ut,d?It:At);D[y]=$t,K[y]=$t-ut}e.modifiersData[i]=K}}const IC={name:"preventOverflow",enabled:!0,phase:"main",fn:fC,requiresIfExists:["offset"]};function EC(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function pC(s){return s===Dt(s)||!_t(s)?da(s):EC(s)}function CC(s){var e=s.getBoundingClientRect(),t=Bs(e.width)/s.offsetWidth||1,i=Bs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function mC(s,e,t){t===void 0&&(t=!1);var i=_t(e),r=_t(e)&&CC(e),n=wi(e),o=ys(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ei(e)!=="body"||fa(n))&&(a=pC(e)),_t(e)?(A=ys(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=ga(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function BC(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 yC(s){var e=BC(s);return Mp.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function QC(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function vC(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 Yh={placement:"bottom",modifiers:[],strategy:"absolute"};function Vh(){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 SC(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?Yh:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Yh,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(B){var S=typeof B=="function"?B(c.options):B;g(),c.options=Object.assign({},n,c.options,S),c.scrollParents={reference:$i(a)?sr(a):a.contextElement?sr(a.contextElement):[],popper:sr(A)};var Q=yC(vC([].concat(i,c.options.modifiers)));return c.orderedModifiers=Q.filter(function(m){return m.enabled}),f(),d.update()},forceUpdate:function(){if(!u){var B=c.elements,S=B.reference,Q=B.popper;if(Vh(S,Q)){c.rects={reference:mC(S,tr(Q),c.options.strategy==="fixed"),popper:ha(Q)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(_){return c.modifiersData[_.name]=Object.assign({},_.data)});for(var m=0;m<c.orderedModifiers.length;m++){if(c.reset===!0){c.reset=!1,m=-1;continue}var y=c.orderedModifiers[m],D=y.fn,v=y.options,k=v===void 0?{}:v,P=y.name;typeof D=="function"&&(c=D({state:c,options:k,name:P,instance:d})||c)}}}},update:QC(function(){return new Promise(function(I){d.forceUpdate(),I(c)})}),destroy:function(){g(),u=!0}};if(!Vh(a,A))return d;d.setOptions(l).then(function(I){!u&&l.onFirstUpdate&&l.onFirstUpdate(I)});function f(){c.orderedModifiers.forEach(function(I){var B=I.name,S=I.options,Q=S===void 0?{}:S,m=I.effect;if(typeof m=="function"){var y=m({state:c,name:B,instance:d,options:Q}),D=function(){};h.push(y||D)}})}function g(){h.forEach(function(I){return I()}),h=[]}return d}}var DC=[qp,dC,Jp,Th,hC,oC,IC,$p,AC],wC=SC({defaultModifiers:DC}),bC="tippy-box",Jh="tippy-content",RC="tippy-backdrop",Wh="tippy-arrow",qh="tippy-svg-arrow",Yi={passive:!0,capture:!0},jh=function(){return document.body};function Ea(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function pa(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Xh(s,e){return typeof s=="function"?s.apply(void 0,e):s}function Zh(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function xC(s){return s.split(/\s+/).filter(Boolean)}function vs(s){return[].concat(s)}function zh(s,e){s.indexOf(e)===-1&&s.push(e)}function TC(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function LC(s){return s.split("-")[0]}function In(s){return[].slice.call(s)}function eu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function nr(){return document.createElement("div")}function En(s){return["Element","Fragment"].some(function(e){return pa(s,e)})}function kC(s){return pa(s,"NodeList")}function MC(s){return pa(s,"MouseEvent")}function _C(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function FC(s){return En(s)?[s]:kC(s)?In(s):Array.isArray(s)?s:In(document.querySelectorAll(s))}function Ca(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 NC(s){var e,t=vs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function OC(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=LC(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,f=l==="left"?c.right.x:0,g=n.top-i+h>A,I=i-n.bottom-u>A,B=n.left-t+d>A,S=t-n.right-f>A;return g||I||B||S})}function ma(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function iu(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},su=0;function UC(){ii.isTouch||(ii.isTouch=!0,window.performance&&document.addEventListener("mousemove",ru))}function ru(){var s=performance.now();s-su<20&&(ii.isTouch=!1,document.removeEventListener("mousemove",ru)),su=s}function PC(){var s=document.activeElement;if(_C(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function GC(){document.addEventListener("touchstart",UC,Yi),window.addEventListener("blur",PC)}var HC=typeof window<"u"&&typeof document<"u",$C=HC?!!window.msCrypto:!1,KC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},YC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Pt=Object.assign({appendTo:jh,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},KC,YC),VC=Object.keys(Pt),JC=function(e){var t=Object.keys(e);t.forEach(function(i){Pt[i]=e[i]})};function nu(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=Pt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function WC(s,e){var t=e?Object.keys(nu(Object.assign({},Pt,{plugins:e}))):VC,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 ou(s,e){var t=Object.assign({},e,{content:Xh(e.content,[s])},e.ignoreAttributes?{}:WC(s,e.plugins));return t.aria=Object.assign({},Pt.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 qC=function(){return"innerHTML"};function Ba(s,e){s[qC()]=e}function au(s){var e=nr();return s===!0?e.className=Wh:(e.className=qh,En(s)?e.appendChild(s):Ba(e,s)),e}function Au(s,e){En(e.content)?(Ba(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ba(s,e.content):s.textContent=e.content)}function ya(s){var e=s.firstElementChild,t=In(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(Jh)}),arrow:t.find(function(i){return i.classList.contains(Wh)||i.classList.contains(qh)}),backdrop:t.find(function(i){return i.classList.contains(RC)})}}function lu(s){var e=nr(),t=nr();t.className=bC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=nr();i.className=Jh,i.setAttribute("data-state","hidden"),Au(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=ya(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)&&Au(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(au(o.arrow))):A.appendChild(au(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}lu.$$tippy=!0;var jC=1,pn=[],Qa=[];function XC(s,e){var t=ou(s,Object.assign({},Pt,nu(eu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],f=Zh(He,t.interactiveDebounce),g,I=jC++,B=null,S=TC(t.plugins),Q={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},m={id:I,reference:s,popper:nr(),popperInstance:B,props:t,state:Q,plugins:S,clearDelayTimeouts:ze,setProps:It,setContent:$t,show:et,hide:St,hideWithInteractivity:ai,enable:vt,disable:wt,unmount:Ci,destroy:Et};if(!t.render)return m;var y=t.render(m),D=y.popper,v=y.onUpdate;D.setAttribute("data-tippy-root",""),D.id="tippy-"+m.id,m.popper=D,s._tippy=m,D._tippy=m;var k=S.map(function($){return $.fn(m)}),P=s.hasAttribute("aria-expanded");return Ce(),T(),W(),b("onCreate",[m]),t.showOnCreate&&Qe(),D.addEventListener("mouseenter",function(){m.props.interactive&&m.state.isVisible&&m.clearDelayTimeouts()}),D.addEventListener("mouseleave",function(){m.props.interactive&&m.props.trigger.indexOf("mouseenter")>=0&&X().addEventListener("mousemove",f)}),m;function _(){var $=m.props.touch;return Array.isArray($)?$:[$,0]}function U(){return _()[0]==="hold"}function K(){var $;return!!(($=m.props.render)!=null&&$.$$tippy)}function Y(){return g||s}function X(){var $=Y().parentNode;return $?NC($):document}function R(){return ya(D)}function L($){return m.state.isMounted&&!m.state.isVisible||ii.isTouch||c&&c.type==="focus"?0:Ea(m.props.delay,$?0:1,Pt.delay)}function W($){$===void 0&&($=!1),D.style.pointerEvents=m.props.interactive&&!$?"":"none",D.style.zIndex=""+m.props.zIndex}function b($,ae,Ae){if(Ae===void 0&&(Ae=!0),k.forEach(function(pe){pe[$]&&pe[$].apply(pe,ae)}),Ae){var Se;(Se=m.props)[$].apply(Se,ae)}}function w(){var $=m.props.aria;if($.content){var ae="aria-"+$.content,Ae=D.id,Se=vs(m.props.triggerTarget||s);Se.forEach(function(pe){var tt=pe.getAttribute(ae);if(m.state.isVisible)pe.setAttribute(ae,tt?tt+" "+Ae:Ae);else{var $e=tt&&tt.replace(Ae,"").trim();$e?pe.setAttribute(ae,$e):pe.removeAttribute(ae)}})}}function T(){if(!(P||!m.props.aria.expanded)){var $=vs(m.props.triggerTarget||s);$.forEach(function(ae){m.props.interactive?ae.setAttribute("aria-expanded",m.state.isVisible&&ae===Y()?"true":"false"):ae.removeAttribute("aria-expanded")})}}function V(){X().removeEventListener("mousemove",f),pn=pn.filter(function($){return $!==f})}function H($){if(!(ii.isTouch&&(A||$.type==="mousedown"))){var ae=$.composedPath&&$.composedPath()[0]||$.target;if(!(m.props.interactive&&iu(D,ae))){if(vs(m.props.triggerTarget||s).some(function(Ae){return iu(Ae,ae)})){if(ii.isTouch||m.state.isVisible&&m.props.trigger.indexOf("click")>=0)return}else b("onClickOutside",[m,$]);m.props.hideOnClick===!0&&(m.clearDelayTimeouts(),m.hide(),a=!0,setTimeout(function(){a=!1}),m.state.isMounted||de())}}}function q(){A=!0}function se(){A=!1}function ce(){var $=X();$.addEventListener("mousedown",H,!0),$.addEventListener("touchend",H,Yi),$.addEventListener("touchstart",se,Yi),$.addEventListener("touchmove",q,Yi)}function de(){var $=X();$.removeEventListener("mousedown",H,!0),$.removeEventListener("touchend",H,Yi),$.removeEventListener("touchstart",se,Yi),$.removeEventListener("touchmove",q,Yi)}function re($,ae){Te($,function(){!m.state.isVisible&&D.parentNode&&D.parentNode.contains(D)&&ae()})}function me($,ae){Te($,ae)}function Te($,ae){var Ae=R().box;function Se(pe){pe.target===Ae&&(ma(Ae,"remove",Se),ae())}if($===0)return ae();ma(Ae,"remove",h),ma(Ae,"add",Se),h=Se}function Le($,ae,Ae){Ae===void 0&&(Ae=!1);var Se=vs(m.props.triggerTarget||s);Se.forEach(function(pe){pe.addEventListener($,ae,Ae),d.push({node:pe,eventType:$,handler:ae,options:Ae})})}function Ce(){U()&&(Le("touchstart",Be,{passive:!0}),Le("touchend",ye,{passive:!0})),xC(m.props.trigger).forEach(function($){if($!=="manual")switch(Le($,Be),$){case"mouseenter":Le("mouseleave",ye);break;case"focus":Le($C?"focusout":"blur",_e);break;case"focusin":Le("focusout",_e);break}})}function Ie(){d.forEach(function($){var ae=$.node,Ae=$.eventType,Se=$.handler,pe=$.options;ae.removeEventListener(Ae,Se,pe)}),d=[]}function Be($){var ae,Ae=!1;if(!(!m.state.isEnabled||Ze($)||a)){var Se=((ae=c)==null?void 0:ae.type)==="focus";c=$,g=$.currentTarget,T(),!m.state.isVisible&&MC($)&&pn.forEach(function(pe){return pe($)}),$.type==="click"&&(m.props.trigger.indexOf("mouseenter")<0||o)&&m.props.hideOnClick!==!1&&m.state.isVisible?Ae=!0:Qe($),$.type==="click"&&(o=!Ae),Ae&&!Se&&At($)}}function He($){var ae=$.target,Ae=Y().contains(ae)||D.contains(ae);if(!($.type==="mousemove"&&Ae)){var Se=at().concat(D).map(function(pe){var tt,$e=pe._tippy,Ai=(tt=$e.popperInstance)==null?void 0:tt.state;return Ai?{popperRect:pe.getBoundingClientRect(),popperState:Ai,props:t}:null}).filter(Boolean);OC(Se,$)&&(V(),At($))}}function ye($){var ae=Ze($)||m.props.trigger.indexOf("click")>=0&&o;if(!ae){if(m.props.interactive){m.hideWithInteractivity($);return}At($)}}function _e($){m.props.trigger.indexOf("focusin")<0&&$.target!==Y()||m.props.interactive&&$.relatedTarget&&D.contains($.relatedTarget)||At($)}function Ze($){return ii.isTouch?U()!==$.type.indexOf("touch")>=0:!1}function We(){Ht();var $=m.props,ae=$.popperOptions,Ae=$.placement,Se=$.offset,pe=$.getReferenceClientRect,tt=$.moveTransition,$e=K()?ya(D).arrow:null,Ai=pe?{getBoundingClientRect:pe,contextElement:pe.contextElement||Y()}:s,Qn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Rs){var xi=Rs.state;if(K()){var Oa=R(),bt=Oa.box;["placement","reference-hidden","escaped"].forEach(function(xs){xs==="placement"?bt.setAttribute("data-placement",xi.placement):xi.attributes.popper["data-popper-"+xs]?bt.setAttribute("data-"+xs,""):bt.removeAttribute("data-"+xs)}),xi.attributes.popper={}}}},mi=[{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:!tt}},Qn];K()&&$e&&mi.push({name:"arrow",options:{element:$e,padding:3}}),mi.push.apply(mi,ae?.modifiers||[]),m.popperInstance=wC(Ai,D,Object.assign({},ae,{placement:Ae,onFirstUpdate:u,modifiers:mi}))}function Ht(){m.popperInstance&&(m.popperInstance.destroy(),m.popperInstance=null)}function ut(){var $=m.props.appendTo,ae,Ae=Y();m.props.interactive&&$===jh||$==="parent"?ae=Ae.parentNode:ae=Xh($,[Ae]),ae.contains(D)||ae.appendChild(D),m.state.isMounted=!0,We()}function at(){return In(D.querySelectorAll("[data-tippy-root]"))}function Qe($){m.clearDelayTimeouts(),$&&b("onTrigger",[m,$]),ce();var ae=L(!0),Ae=_(),Se=Ae[0],pe=Ae[1];ii.isTouch&&Se==="hold"&&pe&&(ae=pe),ae?i=setTimeout(function(){m.show()},ae):m.show()}function At($){if(m.clearDelayTimeouts(),b("onUntrigger",[m,$]),!m.state.isVisible){de();return}if(!(m.props.trigger.indexOf("mouseenter")>=0&&m.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf($.type)>=0&&o)){var ae=L(!1);ae?r=setTimeout(function(){m.state.isVisible&&m.hide()},ae):n=requestAnimationFrame(function(){m.hide()})}}function vt(){m.state.isEnabled=!0}function wt(){m.hide(),m.state.isEnabled=!1}function ze(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function It($){if(!m.state.isDestroyed){b("onBeforeUpdate",[m,$]),Ie();var ae=m.props,Ae=ou(s,Object.assign({},ae,eu($),{ignoreAttributes:!0}));m.props=Ae,Ce(),ae.interactiveDebounce!==Ae.interactiveDebounce&&(V(),f=Zh(He,Ae.interactiveDebounce)),ae.triggerTarget&&!Ae.triggerTarget?vs(ae.triggerTarget).forEach(function(Se){Se.removeAttribute("aria-expanded")}):Ae.triggerTarget&&s.removeAttribute("aria-expanded"),T(),W(),v&&v(ae,Ae),m.popperInstance&&(We(),at().forEach(function(Se){requestAnimationFrame(Se._tippy.popperInstance.forceUpdate)})),b("onAfterUpdate",[m,$])}}function $t($){m.setProps({content:$})}function et(){var $=m.state.isVisible,ae=m.state.isDestroyed,Ae=!m.state.isEnabled,Se=ii.isTouch&&!m.props.touch,pe=Ea(m.props.duration,0,Pt.duration);if(!($||ae||Ae||Se)&&!Y().hasAttribute("disabled")&&(b("onShow",[m],!1),m.props.onShow(m)!==!1)){if(m.state.isVisible=!0,K()&&(D.style.visibility="visible"),W(),ce(),m.state.isMounted||(D.style.transition="none"),K()){var tt=R(),$e=tt.box,Ai=tt.content;Ca([$e,Ai],0)}u=function(){var mi;if(!(!m.state.isVisible||l)){if(l=!0,D.offsetHeight,D.style.transition=m.props.moveTransition,K()&&m.props.animation){var qi=R(),Rs=qi.box,xi=qi.content;Ca([Rs,xi],pe),tu([Rs,xi],"visible")}w(),T(),zh(Qa,m),(mi=m.popperInstance)==null||mi.forceUpdate(),b("onMount",[m]),m.props.animation&&K()&&me(pe,function(){m.state.isShown=!0,b("onShown",[m])})}},ut()}}function St(){var $=!m.state.isVisible,ae=m.state.isDestroyed,Ae=!m.state.isEnabled,Se=Ea(m.props.duration,1,Pt.duration);if(!($||ae||Ae)&&(b("onHide",[m],!1),m.props.onHide(m)!==!1)){if(m.state.isVisible=!1,m.state.isShown=!1,l=!1,o=!1,K()&&(D.style.visibility="hidden"),V(),de(),W(!0),K()){var pe=R(),tt=pe.box,$e=pe.content;m.props.animation&&(Ca([tt,$e],Se),tu([tt,$e],"hidden"))}w(),T(),m.props.animation?K()&&re(Se,m.unmount):m.unmount()}}function ai($){X().addEventListener("mousemove",f),zh(pn,f),f($)}function Ci(){m.state.isVisible&&m.hide(),m.state.isMounted&&(Ht(),at().forEach(function($){$._tippy.unmount()}),D.parentNode&&D.parentNode.removeChild(D),Qa=Qa.filter(function($){return $!==m}),m.state.isMounted=!1,b("onHidden",[m]))}function Et(){m.state.isDestroyed||(m.clearDelayTimeouts(),m.unmount(),Ie(),delete s._tippy,m.state.isDestroyed=!0,b("onDestroy",[m]))}}function Vi(s,e){e===void 0&&(e={});var t=Pt.plugins.concat(e.plugins||[]);GC();var i=Object.assign({},e,{plugins:t}),r=FC(s),n=r.reduce(function(o,a){var A=a&&XC(a,i);return A&&o.push(A),o},[]);return En(s)?n[0]:n}Vi.defaultProps=Pt,Vi.setDefaultProps=JC,Vi.currentInput=ii,Object.assign({},Th,{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)}}),Vi.setDefaultProps({render:lu});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 ZC=5;class zC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=dt(),this._controls=dt(),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){const t=Math.min(this.host.duration,Math.max(0,e));this._currentTime=t,this.activeScenes=this.host.scenes?.filter(({start:n,duration:o})=>t>=n&&t<n+o)??[],this._upcomingScenes=this.host.scenes?.filter(({start:n})=>t>=n-ZC&&t<n)??[],this.loadScenes(),this.syncVideoState(),this._controls.value?.setAttribute("currentTime",t.toString());const i=this.activeScenes[0],r=nl(i?.videoMeta?.captions);this.caption=r.find(({start:n,end:o})=>{const a=t-i.start+(i.videoMeta?.start??0);return n&&o&&a>=Lr(n)&&a<=Lr(o)})?.text??"",this.draw(t),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:t}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return gt(this._canvas)}controls(){return gt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{const{start:t,duration:i,video:r,videoMeta:n}=e,o=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(r&&n){const{key:a,hls:A,node:l}=r,{start:c,duration:h}=n,u=this.host.videoState[a];l&&u&&(l.currentTime>=c+h||l.ended||o&&(A?A.startLoadOnce?.(l.currentTime):u.initialised||l.startLoadOnce?.()))}else if(o){const a=`${t}-${i}`,A=this.host._sceneController.videoState[a];this.host.duration&&!A?.buffered?.length&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[a]:{...A,buffered:[{start:Math.max(0,t/this.host.duration*100),end:Math.min((t+i)/this.host.duration*100,100)}]}})}})}syncVideoState(){this.host.scenes?.forEach(e=>{if(e.video){const{key:t,node:i}=e.video,r=this.host.videoState[t],n=this.activeScenes.includes(e);if(i&&r)if(n&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(i.paused&&r.initialised)try{return i.play()}catch(o){throw new si("Video play error",o,!0)}}else i.paused||i.pause()}})}draw(e=this.currentTime){this.host.sceneConfig&&this._canvas.value&&this.host.compilation?.({currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value})}clear(){const e=this._canvas.value;e?.getContext("2d")?.clearRect(0,0,e.width,e.height)}}function em(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function tm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function va(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&&!em()&&Ei.isSupported()){let l=!1;a=new Ei({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,f,g){f.toString().includes("?")||(f+="?"+u),h.apply(this,[d,f,g])}}}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=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?.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 cu(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 im=vi(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 sm=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._createDataResolver=ul(t=>i=>this.host.dataResolver(i,{language:t})),this._resolveVideo=vi(async t=>{const{id:i,key:r}=t,n=await va(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?.split("?")[0],playlist:n?.split("?")[0]})}),this._resolveVideoMeta=vi(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await cu(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})=>()=>{const n=this.videoState[i];if(!n?.initialised){this.videoState={...this.videoState,[i]:{...n,initialised:!0,waiting:!1,buffered:n?.buffered??[]}};const o=this.scenes?.scenes?.find(({video:a})=>{a?.key});o&&this._setVideoCurrentTime({scene:o,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?.initialised&&!i?.waiting&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i?.initialised&&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})=>()=>{this.videoState[i]?.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=>{const i=this.videos[t];i&&(i.node.pause(),i.node.src="",i.hls?.destroy(),Object.keys(i.listeners??{}).forEach(r=>{if(this.videos?.[t]){const n=i.listeners?.[r];n&&i.node.removeEventListener(r,n)}}),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}){const r=t?.buffered,n=[],{start:o,video:a,videoMeta:A}=this.scenes?.scenes.find(({video:l})=>e===l?.key)??{};if(t&&r&&a&&A&&typeof o<"u")for(let l=0;l<r.length;l++){const c=r.start(l),h=r.end(l);Math.max(c,A.start)<=Math.min(h,A.start+A.duration)&&n.push({start:Math.max(0,(Math.max(c-A.start,0)+o)/i*100),end:Math.min((Math.min(h-A.start,A.duration)+o)/i*100,100)})}return n}_setupTask(){new Er(this.host,async([e,t,i,r,n,o,a])=>{try{let A=null;if(this.host._errors=[],i||e){if(this.host._processing=!0,i){let h=null;if(r)try{h=await(await fetch(r,{method:"GET"})).text()}catch(f){const g=new si("Track failed to fetch",f);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:g,message:g.message}))}const d={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:h}}}]}};try{this.scenes=await ns({data:d,template:t,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(f){try{this.scenes=await ns({data:d,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(g){throw new si("Fatal source template error",g,!0)}A=new si("Source template error",f)}}else try{this.scenes=await ns({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(h){try{this.scenes=await ns({data:e,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(u){throw new si("Fatal data template error",u,!0)}A=new si("Data template error",h)}Object.keys(this.videos).forEach(h=>{this.scenes.scenes.find(({video:u})=>h===u?.key)||this._videos[h].node.pause()});const l=this.scenes.scenes.reduce((h,{video:u})=>(u&&(h[u.key]=u),h),{});Object.keys(this.videos).join("|")!==Object.keys(l).join("|")&&this.host.reset(0,!1),this.videos=l,this.videoState={...this.videoState,...this.scenes.scenes.reduce((h,{video:u,start:d,duration:f})=>{const g=u?.key??`${d}-${f}`,I=this._getBufferSegments({key:g,node:u?.node,duration:this.scenes.duration});return h[g]={initialised:!u,waiting:!!u,...this.videoState[g],buffered:u?I:this.videoState[g]?.buffered},h},{})},this.videoMeta=this.scenes.scenes.reduce((h,{video:u,videoMeta:d})=>(u&&d&&(h[u.key]=d),h),{}),(await Promise.all(this.scenes.fonts.map(h=>im(h)))).forEach(h=>{document.fonts.add(h)}),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,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){this.scenes?.scenes.forEach(t=>{this._setVideoCurrentTime({time:e,scene:t})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function rm(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function nm(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Sa=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],om={id:"captions",event:"captions:click",label:"Closed Captions"},am={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},hu={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}]},Am={id:"playbackRate",label:"Playback playbackRate",subItems:hu};class lm extends gA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==zi.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){this.observer?.disconnect(),this.observer=void 0}reconnected(){this.element&&this.observer?.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)),Ft}}const Da=es(lm),cm=ul(()=>{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=tl.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"},hm={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=yp(hm,{delimiter:"-"}),um=Object.keys(uu).map(s=>Ts(`:host { --${s}: ${uu[s]}; }`)),Re=(s=>{class e extends s{static{this.styles=[s?.styles??[],um,lt`
|
187
|
+
:host {
|
188
|
+
font-family: var(--fontFamilies-sans);
|
189
|
+
font-size: var(--fontSizes-medium);
|
190
|
+
line-height: var(--lineHeights-medium);
|
191
|
+
font-weight: var(--fontWeights-regular);
|
192
|
+
}
|
193
|
+
`,lt`
|
194
|
+
*,
|
195
|
+
*::before,
|
196
|
+
*::after,
|
197
|
+
::slotted(*) {
|
198
|
+
box-sizing: border-box;
|
199
|
+
}
|
200
|
+
|
201
|
+
body,
|
202
|
+
h1,
|
203
|
+
h2,
|
204
|
+
h3,
|
205
|
+
h4,
|
206
|
+
p,
|
207
|
+
figure,
|
208
|
+
blockquote,
|
209
|
+
dl,
|
210
|
+
dd,
|
211
|
+
::slotted(h1),
|
212
|
+
::slotted(h2),
|
213
|
+
::slotted(h3),
|
214
|
+
::slotted(h4),
|
215
|
+
::slotted(p),
|
216
|
+
::slotted(figure),
|
217
|
+
::slotted(blockquote),
|
218
|
+
::slotted(dl),
|
219
|
+
::slotted(dd) {
|
220
|
+
margin: 0;
|
221
|
+
}
|
222
|
+
|
223
|
+
ul[role='list'],
|
224
|
+
ol[role='list'],
|
225
|
+
::slotted(ul[role='list']),
|
226
|
+
::slotted(ol[role='list']) {
|
227
|
+
list-style: none;
|
228
|
+
}
|
229
|
+
|
230
|
+
a:not([class]),
|
231
|
+
::slotted(a:not([class])) {
|
232
|
+
text-decoration-skip-ink: auto;
|
233
|
+
}
|
234
|
+
|
235
|
+
img,
|
236
|
+
picture,
|
237
|
+
::slotted(img),
|
238
|
+
::slotted(picture) {
|
239
|
+
max-width: 100%;
|
240
|
+
display: block;
|
241
|
+
}
|
242
|
+
|
243
|
+
input,
|
244
|
+
button,
|
245
|
+
textarea,
|
246
|
+
select,
|
247
|
+
::slotted(input),
|
248
|
+
::slotted(button),
|
249
|
+
::slotted(textarea),
|
250
|
+
::slotted(select) {
|
251
|
+
font: inherit;
|
252
|
+
}
|
253
|
+
|
254
|
+
@media (prefers-reduced-motion) {
|
255
|
+
*,
|
256
|
+
*::before,
|
257
|
+
*::after,
|
258
|
+
::slotted(*),
|
259
|
+
::slotted(*::before),
|
260
|
+
::slotted(*::after) {
|
261
|
+
animation-duration: 0.01ms !important;
|
262
|
+
animation-iteration-count: 1 !important;
|
263
|
+
transition-duration: 0.01ms !important;
|
264
|
+
scroll-behavior: auto !important;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
`]}firstUpdated(){cm().forEach(({load:r,font:n})=>{document.fonts.add(n),r&&n.load()})}}return e})(Zi),dm=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),gm=(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))}}},pt=s=>e=>typeof e=="function"?dm(s,e):gm(s,e);class fm{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=vi(async t=>{const i=await va(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?.split("?")[0],playlist:r?.split("?")[0]})}),this._resolveAnswer=vi(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await va(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?.split("?")[0],playlist:r?.split("?")[0],poster:n?.split("?")[0]})}),this._resolveVideoMeta=vi(async(t,i)=>{const{id:r,duration:n,startOffset:o,endOffset:a}=t,A=n??await cu(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 Er(this.host,async([e,t,i,r])=>{try{if(e){const n=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await ns({data:{questions:{items:[{answer:{id:"source",media:{[n]:e}}}]}},template:i},this._createDataResolver(r),this._resolveVideo,this._resolveVideoMeta)}catch(o){throw new si("Video preview source template error",o)}this._video=this.scenes.scenes[0]?.video?.node??null}else if(t)try{this.scenes=await ns({data:t,template:i},this._createDataResolver(r),this._resolveAnswer,this._resolveVideoMeta)}catch(n){throw new si("Video preview data template error",n)}}catch(n){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:n,message:n.message}))}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template,this.host.language];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 du(s,e,t){return Math.min(Math.max(e,s),t)}function wa(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 Im=Object.defineProperty,Em=Object.getOwnPropertyDescriptor,Ss=(s,e,t,i)=>{for(var r=i>1?void 0:i?Em(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&&Im(e,t,r),r};let bi=class extends Re{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`<button
|
268
|
+
class=${Fe({active:this.active,"size-tiny":this.size==="tiny","size-small":this.size==="small","size-large":this.size==="large","radius-medium":this.rounded==="medium","radius-full":this.rounded==="full","weight-light":this.weight==="light","weight-heavy":this.weight==="heavy"})}
|
269
|
+
>
|
270
|
+
<slot></slot>
|
271
|
+
${this.icon&&fe`<vmp-icon icon=${this.icon}></vmp-icon>`}
|
272
|
+
</button>`}};bi.styles=[Re.styles??[],lt`
|
273
|
+
:host {
|
274
|
+
--button-padding: var(--vu-button-padding, var(--space-s));
|
275
|
+
--button-color: var(--vu-button-color, var(--colors-dark-640));
|
276
|
+
--button-background: var(--vu-button-background, var(--colors-light-1000));
|
277
|
+
--button-background-hover: var(--vu-button-background-hover, var(--colors-light-1000));
|
278
|
+
|
279
|
+
display: block;
|
280
|
+
}
|
281
|
+
|
282
|
+
button {
|
283
|
+
position: relative;
|
284
|
+
display: flex;
|
285
|
+
align-items: center;
|
286
|
+
justify-content: center;
|
287
|
+
gap: var(--space-xxs);
|
288
|
+
border: none;
|
289
|
+
cursor: pointer;
|
290
|
+
font-weight: var(--fontWeights-semibold);
|
291
|
+
pointer-events: all;
|
292
|
+
transition: background 150ms ease;
|
293
|
+
|
294
|
+
padding: var(--button-padding);
|
295
|
+
color: var(--button-color);
|
296
|
+
background: var(--button-background);
|
297
|
+
padding: var(--button-padding);
|
298
|
+
}
|
299
|
+
|
300
|
+
button:focus {
|
301
|
+
outline: var(--borderWidths-thin) solid var(--colors-dark-1000);
|
302
|
+
}
|
303
|
+
|
304
|
+
.size-tiny {
|
305
|
+
--button-padding: var(--vu-button-padding, var(--space-xxs));
|
306
|
+
min-width: 20px;
|
307
|
+
}
|
308
|
+
|
309
|
+
.size-small {
|
310
|
+
--button-padding: var(--vu-button-padding, 6px);
|
311
|
+
min-width: 32px;
|
312
|
+
}
|
313
|
+
|
314
|
+
.size-large {
|
315
|
+
--button-padding: var(--vu-button-padding, var(--space-small));
|
316
|
+
min-width: 48px;
|
317
|
+
}
|
318
|
+
|
319
|
+
.radius-medium {
|
320
|
+
border-radius: var(--radii-small);
|
321
|
+
}
|
322
|
+
|
323
|
+
.radius-full {
|
324
|
+
border-radius: 100rem;
|
325
|
+
}
|
326
|
+
|
327
|
+
.weight-light {
|
328
|
+
--button-color: var(--vu-button-color, var(--colors-light-1000));
|
329
|
+
--button-background: var(--vu-button-background, transparent);
|
330
|
+
}
|
331
|
+
|
332
|
+
.weight-heavy {
|
333
|
+
--button-color: var(--vu-button-color, var(--colors-dark-640));
|
334
|
+
--button-background: var(--vu-button-background, var(--colors-light-1000));
|
335
|
+
}
|
336
|
+
|
337
|
+
.weight-heavy.active,
|
338
|
+
.weight-heavy:hover,
|
339
|
+
.weight-heavy:focus {
|
340
|
+
--button-background: var(--vu-button-background-hover, #cccccc);
|
341
|
+
}
|
342
|
+
|
343
|
+
.weight-light.active,
|
344
|
+
.weight-light:hover,
|
345
|
+
.weight-light:focus {
|
346
|
+
--button-background: var(--vu-button-background-hover, #9d9d9d);
|
347
|
+
}
|
348
|
+
`],Ss([Z({type:Boolean})],bi.prototype,"active",2),Ss([Z({type:String})],bi.prototype,"size",2),Ss([Z({type:String})],bi.prototype,"rounded",2),Ss([Z({type:String})],bi.prototype,"weight",2),Ss([Z({type:String})],bi.prototype,"icon",2),bi=Ss([pt("vmp-button")],bi);const gu={"arrow-left":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
349
|
+
<path
|
350
|
+
d="M16.6666 9.21875H6.52492L11.1833 4.85156L9.99992 3.75L3.33325 10L9.99992 16.25L11.1749 15.1484L6.52492 10.7812H16.6666V9.21875Z"
|
351
|
+
fill="currentColor"
|
352
|
+
/>
|
353
|
+
</svg>`,"arrow-right":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
354
|
+
<path
|
355
|
+
d="M3.75 9.21875H13.2578L8.89062 4.85156L10 3.75L16.25 10L10 16.25L8.89844 15.1484L13.2578 10.7812H3.75V9.21875Z"
|
356
|
+
fill="currentColor"
|
357
|
+
/>
|
358
|
+
</svg>`,"captions-cross":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
359
|
+
<path
|
360
|
+
d="M17.0625 19.4167L14.3125 16.6667H3.33333C2.875 16.6667 2.4825 16.5036 2.15583 16.1775C1.82972 15.8509 1.66667 15.4584 1.66667 15V4.16669C1.66667 4.13891 1.66667 4.11446 1.66667 4.09335C1.66667 4.0728 1.66667 4.04863 1.66667 4.02085L0.5625 2.91669L1.75 1.72919L18.25 18.2292L17.0625 19.4167ZM18.3333 15.9375L14.7083 12.3125C14.8056 12.2431 14.8786 12.1495 14.9275 12.0317C14.9758 11.9134 15 11.7917 15 11.6667V10.8334H13.75V11.25H13.6458L12.0833 9.68752V8.75002H13.75V9.16669H15V8.33335C15 8.09724 14.92 7.89919 14.76 7.73919C14.6006 7.57974 14.4028 7.50002 14.1667 7.50002H11.6667C11.4306 7.50002 11.2328 7.57974 11.0733 7.73919C10.9133 7.89919 10.8333 8.09724 10.8333 8.33335V8.43752L5.72917 3.33335H16.6667C17.125 3.33335 17.5175 3.49669 17.8442 3.82335C18.1703 4.14946 18.3333 4.54169 18.3333 5.00002V15.9375ZM5.83333 12.5H8.33333C8.56944 12.5 8.7675 12.42 8.9275 12.26C9.08694 12.1006 9.16667 11.9028 9.16667 11.6667V11.5209L8.47917 10.8334H7.91667V11.25H6.25V8.60419L5.3125 7.66669C5.21528 7.73613 5.13889 7.82974 5.08333 7.94752C5.02778 8.06585 5 8.19446 5 8.33335V11.6667C5 11.9028 5.07972 12.1006 5.23917 12.26C5.39917 12.42 5.59722 12.5 5.83333 12.5Z"
|
361
|
+
fill="currentColor"
|
362
|
+
/>
|
363
|
+
</svg>`,captions:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
364
|
+
<path
|
365
|
+
d="M5.83342 12.5H8.33342C8.56953 12.5 8.76758 12.42 8.92758 12.26C9.08703 12.1005 9.16675 11.9028 9.16675 11.6666V10.8333H7.91675V11.25H6.25008V8.74998H7.91675V9.16665H9.16675V8.33331C9.16675 8.0972 9.08703 7.89915 8.92758 7.73915C8.76758 7.5797 8.56953 7.49998 8.33342 7.49998H5.83342C5.5973 7.49998 5.39925 7.5797 5.23925 7.73915C5.0798 7.89915 5.00008 8.0972 5.00008 8.33331V11.6666C5.00008 11.9028 5.0798 12.1005 5.23925 12.26C5.39925 12.42 5.5973 12.5 5.83342 12.5ZM11.6667 12.5H14.1667C14.4029 12.5 14.6006 12.42 14.7601 12.26C14.9201 12.1005 15.0001 11.9028 15.0001 11.6666V10.8333H13.7501V11.25H12.0834V8.74998H13.7501V9.16665H15.0001V8.33331C15.0001 8.0972 14.9201 7.89915 14.7601 7.73915C14.6006 7.5797 14.4029 7.49998 14.1667 7.49998H11.6667C11.4306 7.49998 11.2329 7.5797 11.0734 7.73915C10.9134 7.89915 10.8334 8.0972 10.8334 8.33331V11.6666C10.8334 11.9028 10.9134 12.1005 11.0734 12.26C11.2329 12.42 11.4306 12.5 11.6667 12.5ZM3.33341 16.6666C2.87508 16.6666 2.48258 16.5036 2.15591 16.1775C1.8298 15.8508 1.66675 15.4583 1.66675 15V4.99998C1.66675 4.54165 1.8298 4.14942 2.15591 3.82331C2.48258 3.49665 2.87508 3.33331 3.33341 3.33331H16.6667C17.1251 3.33331 17.5176 3.49665 17.8442 3.82331C18.1704 4.14942 18.3334 4.54165 18.3334 4.99998V15C18.3334 15.4583 18.1704 15.8508 17.8442 16.1775C17.5176 16.5036 17.1251 16.6666 16.6667 16.6666H3.33341Z"
|
366
|
+
fill="currentColor"
|
367
|
+
/>
|
368
|
+
</svg>`,"chevron-down":()=>fe`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" part="svg">
|
369
|
+
<path
|
370
|
+
d="M11.8032 7.13666L10.8632 6.19666L7.80322 9.24999L4.74322 6.19666L3.80322 7.13666L7.80322 11.1367L11.8032 7.13666Z"
|
371
|
+
fill="currentColor"
|
372
|
+
/>
|
373
|
+
</svg>`,close:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
|
374
|
+
<path
|
375
|
+
d="M15.8334 5.34163L14.6584 4.16663L10 8.82496L5.34169 4.16663L4.16669 5.34163L8.82502 9.99996L4.16669 14.6583L5.34169 15.8333L10 11.175L14.6584 15.8333L15.8334 14.6583L11.175 9.99996L15.8334 5.34163Z"
|
376
|
+
fill="currentColor"
|
377
|
+
/>
|
378
|
+
</svg>`,error:()=>fe`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
|
379
|
+
<path
|
380
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2Zm1 15h-2v-2h2v2Zm0-4h-2V7h2v6Z"
|
381
|
+
fill="currentColor"
|
382
|
+
/>
|
383
|
+
</svg>`,loading:()=>fe`<svg class="spinner" width="50" height="50" viewBox="0 0 50 50" part="svg">
|
384
|
+
<style>
|
385
|
+
/* SVG spinner icon animation */
|
386
|
+
.spinner {
|
387
|
+
-webkit-animation: rotate 2s linear infinite;
|
388
|
+
animation: rotate 2s linear infinite;
|
389
|
+
}
|
390
|
+
|
391
|
+
.spinner .path {
|
392
|
+
stroke: currentColor;
|
393
|
+
stroke-linecap: round;
|
394
|
+
-webkit-animation: dash 1.5s ease-in-out infinite;
|
395
|
+
animation: dash 1.5s ease-in-out infinite;
|
396
|
+
}
|
397
|
+
|
398
|
+
@-webkit-keyframes rotate {
|
399
|
+
100% {
|
400
|
+
-webkit-transform: rotate(360deg);
|
401
|
+
transform: rotate(360deg);
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
@keyframes rotate {
|
406
|
+
100% {
|
407
|
+
-webkit-transform: rotate(360deg);
|
408
|
+
transform: rotate(360deg);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
|
412
|
+
@-webkit-keyframes dash {
|
413
|
+
0% {
|
414
|
+
stroke-dasharray: 1, 150;
|
415
|
+
stroke-dashoffset: 0;
|
416
|
+
}
|
417
|
+
50% {
|
418
|
+
stroke-dasharray: 90, 150;
|
419
|
+
stroke-dashoffset: -35;
|
420
|
+
}
|
421
|
+
100% {
|
422
|
+
stroke-dasharray: 90, 150;
|
423
|
+
stroke-dashoffset: -124;
|
424
|
+
}
|
425
|
+
}
|
426
|
+
|
427
|
+
@keyframes dash {
|
428
|
+
0% {
|
429
|
+
stroke-dasharray: 1, 150;
|
430
|
+
stroke-dashoffset: 0;
|
431
|
+
}
|
432
|
+
50% {
|
433
|
+
stroke-dasharray: 90, 150;
|
434
|
+
stroke-dashoffset: -35;
|
435
|
+
}
|
436
|
+
100% {
|
437
|
+
stroke-dasharray: 90, 150;
|
438
|
+
stroke-dashoffset: -124;
|
439
|
+
}
|
440
|
+
}
|
441
|
+
</style>
|
442
|
+
<circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5" />
|
443
|
+
</svg>`,maximize:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
444
|
+
<path
|
445
|
+
fill-rule="evenodd"
|
446
|
+
clip-rule="evenodd"
|
447
|
+
d="M6.66675 3.33331H3.33341H1.66675V4.99998V8.33331H3.33341V4.99998H6.66675V3.33331ZM6.66675 15H3.33341V11.6666H1.66675V15V16.6666H3.33341H6.66675V15ZM13.3334 3.33331H16.6667H18.3334V4.99998V8.33331H16.6667V4.99998H13.3334V3.33331ZM16.6667 15H13.3334V16.6666H16.6667H18.3334V15V11.6666H16.6667V15Z"
|
448
|
+
fill="currentColor"
|
449
|
+
/>
|
450
|
+
</svg>`,minimize:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
451
|
+
<path
|
452
|
+
fill-rule="evenodd"
|
453
|
+
clip-rule="evenodd"
|
454
|
+
d="M5.00008 3.33331H6.66675V6.66665V8.33331H5.00008H1.66675V6.66665H5.00008V3.33331ZM5.00008 11.6666H1.66675V13.3333H5.00008V16.6666H6.66675V13.3333V11.6666H5.00008ZM15.0001 6.66665H18.3334V8.33331H15.0001H13.3334V6.66665V3.33331H15.0001V6.66665ZM18.3334 11.6666H15.0001H13.3334V13.3333V16.6666H15.0001V13.3333H18.3334V11.6666Z"
|
455
|
+
fill="currentColor"
|
456
|
+
/>
|
457
|
+
</svg>`,muted:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
458
|
+
<path
|
459
|
+
d="M13.75 10C13.75 8.525 12.9 7.25833 11.6667 6.64167V8.48333L13.7083 10.525C13.7333 10.3583 13.75 10.1833 13.75 10ZM15.8333 10C15.8333 10.7833 15.6667 11.5167 15.3833 12.2L16.6417 13.4583C17.1917 12.425 17.5 11.25 17.5 10C17.5 6.43333 15.0083 3.45 11.6667 2.69167V4.40833C14.075 5.125 15.8333 7.35833 15.8333 10ZM3.55833 2.5L2.5 3.55833L6.44167 7.5H2.5V12.5H5.83333L10 16.6667V11.0583L13.5417 14.6C12.9833 15.0333 12.3583 15.375 11.6667 15.5833V17.3C12.8167 17.0417 13.8583 16.5083 14.7417 15.7917L16.4417 17.5L17.5 16.4417L10 8.94167L3.55833 2.5ZM10 3.33333L8.25833 5.075L10 6.81667V3.33333Z"
|
460
|
+
fill="currentColor"
|
461
|
+
/>
|
462
|
+
</svg>`,pause:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
463
|
+
<path
|
464
|
+
fill-rule="evenodd"
|
465
|
+
clip-rule="evenodd"
|
466
|
+
d="M8.33333 2.5H5V17.5H8.33333V2.5ZM15 2.5H11.6667V17.5H15V2.5Z"
|
467
|
+
fill="currentColor"
|
468
|
+
/>
|
469
|
+
</svg>`,"play-large":()=>fe`<svg width="45" height="53" viewBox="0 0 45 53" fill="none" part="svg">
|
470
|
+
<path
|
471
|
+
d="M43.5 23.8319C45.5 25.0083 45.5 27.9492 43.5 29.1256L4.5 52.0647C2.5 53.2411 0 51.7706 0 49.4179V3.53961C0 1.18687 2.5 -0.283582 4.5 0.892785L43.5 23.8319Z"
|
472
|
+
fill="currentColor"
|
473
|
+
/>
|
474
|
+
</svg>`,play:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
475
|
+
<path d="M17.3803 9.99998L5.83325 16.6666V3.33331L17.3803 9.99998Z" fill="currentColor" />
|
476
|
+
</svg>`,settings:()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
477
|
+
<path
|
478
|
+
d="M7.70833 18.3334L7.375 15.6667C7.19445 15.5972 7.02444 15.5139 6.865 15.4167C6.705 15.3195 6.54861 15.2153 6.39583 15.1042L3.91667 16.1459L1.625 12.1875L3.77083 10.5625C3.75694 10.4653 3.75 10.3714 3.75 10.2809C3.75 10.1909 3.75 10.0972 3.75 10C3.75 9.9028 3.75 9.80891 3.75 9.71835C3.75 9.62835 3.75694 9.53474 3.77083 9.43752L1.625 7.81252L3.91667 3.85419L6.39583 4.89585C6.54861 4.78474 6.70833 4.68058 6.875 4.58335C7.04167 4.48613 7.20833 4.4028 7.375 4.33335L7.70833 1.66669H12.2917L12.625 4.33335C12.8056 4.4028 12.9758 4.48613 13.1358 4.58335C13.2953 4.68058 13.4514 4.78474 13.6042 4.89585L16.0833 3.85419L18.375 7.81252L16.2292 9.43752C16.2431 9.53474 16.25 9.62835 16.25 9.71835C16.25 9.80891 16.25 9.9028 16.25 10C16.25 10.0972 16.25 10.1909 16.25 10.2809C16.25 10.3714 16.2361 10.4653 16.2083 10.5625L18.3542 12.1875L16.0625 16.1459L13.6042 15.1042C13.4514 15.2153 13.2917 15.3195 13.125 15.4167C12.9583 15.5139 12.7917 15.5972 12.625 15.6667L12.2917 18.3334H7.70833ZM10.0417 12.9167C10.8472 12.9167 11.5347 12.632 12.1042 12.0625C12.6736 11.4931 12.9583 10.8056 12.9583 10C12.9583 9.19447 12.6736 8.50696 12.1042 7.93752C11.5347 7.36808 10.8472 7.08335 10.0417 7.08335C9.22222 7.08335 8.53111 7.36808 7.96833 7.93752C7.40611 8.50696 7.125 9.19447 7.125 10C7.125 10.8056 7.40611 11.4931 7.96833 12.0625C8.53111 12.632 9.22222 12.9167 10.0417 12.9167ZM10.0417 11.25C9.69445 11.25 9.39945 11.1284 9.15667 10.885C8.91333 10.6422 8.79167 10.3472 8.79167 10C8.79167 9.6528 8.91333 9.3578 9.15667 9.11502C9.39945 8.87169 9.69445 8.75002 10.0417 8.75002C10.3889 8.75002 10.6842 8.87169 10.9275 9.11502C11.1703 9.3578 11.2917 9.6528 11.2917 10C11.2917 10.3472 11.1703 10.6422 10.9275 10.885C10.6842 11.1284 10.3889 11.25 10.0417 11.25ZM9.16667 16.6667H10.8125L11.1042 14.4584C11.5347 14.3472 11.9342 14.1839 12.3025 13.9684C12.6703 13.7534 13.0069 13.4931 13.3125 13.1875L15.375 14.0417L16.1875 12.625L14.3958 11.2709C14.4653 11.0764 14.5139 10.8714 14.5417 10.6559C14.5694 10.4409 14.5833 10.2222 14.5833 10C14.5833 9.7778 14.5694 9.55891 14.5417 9.34335C14.5139 9.12835 14.4653 8.92363 14.3958 8.72919L16.1875 7.37502L15.375 5.95835L13.3125 6.83335C13.0069 6.51391 12.6703 6.24641 12.3025 6.03085C11.9342 5.81585 11.5347 5.6528 11.1042 5.54169L10.8333 3.33335H9.1875L8.89583 5.54169C8.46528 5.6528 8.06611 5.81585 7.69833 6.03085C7.33 6.24641 6.99306 6.50697 6.6875 6.81252L4.625 5.95835L3.8125 7.37502L5.60417 8.70835C5.53472 8.91669 5.48611 9.12502 5.45833 9.33335C5.43056 9.54169 5.41667 9.76391 5.41667 10C5.41667 10.2222 5.43056 10.4375 5.45833 10.6459C5.48611 10.8542 5.53472 11.0625 5.60417 11.2709L3.8125 12.625L4.625 14.0417L6.6875 13.1667C6.99306 13.4861 7.33 13.7534 7.69833 13.9684C8.06611 14.1839 8.46528 14.3472 8.89583 14.4584L9.16667 16.6667Z"
|
479
|
+
fill="currentColor"
|
480
|
+
/>
|
481
|
+
</svg>`,tick:()=>fe`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" part="svg">
|
482
|
+
<path
|
483
|
+
d="M7.50016 14.0001L4.00016 10.5001L2.8335 11.6667L7.50016 16.3334L17.5002 6.33341L16.3335 5.16675L7.50016 14.0001Z"
|
484
|
+
fill="currentColor"
|
485
|
+
/>
|
486
|
+
</svg>`,"volume-high":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
487
|
+
<path
|
488
|
+
d="M2.5 7.49998V12.5H5.83333L10 16.6667V3.33332L5.83333 7.49998H2.5ZM13.75 9.99998C13.75 8.52498 12.9 7.25832 11.6667 6.64165V13.35C12.9 12.7417 13.75 11.475 13.75 9.99998ZM11.6667 2.69165V4.40832C14.075 5.12498 15.8333 7.35832 15.8333 9.99998C15.8333 12.6417 14.075 14.875 11.6667 15.5917V17.3083C15.0083 16.55 17.5 13.5667 17.5 9.99998C17.5 6.43332 15.0083 3.44998 11.6667 2.69165Z"
|
489
|
+
fill="currentColor"
|
490
|
+
/>
|
491
|
+
</svg>`,"volume-low":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
492
|
+
<path d="M5.83325 7.49998V12.5H9.16658L13.3333 16.6666V3.33331L9.16658 7.49998H5.83325Z" fill="currentColor" />
|
493
|
+
</svg>`,"volume-medium":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
|
494
|
+
<path
|
495
|
+
d="M15.4167 9.99998C15.4167 8.52498 14.5667 7.25831 13.3334 6.64165V13.35C14.5667 12.7416 15.4167 11.475 15.4167 9.99998ZM4.16675 7.49998V12.5H7.50008L11.6667 16.6666V3.33331L7.50008 7.49998H4.16675Z"
|
496
|
+
fill="currentColor"
|
497
|
+
/>
|
498
|
+
</svg>`,vouch:()=>fe`<svg
|
499
|
+
xmlns="http://www.w3.org/2000/svg"
|
500
|
+
height="28"
|
501
|
+
width="105"
|
502
|
+
viewBox="0 0 105 28"
|
503
|
+
fill="currentColor"
|
504
|
+
part="svg"
|
505
|
+
>
|
506
|
+
<path
|
507
|
+
d="M9.853 23.246L4.86 7.688H0L7 27.42h5.52l7.265-19.733h-4.65L9.854 23.246zM95.12 7.08a8.905 8.905 0 00-4.648 1.294V0H86.14v27.419h4.332V16.087a4.656 4.656 0 014.649-4.65 4.656 4.656 0 014.649 4.65v11.332h4.332V16.087c.026-4.966-4.015-9.008-8.981-9.008zM57.188 19.02a4.656 4.656 0 01-4.649 4.649 4.656 4.656 0 01-4.649-4.65V7.689h-4.332V19.02c0 4.966 4.041 8.98 8.981 8.98 4.94 0 8.981-4.04 8.981-8.98V7.688h-4.332V19.02zM30.483 7.133c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408c5.732 0 10.408-4.676 10.408-10.408 0-5.732-4.676-10.407-10.408-10.407zm0 16.483a6.076 6.076 0 116.075-6.076c0 3.355-2.747 6.076-6.075 6.076zM74.517 23.616a6.076 6.076 0 010-12.151 6.132 6.132 0 015.045 2.668l3.592-2.43a10.473 10.473 0 00-8.637-4.57c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408a10.35 10.35 0 008.611-4.596l-3.593-2.43a5.975 5.975 0 01-5.018 2.694z"
|
508
|
+
/>
|
509
|
+
</svg>`};var pm=Object.defineProperty,Cm=Object.getOwnPropertyDescriptor,fu=(s,e,t,i)=>{for(var r=i>1?void 0:i?Cm(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&&pm(e,t,r),r};let Cn=class extends Re{render(){return!this.icon||!Object.keys(gu).includes(this.icon)?null:gu[this.icon]()}};Cn.styles=[Re.styles??[],lt`
|
510
|
+
:host {
|
511
|
+
display: flex;
|
512
|
+
align-items: center;
|
513
|
+
justify-content: center;
|
514
|
+
flex-shrink: 0;
|
515
|
+
}
|
516
|
+
`],fu([Z({type:String})],Cn.prototype,"icon",2),Cn=fu([pt("vmp-icon")],Cn);var mm=Object.defineProperty,Bm=Object.getOwnPropertyDescriptor,Ds=(s,e,t,i)=>{for(var r=i>1?void 0:i?Bm(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&&mm(e,t,r),r};let Ri=class extends Re{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`
|
517
|
+
<vmp-button
|
518
|
+
?active=${this.active}
|
519
|
+
size=${_i(this.size)}
|
520
|
+
rounded=${_i(this.rounded)}
|
521
|
+
weight=${_i(this.weight)}
|
522
|
+
>
|
523
|
+
<vmp-icon
|
524
|
+
class=${Fe({tiny:this.size==="tiny",small:this.size==="small",large:this.size==="large"})}
|
525
|
+
icon=${_i(this.icon)}
|
526
|
+
></vmp-icon>
|
527
|
+
</vmp-button>
|
528
|
+
`}};Ri.styles=[Re.styles??[],lt`
|
529
|
+
.tiny::part(svg) {
|
530
|
+
height: 12px;
|
531
|
+
width: 12px;
|
532
|
+
}
|
533
|
+
|
534
|
+
.small::part(svg) {
|
535
|
+
height: 20px;
|
536
|
+
width: 20px;
|
537
|
+
}
|
538
|
+
|
539
|
+
.large::part(svg) {
|
540
|
+
height: 32px;
|
541
|
+
width: 32px;
|
542
|
+
}
|
543
|
+
`],Ds([Z({type:Boolean})],Ri.prototype,"active",2),Ds([Z({type:String})],Ri.prototype,"size",2),Ds([Z({type:String})],Ri.prototype,"rounded",2),Ds([Z({type:String})],Ri.prototype,"weight",2),Ds([Z({type:String})],Ri.prototype,"icon",2),Ri=Ds([pt("vmp-icon-button")],Ri);var ym=Object.defineProperty,Qm=Object.getOwnPropertyDescriptor,nt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Qm(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&&ym(e,t,r),r};let Gt=class extends Re{constructor(){super(...arguments),this.language="en",this.disabled=!1,this.aspectRatio=1,this.compilation=zn,this.dataResolver=no,this._currentTime=0,this._sceneController=new fm(this),this._canvasRef=dt(),this._previewRef=dt(),this._previewTimeRef=dt(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{if(this._previewRef?.value){const r=this._previewRef.value.getBoundingClientRect(),n=this._previewRef.value.getRootNode().host?.getBoundingClientRect();r&&n&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${du(t-n.left,s-n.left-r.width/2,i-n.left-r.width)}px, ${e-n.top-r.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{if(this._currentTime=s,this._sceneController.scenes?.scenes.length){const r=this._sceneController.scenes?.scenes?.find(({start:n,duration:o,video:a})=>a&&s>=n&&s<=n+o)?.video?.node;if(r&&(r.currentTime=s),this._draw(),this._previewRef?.value){const n=this._previewRef.value.getBoundingClientRect(),o=this._previewRef.value.getRootNode().host?.getBoundingClientRect();if(n&&o){const a=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,A]=Array.from(a.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${du(t-o.left,e-o.left-n.width/2,i-o.left-n.width)}px, ${A[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",wa(Math.max(0,Math.min(this._currentTime,this._sceneController.scenes?.duration))))}},this._handleScrubberMouseLeave=()=>{this._previewRef?.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{if(this._previewRef?.value){const e=this._previewRef.value.getBoundingClientRect(),t=this._previewRef.value.getRootNode().host?.getBoundingClientRect();if(e&&t){const i=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[r]=Array.from(i.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${r[1]}px, ${s-t.top-e.height-28}px, 0)`}}}}_draw(s=this._currentTime){this._sceneController.scenes&&this._canvasRef.value&&this.compilation?.({currentTime:Math.max(0,Math.min(s,this._sceneController.scenes?.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(){const{height:s,width:e}=eo({resolution:180,aspectRatio:this.aspectRatio}),t=this._sceneController.scenes?.scenes.length??0;return!this.disabled&&(this.src||t>1)?fe`
|
544
|
+
<div
|
545
|
+
${gt(this._previewRef)}
|
546
|
+
class="preview"
|
547
|
+
style=${oo({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
|
548
|
+
>
|
549
|
+
<canvas ${gt(this._canvasRef)} class="preview-canvas" width=${e} height=${s}></canvas>
|
550
|
+
<vmp-text ${gt(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
|
551
|
+
</div>
|
552
|
+
`:null}};Gt.styles=[Re.styles??[],lt`
|
553
|
+
.preview {
|
554
|
+
position: absolute;
|
555
|
+
display: flex;
|
556
|
+
top: 0;
|
557
|
+
left: 0;
|
558
|
+
align-items: center;
|
559
|
+
flex-direction: column;
|
560
|
+
opacity: 0;
|
561
|
+
// Always on top
|
562
|
+
z-index: 2147483647;
|
563
|
+
pointer-events: none;
|
564
|
+
border: 3px solid var(--colors-light-1000);
|
565
|
+
background: var(--colors-dark-1000);
|
566
|
+
border-radius: var(--radii-medium);
|
567
|
+
transition: opacity 150ms ease-out;
|
568
|
+
}
|
569
|
+
|
570
|
+
.preview-canvas {
|
571
|
+
width: 100%;
|
572
|
+
height: 100%;
|
573
|
+
border-radius: var(--radii-small);
|
574
|
+
}
|
575
|
+
|
576
|
+
.preview-text {
|
577
|
+
position: absolute;
|
578
|
+
bottom: 0;
|
579
|
+
transform: translate3d(0, calc(100% + 9px), 0);
|
580
|
+
color: var(--colors-light-1000);
|
581
|
+
font-variant-numeric: tabular-nums;
|
582
|
+
}
|
583
|
+
`],nt([Z({type:String})],Gt.prototype,"src",2),nt([Z({type:Object})],Gt.prototype,"data",2),nt([Z({type:Object})],Gt.prototype,"template",2),nt([Z({type:String})],Gt.prototype,"language",2),nt([Z({type:Boolean})],Gt.prototype,"disabled",2),nt([Z({type:Number})],Gt.prototype,"aspectRatio",2),nt([Z({attribute:!1})],Gt.prototype,"compilation",2),nt([Z({attribute:!1})],Gt.prototype,"dataResolver",2),Gt=nt([pt("vmp-video-preview-content")],Gt);let ni=class extends Re{constructor(){super(...arguments),this.language="en",this.disabled=!1,this.aspectRatio=1,this.compilation=zn,this.dataResolver=no}render(){return fe`
|
584
|
+
<vmp-video-preview-content
|
585
|
+
?disabled=${this.disabled}
|
586
|
+
.src=${this.src}
|
587
|
+
.data=${this.data}
|
588
|
+
.template=${this.template}
|
589
|
+
.aspectRatio=${this.aspectRatio}
|
590
|
+
.compilation=${this.compilation}
|
591
|
+
.dataResolver=${this.dataResolver}
|
592
|
+
></vmp-video-preview-content>
|
593
|
+
`}};nt([Z({type:String})],ni.prototype,"src",2),nt([Z({type:Object})],ni.prototype,"data",2),nt([Z({type:Object})],ni.prototype,"template",2),nt([Z({type:String})],ni.prototype,"language",2),nt([Z({type:Boolean})],ni.prototype,"disabled",2),nt([Z({type:Number})],ni.prototype,"aspectRatio",2),nt([Z({attribute:!1})],ni.prototype,"compilation",2),nt([Z({attribute:!1})],ni.prototype,"dataResolver",2),ni=nt([pt("vmp-video-preview")],ni);class vm extends Us{constructor(e){if(super(e),e.type!==zi.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t?.(e.element),Ft}}const Iu=es(vm);class Sm{constructor(e){this.hiddenControls=[],this._measureRef=dt(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{const i=this._measureRef.value,r=t?.[0]?.borderBoxSize?.[0]?.inlineSize;if(i&&r&&r!==this._prevControlsWidth){Object.keys(this._hideables).forEach(o=>{this._hideables[o].element.style.display=""}),Object.keys(this._showables).forEach(o=>{this._showables[o].element.style.display="none"});const n=[];for(;i.scrollWidth>i.offsetWidth;){const o=Object.keys(this._hideables).find(A=>this._hideables[A].hideIndex===n.length);if(!o)break;const a=this._hideables[o].element;a&&(a.style.display="none"),n.push(o),Object.keys(this._showables).forEach(A=>{this._showables[A].showOn.some(l=>n.includes(l))&&(this._showables[A].element.style.display="flex")})}this.hiddenControls=n,this._prevControlsWidth=r,this.host.requestUpdate()}},this.host=e}measure(){return gt(this._measureRef)}contain(){return Da(this._onResize)}hide(e,t){return Iu(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Iu(i=>{this._showables[e]={element:i,showOn:t}})}}const ba=".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 Dm=Object.defineProperty,wm=Object.getOwnPropertyDescriptor,or=(s,e,t,i)=>{for(var r=i>1?void 0:i?wm(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&&Dm(e,t,r),r};let Ji=class extends Re{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return fe`
|
594
|
+
<div
|
595
|
+
part="content"
|
596
|
+
class=${Fe({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
|
597
|
+
style=${oo({fontFamily:Rr({text:this.content,font:"var(--fontFamilies-sans)"})})}
|
598
|
+
>
|
599
|
+
${this.content}
|
600
|
+
</div>
|
601
|
+
`}};Ji.styles=[Re.styles??[],lt`
|
602
|
+
:host {
|
603
|
+
--text-size: var(--fontSizes-medium);
|
604
|
+
--text-line-height: var(--lineHeights-medium);
|
605
|
+
--text-weight: var(--fontWeights-regular);
|
606
|
+
}
|
607
|
+
|
608
|
+
div {
|
609
|
+
font-size: var(--text-size);
|
610
|
+
line-height: var(--text-line-height);
|
611
|
+
font-weight: var(--text-weight);
|
612
|
+
}
|
613
|
+
|
614
|
+
.small {
|
615
|
+
--text-size: var(--fontSizes-small);
|
616
|
+
--text-line-height: var(--lineHeights-small);
|
617
|
+
}
|
618
|
+
|
619
|
+
.medium {
|
620
|
+
--text-size: var(--fontSizes-medium);
|
621
|
+
--text-line-height: var(--lineHeights-medium);
|
622
|
+
}
|
623
|
+
|
624
|
+
.large {
|
625
|
+
--text-size: var(--fontSizes-large);
|
626
|
+
--text-line-height: var(--lineHeights-large);
|
627
|
+
}
|
628
|
+
|
629
|
+
.semibold {
|
630
|
+
--text-weight: var(--fontWeights-semibold);
|
631
|
+
}
|
632
|
+
|
633
|
+
.truncate {
|
634
|
+
white-space: nowrap;
|
635
|
+
text-overflow: ellipsis;
|
636
|
+
overflow: hidden;
|
637
|
+
}
|
638
|
+
`],or([Z({type:Boolean})],Ji.prototype,"semibold",2),or([Z({type:Boolean})],Ji.prototype,"truncate",2),or([Z({type:String})],Ji.prototype,"size",2),or([Z({type:String})],Ji.prototype,"content",2),Ji=or([pt("vmp-text")],Ji);var bm=Object.defineProperty,Rm=Object.getOwnPropertyDescriptor,ar=(s,e,t,i)=>{for(var r=i>1?void 0:i?Rm(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&&bm(e,t,r),r};let Wi=class extends Re{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=dt()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){const s=this.items?.items.find(({id:e})=>this.subItemsActive===e)?.subItems;this.visibleItems=s??this.items??null,s||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector("slot")?.assignedElements()[0];e&&this._contentRef.value&&(this.tippy=Vi(e,{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(){super.disconnectedCallback(),this.tippy?.destroy()}render(){return fe`
|
639
|
+
<slot></slot>
|
640
|
+
<div ${gt(this._contentRef)} class="content">
|
641
|
+
<div class="title">
|
642
|
+
${this.subItemsActive?fe`
|
643
|
+
<button class="back" @click=${this._handleBackClick}>
|
644
|
+
<vmp-icon icon="chevron-down"></vmp-icon>
|
645
|
+
</button>
|
646
|
+
`:null}
|
647
|
+
<vmp-text
|
648
|
+
?bold=${!0}
|
649
|
+
?truncate=${!0}
|
650
|
+
size="small"
|
651
|
+
.content=${this.visibleItems?.title??"Sub Menu"}
|
652
|
+
></vmp-text>
|
653
|
+
</div>
|
654
|
+
${wh(this.visibleItems?.items??[],({id:s})=>s,s=>fe`
|
655
|
+
<button
|
656
|
+
class="item"
|
657
|
+
@click=${()=>{s.subItems&&(this.subItemsActive=s.id,this.visibleItems=s.subItems),s.event&&this.dispatchEvent(new CustomEvent(s.event,{detail:s,bubbles:!0,composed:!0}))}}
|
658
|
+
>
|
659
|
+
<vmp-text ?semibold=${!0} size="small" content=${s.label}></vmp-text>
|
660
|
+
${s.subItems?fe`<vmp-icon class="forward" icon="chevron-down"></vmp-icon>`:this.activeItems.includes(s.id)?fe`<vmp-icon icon="tick"></vmp-icon>`:null}
|
661
|
+
</button>
|
662
|
+
`)}
|
663
|
+
</div>
|
664
|
+
`}};Wi.styles=[Re.styles??[],Ts(ba),lt`
|
665
|
+
:host {
|
666
|
+
display: flex;
|
667
|
+
}
|
668
|
+
|
669
|
+
.content {
|
670
|
+
display: flex;
|
671
|
+
min-width: 140px;
|
672
|
+
overflow: hidden;
|
673
|
+
flex-direction: column;
|
674
|
+
color: var(--colors-dark-1000);
|
675
|
+
background: var(--colors-light-1000);
|
676
|
+
border-radius: var(--radii-medium);
|
677
|
+
transition: height 150ms ease-out;
|
678
|
+
}
|
679
|
+
|
680
|
+
.back {
|
681
|
+
padding: 0;
|
682
|
+
margin: 0;
|
683
|
+
border: 0;
|
684
|
+
cursor: pointer;
|
685
|
+
background: transparent;
|
686
|
+
color: var(--colors-dark-400);
|
687
|
+
/* TODO: Kinda eyeballing this one */
|
688
|
+
margin-left: calc(var(--space-xxs) * -1);
|
689
|
+
transform: rotate(90deg);
|
690
|
+
}
|
691
|
+
|
692
|
+
.forward {
|
693
|
+
transform: rotate(-90deg);
|
694
|
+
}
|
695
|
+
|
696
|
+
.title {
|
697
|
+
display: flex;
|
698
|
+
align-items: center;
|
699
|
+
gap: var(--space-xxs);
|
700
|
+
color: var(--colors-dark-400);
|
701
|
+
text-transform: uppercase;
|
702
|
+
height: 36px;
|
703
|
+
padding: var(--space-small) var(--space-small) var(--space-xxs) var(--space-small);
|
704
|
+
}
|
705
|
+
|
706
|
+
.item {
|
707
|
+
display: flex;
|
708
|
+
align-items: center;
|
709
|
+
justify-content: space-between;
|
710
|
+
height: 42px;
|
711
|
+
border: none;
|
712
|
+
cursor: pointer;
|
713
|
+
color: var(--colors-dark-1000);
|
714
|
+
background: transparent;
|
715
|
+
padding: 0 var(--space-small);
|
716
|
+
}
|
717
|
+
|
718
|
+
.item:hover {
|
719
|
+
background: var(--colors-dark-100);
|
720
|
+
}
|
721
|
+
|
722
|
+
vmp-icon::part(svg) {
|
723
|
+
height: 20px;
|
724
|
+
width: 20px;
|
725
|
+
}
|
726
|
+
`],ar([Z({type:Object})],Wi.prototype,"items",2),ar([Z({type:Array})],Wi.prototype,"activeItems",2),ar([je()],Wi.prototype,"visibleItems",2),ar([je()],Wi.prototype,"subItemsActive",2),Wi=ar([pt("vmp-menu")],Wi);var xm=Object.defineProperty,Tm=Object.getOwnPropertyDescriptor,Ra=(s,e,t,i)=>{for(var r=i>1?void 0:i?Tm(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&&xm(e,t,r),r};let Ar=class extends Re{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=dt()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector("slot")?.assignedElements()[0];e&&this._contentRef.value&&(this.tippy=Vi(e,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){super.disconnectedCallback(),this.tippy?.destroy()}updated(){this.disabled?this.tippy?.disable():this.tippy?.enable()}render(){return fe`
|
727
|
+
<slot></slot>
|
728
|
+
<div ${gt(this._contentRef)} class="content">
|
729
|
+
<vmp-text content=${this.content}></vmp-text>
|
730
|
+
</div>
|
731
|
+
`}};Ar.styles=[Re.styles??[],Ts(ba),lt`
|
732
|
+
:host {
|
733
|
+
display: flex;
|
734
|
+
}
|
735
|
+
|
736
|
+
.content {
|
737
|
+
display: flex;
|
738
|
+
align-items: center;
|
739
|
+
justify-content: center;
|
740
|
+
padding: var(--space-small);
|
741
|
+
color: var(--colors-light-1000);
|
742
|
+
background: var(--colors-dark-800);
|
743
|
+
border-radius: var(--radii-medium);
|
744
|
+
}
|
745
|
+
`],Ra([Z({type:String})],Ar.prototype,"content",2),Ra([Z({type:Boolean})],Ar.prototype,"disabled",2),Ar=Ra([pt("vmp-tooltip")],Ar);var Lm=Object.defineProperty,km=Object.getOwnPropertyDescriptor,xa=(s,e,t,i)=>{for(var r=i>1?void 0:i?km(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&&Lm(e,t,r),r};let lr=class extends Re{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=dt(),this._anchorRef=dt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=Vi(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(){super.disconnectedCallback(),this.tippy?.destroy()}render(){return fe`
|
746
|
+
<vmp-icon-button
|
747
|
+
${gt(this._anchorRef)}
|
748
|
+
icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
|
749
|
+
weight="heavy"
|
750
|
+
rounded="full"
|
751
|
+
@pointerdown=${s=>{this._menuOpen&&s.preventDefault()}}
|
752
|
+
@click=${()=>{this._menuOpen&&this.dispatchEvent(new CustomEvent("volume:click",{bubbles:!0,composed:!0,detail:this.muted}))}}
|
753
|
+
></vmp-icon-button>
|
754
|
+
<div ${gt(this._contentRef)} class="content">
|
755
|
+
<input
|
756
|
+
key="volume"
|
757
|
+
type="range"
|
758
|
+
min="0"
|
759
|
+
max="1"
|
760
|
+
step="0.01"
|
761
|
+
.value=${this.volume.toString()}
|
762
|
+
@blur=${()=>this.tippy?.hide()}
|
763
|
+
/>
|
764
|
+
</div>
|
765
|
+
`}};lr.styles=[Re.styles??[],Ts(ba),lt`
|
766
|
+
.content {
|
767
|
+
--volume-slider-height: 4px;
|
768
|
+
--volume-slider-width: 78px;
|
769
|
+
|
770
|
+
display: flex;
|
771
|
+
height: var(--volume-slider-width);
|
772
|
+
width: var(--volume-slider-height);
|
773
|
+
}
|
774
|
+
|
775
|
+
.spacer {
|
776
|
+
display: flex;
|
777
|
+
height: var(--volume-slider-width);
|
778
|
+
width: var(--volume-slider-height);
|
779
|
+
}
|
780
|
+
|
781
|
+
input {
|
782
|
+
position: absolute;
|
783
|
+
appearance: none !important;
|
784
|
+
height: var(--volume-slider-height);
|
785
|
+
width: var(--volume-slider-width);
|
786
|
+
overflow: hidden;
|
787
|
+
border-radius: 1000rem;
|
788
|
+
cursor: pointer;
|
789
|
+
background: var(--colors-light-200);
|
790
|
+
rotate: -90deg;
|
791
|
+
/* Minus the input margin */
|
792
|
+
translate: 0 calc(var(--volume-slider-width) - 4px);
|
793
|
+
transform-origin: left;
|
794
|
+
transition:
|
795
|
+
height 100ms ease-out,
|
796
|
+
transform 100ms ease-out;
|
797
|
+
}
|
798
|
+
|
799
|
+
input:hover {
|
800
|
+
height: calc(var(--volume-slider-height) * 2);
|
801
|
+
}
|
802
|
+
|
803
|
+
input::-webkit-slider-runnable-track {
|
804
|
+
appearance: none !important;
|
805
|
+
height: var(--volume-slider-height);
|
806
|
+
color: var(--colors-light-1000);
|
807
|
+
transition: height 100ms ease-out;
|
808
|
+
}
|
809
|
+
|
810
|
+
input::-moz-range-track {
|
811
|
+
appearance: none !important;
|
812
|
+
height: var(--volume-slider-height);
|
813
|
+
color: var(--colors-light-1000);
|
814
|
+
transition: height 100ms ease-out;
|
815
|
+
}
|
816
|
+
|
817
|
+
input::-ms-track {
|
818
|
+
appearance: none !important;
|
819
|
+
height: var(--volume-slider-height);
|
820
|
+
color: var(--colors-light-1000);
|
821
|
+
transition: height 100ms ease-out;
|
822
|
+
}
|
823
|
+
|
824
|
+
input:hover::-webkit-slider-runnable-track {
|
825
|
+
height: calc(var(--volume-slider-height) * 2);
|
826
|
+
}
|
827
|
+
|
828
|
+
input:hover::-moz-range-track {
|
829
|
+
height: calc(var(--volume-slider-height) * 2);
|
830
|
+
}
|
831
|
+
|
832
|
+
input:hover::-ms-track {
|
833
|
+
height: calc(var(--volume-slider-height) * 2);
|
834
|
+
}
|
835
|
+
|
836
|
+
input::-webkit-slider-thumb {
|
837
|
+
appearance: none !important;
|
838
|
+
height: var(--volume-slider-height) !important;
|
839
|
+
width: var(--volume-slider-height) !important;
|
840
|
+
color: var(--colors-light-1000);
|
841
|
+
border-radius: 50%;
|
842
|
+
border: none;
|
843
|
+
background: var(--colors-light-1000);
|
844
|
+
box-shadow:
|
845
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2) * -1) 0 0 var(--volume-slider-width),
|
846
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2)) 0 0 var(--volume-slider-width)
|
847
|
+
var(--colors-dark-640);
|
848
|
+
transition:
|
849
|
+
height 100ms ease-out,
|
850
|
+
width 100ms ease-out,
|
851
|
+
box-shadow 100ms ease-out,
|
852
|
+
color 200ms ease-out;
|
853
|
+
}
|
854
|
+
|
855
|
+
input::-moz-range-thumb {
|
856
|
+
appearance: none !important;
|
857
|
+
height: var(--volume-slider-height) !important;
|
858
|
+
width: var(--volume-slider-height) !important;
|
859
|
+
color: var(--colors-light-1000);
|
860
|
+
border-radius: 50%;
|
861
|
+
border: none;
|
862
|
+
background: var(--colors-light-1000);
|
863
|
+
box-shadow:
|
864
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2) * -1) 0 0 var(--volume-slider-width),
|
865
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2)) 0 0 var(--volume-slider-width)
|
866
|
+
var(--colors-dark-640);
|
867
|
+
transition:
|
868
|
+
height 100ms ease-out,
|
869
|
+
width 100ms ease-out,
|
870
|
+
box-shadow 100ms ease-out,
|
871
|
+
color 200ms ease-out;
|
872
|
+
}
|
873
|
+
|
874
|
+
input::-ms-thumb {
|
875
|
+
appearance: none !important;
|
876
|
+
height: var(--volume-slider-height) !important;
|
877
|
+
width: var(--volume-slider-height) !important;
|
878
|
+
color: var(--colors-light-1000);
|
879
|
+
border-radius: 50%;
|
880
|
+
border: none;
|
881
|
+
background: var(--colors-light-1000);
|
882
|
+
box-shadow:
|
883
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2) * -1) 0 0 var(--volume-slider-width),
|
884
|
+
calc((var(--volume-slider-width) + var(--volume-slider-height) / 2)) 0 0 var(--volume-slider-width)
|
885
|
+
var(--colors-dark-640);
|
886
|
+
transition:
|
887
|
+
height 100ms ease-out,
|
888
|
+
width 100ms ease-out,
|
889
|
+
box-shadow 100ms ease-out,
|
890
|
+
color 200ms ease-out;
|
891
|
+
}
|
892
|
+
|
893
|
+
input:hover::-webkit-slider-thumb {
|
894
|
+
--volume-slider-height: 8px;
|
895
|
+
color: var(--colors-light-800);
|
896
|
+
}
|
897
|
+
|
898
|
+
input:hover::-moz-range-thumb {
|
899
|
+
--volume-slider-height: 8px;
|
900
|
+
color: var(--colors-light-800);
|
901
|
+
}
|
902
|
+
|
903
|
+
input:hover::-ms-thumb {
|
904
|
+
--volume-slider-height: 8px;
|
905
|
+
color: var(--colors-light-800);
|
906
|
+
}
|
907
|
+
`],xa([Z({type:Number})],lr.prototype,"volume",2),xa([Z({type:Boolean})],lr.prototype,"muted",2),lr=xa([pt("vmp-volume-button")],lr);var Mm=Object.defineProperty,_m=Object.getOwnPropertyDescriptor,mn=(s,e,t,i)=>{for(var r=i>1?void 0:i?_m(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&&Mm(e,t,r),r};let ws=class extends Re{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=dt(),this._handleContainerResize=()=>{const s=this._containerRef.value?.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:s,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{const e=this._containerRef.value?.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:e?.left??0,elementRight:e?.right??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{const e=this._containerRef.value?.getBoundingClientRect(),i=(s.clientX-(e?.left??0))/(e?.width??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:i*this.duration,elementLeft:e?.left??0,elementRight:e?.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(){const s=this.buffer?.sort((e,t)=>e.start<t.start?-1:t.start<e.start?1:0).reduce((e,{start:t,end:i},r)=>{const n=e[r-1],o=Math.floor(t),a=Math.ceil(i);return e.push({id:t,start:Math.max(0,o),end:Math.min(a,100)}),n&&n.end>=t-1&&(e[r].start=n.end),e},[])??[];return fe`
|
908
|
+
<div
|
909
|
+
class="container"
|
910
|
+
${gt(this._containerRef)}
|
911
|
+
${Da(this._handleContainerResize)}
|
912
|
+
@mouseenter=${this._handleMouseEnter}
|
913
|
+
@mousemove=${this._handleMouseMove}
|
914
|
+
@mouseleave=${this._handleMouseLeave}
|
915
|
+
>
|
916
|
+
<input
|
917
|
+
key="scrubber"
|
918
|
+
aria-label="Progress scrubber"
|
919
|
+
type="range"
|
920
|
+
min="0"
|
921
|
+
max=${this.duration}
|
922
|
+
step="0.01"
|
923
|
+
.value=${this.currentTime.toString()}
|
924
|
+
data-testid="scrubber"
|
925
|
+
/>
|
926
|
+
${wh(s,({id:e})=>e,e=>fe`
|
927
|
+
<div class="buffer" style=${`left: ${e.start}%; width: ${e.end-e.start}%`}></div>
|
928
|
+
`)}
|
929
|
+
</div>
|
930
|
+
`}};ws.styles=[Re.styles??[],lt`
|
931
|
+
:host {
|
932
|
+
--player-scrubber-height: 8px;
|
933
|
+
--player-scrubber-shadow-width: 4000px;
|
934
|
+
|
935
|
+
display: flex;
|
936
|
+
}
|
937
|
+
|
938
|
+
.container {
|
939
|
+
position: relative;
|
940
|
+
display: flex;
|
941
|
+
width: 100%;
|
942
|
+
opacity: 1;
|
943
|
+
border-radius: 1000rem;
|
944
|
+
overflow: hidden;
|
945
|
+
transition: opacity 150ms ease-out;
|
946
|
+
}
|
947
|
+
|
948
|
+
input {
|
949
|
+
appearance: none !important;
|
950
|
+
height: var(--player-scrubber-height);
|
951
|
+
width: 100%;
|
952
|
+
margin: 0;
|
953
|
+
overflow: hidden;
|
954
|
+
cursor: pointer;
|
955
|
+
background: var(--colors-light-200);
|
956
|
+
transition:
|
957
|
+
height 100ms ease-out,
|
958
|
+
transform 100ms ease-out;
|
959
|
+
}
|
960
|
+
|
961
|
+
.buffer {
|
962
|
+
position: absolute;
|
963
|
+
height: var(--player-scrubber-height);
|
964
|
+
width: var(--player-buffered-percentage);
|
965
|
+
background: var(--colors-light-400);
|
966
|
+
pointer-events: none;
|
967
|
+
transition:
|
968
|
+
height 100ms ease-out,
|
969
|
+
width 250ms ease-out,
|
970
|
+
left 250ms ease-out;
|
971
|
+
}
|
972
|
+
|
973
|
+
.container:hover .buffer {
|
974
|
+
height: calc(var(--player-scrubber-height) * 2);
|
975
|
+
}
|
976
|
+
|
977
|
+
.container:hover input {
|
978
|
+
height: calc(var(--player-scrubber-height) * 2);
|
979
|
+
}
|
980
|
+
|
981
|
+
input::-webkit-slider-runnable-track {
|
982
|
+
appearance: none !important;
|
983
|
+
height: var(--player-scrubber-height);
|
984
|
+
color: var(--colors-light-1000);
|
985
|
+
z-index: 2;
|
986
|
+
transition: height 100ms ease-out;
|
987
|
+
}
|
988
|
+
|
989
|
+
input::-moz-range-track {
|
990
|
+
appearance: none !important;
|
991
|
+
height: var(--player-scrubber-height);
|
992
|
+
color: var(--colors-light-1000);
|
993
|
+
transition: height 100ms ease-out;
|
994
|
+
}
|
995
|
+
|
996
|
+
input::-ms-track {
|
997
|
+
appearance: none !important;
|
998
|
+
height: var(--player-scrubber-height);
|
999
|
+
color: var(--colors-light-1000);
|
1000
|
+
transition: height 100ms ease-out;
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
.container:hover input::-webkit-slider-runnable-track {
|
1004
|
+
height: calc(var(--player-scrubber-height) * 2);
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
.container:hover input::-moz-range-track {
|
1008
|
+
height: calc(var(--player-scrubber-height) * 2);
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
.container:hover input::-ms-track {
|
1012
|
+
height: calc(var(--player-scrubber-height) * 2);
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
input::-webkit-slider-thumb {
|
1016
|
+
appearance: none !important;
|
1017
|
+
height: var(--player-scrubber-height) !important;
|
1018
|
+
width: var(--player-scrubber-height) !important;
|
1019
|
+
color: var(--colors-light-1000);
|
1020
|
+
border-radius: 50%;
|
1021
|
+
border: none;
|
1022
|
+
background: var(--colors-light-1000);
|
1023
|
+
box-shadow: calc((var(--player-scrubber-shadow-width) + var(--player-scrubber-height) / 2) * -1) 0 0
|
1024
|
+
var(--player-scrubber-shadow-width);
|
1025
|
+
transition:
|
1026
|
+
height 100ms ease-out,
|
1027
|
+
width 100ms ease-out,
|
1028
|
+
box-shadow 100ms ease-out,
|
1029
|
+
color 200ms ease-out;
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
input::-moz-range-thumb {
|
1033
|
+
appearance: none !important;
|
1034
|
+
height: var(--player-scrubber-height) !important;
|
1035
|
+
width: var(--player-scrubber-height) !important;
|
1036
|
+
color: var(--colors-light-1000);
|
1037
|
+
border-radius: 50%;
|
1038
|
+
border: none;
|
1039
|
+
background: var(--colors-light-1000);
|
1040
|
+
box-shadow: calc((var(--player-scrubber-shadow-width) + var(--player-scrubber-height) / 2) * -1) 0 0
|
1041
|
+
var(--player-scrubber-shadow-width);
|
1042
|
+
transition:
|
1043
|
+
height 100ms ease-out,
|
1044
|
+
width 100ms ease-out,
|
1045
|
+
box-shadow 100ms ease-out,
|
1046
|
+
color 200ms ease-out;
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
input::-ms-thumb {
|
1050
|
+
appearance: none !important;
|
1051
|
+
height: var(--player-scrubber-height) !important;
|
1052
|
+
width: var(--player-scrubber-height) !important;
|
1053
|
+
color: var(--colors-light-1000);
|
1054
|
+
border-radius: 50%;
|
1055
|
+
border: none;
|
1056
|
+
background: var(--colors-light-1000);
|
1057
|
+
box-shadow: calc((var(--player-scrubber-shadow-width) + var(--player-scrubber-height) / 2) * -1) 0 0
|
1058
|
+
var(--player-scrubber-shadow-width);
|
1059
|
+
transition:
|
1060
|
+
height 100ms ease-out,
|
1061
|
+
width 100ms ease-out,
|
1062
|
+
box-shadow 100ms ease-out,
|
1063
|
+
color 200ms ease-out;
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
.container:hover input::-webkit-slider-thumb {
|
1067
|
+
--player-scrubber-height: 16px;
|
1068
|
+
color: var(--colors-light-800);
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
.container:hover input::-moz-range-thumb {
|
1072
|
+
--player-scrubber-height: 16px;
|
1073
|
+
color: var(--colors-light-800);
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
.container:hover input::-ms-thumb {
|
1077
|
+
--player-scrubber-height: 16px;
|
1078
|
+
color: var(--colors-light-800);
|
1079
|
+
}
|
1080
|
+
`],mn([Z({type:Number})],ws.prototype,"duration",2),mn([Z({type:Number})],ws.prototype,"currentTime",2),mn([Z({type:Array})],ws.prototype,"buffer",2),ws=mn([pt("vmp-progress-scrubber")],ws);var Fm=Object.defineProperty,Nm=Object.getOwnPropertyDescriptor,Ve=(s,e,t,i)=>{for(var r=i>1?void 0:i?Nm(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&&Fm(e,t,r),r};let Pe=class extends Re{constructor(){super(...arguments),this.resizeHider=new Sm(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Sa,this.volumeMenuOpen=!1,this.languageMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLanguageMenuOpen({detail:s}){this.languageMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){Array.from(this.shadowRoot?.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button"))?.forEach(s=>{s.tippy?.hide()})}render(){const s=this.languages?.map(v=>({id:`language-${v.value}`,event:"language:click",label:v.label,value:v.value}))??[],e={title:"Languages",items:s},t={id:"languages",label:"Languages",subItems:e},i=e.items.find(({value:v})=>v===this.language),r=this.levels?.map((v,k)=>{const P=Math.min(v.width,v.height);return{id:`level-${k.toString()}`,event:"level:click",label:`${P}p`,value:{resolution:P,level:k}}})??[],n={title:"Quality",items:[...r.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},o={id:"levels",label:"Quality",subItems:n},a=n.items?.find(({value:v})=>v.level===this.level),A=[s?.length&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(v=>this.controls?.includes(v)),l={title:"Settings",items:[s?.length&&t,om,am,o,Am].filter(Boolean).filter(({id:v})=>A.includes(v)&&this.resizeHider.hiddenControls.includes(v))},c=this.controls?.includes("progress"),h=this.controls?.includes("navigation"),u=this.controls?.includes("play"),d=this.controls?.includes("volume"),f=this.controls?.includes("current-time"),g=this.controls?.includes("duration"),I=this.controls?.includes("languages"),B=this.controls?.includes("levels"),S=this.controls?.includes("speed"),Q=this.controls?.includes("captions"),m=this.controls?.includes("fullscreen"),y=u||d||f||g||I||B||S||Q||m,D=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${this.level?.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return fe`
|
1081
|
+
<div
|
1082
|
+
${this.resizeHider.measure()}
|
1083
|
+
${this.resizeHider.contain()}
|
1084
|
+
class=${Fe({container:!0,hidden:!c&&!y})}
|
1085
|
+
>
|
1086
|
+
<div
|
1087
|
+
class=${Fe({"scrubber-container":!0,hidden:!c})}
|
1088
|
+
>
|
1089
|
+
<vmp-progress-scrubber
|
1090
|
+
class=${Fe({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
|
1091
|
+
duration=${this.duration}
|
1092
|
+
currentTime=${this.currentTime}
|
1093
|
+
.buffer=${this.buffer}
|
1094
|
+
></vmp-progress-scrubber>
|
1095
|
+
</div>
|
1096
|
+
<div
|
1097
|
+
${this.resizeHider.contain()}
|
1098
|
+
class=${Fe({buttons:!0,hidden:!y})}
|
1099
|
+
>
|
1100
|
+
<div class="section">
|
1101
|
+
<div
|
1102
|
+
${this.resizeHider.hide("navigation",7)}
|
1103
|
+
class=${Fe({navigation:!0,hidden:!h})}
|
1104
|
+
>
|
1105
|
+
<vmp-icon-button
|
1106
|
+
icon="arrow-left"
|
1107
|
+
weight="heavy"
|
1108
|
+
rounded="full"
|
1109
|
+
@click=${this._handleNavigateBackClick}
|
1110
|
+
></vmp-icon-button>
|
1111
|
+
<vmp-icon-button
|
1112
|
+
icon="arrow-right"
|
1113
|
+
weight="heavy"
|
1114
|
+
rounded="full"
|
1115
|
+
@click=${this._handleNavigateForwardClick}
|
1116
|
+
></vmp-icon-button>
|
1117
|
+
</div>
|
1118
|
+
<vmp-icon-button
|
1119
|
+
class=${Fe({hidden:!u})}
|
1120
|
+
icon=${this.playing?"pause":"play"}
|
1121
|
+
weight="heavy"
|
1122
|
+
rounded="full"
|
1123
|
+
data-testid="play"
|
1124
|
+
@click=${this._handlePlayClick}
|
1125
|
+
></vmp-icon-button>
|
1126
|
+
<vmp-volume-button
|
1127
|
+
class=${Fe({hidden:!d})}
|
1128
|
+
?muted=${this.muted}
|
1129
|
+
volume=${this.volume}
|
1130
|
+
@menu:toggle=${this._handleVolumeMenuToggle}
|
1131
|
+
></vmp-volume-button>
|
1132
|
+
<div class="time">
|
1133
|
+
<vmp-text
|
1134
|
+
${this.resizeHider.hide("current-time",2)}
|
1135
|
+
class=${Fe({hidden:!f})}
|
1136
|
+
?semibold=${!0}
|
1137
|
+
content="${wa(this.currentTime)}${g?"/":null}"
|
1138
|
+
></vmp-text>
|
1139
|
+
<vmp-text
|
1140
|
+
${this.resizeHider.hide("duration",6)}
|
1141
|
+
class=${Fe({hidden:!g})}
|
1142
|
+
?semibold=${!0}
|
1143
|
+
content=${wa(this.duration)}
|
1144
|
+
></vmp-text>
|
1145
|
+
</div>
|
1146
|
+
</div>
|
1147
|
+
<div class="section">
|
1148
|
+
<vmp-menu
|
1149
|
+
${this.resizeHider.hide("languages",0)}
|
1150
|
+
class=${Fe({hidden:!I||!s||s.length<=0})}
|
1151
|
+
.items=${e}
|
1152
|
+
.activeItems=${D}
|
1153
|
+
@menu:toggle=${this._handleLanguageMenuOpen}
|
1154
|
+
>
|
1155
|
+
<vmp-tooltip content="Languages" ?disabled=${this.languageMenuOpen}>
|
1156
|
+
<vmp-button ?active=${this.languageMenuOpen} icon="chevron-down">${i?.label}</vmp-button>
|
1157
|
+
</vmp-tooltip>
|
1158
|
+
</vmp-menu>
|
1159
|
+
<vmp-menu
|
1160
|
+
${this.resizeHider.hide("levels",1)}
|
1161
|
+
class=${Fe({hidden:!B||r.length<=0})}
|
1162
|
+
.items=${n}
|
1163
|
+
.activeItems=${D}
|
1164
|
+
@menu:toggle=${this._handleLevelsMenuOpen}
|
1165
|
+
>
|
1166
|
+
<vmp-tooltip content="Quality" ?disabled=${this.levelsMenuOpen}>
|
1167
|
+
<vmp-button ?active=${this.levelsMenuOpen} icon="chevron-down">${a?.label}</vmp-button>
|
1168
|
+
</vmp-tooltip>
|
1169
|
+
</vmp-menu>
|
1170
|
+
<vmp-menu
|
1171
|
+
${this.resizeHider.hide("playback-rate",5)}
|
1172
|
+
class=${Fe({hidden:!S})}
|
1173
|
+
.items=${hu}
|
1174
|
+
.activeItems=${D}
|
1175
|
+
@menu:toggle=${this._handlePlaybackMenuToggle}
|
1176
|
+
>
|
1177
|
+
<vmp-tooltip content="Playback speed" ?disabled=${this.playbackRateMenuOpen}>
|
1178
|
+
<vmp-button ?active=${this.playbackRateMenuOpen} icon="chevron-down"
|
1179
|
+
>${this.playbackRate.toFixed(1)}x</vmp-button
|
1180
|
+
>
|
1181
|
+
</vmp-tooltip>
|
1182
|
+
</vmp-menu>
|
1183
|
+
<vmp-tooltip
|
1184
|
+
${this.resizeHider.hide("captions",4)}
|
1185
|
+
class=${Fe({hidden:!Q})}
|
1186
|
+
content="Captions"
|
1187
|
+
>
|
1188
|
+
<vmp-icon-button
|
1189
|
+
?active=${this.captions}
|
1190
|
+
icon=${this.captions?"captions":"captions-cross"}
|
1191
|
+
rounded="full"
|
1192
|
+
@click=${this._handleCaptionsClick}
|
1193
|
+
></vmp-icon-button>
|
1194
|
+
</vmp-tooltip>
|
1195
|
+
<vmp-tooltip
|
1196
|
+
${this.resizeHider.hide("fullscreen",3)}
|
1197
|
+
content="Fullscreen"
|
1198
|
+
class=${Fe({hidden:!m})}
|
1199
|
+
>
|
1200
|
+
<vmp-icon-button
|
1201
|
+
?active=${this.fullscreen}
|
1202
|
+
icon=${this.fullscreen?"minimize":"maximize"}
|
1203
|
+
rounded="full"
|
1204
|
+
data-testid="fullscreen"
|
1205
|
+
@click=${this._handleFullscreenClick}
|
1206
|
+
></vmp-icon-button>
|
1207
|
+
</vmp-tooltip>
|
1208
|
+
<vmp-menu
|
1209
|
+
${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
|
1210
|
+
.items=${l}
|
1211
|
+
.activeItems=${D}
|
1212
|
+
@menu:toggle=${this._handleSettingsMenuToggle}
|
1213
|
+
>
|
1214
|
+
<vmp-tooltip content="Settings" ?disabled=${this.settingsMenuOpen}>
|
1215
|
+
<vmp-icon-button ?active=${this.settingsMenuOpen} icon="settings" rounded="full"></vmp-icon-button>
|
1216
|
+
</vmp-tooltip>
|
1217
|
+
</vmp-menu>
|
1218
|
+
</div>
|
1219
|
+
</div>
|
1220
|
+
</div>
|
1221
|
+
`}};Pe.styles=[Re.styles??[],lt`
|
1222
|
+
:host {
|
1223
|
+
--controls-border-radius: var(--player-border-radius, 0px);
|
1224
|
+
|
1225
|
+
display: flex;
|
1226
|
+
width: 100%;
|
1227
|
+
isolation: isolate;
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
.container {
|
1231
|
+
display: flex;
|
1232
|
+
flex-direction: column;
|
1233
|
+
gap: var(--space-small);
|
1234
|
+
flex: 1;
|
1235
|
+
min-width: 0;
|
1236
|
+
overflow: auto;
|
1237
|
+
padding: var(--space-xl) var(--space-xs) var(--space-xs) var(--space-xs);
|
1238
|
+
background: linear-gradient(to bottom, transparent 20%, var(--colors-dark-800) 100%);
|
1239
|
+
border-radius: var(--controls-border-radius);
|
1240
|
+
border-top-left-radius: 0;
|
1241
|
+
border-top-right-radius: 0;
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
.buttons {
|
1245
|
+
display: flex;
|
1246
|
+
justify-content: space-between;
|
1247
|
+
gap: var(--space-xs);
|
1248
|
+
width: max-content;
|
1249
|
+
min-width: 100%;
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
.section {
|
1253
|
+
display: flex;
|
1254
|
+
gap: var(--space-xs);
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
.scrubber-container {
|
1258
|
+
position: relative;
|
1259
|
+
display: flex;
|
1260
|
+
height: 8px;
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
.scrubber {
|
1264
|
+
position: absolute;
|
1265
|
+
width: 100%;
|
1266
|
+
bottom: 0;
|
1267
|
+
transition: opacity 150ms ease-out;
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
.invisible {
|
1271
|
+
opacity: 0;
|
1272
|
+
pointer-events: none;
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
.navigation {
|
1276
|
+
display: flex;
|
1277
|
+
background: var(--colors-light-1000);
|
1278
|
+
border-radius: 1000rem;
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
.time {
|
1282
|
+
display: flex;
|
1283
|
+
align-items: center;
|
1284
|
+
color: var(--colors-light-1000);
|
1285
|
+
white-space: nowrap;
|
1286
|
+
font-variant-numeric: tabular-nums;
|
1287
|
+
}
|
1288
|
+
|
1289
|
+
.hidden {
|
1290
|
+
display: none;
|
1291
|
+
}
|
1292
|
+
`],Ve([Z({type:Boolean})],Pe.prototype,"playing",2),Ve([Z({type:Number})],Pe.prototype,"volume",2),Ve([Z({type:Boolean})],Pe.prototype,"muted",2),Ve([Z({type:Number})],Pe.prototype,"currentTime",2),Ve([Z({type:Number})],Pe.prototype,"duration",2),Ve([Z({type:Array})],Pe.prototype,"languages",2),Ve([Z({type:String})],Pe.prototype,"language",2),Ve([Z({type:Array,attribute:!1})],Pe.prototype,"levels",2),Ve([Z({type:Number})],Pe.prototype,"level",2),Ve([Z({type:Number})],Pe.prototype,"playbackRate",2),Ve([Z({type:Array})],Pe.prototype,"buffer",2),Ve([Z({type:Boolean})],Pe.prototype,"captions",2),Ve([Z({type:Boolean})],Pe.prototype,"fullscreen",2),Ve([Z({type:Array})],Pe.prototype,"controls",2),Ve([je()],Pe.prototype,"volumeMenuOpen",2),Ve([je()],Pe.prototype,"languageMenuOpen",2),Ve([je()],Pe.prototype,"levelsMenuOpen",2),Ve([je()],Pe.prototype,"playbackRateMenuOpen",2),Ve([je()],Pe.prototype,"settingsMenuOpen",2),Pe=Ve([pt("vmp-player-controls")],Pe);var Om=Object.defineProperty,Um=Object.getOwnPropertyDescriptor,Pm=(s,e,t,i)=>{for(var r=i>1?void 0:i?Um(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&&Om(e,t,r),r};let Ta=class extends Re{render(){return fe`<vmp-icon icon="loading"></vmp-icon>`}};Ta.styles=[Re.styles??[],lt`
|
1293
|
+
:host {
|
1294
|
+
display: flex;
|
1295
|
+
align-items: center;
|
1296
|
+
justify-content: center;
|
1297
|
+
}
|
1298
|
+
`],Ta=Pm([pt("vmp-loading-spinner")],Ta);var Gm=Object.defineProperty,Hm=Object.getOwnPropertyDescriptor,Eu=(s,e,t,i)=>{for(var r=i>1?void 0:i?Hm(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&&Gm(e,t,r),r};let Bn=class extends Re{constructor(){super(...arguments),this.caption=""}render(){return fe`
|
1299
|
+
<div class="container">
|
1300
|
+
<vmp-text content=${this.caption} size="large"></vmp-text>
|
1301
|
+
</div>
|
1302
|
+
`}};Bn.styles=[Re.styles??[],lt`
|
1303
|
+
.container {
|
1304
|
+
display: block;
|
1305
|
+
margin: 0 var(--space-small);
|
1306
|
+
text-align: center;
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
vmp-text::part(content) {
|
1310
|
+
display: inline;
|
1311
|
+
padding: var(--space-xxs) var(--space-xs);
|
1312
|
+
text-align: center;
|
1313
|
+
border-radius: var(--radii-small);
|
1314
|
+
box-decoration-break: clone;
|
1315
|
+
-webkit-box-decoration-break: clone;
|
1316
|
+
color: var(--colors-light-1000);
|
1317
|
+
background: var(--colors-dark-800);
|
1318
|
+
/* Line height controls the spacing between the cloned boxes so has to override the default */
|
1319
|
+
line-height: 2.2;
|
1320
|
+
}
|
1321
|
+
`],Eu([Z({type:String})],Bn.prototype,"caption",2),Bn=Eu([pt("vmp-captions")],Bn);var $m=Object.defineProperty,Km=Object.getOwnPropertyDescriptor,ot=(s,e,t,i)=>{for(var r=i>1?void 0:i?Km(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&&$m(e,t,r),r};const Ym=3e3;let Je=class extends Re{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.language="en",this.languages=[],this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Sa,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=dt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},Ym)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&this._playerControlsRef.value?.hideMenus()}render(){const s=this.controls?.includes("play-large"),e=this.playing&&!this.showControls,t=!!(s&&!this.playing);return fe`
|
1322
|
+
<div
|
1323
|
+
class=${Fe({container:!0,hide:e})}
|
1324
|
+
@mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
|
1325
|
+
@mouseleave=${this._immediateHideControls}
|
1326
|
+
@touchstart=${i=>{this.playing&&!this.showControls&&!this._hasTouched&&(i.preventDefault(),this._hasTouched=!0,this._immediateShowControls(),this._startHideControls())}}
|
1327
|
+
>
|
1328
|
+
<div
|
1329
|
+
class=${Fe({fixtures:!0,invisible:!this.loading&&!t})}
|
1330
|
+
@click=${()=>{this.showControls&&this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}}
|
1331
|
+
>
|
1332
|
+
<vmp-icon
|
1333
|
+
class=${Fe({hidden:!t})}
|
1334
|
+
icon="play-large"
|
1335
|
+
></vmp-icon>
|
1336
|
+
<vmp-loading-spinner
|
1337
|
+
class=${Fe({hidden:!this.loading||t})}
|
1338
|
+
></vmp-loading-spinner>
|
1339
|
+
</div>
|
1340
|
+
<div
|
1341
|
+
class=${Fe({controls:!0,hide:e})}
|
1342
|
+
@focusin=${this._immediateShowControls}
|
1343
|
+
@mousemove=${i=>{i.stopPropagation(),this._immediateShowControls()}}
|
1344
|
+
@click=${this._immediateShowControls}
|
1345
|
+
>
|
1346
|
+
${this.captions?fe`<vmp-captions
|
1347
|
+
class=${Fe({hidden:!this.caption,hiddenControls:e})}
|
1348
|
+
caption=${this.caption}
|
1349
|
+
></vmp-captions>`:null}
|
1350
|
+
<vmp-player-controls
|
1351
|
+
${gt(this._playerControlsRef)}
|
1352
|
+
?playing=${this.playing}
|
1353
|
+
?muted=${this.muted}
|
1354
|
+
volume=${this.volume}
|
1355
|
+
currentTime=${this.currentTime}
|
1356
|
+
duration=${this.duration}
|
1357
|
+
.languages=${this.languages}
|
1358
|
+
language=${this.language}
|
1359
|
+
.levels=${this.levels}
|
1360
|
+
.level=${this.level}
|
1361
|
+
playbackRate=${this.playbackRate}
|
1362
|
+
.buffer=${this.buffer}
|
1363
|
+
.controls=${this.controls}
|
1364
|
+
?captions=${this.captions}
|
1365
|
+
?fullscreen=${this.fullscreen}
|
1366
|
+
></vmp-player-controls>
|
1367
|
+
</div>
|
1368
|
+
</div>
|
1369
|
+
`}};Je.styles=[Re.styles??[],lt`
|
1370
|
+
:host {
|
1371
|
+
--overlay-border-radius: var(--player-border-radius, 0px);
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
.container {
|
1375
|
+
position: relative;
|
1376
|
+
display: flex;
|
1377
|
+
justify-content: space-between;
|
1378
|
+
height: 100%;
|
1379
|
+
width: 100%;
|
1380
|
+
overflow: hidden;
|
1381
|
+
border-radius: var(--overlay-border-radius);
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
.container.hide {
|
1385
|
+
cursor: none;
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
.fixtures {
|
1389
|
+
position: absolute;
|
1390
|
+
top: 0;
|
1391
|
+
left: 0;
|
1392
|
+
right: 0;
|
1393
|
+
bottom: 0;
|
1394
|
+
display: flex;
|
1395
|
+
align-items: center;
|
1396
|
+
justify-content: center;
|
1397
|
+
opacity: 1;
|
1398
|
+
color: var(--colors-light-1000);
|
1399
|
+
background: var(--colors-dark-200);
|
1400
|
+
border-radius: var(--overlay-border-radius);
|
1401
|
+
transition: opacity 150ms ease-out;
|
1402
|
+
}
|
1403
|
+
|
1404
|
+
.hidden {
|
1405
|
+
display: none;
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
.invisible {
|
1409
|
+
opacity: 0;
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
.controls {
|
1413
|
+
position: relative;
|
1414
|
+
display: flex;
|
1415
|
+
flex-direction: column;
|
1416
|
+
align-self: flex-end;
|
1417
|
+
flex: 1;
|
1418
|
+
min-width: 0;
|
1419
|
+
opacity: 1;
|
1420
|
+
isolation: isolate;
|
1421
|
+
transform: translateY(0%);
|
1422
|
+
transition: transform 200ms ease-out;
|
1423
|
+
}
|
1424
|
+
|
1425
|
+
.controls.hide {
|
1426
|
+
pointer-events: none;
|
1427
|
+
transform: translateY(100%);
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
vmp-captions {
|
1431
|
+
position: absolute;
|
1432
|
+
bottom: calc(100%);
|
1433
|
+
width: 100%;
|
1434
|
+
transform: translateY(var(--space-medium));
|
1435
|
+
transition: transform 200ms ease-out;
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
vmp-captions.hiddenControls {
|
1439
|
+
transform: translateY(calc(var(--space-small) * -1));
|
1440
|
+
}
|
1441
|
+
`],ot([Z({type:Boolean})],Je.prototype,"loading",2),ot([Z({type:Boolean})],Je.prototype,"playing",2),ot([Z({type:Number})],Je.prototype,"volume",2),ot([Z({type:Boolean})],Je.prototype,"muted",2),ot([Z({type:Number})],Je.prototype,"currentTime",2),ot([Z({type:Number})],Je.prototype,"duration",2),ot([Z({type:String})],Je.prototype,"language",2),ot([Z({type:Array})],Je.prototype,"languages",2),ot([Z({type:Array,attribute:!1})],Je.prototype,"levels",2),ot([Z({type:Number})],Je.prototype,"level",2),ot([Z({type:Number})],Je.prototype,"playbackRate",2),ot([Z({type:String})],Je.prototype,"caption",2),ot([Z({type:Array})],Je.prototype,"buffer",2),ot([Z({type:Boolean})],Je.prototype,"captions",2),ot([Z({type:Boolean})],Je.prototype,"fullscreen",2),ot([Z({type:Array})],Je.prototype,"controls",2),ot([je()],Je.prototype,"showControls",2),Je=ot([pt("vmp-player-overlay")],Je);var Vm=Object.defineProperty,Jm=Object.getOwnPropertyDescriptor,Oe=(s,e,t,i)=>{for(var r=i>1?void 0:i?Jm(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&&Vm(e,t,r),r};const Wm=1e3/60;let Me=class extends Re{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=zn,this.dataResolver=no,this.languageResolver=Zg,this._sceneController=new sm(this),this._drawController=new zC(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=dt(),this._canvasRef=dt(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language="en",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=()=>{this.shadowRoot?.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,Wm):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 language(){return this._language}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(){return this._sceneController.scenes?.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?.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?.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){if(this._sceneController?.scenes){const e=this.scenes?.[s];if(!e){const t=new si(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:t,message:t.message}))}this.reset(e.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?nm():this._playerRef.value&&rm(this._playerRef.value)}connectedCallback(){super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),this.shadowRoot?.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(){super.disconnectedCallback(),this._observer?.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?fe`
|
1442
|
+
<style>
|
1443
|
+
:host {
|
1444
|
+
aspect-ratio: ${this.propAspectRatio};
|
1445
|
+
}
|
1446
|
+
</style>
|
1447
|
+
`:null:fe`
|
1448
|
+
<style>
|
1449
|
+
:host {
|
1450
|
+
width: 100%;
|
1451
|
+
height: 100%;
|
1452
|
+
}
|
1453
|
+
</style>
|
1454
|
+
`}_renderError(){return fe`<div class="error">
|
1455
|
+
<div class="error-icon">
|
1456
|
+
<vmp-icon icon="error"></vmp-icon>
|
1457
|
+
</div>
|
1458
|
+
<div class="error-text">
|
1459
|
+
<vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
|
1460
|
+
<vmp-text semibold content="Please try again later."></vmp-text>
|
1461
|
+
</div>
|
1462
|
+
</div>`}render(){const s=this.loading||this.processing||!this.scenes||this.duration<=0,{height:e,width:t}=eo({resolution:this.sceneConfig?.resolution??720,aspectRatio:this.aspectRatio}),i=Object.keys(this.sceneVideoState).reduce((d,f)=>d.concat(this.sceneVideoState[f].buffered??[]),[]),r=this.languageResolver({data:this.data}),n=s?[]:(this.controls??Sa)?.filter(d=>!(d==="fullscreen"&&tm()||d==="navigation"&&(!this.scenes||this.scenes.length<=1))),o=!n?.includes("preview"),a=(this.scenes?.length??0)-1,A=this.scenes?.findIndex(d=>d===this._drawController.activeScenes[0])??0,l=this._drawController.activeScenes[0]?.video?.hls,c=this.loading||this.waiting||this.processing,h=!this.src&&!this.data,u=!!this.errors.find(d=>d.fatal);return fe`
|
1463
|
+
${this._renderStyles()}
|
1464
|
+
<div
|
1465
|
+
${gt(this._playerRef)}
|
1466
|
+
class=${Fe({player:!0,responsive:!this.propAspectRatio})}
|
1467
|
+
style=${oo({aspectRatio:this.aspectRatio})}
|
1468
|
+
>
|
1469
|
+
${!c&&(h||u)?this._renderError():fe`<canvas
|
1470
|
+
${gt(this._canvasRef)}
|
1471
|
+
${this._drawController.canvas()}
|
1472
|
+
${Da(this._handleCanvasResize)}
|
1473
|
+
height=${e}
|
1474
|
+
width=${t}
|
1475
|
+
></canvas>
|
1476
|
+
<vmp-player-overlay
|
1477
|
+
${this._drawController.controls()}
|
1478
|
+
.data=${this.data}
|
1479
|
+
.template=${this.template}
|
1480
|
+
?disabled=${s}
|
1481
|
+
?playing=${!this.paused}
|
1482
|
+
?loading=${c}
|
1483
|
+
?muted=${this.muted}
|
1484
|
+
volume=${this.volume}
|
1485
|
+
duration=${this.duration}
|
1486
|
+
.languages=${r}
|
1487
|
+
language=${this.language}
|
1488
|
+
.levels=${l?.levels??[]}
|
1489
|
+
level=${_i(l?.autoLevelEnabled?-1:l?.currentLevel)}
|
1490
|
+
playbackRate=${this.playbackRate}
|
1491
|
+
caption=${this._drawController.caption}
|
1492
|
+
.buffer=${i}
|
1493
|
+
.controls=${n}
|
1494
|
+
?captions=${this.captions}
|
1495
|
+
?fullscreen=${this.fullscreen}
|
1496
|
+
@navigate:back=${d=>{d.defaultPrevented||this.setScene(A<=0?a:A-1)}}
|
1497
|
+
@navigate:forward=${d=>{d.defaultPrevented||this.setScene(A>=a?0:A+1)}}
|
1498
|
+
@play:click=${({detail:d})=>{s||(d?this.pause():(this.muted=this._manualMute,this.play()))}}
|
1499
|
+
@volume:click=${({detail:d})=>{this.muted=!d,this._manualMute=!d}}
|
1500
|
+
@language:click=${({detail:d})=>{this._language=d.value}}
|
1501
|
+
@level:click=${({detail:d})=>{this.videoResolution=d.value.resolution}}
|
1502
|
+
@playbackRate:click=${({detail:d})=>{this.playbackRate=d.value??1}}
|
1503
|
+
@captions:click=${()=>{this._captions=!this._captions}}
|
1504
|
+
@fullscreen:click=${()=>{this.toggleFullscreen()}}
|
1505
|
+
@input=${d=>{const f=d.composedPath()[0],g=f.getAttribute("key");if(g==="scrubber"){const I=parseFloat(f.value);this._drawController.currentTime=I,this._sceneController.setVideosCurrentTime(I),this.dispatchEvent(new CustomEvent("seeking",{detail:I}))}g==="volume"&&(this.volume=parseFloat(f.value))}}
|
1506
|
+
@pointerdown=${d=>{d.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!0,this._wasPlaying=!this.paused,this.paused||this.pause())}}
|
1507
|
+
@pointerup=${d=>{d.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!1,this._wasPlaying&&(this.play(),this._wasPlaying=!1),this.dispatchEvent(new CustomEvent("seeked",{detail:this._drawController.currentTime})))}}
|
1508
|
+
></vmp-player-overlay>
|
1509
|
+
<vmp-video-preview
|
1510
|
+
?disabled=${o}
|
1511
|
+
.src=${this.src}
|
1512
|
+
.data=${this.data}
|
1513
|
+
.template=${this.template}
|
1514
|
+
language=${this.language}
|
1515
|
+
.aspectRatio=${this.aspectRatio}
|
1516
|
+
.compilation=${this.compilation}
|
1517
|
+
.dataResolver=${this.dataResolver}
|
1518
|
+
></vmp-video-preview>`}
|
1519
|
+
</div>
|
1520
|
+
`}};Me.styles=[Re.styles??[],lt`
|
1521
|
+
:host {
|
1522
|
+
--player-border-radius: var(--vouch-media-player-border-radius, 0px);
|
1523
|
+
|
1524
|
+
display: flex;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
.player {
|
1528
|
+
position: relative;
|
1529
|
+
display: flex;
|
1530
|
+
align-items: center;
|
1531
|
+
justify-content: center;
|
1532
|
+
background: var(--colors-dark-1000);
|
1533
|
+
border-radius: var(--player-border-radius);
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
.responsive {
|
1537
|
+
width: 100%;
|
1538
|
+
height: 100%;
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
.error {
|
1542
|
+
display: flex;
|
1543
|
+
align-items: center;
|
1544
|
+
justify-content: center;
|
1545
|
+
gap: var(--space-xxs);
|
1546
|
+
padding: var(--space-medium);
|
1547
|
+
width: 100%;
|
1548
|
+
height: 100%;
|
1549
|
+
color: white;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
.error-icon {
|
1553
|
+
color: var(--colors-red-500);
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
.error-text {
|
1557
|
+
display: flex;
|
1558
|
+
flex-direction: column;
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
canvas {
|
1562
|
+
width: 100%;
|
1563
|
+
max-height: 100%;
|
1564
|
+
object-fit: contain;
|
1565
|
+
border-radius: var(--player-border-radius);
|
1566
|
+
}
|
1567
|
+
|
1568
|
+
vmp-player-overlay {
|
1569
|
+
position: absolute;
|
1570
|
+
top: 0;
|
1571
|
+
left: 0;
|
1572
|
+
right: 0;
|
1573
|
+
bottom: 0;
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
vmp-video-preview {
|
1577
|
+
position: absolute;
|
1578
|
+
top: 0;
|
1579
|
+
left: 0;
|
1580
|
+
}
|
1581
|
+
`],Oe([Z({type:Object})],Me.prototype,"data",2),Oe([Z({type:Object})],Me.prototype,"template",2),Oe([Z({type:Boolean})],Me.prototype,"burnCaptions",2),Oe([Z({type:Boolean})],Me.prototype,"debug",2),Oe([Z({type:String})],Me.prototype,"src",2),Oe([Z({type:String})],Me.prototype,"track",2),Oe([Z({type:Number,attribute:"aspectratio"})],Me.prototype,"propAspectRatio",2),Oe([Z({type:String})],Me.prototype,"preload",2),Oe([Z({type:Boolean})],Me.prototype,"autoplay",2),Oe([Z({type:Boolean})],Me.prototype,"loading",2),Oe([Z({type:Array})],Me.prototype,"controls",2),Oe([Z({attribute:!1})],Me.prototype,"compilation",2),Oe([Z({attribute:!1})],Me.prototype,"dataResolver",2),Oe([Z({attribute:!1})],Me.prototype,"languageResolver",2),Oe([je()],Me.prototype,"_pageHidden",2),Oe([je()],Me.prototype,"_aspectRatio",2),Oe([je()],Me.prototype,"_processing",2),Oe([je()],Me.prototype,"_waiting",2),Oe([je()],Me.prototype,"_errors",2),Oe([je()],Me.prototype,"_seeking",2),Oe([je()],Me.prototype,"_language",2),Oe([je()],Me.prototype,"_captions",2),Oe([je()],Me.prototype,"_fullscreen",2),Me=Oe([pt("vmp-media-player")],Me);var qm=Object.defineProperty,jm=Object.getOwnPropertyDescriptor,Ct=(s,e,t,i)=>{for(var r=i>1?void 0:i?jm(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&&qm(e,t,r),r};Ke.PlayerEmbed=class extends Zi{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 Ad(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 yd(this),this._trackingController=new Yg(this),this._mediaPlayerRef=dt()}get fetching(){return this._fetcherController.fetching}get waiting(){return this._mediaPlayerRef.value?.waiting}get initialised(){return this._mediaPlayerRef.value?.initialised}get seeking(){return this._mediaPlayerRef.value?.seeking}get paused(){return this._mediaPlayerRef.value?.paused}get captions(){return this._mediaPlayerRef.value?.captions}get fullscreen(){return this._mediaPlayerRef.value?.fullscreen}get duration(){return this._mediaPlayerRef.value?.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){return this._mediaPlayerRef.value?.currentTime??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){return this._mediaPlayerRef.value?.playbackRate??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){return this._mediaPlayerRef.value?.volume??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){return this._mediaPlayerRef.value?.muted??!1}get scene(){return this._mediaPlayerRef.value?.scene??null}get scenes(){return this._mediaPlayerRef.value?.scenes??[]}get sceneConfig(){return this._mediaPlayerRef.value?.sceneConfig??null}get videoState(){return this._mediaPlayerRef.value?.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){this._mediaPlayerRef.value?.play()}pause(){this._mediaPlayerRef.value?.pause()}reset(e=0,t=!1){this._mediaPlayerRef.value?.reset(e,t)}setScene(e){this._mediaPlayerRef.value?.setScene(e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?fe`
|
1582
|
+
<style>
|
1583
|
+
:host {
|
1584
|
+
aspect-ratio: ${this.aspectRatio};
|
1585
|
+
}
|
1586
|
+
</style>
|
1587
|
+
`:null:fe`
|
1588
|
+
<style>
|
1589
|
+
:host {
|
1590
|
+
width: 100%;
|
1591
|
+
height: 100%;
|
1592
|
+
}
|
1593
|
+
</style>
|
1594
|
+
`}render(){return fe`
|
1595
|
+
${this._renderStyles()}
|
1596
|
+
<vmp-media-player
|
1597
|
+
${gt(this._mediaPlayerRef)}
|
1598
|
+
${this.eventController.register()}
|
1599
|
+
?autoplay=${this.autoplay}
|
1600
|
+
?loading=${this.fetching}
|
1601
|
+
.data=${this.vouch}
|
1602
|
+
.template=${this.template}
|
1603
|
+
aspectRatio=${_i(this.aspectRatio)}
|
1604
|
+
preload=${_i(this.preload)}
|
1605
|
+
.controls=${this.controls}
|
1606
|
+
></vmp-media-player>
|
1607
|
+
`}},Ke.PlayerEmbed.styles=[lt`
|
1608
|
+
:host {
|
1609
|
+
display: flex;
|
1610
|
+
}
|
1611
|
+
`],Ct([Z({type:Object})],Ke.PlayerEmbed.prototype,"data",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"vouchId",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"templateId",2),Ct([Z({type:Array})],Ke.PlayerEmbed.prototype,"questions",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"env",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"apiKey",2),Ct([Z({type:Boolean})],Ke.PlayerEmbed.prototype,"disableTracking",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"trackingSource",2),Ct([Z({type:Array})],Ke.PlayerEmbed.prototype,"controls",2),Ct([Z({type:String})],Ke.PlayerEmbed.prototype,"preload",2),Ct([Z({type:Boolean})],Ke.PlayerEmbed.prototype,"autoplay",2),Ct([Z({type:Number})],Ke.PlayerEmbed.prototype,"aspectRatio",2),Ct([je()],Ke.PlayerEmbed.prototype,"vouch",2),Ct([je()],Ke.PlayerEmbed.prototype,"template",2),Ke.PlayerEmbed=Ct([qu("vouch-embed-player")],Ke.PlayerEmbed);function oi(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function pu(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 Xm(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 bs={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),oi(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=pu(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(oi(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=pu(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return oi(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];oi(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":bs.normalize(e)},relative:function(e,t){if(oi(e),oi(t),e===t||(e=bs.resolve(e),t=bs.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 f="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(f.length===0?f+="..":f+="/..");return f.length>0?f+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(oi(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');oi(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){oi(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Xm("/",e)},parse:function(e){oi(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};bs.posix=bs;var Zm=bs;const{basename:Cu,extname:zm}=Zm;class eB{constructor(){let e=typeof wr>"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 tB(s,{filename:e="",extension:t="",format:g,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new eB,d=d||"canvas",f=g||t.replace(/@\d+x$/i,"")||zm(e),g=c(h(f)||f),I=h(g),B=s.length;if(!f)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!g)throw new Error(`Unsupported file format "${f}" (expected ${u})`);if(!B)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let S,Q,m=e.replace(/{(\d*)}/g,(D,v)=>(Q=!0,v=parseInt(v,10),S=isFinite(v)?v:isFinite(S)?S:-1,"{}")),y=r>0?r-1:r<0?B+r:void 0;if(isFinite(y)&&y<0||y>=B)throw new RangeError(B==1?`Canvas only has a ‘page 1’ (${y} is out of bounds)`:`Canvas has pages 1–${B} (${y} is out of bounds)`);if(s=isFinite(y)?[s[y]]:Q||g=="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 D=(t||Cu(e,f)).match(/@(\d+)x$/i);a=D?parseInt(D[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:g=="svg"&&(A=!!A),{filename:e,pattern:m,format:g,mime:I,pages:s,padding:S,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 La(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}class ka{static encoder=new TextEncoder;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=ka.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=La(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=La(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=La(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"})}}const Ma=(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))},iB=(...s)=>Ma(...s).then(e=>e.arrayBuffer()),sB=async(s,e,t,i,r)=>{mu(r,await Ma(s,e,t,i))},rB=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Cu(r,".zip")||"archive",l=new ka(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await Ma(c,e,t,i))})),mu(`${A}.zip`,l.blob)},mu=(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 nB={asBuffer:iB,asDownload:sB,asZipDownload:rB,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:tB};const{asBuffer:_a,asDownload:oB,asZipDownload:aB,atScale:Fa,options:Na}=nB,Bu=Symbol.for("toDataURL"),AB=s=>{let e=Object.assign(new yu,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class lB{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:()=>_a(i,"image/png"),jpg:()=>_a(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=Na(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:f,density:g,archive:I}=l,B=Fa(l.pages,g);return h==null?oB(B[0],u,d,f,a):aB(B,u,d,f,I,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Na(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:f}=l,g=Fa(d,f,u)[0];return _a(g,c,h,u)},[Bu]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Na(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:f}=l,g=Fa(d,f,u)[0],I=g[g===i?Bu:"toDataURL"](c,h);return Promise.resolve(I)}})}}const{CanvasRenderingContext2D:cB,CanvasGradient:hB,CanvasPattern:uB,Image:yu,ImageData:dB,Path2D:gB,DOMMatrix:fB,DOMRect:IB,DOMPoint:EB}=window;var Qu={Canvas:lB,loadImage:AB,CanvasRenderingContext2D:cB,CanvasGradient:hB,CanvasPattern:uB,Image:yu,ImageData:dB,Path2D:gB,DOMMatrix:fB,DOMRect:IB,DOMPoint:EB};const vu=ku({__proto__:null,default:YA(Qu)},[Qu]);return Object.defineProperty(Ke,Symbol.toStringTag,{value:"Module"}),Ke}({});
|
1612
|
+
//# sourceMappingURL=embed.iife.js.map
|