@arbocollab/arbo-web-scene 0.26.5-alpha.49 → 0.26.5-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.es.js CHANGED
@@ -51370,11 +51370,11 @@ const bgn = {
51370
51370
  (s = (a = e == null ? void 0 : e.config) == null ? void 0 : a.globalProperties) == null || s.setStoreValue("scene", "setCurrentSceneTabId", o);
51371
51371
  }
51372
51372
  return e.config.globalProperties.setStoreValue = r, e.config.globalProperties.handleSetTab = i, { handleSetTab: i };
51373
- }, Egn = "0.26.5-alpha.49", xgn = {
51373
+ }, Egn = "0.26.5-alpha.50", xgn = {
51374
51374
  "@arbocollab/arbo-chart-component": "1.0.1",
51375
51375
  "@arbocollab/arbo-comment-utils": "1.0.1",
51376
51376
  "@arbocollab/arbo-common-utils": "npm:@arbocollab/arbo-common-utils@0.0.12-alpha.0",
51377
- "@arbocollab/arbo-media-player-component": "0.0.13",
51377
+ "@arbocollab/arbo-media-player-component": "0.0.14",
51378
51378
  "@arbocollab/arbo-table-component": "1.0.1",
51379
51379
  "@arbocollab/arbo-ui-components": "npm:@arbocollab/arbo-ui-components-beta@0.0.376-alpha.109",
51380
51380
  "@arbocollab/arbo-calendar-component": "0.0.38",
@@ -324105,22 +324105,6 @@ var rCi = {
324105
324105
  console.log("onDownload", F, z);
324106
324106
  var q = tO({
324107
324107
  mode: "cors",
324108
- referrerPolicy: "origin-when-cross-origin",
324109
- headers: {
324110
- "Access-Control-Allow-Origin": "*",
324111
- accept: "*/*",
324112
- "accept-language": "vi,en;q=0.9,zh-CN;q=0.8,zh;q=0.7",
324113
- "cache-control": "no-cache",
324114
- pragma: "no-cache",
324115
- "sec-ch-ua": '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
324116
- "sec-ch-ua-mobile": "?0",
324117
- "sec-ch-ua-platform": '"Windows"',
324118
- "sec-fetch-dest": "empty",
324119
- "sec-fetch-mode": "cors",
324120
- "sec-fetch-site": "cross-site",
324121
- Referer: sessionStorage.getItem("BASE_URL"),
324122
- "Referrer-Policy": "origin-when-cross-origin"
324123
- },
324124
324108
  method: "GET"
324125
324109
  }, o.downloadConfiguration);
324126
324110
  console.log("aaa", F, z);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arbocollab/arbo-web-scene",
3
3
  "description": "Arbo Web Scene",
4
- "version": "0.26.5-alpha.49",
4
+ "version": "0.26.5-alpha.50",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "scripts": {
package/umd/index.umd.js CHANGED
@@ -199,7 +199,7 @@ ${u}`:l)}else throw a},onCacheKey:a=>jln(t,n,a)}}function Scn(e){if(Kr(e))return
199
199
  * vue-i18n v9.14.5
200
200
  * (c) 2025 kazuya kawaguchi
201
201
  * Released under the MIT License.
202
- */const Ecn="9.14.5";function xcn(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(fC().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(fC().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(fC().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(fC().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(fC().__INTLIFY_PROD_DEVTOOLS__=!1)}const q5e=Zp.__EXTEND_POINT__,pC=zG(q5e),Pm={FALLBACK_TO_ROOT:q5e,NOT_SUPPORTED_PRESERVE:pC(),NOT_SUPPORTED_FORMATTER:pC(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:pC(),NOT_SUPPORTED_GET_CHOICE_INDEX:pC(),COMPONENT_NAME_LEGACY_COMPATIBLE:pC(),NOT_FOUND_PARENT_SCOPE:pC(),IGNORE_OBJ_FLATTEN:pC(),NOTICE_DROP_ALLOW_COMPOSITION:pC(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:pC()},Tcn={[Pm.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Pm.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Pm.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Pm.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Pm.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Pm.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Pm.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Pm.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Pm.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see šŸ‘‰ https://tinyurl.com/2p97mcze",[Pm.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function QG(e,...t){return Pde(Tcn[e],...t)}const G5e=$f.__EXTEND_POINT__,Mm=zG(G5e),rc={UNEXPECTED_RETURN_TYPE:G5e,INVALID_ARGUMENT:Mm(),MUST_BE_CALL_SETUP_TOP:Mm(),NOT_INSTALLED:Mm(),NOT_AVAILABLE_IN_LEGACY_MODE:Mm(),REQUIRED_VALUE:Mm(),INVALID_VALUE:Mm(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:Mm(),NOT_INSTALLED_WITH_PROVIDE:Mm(),UNEXPECTED_ERROR:Mm(),NOT_COMPATIBLE_LEGACY_VUE_I18N:Mm(),BRIDGE_SUPPORT_VUE_2_ONLY:Mm(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:Mm(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:Mm(),__EXTEND_POINT__:Mm()};function Gx(e,...t){return U$(e,null,Ue.env.NODE_ENV!=="production"?{messages:kcn,args:t}:void 0)}const kcn={[rc.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[rc.INVALID_ARGUMENT]:"Invalid argument",[rc.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[rc.NOT_INSTALLED]:"Need to install with `app.use` function",[rc.UNEXPECTED_ERROR]:"Unexpected error",[rc.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[rc.REQUIRED_VALUE]:"Required in value: {0}",[rc.INVALID_VALUE]:"Invalid value",[rc.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[rc.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[rc.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[rc.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[rc.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ā€˜i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[rc.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},qde=dC("__translateVNode"),Gde=dC("__datetimeParts"),Kde=dC("__numberParts"),Yde=dC("__enableEmitter"),Zde=dC("__disableEmitter"),Dcn=dC("__setPluralRules"),K5e=dC("__injectWithOption"),Xde=dC("__dispose");function $V(e){if(!Ua(e)||N0(e))return e;for(const t in e)if(P0(e,t))if(!t.includes("."))Ua(e[t])&&$V(e[t]);else{const n=t.split("."),r=n.length-1;let i=e,o=!1;for(let a=0;a<r;a++){if(n[a]==="__proto__")throw new Error(`unsafe key: ${n[a]}`);if(n[a]in i||(i[n[a]]=cl()),!Ua(i[n[a]])){Ue.env.NODE_ENV!=="production"&&B_(QG(Pm.IGNORE_OBJ_FLATTEN,{key:n[a]})),o=!0;break}i=i[n[a]]}if(o||(N0(i)?d5e.includes(n[r])||delete e[t]:(i[n[r]]=e[t],delete e[t])),!N0(i)){const a=i[n[r]];Ua(a)&&$V(a)}}return e}function Jde(e,t){const{messages:n,__i18n:r,messageResolver:i,flatJson:o}=t,a=xa(n)?n:kd(r)?cl():{[e]:cl()};if(kd(r)&&r.forEach(s=>{if("locale"in s&&"resource"in s){const{locale:l,resource:u}=s;l?(a[l]=a[l]||cl(),qG(u,a[l])):qG(u,a)}else Kr(s)&&qG(JSON.parse(s),a)}),i==null&&o)for(const s in a)P0(a,s)&&$V(a[s]);return a}function Acn(e){return e.type}function Ocn(e,t,n){let r=Ua(t.messages)?t.messages:cl();"__i18nGlobal"in n&&(r=Jde(e.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const i=Object.keys(r);i.length&&i.forEach(o=>{e.mergeLocaleMessage(o,r[o])});{if(Ua(t.datetimeFormats)){const o=Object.keys(t.datetimeFormats);o.length&&o.forEach(a=>{e.mergeDateTimeFormat(a,t.datetimeFormats[a])})}if(Ua(t.numberFormats)){const o=Object.keys(t.numberFormats);o.length&&o.forEach(a=>{e.mergeNumberFormat(a,t.numberFormats[a])})}}}function Y5e(e){return Me(yy,null,e,0)}const Z5e=()=>[],Icn=()=>!1;let X5e=0;function J5e(e){return(t,n,r,i)=>e(n,r,qi()||void 0,i)}function Rcn(e={},t){const{__root:n,__injectWithOption:r}=e,i=n===void 0,o=e.flatJson,a=cC?K:km,s=!!e.translateExistCompatible;Ue.env.NODE_ENV!=="production"&&s&&HUe(QG(Pm.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let l=Ol(e.inheritLocale)?e.inheritLocale:!0;const u=a(n&&l?n.locale.value:Kr(e.locale)?e.locale:IV),c=a(n&&l?n.fallbackLocale.value:Kr(e.fallbackLocale)||kd(e.fallbackLocale)||xa(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:u.value),d=a(Jde(u.value,e)),h=a(xa(e.datetimeFormats)?e.datetimeFormats:{[u.value]:{}}),f=a(xa(e.numberFormats)?e.numberFormats:{[u.value]:{}});let g=n?n.missingWarn:Ol(e.missingWarn)||V$(e.missingWarn)?e.missingWarn:!0,m=n?n.fallbackWarn:Ol(e.fallbackWarn)||V$(e.fallbackWarn)?e.fallbackWarn:!0,b=n?n.fallbackRoot:Ol(e.fallbackRoot)?e.fallbackRoot:!0,w=!!e.fallbackFormat,_=iu(e.missing)?e.missing:null,C=iu(e.missing)?J5e(e.missing):null,y=iu(e.postTranslation)?e.postTranslation:null,x=n?n.warnHtmlMessage:Ol(e.warnHtmlMessage)?e.warnHtmlMessage:!0,E=!!e.escapeParameter;const T=n?n.modifiers:xa(e.modifiers)?e.modifiers:{};let O=e.pluralRules||n&&n.pluralRules,A;A=(()=>{i&&x5e(null);const ht={version:Ecn,locale:u.value,fallbackLocale:c.value,messages:d.value,modifiers:T,pluralRules:O,missing:C===null?void 0:C,missingWarn:g,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:y===null?void 0:y,warnHtmlMessage:x,escapeParameter:E,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:"vue"}};ht.datetimeFormats=h.value,ht.numberFormats=f.value,ht.__datetimeFormatters=xa(A)?A.__datetimeFormatters:void 0,ht.__numberFormatters=xa(A)?A.__numberFormatters:void 0,Ue.env.NODE_ENV!=="production"&&(ht.__v_emitter=xa(A)?A.__v_emitter:void 0);const vt=hcn(ht);return i&&x5e(vt),vt})(),RV(A,u.value,c.value);function D(){return[u.value,c.value,d.value,h.value,f.value]}const R=q({get:()=>u.value,set:ht=>{u.value=ht,A.locale=u.value}}),N=q({get:()=>c.value,set:ht=>{c.value=ht,A.fallbackLocale=c.value,RV(A,u.value,ht)}}),$=q(()=>d.value),P=q(()=>h.value),B=q(()=>f.value);function F(){return iu(y)?y:null}function z(ht){y=ht,A.postTranslation=ht}function G(){return _}function ee(ht){ht!==null&&(C=J5e(ht)),_=ht,A.missing=C}function fe(ht,vt){return ht!=="translate"||!vt.resolvedMessage}const oe=(ht,vt,_t,kt,un,Cn)=>{D();let tn;try{Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=n?fcn():void 0),tn=ht(A)}finally{Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=void 0)}if(_t!=="translate exists"&&Rf(tn)&&tn===ZG||_t==="translate exists"&&!tn){const[ln,wn]=vt();if(Ue.env.NODE_ENV!=="production"&&n&&Kr(ln)&&fe(_t,wn)&&(b&&(JG(m,ln)||k5e(g,ln))&&B_(QG(Pm.FALLBACK_TO_ROOT,{key:ln,type:_t})),Ue.env.NODE_ENV!=="production")){const{__v_emitter:Q}=A;Q&&b&&Q.emit("fallback",{type:_t,key:ln,to:"global",groupId:`${_t}:${ln}`})}return n&&b?kt(n):un(ln)}else{if(Cn(tn))return tn;throw Gx(rc.UNEXPECTED_RETURN_TYPE)}};function U(...ht){return oe(vt=>Reflect.apply(M5e,null,[vt,...ht]),()=>Hde(...ht),"translate",vt=>Reflect.apply(vt.t,vt,[...ht]),vt=>vt,vt=>Kr(vt))}function L(...ht){const[vt,_t,kt]=ht;if(kt&&!Ua(kt))throw Gx(rc.INVALID_ARGUMENT);return U(vt,_t,Yh({resolvedMessage:!0},kt||{}))}function Y(...ht){return oe(vt=>Reflect.apply(V5e,null,[vt,...ht]),()=>zde(...ht),"datetime format",vt=>Reflect.apply(vt.d,vt,[...ht]),()=>XG,vt=>Kr(vt))}function ae(...ht){return oe(vt=>Reflect.apply(H5e,null,[vt,...ht]),()=>Wde(...ht),"number format",vt=>Reflect.apply(vt.n,vt,[...ht]),()=>XG,vt=>Kr(vt))}function Te(ht){return ht.map(vt=>Kr(vt)||Rf(vt)||Ol(vt)?Y5e(String(vt)):vt)}const ke={normalize:Te,interpolate:ht=>ht,type:"vnode"};function X(...ht){return oe(vt=>{let _t;const kt=vt;try{kt.processor=ke,_t=Reflect.apply(M5e,null,[kt,...ht])}finally{kt.processor=null}return _t},()=>Hde(...ht),"translate",vt=>vt[qde](...ht),vt=>[Y5e(vt)],vt=>kd(vt))}function J(...ht){return oe(vt=>Reflect.apply(H5e,null,[vt,...ht]),()=>Wde(...ht),"number format",vt=>vt[Kde](...ht),Z5e,vt=>Kr(vt)||kd(vt))}function $e(...ht){return oe(vt=>Reflect.apply(V5e,null,[vt,...ht]),()=>zde(...ht),"datetime format",vt=>vt[Gde](...ht),Z5e,vt=>Kr(vt)||kd(vt))}function pe(ht){O=ht,A.pluralRules=O}function He(ht,vt){return oe(()=>{if(!ht)return!1;const _t=Kr(vt)?vt:u.value,kt=Ae(_t),un=A.messageResolver(kt,ht);return s?un!=null:N0(un)||L0(un)||Kr(un)},()=>[ht],"translate exists",_t=>Reflect.apply(_t.te,_t,[ht,vt]),Icn,_t=>Ol(_t))}function Se(ht){let vt=null;const _t=v5e(A,c.value,u.value);for(let kt=0;kt<_t.length;kt++){const un=d.value[_t[kt]]||{},Cn=A.messageResolver(un,ht);if(Cn!=null){vt=Cn;break}}return vt}function Ie(ht){return Se(ht)??(n?n.tm(ht)||{}:{})}function Ae(ht){return d.value[ht]||{}}function Je(ht,vt){if(o){const _t={[ht]:vt};for(const kt in _t)P0(_t,kt)&&$V(_t[kt]);vt=_t[ht]}d.value[ht]=vt,A.messages=d.value}function et(ht,vt){d.value[ht]=d.value[ht]||{};const _t={[ht]:vt};if(o)for(const kt in _t)P0(_t,kt)&&$V(_t[kt]);vt=_t[ht],qG(vt,d.value[ht]),A.messages=d.value}function Ve(ht){return h.value[ht]||{}}function Ye(ht,vt){h.value[ht]=vt,A.datetimeFormats=h.value,j5e(A,ht,vt)}function ce(ht,vt){h.value[ht]=Yh(h.value[ht]||{},vt),A.datetimeFormats=h.value,j5e(A,ht,vt)}function Ee(ht){return f.value[ht]||{}}function rt(ht,vt){f.value[ht]=vt,A.numberFormats=f.value,W5e(A,ht,vt)}function ze(ht,vt){f.value[ht]=Yh(f.value[ht]||{},vt),A.numberFormats=f.value,W5e(A,ht,vt)}X5e++,n&&cC&&(gt(n.locale,ht=>{l&&(u.value=ht,A.locale=ht,RV(A,u.value,c.value))}),gt(n.fallbackLocale,ht=>{l&&(c.value=ht,A.fallbackLocale=ht,RV(A,u.value,c.value))}));const nt={id:X5e,locale:R,fallbackLocale:N,get inheritLocale(){return l},set inheritLocale(ht){l=ht,ht&&n&&(u.value=n.locale.value,c.value=n.fallbackLocale.value,RV(A,u.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:$,get modifiers(){return T},get pluralRules(){return O||{}},get isGlobal(){return i},get missingWarn(){return g},set missingWarn(ht){g=ht,A.missingWarn=g},get fallbackWarn(){return m},set fallbackWarn(ht){m=ht,A.fallbackWarn=m},get fallbackRoot(){return b},set fallbackRoot(ht){b=ht},get fallbackFormat(){return w},set fallbackFormat(ht){w=ht,A.fallbackFormat=w},get warnHtmlMessage(){return x},set warnHtmlMessage(ht){x=ht,A.warnHtmlMessage=ht},get escapeParameter(){return E},set escapeParameter(ht){E=ht,A.escapeParameter=ht},t:U,getLocaleMessage:Ae,setLocaleMessage:Je,mergeLocaleMessage:et,getPostTranslationHandler:F,setPostTranslationHandler:z,getMissingHandler:G,setMissingHandler:ee,[Dcn]:pe};return nt.datetimeFormats=P,nt.numberFormats=B,nt.rt=L,nt.te=He,nt.tm=Ie,nt.d=Y,nt.n=ae,nt.getDateTimeFormat=Ve,nt.setDateTimeFormat=Ye,nt.mergeDateTimeFormat=ce,nt.getNumberFormat=Ee,nt.setNumberFormat=rt,nt.mergeNumberFormat=ze,nt[K5e]=r,nt[qde]=X,nt[Gde]=$e,nt[Kde]=J,Ue.env.NODE_ENV!=="production"&&(nt[Yde]=ht=>{A.__v_emitter=ht},nt[Zde]=()=>{A.__v_emitter=void 0}),nt}const Qde={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e==="parent"||e==="global",default:"parent"},i18n:{type:Object}};function $cn({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((n,r)=>[...n,...r.type===Ht?r.children:[r]],[]):t.reduce((n,r)=>{const i=e[r];return i&&(n[r]=i()),n},cl())}function Q5e(e){return Ht}Yh({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>Rf(e)||!isNaN(e)}},Qde);function Pcn(e){return kd(e)&&!Kr(e[0])}function e8e(e,t,n,r){const{slots:i,attrs:o}=t;return()=>{const a={part:!0};let s=cl();e.locale&&(a.locale=e.locale),Kr(e.format)?a.key=e.format:Ua(e.format)&&(Kr(e.format.key)&&(a.key=e.format.key),s=Object.keys(e.format).reduce((h,f)=>n.includes(f)?Yh(cl(),h,{[f]:e.format[f]}):h,cl()));const l=r(e.value,a,s);let u=[a.key];kd(l)?u=l.map((h,f)=>{const g=i[h.type],m=g?g({[h.type]:h.value,index:f,parts:l}):[h.value];return Pcn(m)&&(m[0].key=`${h.type}-${f}`),m}):Kr(l)&&(u=[l]);const c=Yh(cl(),o),d=Kr(e.tag)||Ua(e.tag)?e.tag:Q5e();return Qs(d,c,u)}}Yh({value:{type:Number,required:!0},format:{type:[String,Object]}},Qde),Yh({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Qde);function t8e(e,t){}const Mcn=dC("global-vue-i18n");function efe(e={}){const t=qi();if(t==null)throw Gx(rc.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw Gx(rc.NOT_INSTALLED);const n=Ncn(t),r=Fcn(n),i=Acn(t),o=Lcn(e,i);if(__VUE_I18N_LEGACY_API__&&n.mode==="legacy"&&!e.__useComponent){if(!n.allowComposition)throw Gx(rc.NOT_AVAILABLE_IN_LEGACY_MODE);return jcn(t,o,r,e)}if(o==="global")return Ocn(r,e,i),r;if(o==="parent"){let l=Bcn(n,t,e.__useComponent);return l==null&&(Ue.env.NODE_ENV!=="production"&&B_(QG(Pm.NOT_FOUND_PARENT_SCOPE)),l=r),l}const a=n;let s=a.__getInstance(t);if(s==null){const l=Yh({},e);"__i18n"in i&&(l.__i18n=i.__i18n),r&&(l.__root=r),s=Rcn(l),a.__composerExtend&&(s[Xde]=a.__composerExtend(s)),Ucn(a,t,s),a.__setInstance(t,s)}return s}function Ncn(e){{const t=Io(e.isCE?Mcn:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw Gx(e.isCE?rc.NOT_INSTALLED_WITH_PROVIDE:rc.UNEXPECTED_ERROR);return t}}function Lcn(e,t){return HG(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}function Fcn(e){return e.mode==="composition"?e.global:e.global.__composer}function Bcn(e,t,n=!1){let r=null;const i=t.root;let o=Vcn(t,n);for(;o!=null;){const a=e;if(e.mode==="composition")r=a.__getInstance(o);else if(__VUE_I18N_LEGACY_API__){const s=a.__getInstance(o);s!=null&&(r=s.__composer,n&&r&&!r[K5e]&&(r=null))}if(r!=null||i===o)break;o=o.parent}return r}function Vcn(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function Ucn(e,t,n){let r=null;yn(()=>{if(Ue.env.NODE_ENV!=="production"&&t.vnode.el){t.vnode.el.__VUE_I18N__=n,r=Jln();const i=n;i[Yde]&&i[Yde](r),r.on("*",t8e)}},t),kl(()=>{const i=n;Ue.env.NODE_ENV!=="production"&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&(r&&r.off("*",t8e),i[Zde]&&i[Zde](),delete t.vnode.el.__VUE_I18N__),e.__deleteInstance(t);const o=i[Xde];o&&(o(),delete i[Xde])},t)}function jcn(e,t,n,r={}){const i=t==="local",o=km(null);if(i&&e.proxy&&!(e.proxy.$options.i18n||e.proxy.$options.__i18n))throw Gx(rc.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);const a=Ol(r.inheritLocale)?r.inheritLocale:!Kr(r.locale),s=K(!i||a?n.locale.value:Kr(r.locale)?r.locale:IV),l=K(!i||a?n.fallbackLocale.value:Kr(r.fallbackLocale)||kd(r.fallbackLocale)||xa(r.fallbackLocale)||r.fallbackLocale===!1?r.fallbackLocale:s.value),u=K(Jde(s.value,r)),c=K(xa(r.datetimeFormats)?r.datetimeFormats:{[s.value]:{}}),d=K(xa(r.numberFormats)?r.numberFormats:{[s.value]:{}}),h=i?n.missingWarn:Ol(r.missingWarn)||V$(r.missingWarn)?r.missingWarn:!0,f=i?n.fallbackWarn:Ol(r.fallbackWarn)||V$(r.fallbackWarn)?r.fallbackWarn:!0,g=i?n.fallbackRoot:Ol(r.fallbackRoot)?r.fallbackRoot:!0,m=!!r.fallbackFormat,b=iu(r.missing)?r.missing:null,w=iu(r.postTranslation)?r.postTranslation:null,_=i?n.warnHtmlMessage:Ol(r.warnHtmlMessage)?r.warnHtmlMessage:!0,C=!!r.escapeParameter,y=i?n.modifiers:xa(r.modifiers)?r.modifiers:{},x=r.pluralRules||i&&n.pluralRules;function E(){return[s.value,l.value,u.value,c.value,d.value]}const T=q({get:()=>o.value?o.value.locale.value:s.value,set:Ie=>{o.value&&(o.value.locale.value=Ie),s.value=Ie}}),O=q({get:()=>o.value?o.value.fallbackLocale.value:l.value,set:Ie=>{o.value&&(o.value.fallbackLocale.value=Ie),l.value=Ie}}),A=q(()=>o.value?o.value.messages.value:u.value),D=q(()=>c.value),R=q(()=>d.value);function N(){return o.value?o.value.getPostTranslationHandler():w}function $(Ie){o.value&&o.value.setPostTranslationHandler(Ie)}function P(){return o.value?o.value.getMissingHandler():b}function B(Ie){o.value&&o.value.setMissingHandler(Ie)}function F(Ie){return E(),Ie()}function z(...Ie){return o.value?F(()=>Reflect.apply(o.value.t,null,[...Ie])):F(()=>"")}function G(...Ie){return o.value?Reflect.apply(o.value.rt,null,[...Ie]):""}function ee(...Ie){return o.value?F(()=>Reflect.apply(o.value.d,null,[...Ie])):F(()=>"")}function fe(...Ie){return o.value?F(()=>Reflect.apply(o.value.n,null,[...Ie])):F(()=>"")}function oe(Ie){return o.value?o.value.tm(Ie):{}}function U(Ie,Ae){return o.value?o.value.te(Ie,Ae):!1}function L(Ie){return o.value?o.value.getLocaleMessage(Ie):{}}function Y(Ie,Ae){o.value&&(o.value.setLocaleMessage(Ie,Ae),u.value[Ie]=Ae)}function ae(Ie,Ae){o.value&&o.value.mergeLocaleMessage(Ie,Ae)}function Te(Ie){return o.value?o.value.getDateTimeFormat(Ie):{}}function ke(Ie,Ae){o.value&&(o.value.setDateTimeFormat(Ie,Ae),c.value[Ie]=Ae)}function X(Ie,Ae){o.value&&o.value.mergeDateTimeFormat(Ie,Ae)}function J(Ie){return o.value?o.value.getNumberFormat(Ie):{}}function $e(Ie,Ae){o.value&&(o.value.setNumberFormat(Ie,Ae),d.value[Ie]=Ae)}function pe(Ie,Ae){o.value&&o.value.mergeNumberFormat(Ie,Ae)}const He={get id(){return o.value?o.value.id:-1},locale:T,fallbackLocale:O,messages:A,datetimeFormats:D,numberFormats:R,get inheritLocale(){return o.value?o.value.inheritLocale:a},set inheritLocale(Ie){o.value&&(o.value.inheritLocale=Ie)},get availableLocales(){return o.value?o.value.availableLocales:Object.keys(u.value)},get modifiers(){return o.value?o.value.modifiers:y},get pluralRules(){return o.value?o.value.pluralRules:x},get isGlobal(){return o.value?o.value.isGlobal:!1},get missingWarn(){return o.value?o.value.missingWarn:h},set missingWarn(Ie){o.value&&(o.value.missingWarn=Ie)},get fallbackWarn(){return o.value?o.value.fallbackWarn:f},set fallbackWarn(Ie){o.value&&(o.value.missingWarn=Ie)},get fallbackRoot(){return o.value?o.value.fallbackRoot:g},set fallbackRoot(Ie){o.value&&(o.value.fallbackRoot=Ie)},get fallbackFormat(){return o.value?o.value.fallbackFormat:m},set fallbackFormat(Ie){o.value&&(o.value.fallbackFormat=Ie)},get warnHtmlMessage(){return o.value?o.value.warnHtmlMessage:_},set warnHtmlMessage(Ie){o.value&&(o.value.warnHtmlMessage=Ie)},get escapeParameter(){return o.value?o.value.escapeParameter:C},set escapeParameter(Ie){o.value&&(o.value.escapeParameter=Ie)},t:z,getPostTranslationHandler:N,setPostTranslationHandler:$,getMissingHandler:P,setMissingHandler:B,rt:G,d:ee,n:fe,tm:oe,te:U,getLocaleMessage:L,setLocaleMessage:Y,mergeLocaleMessage:ae,getDateTimeFormat:Te,setDateTimeFormat:ke,mergeDateTimeFormat:X,getNumberFormat:J,setNumberFormat:$e,mergeNumberFormat:pe};function Se(Ie){Ie.locale.value=s.value,Ie.fallbackLocale.value=l.value,Object.keys(u.value).forEach(Ae=>{Ie.mergeLocaleMessage(Ae,u.value[Ae])}),Object.keys(c.value).forEach(Ae=>{Ie.mergeDateTimeFormat(Ae,c.value[Ae])}),Object.keys(d.value).forEach(Ae=>{Ie.mergeNumberFormat(Ae,d.value[Ae])}),Ie.escapeParameter=C,Ie.fallbackFormat=m,Ie.fallbackRoot=g,Ie.fallbackWarn=f,Ie.missingWarn=h,Ie.warnHtmlMessage=_}return ds(()=>{if(e.proxy==null||e.proxy.$i18n==null)throw Gx(rc.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const Ie=o.value=e.proxy.$i18n.__composer;t==="global"?(s.value=Ie.locale.value,l.value=Ie.fallbackLocale.value,u.value=Ie.messages.value,c.value=Ie.datetimeFormats.value,d.value=Ie.numberFormats.value):i&&Se(Ie)}),He}if(xcn(),__INTLIFY_JIT_COMPILATION__?_5e(ycn):_5e(vcn),ccn(zun),dcn(v5e),Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const e=fC();e.__INTLIFY__=!0,Qun(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}Ue.env.NODE_ENV;const Hcn={EmptyData:$Ue,HeaderWrapper:MUe,Checkbox:_G,CreateNewScene:NUe,FileUploader:LUe,FilterBox:BUe,RatingRenderer:VUe,Switch:$de,CloseBadgeWrapper:xA,MetricEditorDropdown:sG,MetricEditorInput:lG,ClearButton:UUe},zcn={install(e){let t=BZt();t||(t=rXt(),e.use(t)),TG(t),PUe(t),Uce(t),wG(t),jG(t),XVe(t),oV(t);const n={...Vln,...Hcn};Object.entries(n).forEach(([r,i])=>{const o=(i==null?void 0:i.name)||r;(o&&i&&typeof i=="object"&&("render"in i||"setup"in i)||o&&typeof i=="function")&&e.component(o,i)})}},Wcn=Object.freeze(Object.defineProperty({__proto__:null,ArboUIPlugin:zcn},Symbol.toStringTag,{value:"Module"})),qcn={install:e=>{Promise.resolve().then(()=>Wcn).then(({ArboUIPlugin:t})=>{e.use(t)})}},Gcn=(e,t)=>{const n=o=>t._s.get(o),r=(o,a,s)=>{const l=n(o);return l&&a in l?(l[a](s),!0):(console.warn(`[initWebScene] Store "${o}" or dispactcher "${a}" not found`),!1)};function i(o){var a,s;(s=(a=e==null?void 0:e.config)==null?void 0:a.globalProperties)==null||s.setStoreValue("scene","setCurrentSceneTabId",o)}return e.config.globalProperties.setStoreValue=r,e.config.globalProperties.handleSetTab=i,{handleSetTab:i}},Kcn="0.26.5-alpha.49",Ycn={"@arbocollab/arbo-chart-component":"1.0.1","@arbocollab/arbo-comment-utils":"1.0.1","@arbocollab/arbo-common-utils":"npm:@arbocollab/arbo-common-utils@0.0.12-alpha.0","@arbocollab/arbo-media-player-component":"0.0.13","@arbocollab/arbo-table-component":"1.0.1","@arbocollab/arbo-ui-components":"npm:@arbocollab/arbo-ui-components-beta@0.0.376-alpha.109","@arbocollab/arbo-calendar-component":"0.0.38","@arbocollab/arbo-metric-table":"npm:@arbocollab/arbo-metric-table@0.0.24","@arbocollab/ag-grid-ui-components":"0.0.43","@vueuse/core":"^10.11.1","@ctrl/tinycolor":"^4.2.0",axios:"^1.7.2","date-fns":"^4.1.0","date-fns-tz":"^3.2.0",dayjs:"^1.11.11",dexie:"4.0.10","js-cookie":"^3.0.5",pinia:"^3.0.3","prettier-plugin-stylus":"^0.1.0","sanitize-html":"^2.15.0","vite-bundle-visualizer":"^1.2.1","vite-plugin-html":"^3.2.2",vue:"^3.5.18","vue-draggable-next":"^2.2.1","vue-i18n":"^9.13.1","vue-router":"^4.5.1","vue-virtual-scroller":"^2.0.0-beta.8"};var $i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function PV(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zcn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var n8e={exports:{}};(function(e,t){(function(n,r){e.exports=r()})($i,function(){/*! *****************************************************************************
202
+ */const Ecn="9.14.5";function xcn(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(fC().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(fC().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(fC().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(fC().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(fC().__INTLIFY_PROD_DEVTOOLS__=!1)}const q5e=Zp.__EXTEND_POINT__,pC=zG(q5e),Pm={FALLBACK_TO_ROOT:q5e,NOT_SUPPORTED_PRESERVE:pC(),NOT_SUPPORTED_FORMATTER:pC(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:pC(),NOT_SUPPORTED_GET_CHOICE_INDEX:pC(),COMPONENT_NAME_LEGACY_COMPATIBLE:pC(),NOT_FOUND_PARENT_SCOPE:pC(),IGNORE_OBJ_FLATTEN:pC(),NOTICE_DROP_ALLOW_COMPOSITION:pC(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:pC()},Tcn={[Pm.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Pm.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Pm.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Pm.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Pm.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Pm.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Pm.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Pm.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Pm.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see šŸ‘‰ https://tinyurl.com/2p97mcze",[Pm.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function QG(e,...t){return Pde(Tcn[e],...t)}const G5e=$f.__EXTEND_POINT__,Mm=zG(G5e),rc={UNEXPECTED_RETURN_TYPE:G5e,INVALID_ARGUMENT:Mm(),MUST_BE_CALL_SETUP_TOP:Mm(),NOT_INSTALLED:Mm(),NOT_AVAILABLE_IN_LEGACY_MODE:Mm(),REQUIRED_VALUE:Mm(),INVALID_VALUE:Mm(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:Mm(),NOT_INSTALLED_WITH_PROVIDE:Mm(),UNEXPECTED_ERROR:Mm(),NOT_COMPATIBLE_LEGACY_VUE_I18N:Mm(),BRIDGE_SUPPORT_VUE_2_ONLY:Mm(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:Mm(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:Mm(),__EXTEND_POINT__:Mm()};function Gx(e,...t){return U$(e,null,Ue.env.NODE_ENV!=="production"?{messages:kcn,args:t}:void 0)}const kcn={[rc.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[rc.INVALID_ARGUMENT]:"Invalid argument",[rc.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[rc.NOT_INSTALLED]:"Need to install with `app.use` function",[rc.UNEXPECTED_ERROR]:"Unexpected error",[rc.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[rc.REQUIRED_VALUE]:"Required in value: {0}",[rc.INVALID_VALUE]:"Invalid value",[rc.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[rc.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[rc.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[rc.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[rc.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ā€˜i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[rc.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},qde=dC("__translateVNode"),Gde=dC("__datetimeParts"),Kde=dC("__numberParts"),Yde=dC("__enableEmitter"),Zde=dC("__disableEmitter"),Dcn=dC("__setPluralRules"),K5e=dC("__injectWithOption"),Xde=dC("__dispose");function $V(e){if(!Ua(e)||N0(e))return e;for(const t in e)if(P0(e,t))if(!t.includes("."))Ua(e[t])&&$V(e[t]);else{const n=t.split("."),r=n.length-1;let i=e,o=!1;for(let a=0;a<r;a++){if(n[a]==="__proto__")throw new Error(`unsafe key: ${n[a]}`);if(n[a]in i||(i[n[a]]=cl()),!Ua(i[n[a]])){Ue.env.NODE_ENV!=="production"&&B_(QG(Pm.IGNORE_OBJ_FLATTEN,{key:n[a]})),o=!0;break}i=i[n[a]]}if(o||(N0(i)?d5e.includes(n[r])||delete e[t]:(i[n[r]]=e[t],delete e[t])),!N0(i)){const a=i[n[r]];Ua(a)&&$V(a)}}return e}function Jde(e,t){const{messages:n,__i18n:r,messageResolver:i,flatJson:o}=t,a=xa(n)?n:kd(r)?cl():{[e]:cl()};if(kd(r)&&r.forEach(s=>{if("locale"in s&&"resource"in s){const{locale:l,resource:u}=s;l?(a[l]=a[l]||cl(),qG(u,a[l])):qG(u,a)}else Kr(s)&&qG(JSON.parse(s),a)}),i==null&&o)for(const s in a)P0(a,s)&&$V(a[s]);return a}function Acn(e){return e.type}function Ocn(e,t,n){let r=Ua(t.messages)?t.messages:cl();"__i18nGlobal"in n&&(r=Jde(e.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const i=Object.keys(r);i.length&&i.forEach(o=>{e.mergeLocaleMessage(o,r[o])});{if(Ua(t.datetimeFormats)){const o=Object.keys(t.datetimeFormats);o.length&&o.forEach(a=>{e.mergeDateTimeFormat(a,t.datetimeFormats[a])})}if(Ua(t.numberFormats)){const o=Object.keys(t.numberFormats);o.length&&o.forEach(a=>{e.mergeNumberFormat(a,t.numberFormats[a])})}}}function Y5e(e){return Me(yy,null,e,0)}const Z5e=()=>[],Icn=()=>!1;let X5e=0;function J5e(e){return(t,n,r,i)=>e(n,r,qi()||void 0,i)}function Rcn(e={},t){const{__root:n,__injectWithOption:r}=e,i=n===void 0,o=e.flatJson,a=cC?K:km,s=!!e.translateExistCompatible;Ue.env.NODE_ENV!=="production"&&s&&HUe(QG(Pm.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let l=Ol(e.inheritLocale)?e.inheritLocale:!0;const u=a(n&&l?n.locale.value:Kr(e.locale)?e.locale:IV),c=a(n&&l?n.fallbackLocale.value:Kr(e.fallbackLocale)||kd(e.fallbackLocale)||xa(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:u.value),d=a(Jde(u.value,e)),h=a(xa(e.datetimeFormats)?e.datetimeFormats:{[u.value]:{}}),f=a(xa(e.numberFormats)?e.numberFormats:{[u.value]:{}});let g=n?n.missingWarn:Ol(e.missingWarn)||V$(e.missingWarn)?e.missingWarn:!0,m=n?n.fallbackWarn:Ol(e.fallbackWarn)||V$(e.fallbackWarn)?e.fallbackWarn:!0,b=n?n.fallbackRoot:Ol(e.fallbackRoot)?e.fallbackRoot:!0,w=!!e.fallbackFormat,_=iu(e.missing)?e.missing:null,C=iu(e.missing)?J5e(e.missing):null,y=iu(e.postTranslation)?e.postTranslation:null,x=n?n.warnHtmlMessage:Ol(e.warnHtmlMessage)?e.warnHtmlMessage:!0,E=!!e.escapeParameter;const T=n?n.modifiers:xa(e.modifiers)?e.modifiers:{};let O=e.pluralRules||n&&n.pluralRules,A;A=(()=>{i&&x5e(null);const ht={version:Ecn,locale:u.value,fallbackLocale:c.value,messages:d.value,modifiers:T,pluralRules:O,missing:C===null?void 0:C,missingWarn:g,fallbackWarn:m,fallbackFormat:w,unresolving:!0,postTranslation:y===null?void 0:y,warnHtmlMessage:x,escapeParameter:E,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:"vue"}};ht.datetimeFormats=h.value,ht.numberFormats=f.value,ht.__datetimeFormatters=xa(A)?A.__datetimeFormatters:void 0,ht.__numberFormatters=xa(A)?A.__numberFormatters:void 0,Ue.env.NODE_ENV!=="production"&&(ht.__v_emitter=xa(A)?A.__v_emitter:void 0);const vt=hcn(ht);return i&&x5e(vt),vt})(),RV(A,u.value,c.value);function D(){return[u.value,c.value,d.value,h.value,f.value]}const R=q({get:()=>u.value,set:ht=>{u.value=ht,A.locale=u.value}}),N=q({get:()=>c.value,set:ht=>{c.value=ht,A.fallbackLocale=c.value,RV(A,u.value,ht)}}),$=q(()=>d.value),P=q(()=>h.value),B=q(()=>f.value);function F(){return iu(y)?y:null}function z(ht){y=ht,A.postTranslation=ht}function G(){return _}function ee(ht){ht!==null&&(C=J5e(ht)),_=ht,A.missing=C}function fe(ht,vt){return ht!=="translate"||!vt.resolvedMessage}const oe=(ht,vt,_t,kt,un,Cn)=>{D();let tn;try{Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=n?fcn():void 0),tn=ht(A)}finally{Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=void 0)}if(_t!=="translate exists"&&Rf(tn)&&tn===ZG||_t==="translate exists"&&!tn){const[ln,wn]=vt();if(Ue.env.NODE_ENV!=="production"&&n&&Kr(ln)&&fe(_t,wn)&&(b&&(JG(m,ln)||k5e(g,ln))&&B_(QG(Pm.FALLBACK_TO_ROOT,{key:ln,type:_t})),Ue.env.NODE_ENV!=="production")){const{__v_emitter:Q}=A;Q&&b&&Q.emit("fallback",{type:_t,key:ln,to:"global",groupId:`${_t}:${ln}`})}return n&&b?kt(n):un(ln)}else{if(Cn(tn))return tn;throw Gx(rc.UNEXPECTED_RETURN_TYPE)}};function U(...ht){return oe(vt=>Reflect.apply(M5e,null,[vt,...ht]),()=>Hde(...ht),"translate",vt=>Reflect.apply(vt.t,vt,[...ht]),vt=>vt,vt=>Kr(vt))}function L(...ht){const[vt,_t,kt]=ht;if(kt&&!Ua(kt))throw Gx(rc.INVALID_ARGUMENT);return U(vt,_t,Yh({resolvedMessage:!0},kt||{}))}function Y(...ht){return oe(vt=>Reflect.apply(V5e,null,[vt,...ht]),()=>zde(...ht),"datetime format",vt=>Reflect.apply(vt.d,vt,[...ht]),()=>XG,vt=>Kr(vt))}function ae(...ht){return oe(vt=>Reflect.apply(H5e,null,[vt,...ht]),()=>Wde(...ht),"number format",vt=>Reflect.apply(vt.n,vt,[...ht]),()=>XG,vt=>Kr(vt))}function Te(ht){return ht.map(vt=>Kr(vt)||Rf(vt)||Ol(vt)?Y5e(String(vt)):vt)}const ke={normalize:Te,interpolate:ht=>ht,type:"vnode"};function X(...ht){return oe(vt=>{let _t;const kt=vt;try{kt.processor=ke,_t=Reflect.apply(M5e,null,[kt,...ht])}finally{kt.processor=null}return _t},()=>Hde(...ht),"translate",vt=>vt[qde](...ht),vt=>[Y5e(vt)],vt=>kd(vt))}function J(...ht){return oe(vt=>Reflect.apply(H5e,null,[vt,...ht]),()=>Wde(...ht),"number format",vt=>vt[Kde](...ht),Z5e,vt=>Kr(vt)||kd(vt))}function $e(...ht){return oe(vt=>Reflect.apply(V5e,null,[vt,...ht]),()=>zde(...ht),"datetime format",vt=>vt[Gde](...ht),Z5e,vt=>Kr(vt)||kd(vt))}function pe(ht){O=ht,A.pluralRules=O}function He(ht,vt){return oe(()=>{if(!ht)return!1;const _t=Kr(vt)?vt:u.value,kt=Ae(_t),un=A.messageResolver(kt,ht);return s?un!=null:N0(un)||L0(un)||Kr(un)},()=>[ht],"translate exists",_t=>Reflect.apply(_t.te,_t,[ht,vt]),Icn,_t=>Ol(_t))}function Se(ht){let vt=null;const _t=v5e(A,c.value,u.value);for(let kt=0;kt<_t.length;kt++){const un=d.value[_t[kt]]||{},Cn=A.messageResolver(un,ht);if(Cn!=null){vt=Cn;break}}return vt}function Ie(ht){return Se(ht)??(n?n.tm(ht)||{}:{})}function Ae(ht){return d.value[ht]||{}}function Je(ht,vt){if(o){const _t={[ht]:vt};for(const kt in _t)P0(_t,kt)&&$V(_t[kt]);vt=_t[ht]}d.value[ht]=vt,A.messages=d.value}function et(ht,vt){d.value[ht]=d.value[ht]||{};const _t={[ht]:vt};if(o)for(const kt in _t)P0(_t,kt)&&$V(_t[kt]);vt=_t[ht],qG(vt,d.value[ht]),A.messages=d.value}function Ve(ht){return h.value[ht]||{}}function Ye(ht,vt){h.value[ht]=vt,A.datetimeFormats=h.value,j5e(A,ht,vt)}function ce(ht,vt){h.value[ht]=Yh(h.value[ht]||{},vt),A.datetimeFormats=h.value,j5e(A,ht,vt)}function Ee(ht){return f.value[ht]||{}}function rt(ht,vt){f.value[ht]=vt,A.numberFormats=f.value,W5e(A,ht,vt)}function ze(ht,vt){f.value[ht]=Yh(f.value[ht]||{},vt),A.numberFormats=f.value,W5e(A,ht,vt)}X5e++,n&&cC&&(gt(n.locale,ht=>{l&&(u.value=ht,A.locale=ht,RV(A,u.value,c.value))}),gt(n.fallbackLocale,ht=>{l&&(c.value=ht,A.fallbackLocale=ht,RV(A,u.value,c.value))}));const nt={id:X5e,locale:R,fallbackLocale:N,get inheritLocale(){return l},set inheritLocale(ht){l=ht,ht&&n&&(u.value=n.locale.value,c.value=n.fallbackLocale.value,RV(A,u.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:$,get modifiers(){return T},get pluralRules(){return O||{}},get isGlobal(){return i},get missingWarn(){return g},set missingWarn(ht){g=ht,A.missingWarn=g},get fallbackWarn(){return m},set fallbackWarn(ht){m=ht,A.fallbackWarn=m},get fallbackRoot(){return b},set fallbackRoot(ht){b=ht},get fallbackFormat(){return w},set fallbackFormat(ht){w=ht,A.fallbackFormat=w},get warnHtmlMessage(){return x},set warnHtmlMessage(ht){x=ht,A.warnHtmlMessage=ht},get escapeParameter(){return E},set escapeParameter(ht){E=ht,A.escapeParameter=ht},t:U,getLocaleMessage:Ae,setLocaleMessage:Je,mergeLocaleMessage:et,getPostTranslationHandler:F,setPostTranslationHandler:z,getMissingHandler:G,setMissingHandler:ee,[Dcn]:pe};return nt.datetimeFormats=P,nt.numberFormats=B,nt.rt=L,nt.te=He,nt.tm=Ie,nt.d=Y,nt.n=ae,nt.getDateTimeFormat=Ve,nt.setDateTimeFormat=Ye,nt.mergeDateTimeFormat=ce,nt.getNumberFormat=Ee,nt.setNumberFormat=rt,nt.mergeNumberFormat=ze,nt[K5e]=r,nt[qde]=X,nt[Gde]=$e,nt[Kde]=J,Ue.env.NODE_ENV!=="production"&&(nt[Yde]=ht=>{A.__v_emitter=ht},nt[Zde]=()=>{A.__v_emitter=void 0}),nt}const Qde={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e==="parent"||e==="global",default:"parent"},i18n:{type:Object}};function $cn({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((n,r)=>[...n,...r.type===Ht?r.children:[r]],[]):t.reduce((n,r)=>{const i=e[r];return i&&(n[r]=i()),n},cl())}function Q5e(e){return Ht}Yh({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>Rf(e)||!isNaN(e)}},Qde);function Pcn(e){return kd(e)&&!Kr(e[0])}function e8e(e,t,n,r){const{slots:i,attrs:o}=t;return()=>{const a={part:!0};let s=cl();e.locale&&(a.locale=e.locale),Kr(e.format)?a.key=e.format:Ua(e.format)&&(Kr(e.format.key)&&(a.key=e.format.key),s=Object.keys(e.format).reduce((h,f)=>n.includes(f)?Yh(cl(),h,{[f]:e.format[f]}):h,cl()));const l=r(e.value,a,s);let u=[a.key];kd(l)?u=l.map((h,f)=>{const g=i[h.type],m=g?g({[h.type]:h.value,index:f,parts:l}):[h.value];return Pcn(m)&&(m[0].key=`${h.type}-${f}`),m}):Kr(l)&&(u=[l]);const c=Yh(cl(),o),d=Kr(e.tag)||Ua(e.tag)?e.tag:Q5e();return Qs(d,c,u)}}Yh({value:{type:Number,required:!0},format:{type:[String,Object]}},Qde),Yh({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Qde);function t8e(e,t){}const Mcn=dC("global-vue-i18n");function efe(e={}){const t=qi();if(t==null)throw Gx(rc.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw Gx(rc.NOT_INSTALLED);const n=Ncn(t),r=Fcn(n),i=Acn(t),o=Lcn(e,i);if(__VUE_I18N_LEGACY_API__&&n.mode==="legacy"&&!e.__useComponent){if(!n.allowComposition)throw Gx(rc.NOT_AVAILABLE_IN_LEGACY_MODE);return jcn(t,o,r,e)}if(o==="global")return Ocn(r,e,i),r;if(o==="parent"){let l=Bcn(n,t,e.__useComponent);return l==null&&(Ue.env.NODE_ENV!=="production"&&B_(QG(Pm.NOT_FOUND_PARENT_SCOPE)),l=r),l}const a=n;let s=a.__getInstance(t);if(s==null){const l=Yh({},e);"__i18n"in i&&(l.__i18n=i.__i18n),r&&(l.__root=r),s=Rcn(l),a.__composerExtend&&(s[Xde]=a.__composerExtend(s)),Ucn(a,t,s),a.__setInstance(t,s)}return s}function Ncn(e){{const t=Io(e.isCE?Mcn:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw Gx(e.isCE?rc.NOT_INSTALLED_WITH_PROVIDE:rc.UNEXPECTED_ERROR);return t}}function Lcn(e,t){return HG(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}function Fcn(e){return e.mode==="composition"?e.global:e.global.__composer}function Bcn(e,t,n=!1){let r=null;const i=t.root;let o=Vcn(t,n);for(;o!=null;){const a=e;if(e.mode==="composition")r=a.__getInstance(o);else if(__VUE_I18N_LEGACY_API__){const s=a.__getInstance(o);s!=null&&(r=s.__composer,n&&r&&!r[K5e]&&(r=null))}if(r!=null||i===o)break;o=o.parent}return r}function Vcn(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function Ucn(e,t,n){let r=null;yn(()=>{if(Ue.env.NODE_ENV!=="production"&&t.vnode.el){t.vnode.el.__VUE_I18N__=n,r=Jln();const i=n;i[Yde]&&i[Yde](r),r.on("*",t8e)}},t),kl(()=>{const i=n;Ue.env.NODE_ENV!=="production"&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&(r&&r.off("*",t8e),i[Zde]&&i[Zde](),delete t.vnode.el.__VUE_I18N__),e.__deleteInstance(t);const o=i[Xde];o&&(o(),delete i[Xde])},t)}function jcn(e,t,n,r={}){const i=t==="local",o=km(null);if(i&&e.proxy&&!(e.proxy.$options.i18n||e.proxy.$options.__i18n))throw Gx(rc.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);const a=Ol(r.inheritLocale)?r.inheritLocale:!Kr(r.locale),s=K(!i||a?n.locale.value:Kr(r.locale)?r.locale:IV),l=K(!i||a?n.fallbackLocale.value:Kr(r.fallbackLocale)||kd(r.fallbackLocale)||xa(r.fallbackLocale)||r.fallbackLocale===!1?r.fallbackLocale:s.value),u=K(Jde(s.value,r)),c=K(xa(r.datetimeFormats)?r.datetimeFormats:{[s.value]:{}}),d=K(xa(r.numberFormats)?r.numberFormats:{[s.value]:{}}),h=i?n.missingWarn:Ol(r.missingWarn)||V$(r.missingWarn)?r.missingWarn:!0,f=i?n.fallbackWarn:Ol(r.fallbackWarn)||V$(r.fallbackWarn)?r.fallbackWarn:!0,g=i?n.fallbackRoot:Ol(r.fallbackRoot)?r.fallbackRoot:!0,m=!!r.fallbackFormat,b=iu(r.missing)?r.missing:null,w=iu(r.postTranslation)?r.postTranslation:null,_=i?n.warnHtmlMessage:Ol(r.warnHtmlMessage)?r.warnHtmlMessage:!0,C=!!r.escapeParameter,y=i?n.modifiers:xa(r.modifiers)?r.modifiers:{},x=r.pluralRules||i&&n.pluralRules;function E(){return[s.value,l.value,u.value,c.value,d.value]}const T=q({get:()=>o.value?o.value.locale.value:s.value,set:Ie=>{o.value&&(o.value.locale.value=Ie),s.value=Ie}}),O=q({get:()=>o.value?o.value.fallbackLocale.value:l.value,set:Ie=>{o.value&&(o.value.fallbackLocale.value=Ie),l.value=Ie}}),A=q(()=>o.value?o.value.messages.value:u.value),D=q(()=>c.value),R=q(()=>d.value);function N(){return o.value?o.value.getPostTranslationHandler():w}function $(Ie){o.value&&o.value.setPostTranslationHandler(Ie)}function P(){return o.value?o.value.getMissingHandler():b}function B(Ie){o.value&&o.value.setMissingHandler(Ie)}function F(Ie){return E(),Ie()}function z(...Ie){return o.value?F(()=>Reflect.apply(o.value.t,null,[...Ie])):F(()=>"")}function G(...Ie){return o.value?Reflect.apply(o.value.rt,null,[...Ie]):""}function ee(...Ie){return o.value?F(()=>Reflect.apply(o.value.d,null,[...Ie])):F(()=>"")}function fe(...Ie){return o.value?F(()=>Reflect.apply(o.value.n,null,[...Ie])):F(()=>"")}function oe(Ie){return o.value?o.value.tm(Ie):{}}function U(Ie,Ae){return o.value?o.value.te(Ie,Ae):!1}function L(Ie){return o.value?o.value.getLocaleMessage(Ie):{}}function Y(Ie,Ae){o.value&&(o.value.setLocaleMessage(Ie,Ae),u.value[Ie]=Ae)}function ae(Ie,Ae){o.value&&o.value.mergeLocaleMessage(Ie,Ae)}function Te(Ie){return o.value?o.value.getDateTimeFormat(Ie):{}}function ke(Ie,Ae){o.value&&(o.value.setDateTimeFormat(Ie,Ae),c.value[Ie]=Ae)}function X(Ie,Ae){o.value&&o.value.mergeDateTimeFormat(Ie,Ae)}function J(Ie){return o.value?o.value.getNumberFormat(Ie):{}}function $e(Ie,Ae){o.value&&(o.value.setNumberFormat(Ie,Ae),d.value[Ie]=Ae)}function pe(Ie,Ae){o.value&&o.value.mergeNumberFormat(Ie,Ae)}const He={get id(){return o.value?o.value.id:-1},locale:T,fallbackLocale:O,messages:A,datetimeFormats:D,numberFormats:R,get inheritLocale(){return o.value?o.value.inheritLocale:a},set inheritLocale(Ie){o.value&&(o.value.inheritLocale=Ie)},get availableLocales(){return o.value?o.value.availableLocales:Object.keys(u.value)},get modifiers(){return o.value?o.value.modifiers:y},get pluralRules(){return o.value?o.value.pluralRules:x},get isGlobal(){return o.value?o.value.isGlobal:!1},get missingWarn(){return o.value?o.value.missingWarn:h},set missingWarn(Ie){o.value&&(o.value.missingWarn=Ie)},get fallbackWarn(){return o.value?o.value.fallbackWarn:f},set fallbackWarn(Ie){o.value&&(o.value.missingWarn=Ie)},get fallbackRoot(){return o.value?o.value.fallbackRoot:g},set fallbackRoot(Ie){o.value&&(o.value.fallbackRoot=Ie)},get fallbackFormat(){return o.value?o.value.fallbackFormat:m},set fallbackFormat(Ie){o.value&&(o.value.fallbackFormat=Ie)},get warnHtmlMessage(){return o.value?o.value.warnHtmlMessage:_},set warnHtmlMessage(Ie){o.value&&(o.value.warnHtmlMessage=Ie)},get escapeParameter(){return o.value?o.value.escapeParameter:C},set escapeParameter(Ie){o.value&&(o.value.escapeParameter=Ie)},t:z,getPostTranslationHandler:N,setPostTranslationHandler:$,getMissingHandler:P,setMissingHandler:B,rt:G,d:ee,n:fe,tm:oe,te:U,getLocaleMessage:L,setLocaleMessage:Y,mergeLocaleMessage:ae,getDateTimeFormat:Te,setDateTimeFormat:ke,mergeDateTimeFormat:X,getNumberFormat:J,setNumberFormat:$e,mergeNumberFormat:pe};function Se(Ie){Ie.locale.value=s.value,Ie.fallbackLocale.value=l.value,Object.keys(u.value).forEach(Ae=>{Ie.mergeLocaleMessage(Ae,u.value[Ae])}),Object.keys(c.value).forEach(Ae=>{Ie.mergeDateTimeFormat(Ae,c.value[Ae])}),Object.keys(d.value).forEach(Ae=>{Ie.mergeNumberFormat(Ae,d.value[Ae])}),Ie.escapeParameter=C,Ie.fallbackFormat=m,Ie.fallbackRoot=g,Ie.fallbackWarn=f,Ie.missingWarn=h,Ie.warnHtmlMessage=_}return ds(()=>{if(e.proxy==null||e.proxy.$i18n==null)throw Gx(rc.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const Ie=o.value=e.proxy.$i18n.__composer;t==="global"?(s.value=Ie.locale.value,l.value=Ie.fallbackLocale.value,u.value=Ie.messages.value,c.value=Ie.datetimeFormats.value,d.value=Ie.numberFormats.value):i&&Se(Ie)}),He}if(xcn(),__INTLIFY_JIT_COMPILATION__?_5e(ycn):_5e(vcn),ccn(zun),dcn(v5e),Ue.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const e=fC();e.__INTLIFY__=!0,Qun(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}Ue.env.NODE_ENV;const Hcn={EmptyData:$Ue,HeaderWrapper:MUe,Checkbox:_G,CreateNewScene:NUe,FileUploader:LUe,FilterBox:BUe,RatingRenderer:VUe,Switch:$de,CloseBadgeWrapper:xA,MetricEditorDropdown:sG,MetricEditorInput:lG,ClearButton:UUe},zcn={install(e){let t=BZt();t||(t=rXt(),e.use(t)),TG(t),PUe(t),Uce(t),wG(t),jG(t),XVe(t),oV(t);const n={...Vln,...Hcn};Object.entries(n).forEach(([r,i])=>{const o=(i==null?void 0:i.name)||r;(o&&i&&typeof i=="object"&&("render"in i||"setup"in i)||o&&typeof i=="function")&&e.component(o,i)})}},Wcn=Object.freeze(Object.defineProperty({__proto__:null,ArboUIPlugin:zcn},Symbol.toStringTag,{value:"Module"})),qcn={install:e=>{Promise.resolve().then(()=>Wcn).then(({ArboUIPlugin:t})=>{e.use(t)})}},Gcn=(e,t)=>{const n=o=>t._s.get(o),r=(o,a,s)=>{const l=n(o);return l&&a in l?(l[a](s),!0):(console.warn(`[initWebScene] Store "${o}" or dispactcher "${a}" not found`),!1)};function i(o){var a,s;(s=(a=e==null?void 0:e.config)==null?void 0:a.globalProperties)==null||s.setStoreValue("scene","setCurrentSceneTabId",o)}return e.config.globalProperties.setStoreValue=r,e.config.globalProperties.handleSetTab=i,{handleSetTab:i}},Kcn="0.26.5-alpha.50",Ycn={"@arbocollab/arbo-chart-component":"1.0.1","@arbocollab/arbo-comment-utils":"1.0.1","@arbocollab/arbo-common-utils":"npm:@arbocollab/arbo-common-utils@0.0.12-alpha.0","@arbocollab/arbo-media-player-component":"0.0.14","@arbocollab/arbo-table-component":"1.0.1","@arbocollab/arbo-ui-components":"npm:@arbocollab/arbo-ui-components-beta@0.0.376-alpha.109","@arbocollab/arbo-calendar-component":"0.0.38","@arbocollab/arbo-metric-table":"npm:@arbocollab/arbo-metric-table@0.0.24","@arbocollab/ag-grid-ui-components":"0.0.43","@vueuse/core":"^10.11.1","@ctrl/tinycolor":"^4.2.0",axios:"^1.7.2","date-fns":"^4.1.0","date-fns-tz":"^3.2.0",dayjs:"^1.11.11",dexie:"4.0.10","js-cookie":"^3.0.5",pinia:"^3.0.3","prettier-plugin-stylus":"^0.1.0","sanitize-html":"^2.15.0","vite-bundle-visualizer":"^1.2.1","vite-plugin-html":"^3.2.2",vue:"^3.5.18","vue-draggable-next":"^2.2.1","vue-i18n":"^9.13.1","vue-router":"^4.5.1","vue-virtual-scroller":"^2.0.0-beta.8"};var $i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function PV(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zcn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var n8e={exports:{}};(function(e,t){(function(n,r){e.exports=r()})($i,function(){/*! *****************************************************************************
203
203
  Copyright (c) Microsoft Corporation.
204
204
  Permission to use, copy, modify, and/or distribute this software for any
205
205
  purpose with or without fee is hereby granted.
@@ -1149,7 +1149,7 @@ ${v4(t)}`),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),
1149
1149
  `.split("").map(e=>e.charCodeAt(0)));class Kvi extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Yvi extends LOe{constructor(t,n={}){super(t,n),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=t.featuresNativeTextTracks,this.loadVttJs=t.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return zf();const t=this.subtitlesTrack_.cues,n=t[0].startTime,r=t[t.length-1].startTime;return zf([[n,r]])}initSegmentForMap(t,n=!1){if(!t)return null;const r=fae(t);let i=this.initSegments_[r];if(n&&!i&&t.bytes){const o=YMt.byteLength+t.bytes.byteLength,a=new Uint8Array(o);a.set(t.bytes),a.set(YMt,t.bytes.byteLength),this.initSegments_[r]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:a}}return i||t}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(t){return typeof t>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=t,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(t,n){UW(t,n,this.subtitlesTrack_)}fillBuffer_(){const t=this.chooseNextRequest_();if(t){if(this.syncController_.timestampOffsetForTimeline(t.timeline)===null){const n=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",n),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(t)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(t){for(;t&&t.segment.empty;){if(t.mediaIndex+1>=t.playlist.segments.length){t=null;break}t=this.generateSegmentInfo_({playlist:t.playlist,mediaIndex:t.mediaIndex+1,startOfSegment:t.startOfSegment+t.duration,isSyncRequest:t.isSyncRequest})}return t}stopForError(t){this.error(t),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(t,n,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(n.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(t){t.code===IS.TIMEOUT&&this.handleTimeout_(),t.code===IS.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(t);return}const i=this.pendingSegment_,o=r.mp4VttCues&&r.mp4VttCues.length;o&&(i.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(i.duration,n.stats),n.key&&this.segmentKey(n.key,!0),this.state="APPENDING",this.trigger("appending");const a=i.segment;if(a.map&&(a.map.bytes=n.map.bytes),i.bytes=n.bytes,typeof Ft.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(t,n,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(i)}catch(s){this.stopForError({message:s.message,metadata:{errorType:mn.Error.StreamingVttParserError,error:s}});return}if(o||this.updateTimeMapping_(i,this.syncController_.timelines[i.timeline],this.playlist_),i.cues.length?i.timingInfo={start:i.cues[0].startTime,end:i.cues[i.cues.length-1].endTime}:i.timingInfo={start:i.startOfSegment,end:i.startOfSegment+i.duration},i.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}i.byteLength=i.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,i.cues.forEach(s=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new Ft.VTTCue(s.startTime,s.endTime,s.text):s)}),Ivi(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(t,n){const r=t&&t.type==="vtt",i=n&&n.type==="text";r&&i&&super.handleData_(t,n)}updateTimingInfoEnd_(){}parseMp4VttCues_(t){const n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();t.mp4VttCues.forEach(r=>{const i=r.start+n,o=r.end+n,a=new Ft.VTTCue(i,o,r.cueText);r.settings&&r.settings.split(" ").forEach(s=>{const l=s.split(":"),u=l[0],c=l[1];a[u]=isNaN(c)?c:Number(c)}),t.cues.push(a)})}parseVTTCues_(t){let n,r=!1;if(typeof Ft.WebVTT!="function")throw new Kvi;if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},t.mp4VttCues){this.parseMp4VttCues_(t);return}typeof Ft.TextDecoder=="function"?n=new Ft.TextDecoder("utf8"):(n=Ft.WebVTT.StringDecoder(),r=!0);const i=new Ft.WebVTT.Parser(Ft,Ft.vttjs,n);if(i.oncue=t.cues.push.bind(t.cues),i.ontimestampmap=a=>{t.timestampmap=a},i.onparsingerror=a=>{mn.log.warn("Error encountered when parsing cues: "+a.message)},t.segment.map){let a=t.segment.map.bytes;r&&(a=KMt(a)),i.parse(a)}let o=t.bytes;r&&(o=KMt(o)),i.parse(o),i.flush()}updateTimeMapping_(t,n,r){const i=t.segment;if(!n)return;if(!t.cues.length){i.empty=!0;return}const{MPEGTS:o,LOCAL:a}=t.timestampmap,l=o/XI.ONE_SECOND_IN_TS-a+n.mapping;if(t.cues.forEach(u=>{const c=u.endTime-u.startTime,d=this.handleRollover_(u.startTime+l,n.time);u.startTime=Math.max(d,0),u.endTime=Math.max(d+c,0)}),!r.syncInfo){const u=t.cues[0].startTime,c=t.cues[t.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+t.mediaIndex,time:Math.min(u,c-i.duration)}}}handleRollover_(t,n){if(n===null)return t;let r=t*XI.ONE_SECOND_IN_TS;const i=n*XI.ONE_SECOND_IN_TS;let o;for(i<r?o=-8589934592:o=8589934592;Math.abs(r-i)>4294967296;)r+=o;return r/XI.ONE_SECOND_IN_TS}}const Zvi=function(e,t){const n=e.cues;for(let r=0;r<n.length;r++){const i=n[r];if(t>=i.adStartTime&&t<=i.adEndTime)return i}return null},Xvi=function(e,t,n=0){if(!e.segments)return;let r=n,i;for(let o=0;o<e.segments.length;o++){const a=e.segments[o];if(i||(i=Zvi(t,r+a.duration/2)),i){if("cueIn"in a){i.endTime=r,i.adEndTime=r,r+=a.duration,i=null;continue}if(r<i.endTime){r+=a.duration;continue}i.endTime+=a.duration}else if("cueOut"in a&&(i=new Ft.VTTCue(r,r+a.duration,a.cueOut),i.adStartTime=r,i.adEndTime=r+parseFloat(a.cueOut),t.addCue(i)),"cueOutCont"in a){const[s,l]=a.cueOutCont.split("/").map(parseFloat);i=new Ft.VTTCue(r,r+a.duration,""),i.adStartTime=r-s,i.adEndTime=i.adStartTime+l,t.addCue(i)}r+=a.duration}};class ZMt{constructor({start:t,end:n,segmentIndex:r,partIndex:i=null,appended:o=!1}){this.start_=t,this.end_=n,this.segmentIndex_=r,this.partIndex_=i,this.appended_=o}isInRange(t){return t>=this.start&&t<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class Jvi{constructor(t,n=[]){this.segmentSyncInfo_=t,this.partsSyncInfo_=n}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(t=>t.resetAppendedStatus())}}class XMt{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(t=>t.resetAppendStatus())}update(t,n){const{mediaSequence:r,segments:i}=t;if(this.isReliable_=this.isReliablePlaylist_(r,i),!!this.isReliable_)return this.updateStorage_(i,r,this.calculateBaseTime_(r,i,n))}getSyncInfoForTime(t){for(const{segmentSyncInfo:n,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const i of r)if(i.isInRange(t))return i}else if(n.isInRange(t))return n;return null}getSyncInfoForMediaSequence(t){return this.storage_.get(t)}updateStorage_(t,n,r){const i=new Map;let o=`
1150
1150
  `,a=r,s=n;this.start_=a,t.forEach((l,u)=>{const c=this.storage_.get(s),d=a,h=d+l.duration,f=!!(c&&c.segmentSyncInfo&&c.segmentSyncInfo.isAppended),g=new ZMt({start:d,end:h,appended:f,segmentIndex:u});l.syncInfo=g;let m=a;const b=(l.parts||[]).map((w,_)=>{const C=m,y=m+w.duration,x=!!(c&&c.partsSyncInfo&&c.partsSyncInfo[_]&&c.partsSyncInfo[_].isAppended),E=new ZMt({start:C,end:y,appended:x,segmentIndex:u,partIndex:_});return m=y,o+=`Media Sequence: ${s}.${_} | Range: ${C} --> ${y} | Appended: ${x}
1151
1151
  `,w.syncInfo=E,E});i.set(s,new Jvi(g,b)),o+=`${BMt(l.resolvedUri)} | Media Sequence: ${s} | Range: ${d} --> ${h} | Appended: ${f}
1152
- `,s++,a=h}),this.end_=a,this.storage_=i,this.diagnostics_=o}calculateBaseTime_(t,n,r){if(!this.storage_.size)return 0;if(this.storage_.has(t))return this.storage_.get(t).segmentSyncInfo.start;const i=Math.min(...this.storage_.keys());if(t<i){const o=i-t;let a=this.storage_.get(i).segmentSyncInfo.start;for(let s=0;s<o;s++){const l=n[s];a-=l.duration}return a}return r}isReliablePlaylist_(t,n){return t!=null&&Array.isArray(n)&&n.length}}class JMt extends XMt{constructor(t){super(),this.parent_=t}calculateBaseTime_(t,n,r){if(!this.storage_.size){const i=this.parent_.getSyncInfoForMediaSequence(t);return i?i.segmentSyncInfo.start:0}return super.calculateBaseTime_(t,n,r)}}const Qvi=86400,BOe=[{name:"VOD",run:(e,t,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,n,r,i,o)=>{const a=e.getMediaSequenceSync(o);if(!a||!a.isReliable)return null;const s=a.getSyncInfoForTime(i);return s?{time:s.start,partIndex:s.partIndex,segmentIndex:s.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,n,r,i)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let o=null,a=null;const s=SOe(t);i=i||0;for(let l=0;l<s.length;l++){const u=t.endList||i===0?l:s.length-(l+1),c=s[u],d=c.segment,h=e.timelineToDatetimeMappings[d.timeline];if(!h||!d.dateTimeObject)continue;let g=d.dateTimeObject.getTime()/1e3+h;if(d.parts&&typeof c.partIndex=="number")for(let b=0;b<c.partIndex;b++)g+=d.parts[b].duration;const m=Math.abs(i-g);if(a!==null&&(m===0||a<m))break;a=m,o={time:g,segmentIndex:c.segmentIndex,partIndex:c.partIndex}}return o}},{name:"Segment",run:(e,t,n,r,i)=>{let o=null,a=null;i=i||0;const s=SOe(t);for(let l=0;l<s.length;l++){const u=t.endList||i===0?l:s.length-(l+1),c=s[u],d=c.segment,h=c.part&&c.part.start||d&&d.start;if(d.timeline===r&&typeof h<"u"){const f=Math.abs(i-h);if(a!==null&&a<f)break;(!o||a===null||a>=f)&&(a=f,o={time:h,segmentIndex:c.segmentIndex,partIndex:c.partIndex})}}return o}},{name:"Discontinuity",run:(e,t,n,r,i)=>{let o=null;if(i=i||0,t.discontinuityStarts&&t.discontinuityStarts.length){let a=null;for(let s=0;s<t.discontinuityStarts.length;s++){const l=t.discontinuityStarts[s],u=t.discontinuitySequence+s+1,c=e.discontinuities[u];if(c){const d=Math.abs(i-c.time);if(a!==null&&a<d)break;(!o||a===null||a>=d)&&(a=d,o={time:c.time,segmentIndex:l,partIndex:null})}}}return o}},{name:"Playlist",run:(e,t,n,r,i)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class eyi extends mn.EventTarget{constructor(t={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const n=new XMt,r=new JMt(n),i=new JMt(n);this.mediaSequenceStorage_={main:n,audio:r,vtt:i},this.logger_=l0("SyncController")}getMediaSequenceSync(t){return this.mediaSequenceStorage_[t]||null}getSyncPoint(t,n,r,i,o){if(n!==1/0)return BOe.find(({name:l})=>l==="VOD").run(this,t,n);const a=this.runStrategies_(t,n,r,i,o);if(!a.length)return null;for(const s of a){const{syncPoint:l,strategy:u}=s,{segmentIndex:c,time:d}=l;if(c<0)continue;const h=t.segments[c],f=d,g=f+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${c}. Time: [${f} -> ${g}]}`),i>=f&&i<g)return this.logger_("Found sync point with exact match: ",l),l}return this.selectSyncPoint_(a,{key:"time",value:i})}getExpiredTime(t,n){if(!t||!t.segments)return null;const r=this.runStrategies_(t,n,t.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+LW({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(t,n,r,i,o){const a=[];for(let s=0;s<BOe.length;s++){const l=BOe[s],u=l.run(this,t,n,r,i,o);u&&(u.strategy=l.name,a.push({strategy:l.name,syncPoint:u}))}return a}selectSyncPoint_(t,n){let r=t[0].syncPoint,i=Math.abs(t[0].syncPoint[n.key]-n.value),o=t[0].strategy;for(let a=1;a<t.length;a++){const s=Math.abs(t[a].syncPoint[n.key]-n.value);s<i&&(i=s,r=t[a].syncPoint,o=t[a].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${o}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(t,n){const r=n.mediaSequence-t.mediaSequence;if(r>Qvi){mn.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const o=t.segments[i];if(o&&typeof o.start<"u"){n.syncInfo={mediaSequence:t.mediaSequence+i,time:o.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(t){if(this.timelineToDatetimeMappings={},t.segments&&t.segments.length&&t.segments[0].dateTimeObject){const n=t.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(t,t.timingInfo,n),i=t.segment;r&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:i.start}));const o=i.dateTimeObject;i.discontinuity&&n&&o&&(this.timelineToDatetimeMappings[i.timeline]=-(o.getTime()/1e3))}timestampOffsetForTimeline(t){return typeof this.timelines[t]>"u"?null:this.timelines[t].time}mappingForTimeline(t){return typeof this.timelines[t]>"u"?null:this.timelines[t].mapping}calculateSegmentTimeMapping_(t,n,r){const i=t.segment,o=t.part;let a=this.timelines[t.timeline],s,l;if(typeof t.timestampOffset=="number")a={time:t.startOfSegment,mapping:t.startOfSegment-n.start},r&&(this.timelines[t.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${t.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),s=t.startOfSegment,l=n.end+a.mapping;else if(a)s=n.start+a.mapping,l=n.end+a.mapping;else return!1;return o&&(o.start=s,o.end=l),(!i.start||s<i.start)&&(i.start=s),i.end=l,!0}saveDiscontinuitySyncInfo_(t){const n=t.playlist,r=t.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const o=n.discontinuityStarts[i],a=n.discontinuitySequence+i+1,s=o-t.mediaIndex,l=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>l){let u;s<0?u=r.start-LW({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:t.mediaIndex,endIndex:o}):u=r.end+LW({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:t.mediaIndex+1,endIndex:o}),this.discontinuities[a]={time:u,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class tyi extends mn.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(t){this.pendingTimelineChanges_[t]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:t,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[t]={type:t,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]}lastTimelineChange({type:t,from:n,to:r}){if(typeof n=="number"&&typeof r=="number"){this.lastTimelineChanges_[t]={type:t,from:n,to:r},delete this.pendingTimelineChanges_[t];const i={timelineChangeInfo:{from:n,to:r}};this.trigger({type:"timelinechange",metadata:i})}return this.lastTimelineChanges_[t]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const nyi=EMt(xMt(function(){var e=function(){function m(){this.listeners={}}var b=m.prototype;return b.on=function(_,C){this.listeners[_]||(this.listeners[_]=[]),this.listeners[_].push(C)},b.off=function(_,C){if(!this.listeners[_])return!1;var y=this.listeners[_].indexOf(C);return this.listeners[_]=this.listeners[_].slice(0),this.listeners[_].splice(y,1),y>-1},b.trigger=function(_){var C=this.listeners[_];if(C)if(arguments.length===2)for(var y=C.length,x=0;x<y;++x)C[x].call(this,arguments[1]);else for(var E=Array.prototype.slice.call(arguments,1),T=C.length,O=0;O<T;++O)C[O].apply(this,E)},b.dispose=function(){this.listeners={}},b.pipe=function(_){this.on("data",function(C){_.push(C)})},m}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function t(m){return m.subarray(0,m.byteLength-m[m.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const n=function(){const m=[[[],[],[],[],[]],[[],[],[],[],[]]],b=m[0],w=m[1],_=b[4],C=w[4];let y,x,E;const T=[],O=[];let A,D,R,N,$,P;for(y=0;y<256;y++)O[(T[y]=y<<1^(y>>7)*283)^y]=y;for(x=E=0;!_[x];x^=A||1,E=O[E]||1)for(N=E^E<<1^E<<2^E<<3^E<<4,N=N>>8^N&255^99,_[x]=N,C[N]=x,R=T[D=T[A=T[x]]],P=R*16843009^D*65537^A*257^x*16843008,$=T[N]*257^N*16843008,y=0;y<4;y++)b[y][x]=$=$<<24^$>>>8,w[y][N]=P=P<<24^P>>>8;for(y=0;y<5;y++)b[y]=b[y].slice(0),w[y]=w[y].slice(0);return m};let r=null;class i{constructor(b){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,_,C;const y=this._tables[0][4],x=this._tables[1],E=b.length;let T=1;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size");const O=b.slice(0),A=[];for(this._key=[O,A],w=E;w<4*E+28;w++)C=O[w-1],(w%E===0||E===8&&w%E===4)&&(C=y[C>>>24]<<24^y[C>>16&255]<<16^y[C>>8&255]<<8^y[C&255],w%E===0&&(C=C<<8^C>>>24^T<<24,T=T<<1^(T>>7)*283)),O[w]=O[w-E]^C;for(_=0;w;_++,w--)C=O[_&3?w:w-4],w<=4||_<4?A[_]=C:A[_]=x[0][y[C>>>24]]^x[1][y[C>>16&255]]^x[2][y[C>>8&255]]^x[3][y[C&255]]}decrypt(b,w,_,C,y,x){const E=this._key[1];let T=b^E[0],O=C^E[1],A=_^E[2],D=w^E[3],R,N,$;const P=E.length/4-2;let B,F=4;const z=this._tables[1],G=z[0],ee=z[1],fe=z[2],oe=z[3],U=z[4];for(B=0;B<P;B++)R=G[T>>>24]^ee[O>>16&255]^fe[A>>8&255]^oe[D&255]^E[F],N=G[O>>>24]^ee[A>>16&255]^fe[D>>8&255]^oe[T&255]^E[F+1],$=G[A>>>24]^ee[D>>16&255]^fe[T>>8&255]^oe[O&255]^E[F+2],D=G[D>>>24]^ee[T>>16&255]^fe[O>>8&255]^oe[A&255]^E[F+3],F+=4,T=R,O=N,A=$;for(B=0;B<4;B++)y[(3&-B)+x]=U[T>>>24]<<24^U[O>>16&255]<<16^U[A>>8&255]<<8^U[D&255]^E[F++],R=T,T=O,O=A,A=D,D=R}}class o extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(b){this.jobs.push(b),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(m){return m<<24|(m&65280)<<8|(m&16711680)>>8|m>>>24},s=function(m,b,w){const _=new Int32Array(m.buffer,m.byteOffset,m.byteLength>>2),C=new i(Array.prototype.slice.call(b)),y=new Uint8Array(m.byteLength),x=new Int32Array(y.buffer);let E,T,O,A,D,R,N,$,P;for(E=w[0],T=w[1],O=w[2],A=w[3],P=0;P<_.length;P+=4)D=a(_[P]),R=a(_[P+1]),N=a(_[P+2]),$=a(_[P+3]),C.decrypt(D,R,N,$,x,P),x[P]=a(x[P]^E),x[P+1]=a(x[P+1]^T),x[P+2]=a(x[P+2]^O),x[P+3]=a(x[P+3]^A),E=D,T=R,O=N,A=$;return y};class l{constructor(b,w,_,C){const y=l.STEP,x=new Int32Array(b.buffer),E=new Uint8Array(b.byteLength);let T=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(x.subarray(T,T+y),w,_,E)),T=y;T<x.length;T+=y)_=new Uint32Array([a(x[T-4]),a(x[T-3]),a(x[T-2]),a(x[T-1])]),this.asyncStream_.push(this.decryptChunk_(x.subarray(T,T+y),w,_,E));this.asyncStream_.push(function(){C(null,t(E))})}static get STEP(){return 32e3}decryptChunk_(b,w,_,C){return function(){const y=s(b,w,_);C.set(y,b.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c;typeof window<"u"?c=window:typeof u<"u"?c=u:typeof self<"u"?c=self:c={};var d=c,h=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},f=d.BigInt||Number;f("0x1"),f("0x100"),f("0x10000"),f("0x1000000"),f("0x100000000"),f("0x10000000000"),f("0x1000000000000"),f("0x100000000000000"),f("0x10000000000000000"),function(){var m=new Uint16Array([65484]),b=new Uint8Array(m.buffer,m.byteOffset,m.byteLength);return b[0]===255?"big":b[0]===204?"little":"unknown"}();const g=function(m){const b={};return Object.keys(m).forEach(w=>{const _=m[w];h(_)?b[w]={bytes:_.buffer,byteOffset:_.byteOffset,byteLength:_.byteLength}:b[w]=_}),b};self.onmessage=function(m){const b=m.data,w=new Uint8Array(b.encrypted.bytes,b.encrypted.byteOffset,b.encrypted.byteLength),_=new Uint32Array(b.key.bytes,b.key.byteOffset,b.key.byteLength/4),C=new Uint32Array(b.iv.bytes,b.iv.byteOffset,b.iv.byteLength/4);new l(w,_,C,function(y,x){self.postMessage(g({source:b.source,decrypted:x}),[x.buffer])})}}));var ryi=CMt(nyi);const iyi=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},QMt=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},VOe=(e,t)=>{t.activePlaylistLoader=e,e.load()},oyi=(e,t)=>()=>{const{segmentLoaders:{[e]:n,main:r},mediaTypes:{[e]:i}}=t,o=i.activeTrack(),a=i.getActiveGroup(),s=i.activePlaylistLoader,l=i.lastGroup_;if(!(a&&l&&a.id===l.id)&&(i.lastGroup_=a,i.lastTrack_=o,QMt(n,i),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){s&&r.resetEverything();return}n.resyncLoader(),VOe(a.playlistLoader,i)}},ayi=(e,t)=>()=>{const{segmentLoaders:{[e]:n},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,n.abort(),n.pause()},syi=(e,t)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[e]:r,main:i},mediaTypes:{[e]:o}}=t,a=o.activeTrack(),s=o.getActiveGroup(),l=o.activePlaylistLoader,u=o.lastTrack_;if(!(u&&a&&u.id===a.id)&&(o.lastGroup_=s,o.lastTrack_=a,QMt(r,o),!!s)){if(s.isMainPlaylist){if(!a||!u||a.id===u.id)return;const c=t.vhs.playlistController_,d=c.selectPlaylist();if(c.media()===d)return;o.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),n.pause(),i.resetEverything(),c.fastQualityChange_(d);return}if(e==="AUDIO"){if(!s.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(l===s.playlistLoader){VOe(s.playlistLoader,o);return}r.track&&r.track(a),r.resetEverything(),VOe(s.playlistLoader,o)}},mae={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:n},excludePlaylist:r}=t,i=n.activeTrack(),o=n.activeGroup(),a=(o.filter(l=>l.default)[0]||o[0]).id,s=n.tracks[a];if(i===s){r({error:{message:"Problem encountered loading the default audio track."}});return}mn.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in n.tracks)n.tracks[l].enabled=n.tracks[l]===s;n.onTrackChanged()},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:n}}=t;mn.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},eNt={AUDIO:(e,t,n)=>{if(!t)return;const{tech:r,requestOptions:i,segmentLoaders:{[e]:o}}=n;t.on("loadedmetadata",()=>{const a=t.media();o.playlist(a,i),(!r.paused()||a.endList&&r.preload()!=="none")&&o.load()}),t.on("loadedplaylist",()=>{o.playlist(t.media(),i),r.paused()||o.load()}),t.on("error",mae[e](e,n))},SUBTITLES:(e,t,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[e]:o},mediaTypes:{[e]:a}}=n;t.on("loadedmetadata",()=>{const s=t.media();o.playlist(s,i),o.track(a.activeTrack()),(!r.paused()||s.endList&&r.preload()!=="none")&&o.load()}),t.on("loadedplaylist",()=>{o.playlist(t.media(),i),r.paused()||o.load()}),t.on("error",mae[e](e,n))}},lyi={AUDIO:(e,t)=>{const{vhs:n,sourceType:r,segmentLoaders:{[e]:i},requestOptions:o,main:{mediaGroups:a},mediaTypes:{[e]:{groups:s,tracks:l,logger_:u}},mainPlaylistLoader:c}=t,d=FW(c.main);(!a[e]||Object.keys(a[e]).length===0)&&(a[e]={main:{default:{default:!0}}},d&&(a[e].main.default.playlists=c.main.playlists));for(const h in a[e]){s[h]||(s[h]=[]);for(const f in a[e][h]){let g=a[e][h][f],m;if(d?(u(`AUDIO group '${h}' label '${f}' is a main playlist`),g.isMainPlaylist=!0,m=null):r==="vhs-json"&&g.playlists?m=new h4(g.playlists[0],n,o):g.resolvedUri?m=new h4(g.resolvedUri,n,o):g.playlists&&r==="dash"?m=new IOe(g.playlists[0],n,o,c):m=null,g=Us({id:f,playlistLoader:m},g),eNt[e](e,g.playlistLoader,t),s[h].push(g),typeof l[f]>"u"){const b=new mn.AudioTrack({id:f,kind:iyi(g),enabled:!1,language:g.language,default:g.default,label:f});l[f]=b}}}i.on("error",mae[e](e,t))},SUBTITLES:(e,t)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[e]:o},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:c}=t;for(const d in s[e]){l[d]||(l[d]=[]);for(const h in s[e][d]){if(!r.options_.useForcedSubtitles&&s[e][d][h].forced)continue;let f=s[e][d][h],g;if(i==="hls")g=new h4(f.resolvedUri,r,a);else if(i==="dash"){if(!f.playlists.filter(b=>b.excludeUntil!==1/0).length)return;g=new IOe(f.playlists[0],r,a,c)}else i==="vhs-json"&&(g=new h4(f.playlists?f.playlists[0]:f.resolvedUri,r,a));if(f=Us({id:h,playlistLoader:g},f),eNt[e](e,f.playlistLoader,t),l[d].push(f),typeof u[h]>"u"){const m=n.addRemoteTextTrack({id:h,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:h},!1).track;u[h]=m}}}o.on("error",mae[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[e]:{groups:i,tracks:o}}}=t;for(const a in r[e]){i[a]||(i[a]=[]);for(const s in r[e][a]){const l=r[e][a][s];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let c={label:s,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(u[c.instreamId]&&(c=Us(c,u[c.instreamId])),c.default===void 0&&delete c.default,i[a].push(Us({id:s},l)),typeof o[s]>"u"){const d=n.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;o[s]=d}}}}},tNt=(e,t)=>{for(let n=0;n<e.length;n++)if(xOe(t,e[n])||e[n].playlists&&tNt(e[n].playlists,t))return!0;return!1},uyi=(e,t)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[e]:{groups:i}}}=t,o=r.media();if(!o)return null;let a=null;o.attributes[e]&&(a=i[o.attributes[e]]);const s=Object.keys(i);if(!a)if(e==="AUDIO"&&s.length>1&&FW(t.main))for(let l=0;l<s.length;l++){const u=i[s[l]];if(tNt(u,o)){a=u;break}}else i.main?a=i.main:s.length===1&&(a=i[s[0]]);return typeof n>"u"?a:n===null||!a?null:a.filter(l=>l.id===n.id)[0]||null},cyi={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},dyi=(e,{mediaTypes:t})=>()=>{const n=t[e].activeTrack();return n?t[e].activeGroup(n):null},fyi=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{lyi[u](u,e)});const{mediaTypes:t,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:o,main:a}}=e;["AUDIO","SUBTITLES"].forEach(u=>{t[u].activeGroup=uyi(u,e),t[u].activeTrack=cyi[u](u,e),t[u].onGroupChanged=oyi(u,e),t[u].onGroupChanging=ayi(u,e),t[u].onTrackChanged=syi(u,e),t[u].getActiveGroup=dyi(u,e)});const s=t.AUDIO.activeGroup();if(s){const u=(s.filter(d=>d.default)[0]||s[0]).id;t.AUDIO.tracks[u].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),o.setAudio(!0)):a.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>t[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>t[u].onGroupChanging())});const l=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[u])},hyi=()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:QE,activeTrack:QE,getActiveGroup:QE,onGroupChanged:QE,onTrackChanged:QE,lastTrack_:null,logger_:l0(`MediaGroups[${t}]`)}}),e};class nNt{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(t){t===1&&(this.version_=t)}set ttl(t){this.ttl_=t||300}set reloadUri(t){t&&(this.reloadUri_=xg(this.reloadUri_,t))}set priority(t){t&&t.length&&(this.priority_=t)}set pathwayClones(t){t&&t.length&&(this.pathwayClones_=new Map(t.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class pyi extends mn.EventTarget{constructor(t,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new nNt,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=l0("Content Steering"),this.xhr_=t,this.getBandwidth_=n}assignTagProperties(t,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=xg(t,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(t){const n=this.steeringManifest.reloadUri;if(!n)return;const r=t?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const i={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:i}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(o,a)=>{if(o){if(a.status===410){this.logger_(`manifest request 410 ${o}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const u=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${o}.`),this.logger_(`content steering will retry in ${u} seconds.`),this.startTTLTimeout_(parseInt(u,10));return}this.logger_(`manifest failed to load ${o}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:i});let s;try{s=JSON.parse(this.request_.responseText)}catch(u){const c={errorType:mn.Error.StreamingContentSteeringParserError,error:u};this.trigger({type:"error",metadata:c})}this.assignSteeringProperties_(s);const l={contentSteeringInfo:i.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:l}),this.startTTLTimeout_()})}setProxyServerUrl_(t){const n=new Ft.URL(t),r=new Ft.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(t){const n=JSON.parse(Ft.atob(t));this.assignSteeringProperties_(n)}setSteeringParams_(t){const n=new Ft.URL(t),r=this.getPathway(),i=this.getBandwidth_();if(r){const o=`_${this.manifestType_}_pathway`;n.searchParams.set(o,r)}if(i){const o=`_${this.manifestType_}_throughput`;n.searchParams.set(o,i)}return n.toString()}assignSteeringProperties_(t){if(this.steeringManifest.version=t.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${t.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=t.TTL,this.steeringManifest.reloadUri=t["RELOAD-URI"],this.steeringManifest.priority=t["PATHWAY-PRIORITY"]||t["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=t["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const o of i)if(this.availablePathways_.has(o))return o;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(t){if(!t)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(t);if(!n(i))return i}const r=this.setSteeringParams_(t);return n(r)?null:r}startTTLTimeout_(t=this.steeringManifest.ttl){const n=t*1e3;this.ttlTimeout_=Ft.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Ft.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new nNt}addAvailablePathway(t){t&&this.availablePathways_.add(t)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(t){return this.availablePathways_.delete(t)}didDASHTagChange(t,n){return!n&&this.steeringManifest.reloadUri||n&&(xg(t,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const myi=(e,t)=>{let n=null;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(null,r)},t)}},gyi=10;let ex;const vyi=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],yyi=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},byi=function({currentPlaylist:e,buffered:t,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:o,duration:a,bufferBasedABR:s,log:l}){if(!r)return mn.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(r.id===e.id)return!1;const c=!!c4(t,n).length;if(!e.endList)return!c&&typeof e.partTargetDuration=="number"?(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${u} as current playlist is live`),!0);const d=wOe(t,n),h=s?Wf.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Wf.MAX_BUFFER_LOW_WATER_LINE;if(a<h)return l(`${u} as duration < max low water line (${a} < ${h})`),!0;const f=r.attributes.BANDWIDTH,g=e.attributes.BANDWIDTH;if(f<g&&(!s||d<o)){let m=`${u} as next bandwidth < current bandwidth (${f} < ${g})`;return s&&(m+=` and forwardBuffer < bufferHighWaterLine (${d} < ${o})`),l(m),!0}if((!s||f>g)&&d>=i){let m=`${u} as forwardBuffer >= bufferLowWaterLine (${d} >= ${i})`;return s&&(m+=` and next bandwidth > current bandwidth (${f} > ${g})`),l(m),!0}return l(`not ${u} as no switching criteria met`),!1};class wyi extends mn.EventTarget{constructor(t){super(),this.fastQualityChange_=myi(this.fastQualityChange_.bind(this),100);const{src:n,withCredentials:r,tech:i,bandwidth:o,externVhs:a,useCueTags:s,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:c,cacheEncryptionKeys:d,bufferBasedABR:h,leastPixelDiffSelector:f,captionServices:g,experimentalUseMMS:m}=t;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:b}=t;(b===null||typeof b>"u")&&(b=1/0),ex=a,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!f,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.player_=t.player_,this.sourceType_=c,this.useCueTags_=s,this.playlistExclusionDuration=l,this.maxPlaylistRetries=b,this.enableLowInitialPlaylist=u,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:b,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=hyi(),m&&Ft.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new Ft.ManagedMediaSource,this.usingManagedMediaSource_=!0,mn.log("Using ManagedMediaSource")):Ft.MediaSource&&(this.mediaSource=new Ft.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=zf(),this.hasPlayed_=!1,this.syncController_=new eyi(t),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ryi,this.sourceUpdater_=new GMt(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new tyi,this.keyStatusMap_=new Map;const w={vhs:this.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:o,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:t.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new IOe(n,this.vhs_,Us(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new h4(n,this.vhs_,Us(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new LOe(Us(w,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),t),this.audioSegmentLoader_=new LOe(Us(w,{loaderType:"audio"}),t),this.subtitleSegmentLoader_=new Yvi(Us(w,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((y,x)=>{function E(){i.off("vttjserror",T),y()}function T(){i.off("vttjsloaded",E),x()}i.one("vttjsloaded",E),i.one("vttjserror",T),i.addWebVttScript_()})}),t);const _=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new pyi(this.vhs_.xhr,_),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),vyi.forEach(y=>{this[y+"_"]=yyi.bind(this,y)}),this.logger_=l0("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(C,()=>{const y=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-y,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const t=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return t===-1||n===-1?-1:t+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(t="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,t)}switchMedia_(t,n,r){const i=this.media(),o=i&&(i.id||i.uri),a=t&&(t.id||t.uri);if(o&&o!==a){this.logger_(`switch media ${o} -> ${a} from ${n}`);const s={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(t,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{const n=this.mediaTypes_[t],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const a=(r.length?r[0].playlists:r.playlists).filter(s=>s.attributes.serviceLocation===i);a.length&&this.mediaTypes_[t].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Ft.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Ft.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const t=this.main(),n=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return n;const r=t.mediaGroups.AUDIO,i=Object.keys(r);let o;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)o=this.mediaTypes_.AUDIO.activeTrack();else{const s=r.main||i.length&&r[i[0]];for(const l in s)if(s[l].default){o={label:l};break}}if(!o)return n;const a=[];for(const s in r)if(r[s][o.label]){const l=r[s][o.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(t.playlists.length)for(let u=0;u<t.playlists.length;u++){const c=t.playlists[u];c.attributes&&c.attributes.AUDIO&&c.attributes.AUDIO===s&&a.push(c)}}return a.length?a:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;EOe(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,n.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load()),fyi({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{const n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;EOe(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(n)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(n=>{this.mainPlaylistLoader_.on(n,r=>{this.player_.trigger(vd({},r))})})}handleUpdatedMediaPlaylist(t){this.useCueTags_&&this.updateAdCues_(t),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!t.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(t,n){const r=t.mediaGroups||{};let i=!0;const o=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const s in r.AUDIO[a])r.AUDIO[a][s].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),ex.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),o.length&&Object.keys(r.AUDIO[o[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(t){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),o=this.bufferHighWaterLine(),a=this.tech_.buffered();return byi({buffered:a,currentTime:r,currentPlaylist:n,nextPlaylist:t,bufferLowWaterLine:i,bufferHighWaterLine:o,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const i=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(i)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",r=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:gyi}))});const t=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(r=>{this.mainSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))}),this.audioSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))}),this.subtitleSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(t=this.selectPlaylist()){if(t&&t===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(t,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const t=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<t.start(0))return this.tech_.setCurrentTime(t.end(t.length-1))}setupFirstPlay(){const t=this.mainPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList||t.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(t.start){const o=t.start.timeOffset;if(o<0){const a=this.mainPlaylistLoader_.main,s=ex.Playlist.liveEdgeDelay(a,t),l=r+s;i=Math.max(Math.min(l+o,r),n.start(0))}else i=Math.min(r,o)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const t=this.tech_.play();typeof t<"u"&&typeof t.then=="function"&&t.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const t=this.inbandTextTracks_.metadataTrack_.cues;if(!t||!t.length)return;const n=this.duration();t[t.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let t=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?t=t&&this.audioSegmentLoader_.ended_:t=this.audioSegmentLoader_.ended_}t&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(t){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(t,this.duration());if(r===null)return!1;const i=ex.Playlist.playlistEnd(t,r),o=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return i-o<=OS;const s=a.end(a.length-1);return s-o<=OS&&i-s<=OS}excludePlaylist({playlistToExclude:t=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(t=t||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!t){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}t.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,o=i.filter(dae),a=o.length===1&&o[0]===t;if(i.length===1&&r!==1/0)return mn.log.warn(`Problem encountered with playlist ${t.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const g=this.pathwayAttribute_(t),m=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(g),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(g)},m);return}let f=!1;i.forEach(g=>{if(g===t)return;const m=g.excludeUntil;typeof m<"u"&&m!==1/0&&(f=!0,delete g.excludeUntil)}),f&&(mn.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let s;t.playlistErrors_>this.maxPlaylistRetries?s=1/0:s=Date.now()+r*1e3,t.excludeUntil=s,n.reason&&(t.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const l=this.selectPlaylist();if(!l){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:mn.log.warn,c=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${t.id}.${c} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==t.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==t.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const d=l.targetDuration/2*1e3||5*1e3,h=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=d;return this.switchMedia_(l,"exclude",a||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(t,n){const r=[],i=t==="all";(i||t==="main")&&r.push(this.mainPlaylistLoader_);const o=[];(i||t==="audio")&&o.push("AUDIO"),(i||t==="subtitle")&&(o.push("CLOSED-CAPTIONS"),o.push("SUBTITLES")),o.forEach(a=>{const s=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;s&&r.push(s)}),["main","audio","subtitle"].forEach(a=>{const s=this[`${a}SegmentLoader_`];s&&(t===a||t==="all")&&r.push(s)}),r.forEach(a=>n.forEach(s=>{typeof a[s]=="function"&&a[s]()}))}setCurrentTime(t){const n=c4(this.tech_.buffered(),t);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return t;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const t=this.mainPlaylistLoader_.media();return t?t.endList?this.mediaSource?this.mediaSource.duration:ex.Playlist.duration(t):1/0:0}seekable(){return this.seekable_}getSeekableRange_(t,n){const r=t.media();if(!r)return null;const i=this.syncController_.getMediaSequenceSync(n);if(i&&i.isReliable){const s=i.start,l=i.end;if(!isFinite(s)||!isFinite(l))return null;const u=ex.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),c=Math.max(s,l-u);return zf([[s,c]])}const o=this.syncController_.getExpiredTime(r,this.duration());if(o===null)return null;const a=ex.Playlist.seekable(r,o,ex.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(t,n){if(!n)return t;const r=t.start(0),i=t.end(0),o=n.start(0),a=n.end(0);return o>i||r>a?t:zf([[Math.max(r,o),Math.min(i,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!t)return;let n;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!n))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,n),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${WPt(this.seekable_)}]`);const i={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:i}),this.tech_.trigger("seekablechanged")}updateDuration(t){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,t),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(t){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=ex.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(t=>{const n=this.mediaTypes_[t].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const t=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=t?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;const r=VW(this.main(),n),i={},o=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(i.video=r.video||t.main.videoCodec||phi),t.main.isMuxed&&(i.video+=`,${r.audio||t.main.audioCodec||_Rt}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||o)&&(i.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||_Rt,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(u,c)=>u?yW(c,this.usingManagedMediaSource_):c2e(c),s={};let l;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!a(t[u].isFmp4,i[u])){const c=t[u].isFmp4?"browser":"muxer";s[c]=s[c]||[],s[c].push(i[u]),u==="audio"&&(l=c)}}),o&&l&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(c=>{(c.attributes&&c.attributes.AUDIO)===u&&c!==n&&(c.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${l} does not support codec(s): "${i.audio}"`)}if(Object.keys(s).length){const u=Object.keys(s).reduce((c,d)=>(c&&(c+=", "),c+=`${d} does not support codec(s): "${s[d].join(",")}"`,c),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(c=>{const d=(SS(this.sourceUpdater_.codecs[c]||"")[0]||{}).type,h=(SS(i[c]||"")[0]||{}).type;d&&h&&d.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[c]}" -> "${i[c]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const t=this.getCodecsOrExclude_();if(!t)return;this.sourceUpdater_.createSourceBuffers(t);const n=[t.video,t.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const t=this.main().playlists,n=[];Object.keys(t).forEach(r=>{const i=t[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const o=VW(this.main,i),a=[];o.audio&&!c2e(o.audio)&&!yW(o.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${o.audio}`),o.video&&!c2e(o.video)&&!yW(o.video,this.usingManagedMediaSource_)&&a.push(`video codec ${o.video}`),o.text&&o.text==="stpp.ttml.im1t"&&a.push(`text codec ${o.text}`),a.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(t){const n=[],r=this.main().playlists,i=BW(SS(t)),o=uMt(i),a=i.video&&SS(i.video)[0]||null,s=i.audio&&SS(i.audio)[0]||null;Object.keys(r).forEach(l=>{const u=r[l];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const c=[],d=VW(this.mainPlaylistLoader_.main,u),h=uMt(d);if(!(!d.audio&&!d.video)){if(h!==o&&c.push(`codec count "${h}" !== "${o}"`),!this.sourceUpdater_.canChangeType()){const f=d.video&&SS(d.video)[0]||null,g=d.audio&&SS(d.audio)[0]||null;f&&a&&f.type.toLowerCase()!==a.type.toLowerCase()&&c.push(`video codec "${f.type}" !== "${a.type}"`),g&&s&&g.type.toLowerCase()!==s.type.toLowerCase()&&c.push(`audio codec "${g.type}" !== "${s.type}"`)}c.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${c.join(" && ")}`))}})}updateAdCues_(t){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),Xvi(t,this.cueTagsTrack_,n)}goalBufferLength(){const t=this.tech_.currentTime(),n=Wf.GOAL_BUFFER_LENGTH,r=Wf.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,Wf.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+t*r,i)}bufferLowWaterLine(){const t=this.tech_.currentTime(),n=Wf.BUFFER_LOW_WATER_LINE,r=Wf.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,Wf.MAX_BUFFER_LOW_WATER_LINE),o=Math.max(n,Wf.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+t*r,this.bufferBasedABR?o:i)}bufferHighWaterLine(){return Wf.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(t){VMt(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Ovi({inbandTextTracks:this.inbandTextTracks_,dateRanges:t})}addMetadataToTextTrack(t,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();VMt(this.inbandTextTracks_,t,this.tech_),kvi({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(t){return t.attributes["PATHWAY-ID"]||t.attributes.serviceLocation}initContentSteeringController_(){const t=this.main();if(t.contentSteering){for(const n of t.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(t.uri,t.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(n=>{this.contentSteeringController_.on(n,r=>{this.trigger(vd({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const n=this.main();(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{const o=this.contentSteeringController_.getAvailablePathways(),a=[];for(const s of n.playlists){const l=s.attributes.serviceLocation;if(l&&(a.push(l),!o.has(l)))return!0}return!!(!a.length&&o.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const t=this.contentSteeringController_.getPathway();if(!t)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let o=!1;Object.keys(r).forEach(a=>{const s=r[a],l=this.pathwayAttribute_(s),u=l&&t!==l;s.excludeUntil===1/0&&s.lastExcludeReason_==="content-steering"&&!u&&(delete s.excludeUntil,delete s.lastExcludeReason_,o=!0);const d=!s.excludeUntil&&s.excludeUntil!==1/0;!i.has(s.id)&&u&&d&&(i.add(s.id),s.excludeUntil=1/0,s.lastExcludeReason_="content-steering",this.logger_(`excluding ${s.id} for ${s.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const s=this.mediaTypes_[a];if(s.activePlaylistLoader){const l=s.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==t&&(o=!0)}}),o&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[a,s]of r.entries())i.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(a));for(const[a,s]of i.entries()){const l=r.get(a);if(!l){n.filter(c=>c.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(c=>{this.mainPlaylistLoader_.addClonePathway(s,c)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(l,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(t,n){if(t["BASE-ID"]!==n["BASE-ID"]||t.ID!==n.ID||t["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=t["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const o in r)if(r[o]!==i[o])return!1;for(const o in i)if(r[o]!==i[o])return!1;return!0}changeSegmentPathway_(){const t=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(t,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let t=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(o=>{const a="usable",s=this.keyStatusMap_.has(o)&&this.keyStatusMap_.get(o)===a,l=r.lastExcludeReason_===n&&r.excludeUntil===1/0;s?s&&l&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${o} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${o} doesn't exist in the keyStatusMap or is not ${a}`)),t++)})}),t>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,o=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&o&&(delete r.excludeUntil,mn.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(t,n){const o=(typeof t=="string"?t:Gvi(t)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${o} added to the keyStatusMap`),this.keyStatusMap_.set(o,n)}updatePlaylistByKeyStatus(t,n){this.addKeyStatus_(t,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const _yi=(e,t,n)=>r=>{const i=e.main.playlists[t],o=COe(i),a=dae(i);if(typeof r>"u")return a;r?delete i.disabled:i.disabled=!0;const s={renditionInfo:{id:t,bandwidth:i.attributes.BANDWIDTH,resolution:i.attributes.RESOLUTION,codecs:i.attributes.CODECS},cause:"fast-quality"};return r!==a&&!o&&(r?(n(i),e.trigger({type:"renditionenabled",metadata:s})):e.trigger({type:"renditiondisabled",metadata:s})),r};class Syi{constructor(t,n,r){const{playlistController_:i}=t,o=i.fastQualityChange_.bind(i);if(n.attributes){const a=n.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=VW(i.main(),n),this.playlist=n,this.id=r,this.enabled=_yi(t.playlists,n.id,o)}}const Cyi=function(e){e.representations=()=>{const t=e.playlistController_.main(),n=FW(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return n?n.filter(r=>!COe(r)).map((r,i)=>new Syi(e,r,r.id)):[]}},rNt=["seeking","seeked","pause","playing","error"];class Eyi extends mn.EventTarget{constructor(t){super(),this.playlistController_=t.playlistController,this.tech_=t.tech,this.seekable=t.seekable,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=t.liveRangeSafeTimeDelta,this.media=t.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=l0("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),o=()=>this.resetTimeUpdate_(),a=this.playlistController_,s=["main","subtitle","audio"],l={};s.forEach(c=>{l[c]={reset:()=>this.resetSegmentDownloads_(c),updateend:()=>this.checkSegmentDownloads_(c)},a[`${c}SegmentLoader_`].on("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].on("playlistupdate",l[c].reset),this.tech_.on(["seeked","seeking"],l[c].reset)});const u=c=>{["main","audio"].forEach(d=>{a[`${d}SegmentLoader_`][c]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(rNt,o),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(rNt,o),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),s.forEach(c=>{a[`${c}SegmentLoader_`].off("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].off("playlistupdate",l[c].reset),this.tech_.off(["seeked","seeking"],l[c].reset)}),this.checkCurrentTimeTimeout_&&Ft.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Ft.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Ft.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(t){const n=this.playlistController_[`${t}SegmentLoader_`];this[`${t}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${t} loader`),this[`${t}StalledDownloads_`]=0,this[`${t}Buffered_`]=n.buffered_()}checkSegmentDownloads_(t){const n=this.playlistController_,r=n[`${t}SegmentLoader_`],i=r.buffered_(),o=fgi(this[`${t}Buffered_`],i);if(this[`${t}Buffered_`]=i,o){const a={bufferedRanges:i};n.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(t);return}this[`${t}StalledDownloads_`]++,this.logger_(`found #${this[`${t}StalledDownloads_`]} ${t} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:oR(i)}),!(this[`${t}StalledDownloads_`]<10)&&(this.logger_(`${t} loader stalled download exclusion`),this.resetSegmentDownloads_(t),this.tech_.trigger({type:"usage",name:`vhs-${t}-download-exclusion`}),t!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${t} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const t=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===t&&(!n.length||t+OS>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&t===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(t===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(zf([this.lastRecordedTime,t]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=t}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let o;if(i&&(o=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const g=n.start(0);o=g+(g===n.end(0)?0:OS)}if(typeof o<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${WPt(n)}. Seeking to ${o}.`),this.tech_.setCurrentTime(o),!0;const a=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,u=a.videoBuffer?a.videoBuffered():null,c=this.media(),d=c.partTargetDuration?c.partTargetDuration:(c.targetDuration-AS)*2,h=[l,u];for(let g=0;g<h.length;g++){if(!h[g])continue;if(wOe(h[g],r)<d)return!1}const f=cae(s,r);return f.length===0?!1:(o=f.start(0)+OS,this.logger_(`Buffered region starts (${f.start(0)}) just beyond seek point (${r}). Seeking to ${o}.`),this.tech_.setCurrentTime(o),!0)}waiting_(){if(this.techWaiting_())return;const t=this.tech_.currentTime(),n=this.tech_.buffered(),r=c4(n,t);if(r.length&&t+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.logger_(`Stopped at ${t} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const t=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(t,n)){const s=t.end(t.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${s}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(s),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=cae(i,n);return a.length>0?(this.logger_(`Stopped at ${n} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(t,n,r,i=!1){if(!t.length)return!1;let o=t.end(t.length-1)+OS;const a=!r.endList,s=typeof r.partTargetDuration=="number";return a&&(s||i)&&(o=t.end(t.length-1)+r.targetDuration*3),n>o}beforeSeekableWindow_(t,n){return!!(t.length&&t.start(0)>0&&n<t.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:t,audioBuffered:n,currentTime:r}){if(!t)return;let i;if(t.length&&n.length){const o=c4(t,r-3),a=c4(t,r),s=c4(n,r);s.length&&!a.length&&o.length&&(i={start:o.end(0),end:s.end(0)})}else cae(t,r).length||(i=this.gapFromVideoUnderflow_(t,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(t){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=cae(n,r);if(this.resetTimeUpdate_(),i.length===0||r!==t)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",t,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+AS);const o={gapInfo:{from:r,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:o}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(t,n){const r=ugi(t);for(let i=0;i<r.length;i++){const o=r.start(i),a=r.end(i);if(n-o<4&&n-o>2)return{start:o,end:a}}return null}}const xyi={errorInterval:30,getSource(e){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return e(n)}},iNt=function(e,t){let n=0,r=0;const i=Us(xyi,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const o=function(){r&&e.currentTime(r)},a=function(c){c!=null&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",o),e.src(c),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},s=function(){if(Date.now()-n<i.errorInterval*1e3){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){mn.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(e,a)},l=function(){e.off("loadedmetadata",o),e.off("error",s),e.off("dispose",l)},u=function(c){l(),iNt(e,c)};e.on("error",s),e.on("dispose",l),e.reloadSourceOnError=u},Tyi=function(e){iNt(this,e)};var oNt="3.17.3",kyi="7.1.0",Dyi="1.3.1",Ayi="7.2.0",Oyi="4.0.2";const fc={PlaylistLoader:h4,Playlist:Tg,utils:Ngi,STANDARD_PLAYLIST_SELECTOR:FMt,INITIAL_PLAYLIST_SELECTOR:Svi,lastBandwidthSelector:FMt,movingAverageBandwidthSelector:wvi,comparePlaylistBandwidth:MOe,comparePlaylistResolution:bvi,xhr:pMt()};Object.keys(Wf).forEach(e=>{Object.defineProperty(fc,e,{get(){return mn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Wf[e]},set(t){if(mn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),typeof t!="number"||t<0){mn.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}Wf[e]=t}})});const aNt="videojs-vhs",sNt=function(e,t){const n=t.media();let r=-1;for(let i=0;i<e.length;i++)if(e[i].id===n.id){r=i;break}e.selectedIndex_=r,e.trigger({selectedIndex:r,type:"change"})},Iyi=function(e,t){t.representations().forEach(n=>{e.addQualityLevel(n)}),sNt(e,t.playlists)};fc.canPlaySource=function(){return mn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Ryi=(e,t,n)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=BW(SS(t.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=j3(r.video),o=j3(r.audio),a={};for(const s in e)a[s]={},o&&(a[s].audioContentType=o),i&&(a[s].videoContentType=i),t.contentProtection&&t.contentProtection[s]&&t.contentProtection[s].pssh&&(a[s].pssh=t.contentProtection[s].pssh),typeof e[s]=="string"&&(a[s].url=e[s]);return Us(e,a)},$yi=(e,t)=>e.reduce((n,r)=>{if(!r.contentProtection)return n;const i=t.reduce((o,a)=>{const s=r.contentProtection[a];return s&&s.pssh&&(o[a]={pssh:s.pssh}),o},{});return Object.keys(i).length&&n.push(i),n},[]),Pyi=({player:e,sourceKeySystems:t,audioMedia:n,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,o=$yi(i,Object.keys(t)),a=[],s=[];return o.forEach(l=>{s.push(new Promise((u,c)=>{e.tech_.one("keysessioncreated",u)})),a.push(new Promise((u,c)=>{e.eme.initializeMediaKeys({keySystems:l},d=>{if(d){c(d);return}u()})}))}),Promise.race([Promise.all(a),Promise.race(s)])},Myi=({player:e,sourceKeySystems:t,media:n,audioMedia:r})=>{const i=Ryi(t,n,r);return i?(e.currentSource().keySystems=i,i&&!e.eme?(mn.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},lNt=()=>{if(!Ft.localStorage)return null;const e=Ft.localStorage.getItem(aNt);if(!e)return null;try{return JSON.parse(e)}catch{return null}},Nyi=e=>{if(!Ft.localStorage)return!1;let t=lNt();t=t?Us(t,e):e;try{Ft.localStorage.setItem(aNt,JSON.stringify(t))}catch{return!1}return t},Lyi=e=>e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(e.substring(e.indexOf(",")+1)):e,uNt=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},cNt=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},dNt=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},fNt=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};fc.supportsNativeHls=function(){if(!sr||!sr.createElement)return!1;const e=sr.createElement("video");return mn.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(e.canPlayType(n))}):!1}(),fc.supportsNativeDash=function(){return!sr||!sr.createElement||!mn.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(sr.createElement("video").canPlayType("application/dash+xml"))}(),fc.supportsTypeNatively=e=>e==="hls"?fc.supportsNativeHls:e==="dash"?fc.supportsNativeDash:!1,fc.isSupported=function(){return mn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},fc.xhr.onRequest=function(e){uNt(fc.xhr,e)},fc.xhr.onResponse=function(e){cNt(fc.xhr,e)},fc.xhr.offRequest=function(e){dNt(fc.xhr,e)},fc.xhr.offResponse=function(e){fNt(fc.xhr,e)};const Fyi=mn.getComponent("Component");class hNt extends Fyi{constructor(t,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=l0("VhsHandler"),n.options_&&n.options_.playerId){const i=mn.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=t,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(sr,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const o=sr.fullscreenElement||sr.webkitFullscreenElement||sr.mozFullScreenElement||sr.msFullscreenElement;o&&o.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(t={}){if(this.options_=Us(this.options_,t),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=lNt();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Wf.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Wf.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(t={}){this.setOptions_(t)}src(t,n){if(!t)return;this.setOptions_(),this.options_.src=Lyi(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=fc,this.options_.sourceType=SRt(n),this.options_.seekTo=o=>{this.tech_.setCurrentTime(o)},this.options_.player_=this.player_,this.playlistController_=new wyi(this.options_);const r=Us({liveRangeSafeTimeDelta:OS},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Eyi(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const o=mn.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),o.error(a)});const i=this.options_.bufferBasedABR?fc.movingAverageBandwidthSelector(.55):fc.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=fc.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(o){this.playlistController_.selectPlaylist=o.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(o){this.playlistController_.mainSegmentLoader_.throughput.rate=o,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let o=this.playlistController_.mainSegmentLoader_.bandwidth;const a=Ft.navigator.connection||Ft.navigator.mozConnection||Ft.navigator.webkitConnection,s=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=s&&o>=s?o=Math.max(o,l):o=l}return o},set(o){this.playlistController_.mainSegmentLoader_.bandwidth=o,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const o=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(o+a))},set(){mn.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>oR(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>oR(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&Nyi({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Cyi(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Ft.URL.createObjectURL(this.playlistController_.mediaSource),(mn.browser.IS_ANY_SAFARI||mn.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Pyi({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=Myi({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const t=mn.players[this.tech_.options_.playerId];!t||!t.qualityLevels||this.qualityLevels_||(this.qualityLevels_=t.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{Iyi(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{sNt(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":oNt,"mux.js":kyi,"mpd-parser":Dyi,"m3u8-parser":Ayi,"aes-decrypter":Oyi}}version(){return this.constructor.version()}canChangeType(){return GMt.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(t){this.playlistController_.setCurrentTime(t)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Ft.URL.revokeObjectURL&&(Ft.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(t,n){return Hgi({playlist:this.playlistController_.media(),time:t,callback:n})}seekToProgramTime(t,n,r=!0,i=2){return bMt({programTime:t,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=t=>{uNt(this.xhr,t)},this.xhr.onResponse=t=>{cNt(this.xhr,t)},this.xhr.offRequest=t=>{dNt(this.xhr,t)},this.xhr.offResponse=t=>{fNt(this.xhr,t)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const t=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];t.forEach(r=>{this.playlistController_.on(r,i=>{this.player_.trigger(vd({},i))})}),n.forEach(r=>{this.playbackWatcher_.on(r,i=>{this.player_.trigger(vd({},i))})})}}const gae={name:"videojs-http-streaming",VERSION:oNt,canHandleSource(e,t={}){const n=Us(mn.options,t);return!n.vhs.experimentalUseMMS&&!yW("avc1.4d400d,mp4a.40.2",!1)?!1:gae.canPlayType(e.type,n)},handleSource(e,t,n={}){const r=Us(mn.options,n);return t.vhs=new hNt(e,t,r),t.vhs.xhr=pMt(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const n=SRt(e);if(!n)return"";const r=gae.getOverrideNative(t);return!fc.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,n=!(mn.browser.IS_ANY_SAFARI||mn.browser.IS_IOS),{overrideNative:r=n}=t;return r}};yW("avc1.4d400d,mp4a.40.2",!0)&&mn.getTech("Html5").registerSourceHandler(gae,0),mn.VhsHandler=hNt,mn.VhsSourceHandler=gae,mn.Vhs=fc,mn.use||mn.registerComponent("Vhs",fc),mn.options.vhs=mn.options.vhs||{},(!mn.getPlugin||!mn.getPlugin("reloadSourceOnError"))&&mn.registerPlugin("reloadSourceOnError",Tyi),typeof mn>"u"&&console.warn(" videojs not detected");var Byi=mn.getPlugin("plugin"),Vyi=function(e){function t(n,r){var i;return Ifi(this,t),i=Ofi(this,t,[n]),XIt(i,"defaultOptions",{beforeElement:"fullscreenToggle",textControl:"Download video",name:"downloadButton",downloadURL:null}),i.options=KI(KI({},i.defaultOptions),r),i.player.on("ready",function(){var o=this,a=mn.getComponent("Button"),s=new a(n,{className:"vjs-icon-file-download"});s.el_.title="Download",s.on("click",ZIt(gW().m(function c(){var d,h,f,g,m,b;return gW().w(function(w){for(;;)switch(w.n){case 0:if(d=function(C){var y=C.split("/"),x=y[y.length-1],E=x.split("?")[0];return E},h=o.player().lastSource_.player,!h){w.n=3;break}return w.n=1,fetch(h);case 1:return f=w.v,w.n=2,f.blob();case 2:g=w.v,m=window.URL.createObjectURL(g),b=document.createElement("a"),b.href=m,b.download=d(m)||h.split("/").pop(),b.click(),window.URL.revokeObjectURL(m);case 3:return w.a(2)}},c)})));var l=n.getChild("ControlBar").el(),u=n.controlBar.getChild("fullscreenToggle");l.insertBefore(s.el(),u.el())}),i}return $fi(t,e),Rfi(t)}(Byi);mn.registerPlugin("DownloadVideoJs",Vyi);var Uyi=Math.floor,jyi=Math.ceil,pNt=Math.max,mNt=Math.min,Hyi=.002,zyi=1;function Wyi(e,t,n){var r=n,i=0;if(e<=.5){var o=e*r+Hyi*r+zyi;i=mNt(pNt(Uyi(o),1),t)}else{var a=e*r;i=mNt(pNt(jyi(a),1),t)}return i}var qyi=function(t){var n=t.videoPlayer,r=t.videoJsProps,i=K(0),o=K(!0),a=K(null),s=function(_){return String(_.toFixed(0)).padStart(2,"0")},l=24,u=K(),c=q(function(){return KI({playbackRates:[.5,1,1.5,2],plugins:{DownloadVideoJs:{text:"Download"}},userActions:{hotkeys:{playPauseKey:function(_){return _.which===32}}}},r.value)}),d=function(){var w=ZIt(gW().m(function _(C){var y,x,E,T,O,A,D,R,N,$;return gW().w(function(P){for(;;)switch(P.n){case 0:if(y=C.now,C.eventSource,!f.value){P.n=2;break}if(E=(x=a.value)===null||x===void 0?void 0:x.currentTime(),!(E===void 0||Number.isNaN(Number(E)))){P.n=1;break}return P.a(2);case 1:T=Wyi(E,i.value,l),O=Math.floor(E/3600),A=Math.floor(E%3600/60),D=Math.floor(E%60),R=Math.floor(T%l),N="".concat(s(O),":").concat(s(A),":").concat(s(D),":").concat(s(R)),$=u.value.querySelector(".vjs-remaining-time.vjs-time-control.vjs-control"),$.innerText=N;case 2:f.value=Number(y),n.value&&n.value.requestVideoFrameCallback(function(B,F){return d({now:B,eventSource:"requestVideoFrameCallback"})});case 3:return P.a(2)}},_)}));return function(C){return w.apply(this,arguments)}}(),h=function(_){var C,y=(C=a.value)===null||C===void 0?void 0:C.currentTime();d({now:y,eventSource:_})},f=K(0),g=function(){a.value&&(a.value.on("loadedmetadata",function(_){var C,y,x,E;o.value=!0,(C=n.value)===null||C===void 0||C.requestVideoFrameCallback(function(T,O){return d({now:0,eventSource:"loadedmetadata"})}),(y=a.value)===null||y===void 0||y.on("onpause",function(T){return h("onpause")}),(x=a.value)===null||x===void 0||x.on("stopped",function(T){return h("onpause")}),(E=a.value)===null||E===void 0||E.on("ended",function(T){return h("ended")})}),a.value.on("canplaythrough",function(){var _,C=((_=a.value)===null||_===void 0?void 0:_.duration())||0;i.value=Math.ceil(C*l)}),a.value.on("error",function(){var _,C=(_=a.value)===null||_===void 0?void 0:_.error();C&&console.log(C),o.value=!1}))},m=function(){try{if(!n.value){console.error("videoPlayer is not defined");return}a.value=mn(n.value,c.value,function(){g()})}catch(_){console.error("Error in video player setup",_)}};ai(function(){a.value&&a.value.dispose()});var b=function(_){var C,y;(C=a.value)===null||C===void 0||C.src(_),(y=a.value)===null||y===void 0||y.load()};return{initVideoPlayer:m,wrapperPlayer:u,videoJsInstance:a,setNewSource:b}},Gyi={key:0,class:"loading"},gNt=wt({__name:"VideoPlayer",props:{sources:{type:Array,required:!0,default:function(){return[{src:"https://vjs.zencdn.net/v/oceans.mp4",type:"video/mp4"},{src:"https://ik.imagekit.io/opqldywkf/21x9.mp4",type:"video/mp4"}]}},poster:{type:String,required:!0,default:void 0},fps:{type:Number,required:!1,default:24}},setup:function(t){var n=t,r=K(null),i=q(function(){return{controls:!0,autoplay:!1,fluid:!1,fill:!0,responsive:!0,sources:n.sources,poster:n.poster||void 0}}),o=qyi({videoPlayer:r,videoJsProps:i}),a=o.initVideoPlayer,s=o.wrapperPlayer,l=o.setNewSource;yn(function(){a()}),gt(function(){return n.sources},function(d){l(d)},{deep:!0,immediate:!0});var u=K(!1),c=function(h){console.error("Error loading video",h)};return function(d,h){return j(),se("div",{class:"video-wrapper",ref_key:"wrapperPlayer",ref:s},[De("video",rn({ref_key:"videoPlayer",ref:r},i.value,{class:"video-js vjs-has-started",onError:c}),null,16),u.value?(j(),se("div",Gyi,YAe(h[0]||(h[0]=[De("span",{class:"loader"},null,-1)])))):Ke("v-if",!0)],512)}}});gNt.__file="packages/player-component/components/video-player/VideoPlayer.vue";var Kyi={key:0,class:"media-player-header"},Yyi={key:0,class:"document-content"},Zyi={class:"document-content-file"},Xyi=["src"],Jyi={key:2,class:"video-player"},Qyi=["src"],ebi={key:4,class:"document-content"},tbi={class:"document-content-file"},nbi={class:"prev-button"},rbi={class:"next-button"},ibi={key:6,class:"media-player-control"},vae=wt({__name:"index",props:{listItems:{type:Array,required:!0,default:function(){return[]}},sharedStyles:{type:Object,required:!1,default:function(){return{}}},downloadConfiguration:{type:null,required:!1},showHeader:{type:Boolean,required:!1,default:!0},name:{type:String,required:!0,default:""},disabled:{type:Boolean,required:!1,default:!1},openIn:{type:Object,required:!1,default:void 0}},emits:["openInArboReview","download","onErrorVideo","event-trigger","change","changeName","onError"],setup:function(t,n){var r=n.expose,i=n.emit,o=t,a=i,s=K(0),l=function(){s.value<o.listItems.length-1?s.value++:s.value=0},u=function(){s.value>0?s.value--:s.value=o.listItems.length-1},c=function(){s.value=0},d=function(){console.log("onDownload",A.value),E(A.value.src,A.value.name)},h=K(),f=K(!1),g=function(){var F=h.value;console.log("Toggling fullscreen for player:",document.fullscreenElement),F&&(document.fullscreenElement?document.exitFullscreen().catch(function(){}):F.requestFullscreen().catch(function(){}))},m=function(){u()},b=function(){l()},w=function(F){a("changeName",F)},_=function(F){a("openInArboReview",F)},C=function(F){a("onErrorVideo",F)},y=function(F){a("onError",{event:F})},x=function(F){var z=F.event,G=F.player,ee=F.which,fe=F.data;a("event-trigger",{event:z,player:G,which:ee,data:fe})},E=function(F,z){console.log("onDownload",F,z);var G=KI({mode:"cors",referrerPolicy:"origin-when-cross-origin",headers:{"Access-Control-Allow-Origin":"*",accept:"*/*","accept-language":"vi,en;q=0.9,zh-CN;q=0.8,zh;q=0.7","cache-control":"no-cache",pragma:"no-cache","sec-ch-ua":'"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site",Referer:sessionStorage.getItem("BASE_URL"),"Referrer-Policy":"origin-when-cross-origin"},method:"GET"},o.downloadConfiguration);console.log("aaa",F,z);var ee=function(oe){var U=oe.split("/"),L=U[U.length-1],Y=L.split("?")[0];return Y};console.log("Downloading file:",F),fetch(F,KI({},G)).then(function(fe){return fe.blob()}).then(function(fe){var oe=window.URL.createObjectURL(fe),U=document.createElement("a");U.href=oe;var L=ee(z||F);L||(L=F.split("/").pop()||"download"),L=L.split("?")[0],L.includes("_Expires=")&&(L=L.split("_Expires=")[0]),U.type=fe.type,U.download=L,U.click(),window.URL.revokeObjectURL(oe)}).catch(function(fe){console.error("Error downloading the file:",fe)}),a("download",F)},T=function(F){s.value=F},O=K(o.name);gt(function(){return o.name},function(B){O.value=B},{immediate:!0});var A=q(function(){var B={src:"",type:"other",id:"",fileType:""};return o.listItems[s.value]&&(B=o.listItems[s.value]),B}),D=q(function(){var B=A.value;return{sources:[{src:B.src,type:B.fileType}],poster:B.poster||null,fps:B.framePerSecond,controls:!0,autoplay:!1,fluid:!1,fill:!0,responsive:!0}}),R=q(function(){return KI({},o.sharedStyles)}),N=q(function(){return o.listItems.length>1});gt(function(){return o.listItems},function(){s.value>o.listItems.length-1&&c()});var $=function(F){var z=o.listItems.findIndex(function(G){return G.src===F});T(z)},P=q(function(){var B,F,z,G,ee,fe={download:((B=A.value)===null||B===void 0?void 0:B.type)!=="video"&&((F=A.value)===null||F===void 0?void 0:F.type)!=="pdf",fullscreen:((z=A.value)===null||z===void 0?void 0:z.type)!=="video"&&((G=A.value)===null||G===void 0?void 0:G.type)!=="other"};if(((ee=A.value)===null||ee===void 0?void 0:ee.type)!=="video")return fe});return r({setCurrentIndex:T,selectPreviewItem:$}),gt([s,A],function(){a("change",{index:s.value,state:KI({},A.value)})}),yn(function(){document.addEventListener("fullscreenchange",function(){var B=!!document.fullscreenElement;f.value=B})}),function(B,F){var z=Ja("arbo-tooltip");return j(),se("div",{class:"media-player video-js",style:pn(R.value)},[t.showHeader?(j(),se("div",Kyi,[Me(Z(Nte),{size:"h3",modelValue:O.value,"onUpdate:modelValue":F[0]||(F[0]=function(G){return O.value=G}),onFinish:w,disabled:t.disabled},null,8,["modelValue","disabled"]),t.openIn?(j(),ot(Z(or),{key:0,"prefix-tooltip":t.openIn.tooltip,onClick:F[1]||(F[1]=function(G){return _(A.value.src)}),type:"primary",style:{minWidth:"125px",justifyContent:"flex-start",fontSize:"14px"},label:t.openIn.label,"prefix-icon":t.openIn.icon,size:"small"},null,8,["prefix-tooltip","label","prefix-icon"])):Ke("v-if",!0)])):Ke("v-if",!0),De("div",{class:"media-player-preview",ref_key:"mediaPlayer",ref:h},[A.value===void 0?(j(),se("div",Yyi,[De("div",Zyi,[Me(Z(to),{name:"File"})]),F[2]||(F[2]=De("h3",{class:"document-content-title"},"No preview available.",-1))])):A.value.type==="image"?(j(),se("img",{key:1,class:"media-player-image",src:A.value.src,alt:"",onError:y},null,40,Xyi)):A.value.type==="video"?(j(),se("div",Jyi,[(j(),ot(gNt,rn({key:A.value.src},D.value,{onOnError:C,onEventTrigger:x}),null,16))])):A.value.type==="pdf"?(j(),se("embed",{key:3,onError:y,width:"100%",height:"100%",src:A.value.src,type:"application/pdf"},null,40,Qyi)):(j(),se("div",ebi,[De("div",tbi,[Me(Z(to),{name:"File"})]),F[3]||(F[3]=De("h3",{class:"document-content-title"},"No preview available.",-1))])),N.value?(j(),se(Ht,{key:5},[$t((j(),se("div",nbi,[Me(Z(Fd),{"suffix-icon":"ArrowLeft",label:"",onClick:m},{suffix:qe(function(G){var ee=G.suffixIcon;return[Me(Z(or),{type:"secondary",label:"",class:"navigate-button"},{default:qe(function(){return[Me(Z(to),{name:ee},null,8,["name"])]}),_:2},1024)]}),_:1})])),[[z,{content:"Previous",delay:[300,0],hideOnClick:!1}]]),$t((j(),se("div",rbi,[Me(Z(Fd),{"suffix-icon":"ArrowRight",label:"",onClick:b},{suffix:qe(function(G){var ee=G.suffixIcon;return[Me(Z(or),{type:"secondary",label:"",class:"navigate-button"},{default:qe(function(){return[Me(Z(to),{name:ee},null,8,["name"])]}),_:2},1024)]}),_:1})])),[[z,{content:"Next",delay:[300,0],hideOnClick:!1}]])],64)):Ke("v-if",!0),P.value?(j(),se("div",ibi,[P.value.download?$t((j(),se("button",{key:0,onClick:d,class:"vjs-control vjs-button vjs-icon-file-download",type:"button","aria-disabled":"false",title:"Download"},YAe(F[4]||(F[4]=[De("span",{class:"vjs-icon-placeholder","aria-hidden":"true"},null,-1),De("span",{class:"vjs-control-text","aria-live":"polite"},null,-1)])))),[[z,{content:"Download",delay:[300,0],hideOnClick:!1}]]):Ke("v-if",!0),P.value.fullscreen?$t((j(),se("button",{key:1,class:"vjs-fullscreen-control vjs-control vjs-button",onClick:g},YAe(F[5]||(F[5]=[De("span",{class:"vjs-icon-placeholder","aria-hidden":"true"},null,-1)])))),[[z,{content:"Fullscreen",delay:[300,0],hideOnClick:!1}]]):Ke("v-if",!0)])):Ke("v-if",!0)],512)],4)}}});vae.__scopeId="data-v-e1151a7a",vae.__file="packages/player-component/components/index.vue";/*!
1152
+ `,s++,a=h}),this.end_=a,this.storage_=i,this.diagnostics_=o}calculateBaseTime_(t,n,r){if(!this.storage_.size)return 0;if(this.storage_.has(t))return this.storage_.get(t).segmentSyncInfo.start;const i=Math.min(...this.storage_.keys());if(t<i){const o=i-t;let a=this.storage_.get(i).segmentSyncInfo.start;for(let s=0;s<o;s++){const l=n[s];a-=l.duration}return a}return r}isReliablePlaylist_(t,n){return t!=null&&Array.isArray(n)&&n.length}}class JMt extends XMt{constructor(t){super(),this.parent_=t}calculateBaseTime_(t,n,r){if(!this.storage_.size){const i=this.parent_.getSyncInfoForMediaSequence(t);return i?i.segmentSyncInfo.start:0}return super.calculateBaseTime_(t,n,r)}}const Qvi=86400,BOe=[{name:"VOD",run:(e,t,n,r,i)=>n!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,n,r,i,o)=>{const a=e.getMediaSequenceSync(o);if(!a||!a.isReliable)return null;const s=a.getSyncInfoForTime(i);return s?{time:s.start,partIndex:s.partIndex,segmentIndex:s.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,n,r,i)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let o=null,a=null;const s=SOe(t);i=i||0;for(let l=0;l<s.length;l++){const u=t.endList||i===0?l:s.length-(l+1),c=s[u],d=c.segment,h=e.timelineToDatetimeMappings[d.timeline];if(!h||!d.dateTimeObject)continue;let g=d.dateTimeObject.getTime()/1e3+h;if(d.parts&&typeof c.partIndex=="number")for(let b=0;b<c.partIndex;b++)g+=d.parts[b].duration;const m=Math.abs(i-g);if(a!==null&&(m===0||a<m))break;a=m,o={time:g,segmentIndex:c.segmentIndex,partIndex:c.partIndex}}return o}},{name:"Segment",run:(e,t,n,r,i)=>{let o=null,a=null;i=i||0;const s=SOe(t);for(let l=0;l<s.length;l++){const u=t.endList||i===0?l:s.length-(l+1),c=s[u],d=c.segment,h=c.part&&c.part.start||d&&d.start;if(d.timeline===r&&typeof h<"u"){const f=Math.abs(i-h);if(a!==null&&a<f)break;(!o||a===null||a>=f)&&(a=f,o={time:h,segmentIndex:c.segmentIndex,partIndex:c.partIndex})}}return o}},{name:"Discontinuity",run:(e,t,n,r,i)=>{let o=null;if(i=i||0,t.discontinuityStarts&&t.discontinuityStarts.length){let a=null;for(let s=0;s<t.discontinuityStarts.length;s++){const l=t.discontinuityStarts[s],u=t.discontinuitySequence+s+1,c=e.discontinuities[u];if(c){const d=Math.abs(i-c.time);if(a!==null&&a<d)break;(!o||a===null||a>=d)&&(a=d,o={time:c.time,segmentIndex:l,partIndex:null})}}}return o}},{name:"Playlist",run:(e,t,n,r,i)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class eyi extends mn.EventTarget{constructor(t={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const n=new XMt,r=new JMt(n),i=new JMt(n);this.mediaSequenceStorage_={main:n,audio:r,vtt:i},this.logger_=l0("SyncController")}getMediaSequenceSync(t){return this.mediaSequenceStorage_[t]||null}getSyncPoint(t,n,r,i,o){if(n!==1/0)return BOe.find(({name:l})=>l==="VOD").run(this,t,n);const a=this.runStrategies_(t,n,r,i,o);if(!a.length)return null;for(const s of a){const{syncPoint:l,strategy:u}=s,{segmentIndex:c,time:d}=l;if(c<0)continue;const h=t.segments[c],f=d,g=f+h.duration;if(this.logger_(`Strategy: ${u}. Current time: ${i}. selected segment: ${c}. Time: [${f} -> ${g}]}`),i>=f&&i<g)return this.logger_("Found sync point with exact match: ",l),l}return this.selectSyncPoint_(a,{key:"time",value:i})}getExpiredTime(t,n){if(!t||!t.segments)return null;const r=this.runStrategies_(t,n,t.discontinuitySequence,0);if(!r.length)return null;const i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+LW({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:i.segmentIndex,endIndex:0}))}runStrategies_(t,n,r,i,o){const a=[];for(let s=0;s<BOe.length;s++){const l=BOe[s],u=l.run(this,t,n,r,i,o);u&&(u.strategy=l.name,a.push({strategy:l.name,syncPoint:u}))}return a}selectSyncPoint_(t,n){let r=t[0].syncPoint,i=Math.abs(t[0].syncPoint[n.key]-n.value),o=t[0].strategy;for(let a=1;a<t.length;a++){const s=Math.abs(t[a].syncPoint[n.key]-n.value);s<i&&(i=s,r=t[a].syncPoint,o=t[a].strategy)}return this.logger_(`syncPoint for [${n.key}: ${n.value}] chosen with strategy [${o}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(t,n){const r=n.mediaSequence-t.mediaSequence;if(r>Qvi){mn.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let i=r-1;i>=0;i--){const o=t.segments[i];if(o&&typeof o.start<"u"){n.syncInfo={mediaSequence:t.mediaSequence+i,time:o.start},this.logger_(`playlist refresh sync: [time:${n.syncInfo.time}, mediaSequence: ${n.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(t){if(this.timelineToDatetimeMappings={},t.segments&&t.segments.length&&t.segments[0].dateTimeObject){const n=t.segments[0],r=n.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[n.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:n}){const r=this.calculateSegmentTimeMapping_(t,t.timingInfo,n),i=t.segment;r&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:i.start}));const o=i.dateTimeObject;i.discontinuity&&n&&o&&(this.timelineToDatetimeMappings[i.timeline]=-(o.getTime()/1e3))}timestampOffsetForTimeline(t){return typeof this.timelines[t]>"u"?null:this.timelines[t].time}mappingForTimeline(t){return typeof this.timelines[t]>"u"?null:this.timelines[t].mapping}calculateSegmentTimeMapping_(t,n,r){const i=t.segment,o=t.part;let a=this.timelines[t.timeline],s,l;if(typeof t.timestampOffset=="number")a={time:t.startOfSegment,mapping:t.startOfSegment-n.start},r&&(this.timelines[t.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${t.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),s=t.startOfSegment,l=n.end+a.mapping;else if(a)s=n.start+a.mapping,l=n.end+a.mapping;else return!1;return o&&(o.start=s,o.end=l),(!i.start||s<i.start)&&(i.start=s),i.end=l,!0}saveDiscontinuitySyncInfo_(t){const n=t.playlist,r=t.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(n.discontinuityStarts&&n.discontinuityStarts.length)for(let i=0;i<n.discontinuityStarts.length;i++){const o=n.discontinuityStarts[i],a=n.discontinuitySequence+i+1,s=o-t.mediaIndex,l=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>l){let u;s<0?u=r.start-LW({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:t.mediaIndex,endIndex:o}):u=r.end+LW({defaultDuration:n.targetDuration,durationList:n.segments,startIndex:t.mediaIndex+1,endIndex:o}),this.discontinuities[a]={time:u,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class tyi extends mn.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(t){this.pendingTimelineChanges_[t]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:t,from:n,to:r}){return typeof n=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[t]={type:t,from:n,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]}lastTimelineChange({type:t,from:n,to:r}){if(typeof n=="number"&&typeof r=="number"){this.lastTimelineChanges_[t]={type:t,from:n,to:r},delete this.pendingTimelineChanges_[t];const i={timelineChangeInfo:{from:n,to:r}};this.trigger({type:"timelinechange",metadata:i})}return this.lastTimelineChanges_[t]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const nyi=EMt(xMt(function(){var e=function(){function m(){this.listeners={}}var b=m.prototype;return b.on=function(_,C){this.listeners[_]||(this.listeners[_]=[]),this.listeners[_].push(C)},b.off=function(_,C){if(!this.listeners[_])return!1;var y=this.listeners[_].indexOf(C);return this.listeners[_]=this.listeners[_].slice(0),this.listeners[_].splice(y,1),y>-1},b.trigger=function(_){var C=this.listeners[_];if(C)if(arguments.length===2)for(var y=C.length,x=0;x<y;++x)C[x].call(this,arguments[1]);else for(var E=Array.prototype.slice.call(arguments,1),T=C.length,O=0;O<T;++O)C[O].apply(this,E)},b.dispose=function(){this.listeners={}},b.pipe=function(_){this.on("data",function(C){_.push(C)})},m}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function t(m){return m.subarray(0,m.byteLength-m[m.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const n=function(){const m=[[[],[],[],[],[]],[[],[],[],[],[]]],b=m[0],w=m[1],_=b[4],C=w[4];let y,x,E;const T=[],O=[];let A,D,R,N,$,P;for(y=0;y<256;y++)O[(T[y]=y<<1^(y>>7)*283)^y]=y;for(x=E=0;!_[x];x^=A||1,E=O[E]||1)for(N=E^E<<1^E<<2^E<<3^E<<4,N=N>>8^N&255^99,_[x]=N,C[N]=x,R=T[D=T[A=T[x]]],P=R*16843009^D*65537^A*257^x*16843008,$=T[N]*257^N*16843008,y=0;y<4;y++)b[y][x]=$=$<<24^$>>>8,w[y][N]=P=P<<24^P>>>8;for(y=0;y<5;y++)b[y]=b[y].slice(0),w[y]=w[y].slice(0);return m};let r=null;class i{constructor(b){r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let w,_,C;const y=this._tables[0][4],x=this._tables[1],E=b.length;let T=1;if(E!==4&&E!==6&&E!==8)throw new Error("Invalid aes key size");const O=b.slice(0),A=[];for(this._key=[O,A],w=E;w<4*E+28;w++)C=O[w-1],(w%E===0||E===8&&w%E===4)&&(C=y[C>>>24]<<24^y[C>>16&255]<<16^y[C>>8&255]<<8^y[C&255],w%E===0&&(C=C<<8^C>>>24^T<<24,T=T<<1^(T>>7)*283)),O[w]=O[w-E]^C;for(_=0;w;_++,w--)C=O[_&3?w:w-4],w<=4||_<4?A[_]=C:A[_]=x[0][y[C>>>24]]^x[1][y[C>>16&255]]^x[2][y[C>>8&255]]^x[3][y[C&255]]}decrypt(b,w,_,C,y,x){const E=this._key[1];let T=b^E[0],O=C^E[1],A=_^E[2],D=w^E[3],R,N,$;const P=E.length/4-2;let B,F=4;const z=this._tables[1],G=z[0],ee=z[1],fe=z[2],oe=z[3],U=z[4];for(B=0;B<P;B++)R=G[T>>>24]^ee[O>>16&255]^fe[A>>8&255]^oe[D&255]^E[F],N=G[O>>>24]^ee[A>>16&255]^fe[D>>8&255]^oe[T&255]^E[F+1],$=G[A>>>24]^ee[D>>16&255]^fe[T>>8&255]^oe[O&255]^E[F+2],D=G[D>>>24]^ee[T>>16&255]^fe[O>>8&255]^oe[A&255]^E[F+3],F+=4,T=R,O=N,A=$;for(B=0;B<4;B++)y[(3&-B)+x]=U[T>>>24]<<24^U[O>>16&255]<<16^U[A>>8&255]<<8^U[D&255]^E[F++],R=T,T=O,O=A,A=D,D=R}}class o extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(b){this.jobs.push(b),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(m){return m<<24|(m&65280)<<8|(m&16711680)>>8|m>>>24},s=function(m,b,w){const _=new Int32Array(m.buffer,m.byteOffset,m.byteLength>>2),C=new i(Array.prototype.slice.call(b)),y=new Uint8Array(m.byteLength),x=new Int32Array(y.buffer);let E,T,O,A,D,R,N,$,P;for(E=w[0],T=w[1],O=w[2],A=w[3],P=0;P<_.length;P+=4)D=a(_[P]),R=a(_[P+1]),N=a(_[P+2]),$=a(_[P+3]),C.decrypt(D,R,N,$,x,P),x[P]=a(x[P]^E),x[P+1]=a(x[P+1]^T),x[P+2]=a(x[P+2]^O),x[P+3]=a(x[P+3]^A),E=D,T=R,O=N,A=$;return y};class l{constructor(b,w,_,C){const y=l.STEP,x=new Int32Array(b.buffer),E=new Uint8Array(b.byteLength);let T=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(x.subarray(T,T+y),w,_,E)),T=y;T<x.length;T+=y)_=new Uint32Array([a(x[T-4]),a(x[T-3]),a(x[T-2]),a(x[T-1])]),this.asyncStream_.push(this.decryptChunk_(x.subarray(T,T+y),w,_,E));this.asyncStream_.push(function(){C(null,t(E))})}static get STEP(){return 32e3}decryptChunk_(b,w,_,C){return function(){const y=s(b,w,_);C.set(y,b.byteOffset)}}}var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c;typeof window<"u"?c=window:typeof u<"u"?c=u:typeof self<"u"?c=self:c={};var d=c,h=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},f=d.BigInt||Number;f("0x1"),f("0x100"),f("0x10000"),f("0x1000000"),f("0x100000000"),f("0x10000000000"),f("0x1000000000000"),f("0x100000000000000"),f("0x10000000000000000"),function(){var m=new Uint16Array([65484]),b=new Uint8Array(m.buffer,m.byteOffset,m.byteLength);return b[0]===255?"big":b[0]===204?"little":"unknown"}();const g=function(m){const b={};return Object.keys(m).forEach(w=>{const _=m[w];h(_)?b[w]={bytes:_.buffer,byteOffset:_.byteOffset,byteLength:_.byteLength}:b[w]=_}),b};self.onmessage=function(m){const b=m.data,w=new Uint8Array(b.encrypted.bytes,b.encrypted.byteOffset,b.encrypted.byteLength),_=new Uint32Array(b.key.bytes,b.key.byteOffset,b.key.byteLength/4),C=new Uint32Array(b.iv.bytes,b.iv.byteOffset,b.iv.byteLength/4);new l(w,_,C,function(y,x){self.postMessage(g({source:b.source,decrypted:x}),[x.buffer])})}}));var ryi=CMt(nyi);const iyi=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},QMt=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},VOe=(e,t)=>{t.activePlaylistLoader=e,e.load()},oyi=(e,t)=>()=>{const{segmentLoaders:{[e]:n,main:r},mediaTypes:{[e]:i}}=t,o=i.activeTrack(),a=i.getActiveGroup(),s=i.activePlaylistLoader,l=i.lastGroup_;if(!(a&&l&&a.id===l.id)&&(i.lastGroup_=a,i.lastTrack_=o,QMt(n,i),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){s&&r.resetEverything();return}n.resyncLoader(),VOe(a.playlistLoader,i)}},ayi=(e,t)=>()=>{const{segmentLoaders:{[e]:n},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,n.abort(),n.pause()},syi=(e,t)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[e]:r,main:i},mediaTypes:{[e]:o}}=t,a=o.activeTrack(),s=o.getActiveGroup(),l=o.activePlaylistLoader,u=o.lastTrack_;if(!(u&&a&&u.id===a.id)&&(o.lastGroup_=s,o.lastTrack_=a,QMt(r,o),!!s)){if(s.isMainPlaylist){if(!a||!u||a.id===u.id)return;const c=t.vhs.playlistController_,d=c.selectPlaylist();if(c.media()===d)return;o.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),n.pause(),i.resetEverything(),c.fastQualityChange_(d);return}if(e==="AUDIO"){if(!s.playlistLoader){i.setAudio(!0),i.resetEverything();return}r.setAudio(!0),i.setAudio(!1)}if(l===s.playlistLoader){VOe(s.playlistLoader,o);return}r.track&&r.track(a),r.resetEverything(),VOe(s.playlistLoader,o)}},mae={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:n},excludePlaylist:r}=t,i=n.activeTrack(),o=n.activeGroup(),a=(o.filter(l=>l.default)[0]||o[0]).id,s=n.tracks[a];if(i===s){r({error:{message:"Problem encountered loading the default audio track."}});return}mn.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in n.tracks)n.tracks[l].enabled=n.tracks[l]===s;n.onTrackChanged()},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:n}}=t;mn.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}},eNt={AUDIO:(e,t,n)=>{if(!t)return;const{tech:r,requestOptions:i,segmentLoaders:{[e]:o}}=n;t.on("loadedmetadata",()=>{const a=t.media();o.playlist(a,i),(!r.paused()||a.endList&&r.preload()!=="none")&&o.load()}),t.on("loadedplaylist",()=>{o.playlist(t.media(),i),r.paused()||o.load()}),t.on("error",mae[e](e,n))},SUBTITLES:(e,t,n)=>{const{tech:r,requestOptions:i,segmentLoaders:{[e]:o},mediaTypes:{[e]:a}}=n;t.on("loadedmetadata",()=>{const s=t.media();o.playlist(s,i),o.track(a.activeTrack()),(!r.paused()||s.endList&&r.preload()!=="none")&&o.load()}),t.on("loadedplaylist",()=>{o.playlist(t.media(),i),r.paused()||o.load()}),t.on("error",mae[e](e,n))}},lyi={AUDIO:(e,t)=>{const{vhs:n,sourceType:r,segmentLoaders:{[e]:i},requestOptions:o,main:{mediaGroups:a},mediaTypes:{[e]:{groups:s,tracks:l,logger_:u}},mainPlaylistLoader:c}=t,d=FW(c.main);(!a[e]||Object.keys(a[e]).length===0)&&(a[e]={main:{default:{default:!0}}},d&&(a[e].main.default.playlists=c.main.playlists));for(const h in a[e]){s[h]||(s[h]=[]);for(const f in a[e][h]){let g=a[e][h][f],m;if(d?(u(`AUDIO group '${h}' label '${f}' is a main playlist`),g.isMainPlaylist=!0,m=null):r==="vhs-json"&&g.playlists?m=new h4(g.playlists[0],n,o):g.resolvedUri?m=new h4(g.resolvedUri,n,o):g.playlists&&r==="dash"?m=new IOe(g.playlists[0],n,o,c):m=null,g=Us({id:f,playlistLoader:m},g),eNt[e](e,g.playlistLoader,t),s[h].push(g),typeof l[f]>"u"){const b=new mn.AudioTrack({id:f,kind:iyi(g),enabled:!1,language:g.language,default:g.default,label:f});l[f]=b}}}i.on("error",mae[e](e,t))},SUBTITLES:(e,t)=>{const{tech:n,vhs:r,sourceType:i,segmentLoaders:{[e]:o},requestOptions:a,main:{mediaGroups:s},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:c}=t;for(const d in s[e]){l[d]||(l[d]=[]);for(const h in s[e][d]){if(!r.options_.useForcedSubtitles&&s[e][d][h].forced)continue;let f=s[e][d][h],g;if(i==="hls")g=new h4(f.resolvedUri,r,a);else if(i==="dash"){if(!f.playlists.filter(b=>b.excludeUntil!==1/0).length)return;g=new IOe(f.playlists[0],r,a,c)}else i==="vhs-json"&&(g=new h4(f.playlists?f.playlists[0]:f.resolvedUri,r,a));if(f=Us({id:h,playlistLoader:g},f),eNt[e](e,f.playlistLoader,t),l[d].push(f),typeof u[h]>"u"){const m=n.addRemoteTextTrack({id:h,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:h},!1).track;u[h]=m}}}o.on("error",mae[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[e]:{groups:i,tracks:o}}}=t;for(const a in r[e]){i[a]||(i[a]=[]);for(const s in r[e][a]){const l=r[e][a][s];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const u=n.options_.vhs&&n.options_.vhs.captionServices||{};let c={label:s,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(u[c.instreamId]&&(c=Us(c,u[c.instreamId])),c.default===void 0&&delete c.default,i[a].push(Us({id:s},l)),typeof o[s]>"u"){const d=n.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;o[s]=d}}}}},tNt=(e,t)=>{for(let n=0;n<e.length;n++)if(xOe(t,e[n])||e[n].playlists&&tNt(e[n].playlists,t))return!0;return!1},uyi=(e,t)=>n=>{const{mainPlaylistLoader:r,mediaTypes:{[e]:{groups:i}}}=t,o=r.media();if(!o)return null;let a=null;o.attributes[e]&&(a=i[o.attributes[e]]);const s=Object.keys(i);if(!a)if(e==="AUDIO"&&s.length>1&&FW(t.main))for(let l=0;l<s.length;l++){const u=i[s[l]];if(tNt(u,o)){a=u;break}}else i.main?a=i.main:s.length===1&&(a=i[s[0]]);return typeof n>"u"?a:n===null||!a?null:a.filter(l=>l.id===n.id)[0]||null},cyi={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const r in n)if(n[r].enabled)return n[r];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const r in n)if(n[r].mode==="showing"||n[r].mode==="hidden")return n[r];return null}},dyi=(e,{mediaTypes:t})=>()=>{const n=t[e].activeTrack();return n?t[e].activeGroup(n):null},fyi=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{lyi[u](u,e)});const{mediaTypes:t,mainPlaylistLoader:n,tech:r,vhs:i,segmentLoaders:{["AUDIO"]:o,main:a}}=e;["AUDIO","SUBTITLES"].forEach(u=>{t[u].activeGroup=uyi(u,e),t[u].activeTrack=cyi[u](u,e),t[u].onGroupChanged=oyi(u,e),t[u].onGroupChanging=ayi(u,e),t[u].onTrackChanged=syi(u,e),t[u].getActiveGroup=dyi(u,e)});const s=t.AUDIO.activeGroup();if(s){const u=(s.filter(d=>d.default)[0]||s[0]).id;t.AUDIO.tracks[u].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),o.setAudio(!0)):a.setAudio(!0)}n.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(u=>t[u].onGroupChanged())}),n.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(u=>t[u].onGroupChanging())});const l=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),i.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const u in t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[u])},hyi=()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:QE,activeTrack:QE,getActiveGroup:QE,onGroupChanged:QE,onTrackChanged:QE,lastTrack_:null,logger_:l0(`MediaGroups[${t}]`)}}),e};class nNt{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(t){t===1&&(this.version_=t)}set ttl(t){this.ttl_=t||300}set reloadUri(t){t&&(this.reloadUri_=xg(this.reloadUri_,t))}set priority(t){t&&t.length&&(this.priority_=t)}set pathwayClones(t){t&&t.length&&(this.pathwayClones_=new Map(t.map(n=>[n.ID,n])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class pyi extends mn.EventTarget{constructor(t,n){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new nNt,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=l0("Content Steering"),this.xhr_=t,this.getBandwidth_=n}assignTagProperties(t,n){this.manifestType_=n.serverUri?"HLS":"DASH";const r=n.serverUri||n.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=xg(t,r),this.defaultPathway=n.pathwayId||n.defaultServiceLocation,this.queryBeforeStart=n.queryBeforeStart,this.proxyServerUrl_=n.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(t){const n=this.steeringManifest.reloadUri;if(!n)return;const r=t?n:this.getRequestURI(n);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const i={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:i}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(o,a)=>{if(o){if(a.status===410){this.logger_(`manifest request 410 ${o}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const u=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${o}.`),this.logger_(`content steering will retry in ${u} seconds.`),this.startTTLTimeout_(parseInt(u,10));return}this.logger_(`manifest failed to load ${o}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:i});let s;try{s=JSON.parse(this.request_.responseText)}catch(u){const c={errorType:mn.Error.StreamingContentSteeringParserError,error:u};this.trigger({type:"error",metadata:c})}this.assignSteeringProperties_(s);const l={contentSteeringInfo:i.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:l}),this.startTTLTimeout_()})}setProxyServerUrl_(t){const n=new Ft.URL(t),r=new Ft.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(n.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(t){const n=JSON.parse(Ft.atob(t));this.assignSteeringProperties_(n)}setSteeringParams_(t){const n=new Ft.URL(t),r=this.getPathway(),i=this.getBandwidth_();if(r){const o=`_${this.manifestType_}_pathway`;n.searchParams.set(o,r)}if(i){const o=`_${this.manifestType_}_throughput`;n.searchParams.set(o,i)}return n.toString()}assignSteeringProperties_(t){if(this.steeringManifest.version=t.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${t.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=t.TTL,this.steeringManifest.reloadUri=t["RELOAD-URI"],this.steeringManifest.priority=t["PATHWAY-PRIORITY"]||t["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=t["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(i=>{for(const o of i)if(this.availablePathways_.has(o))return o;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(t){if(!t)return null;const n=i=>this.excludedSteeringManifestURLs.has(i);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(t);if(!n(i))return i}const r=this.setSteeringParams_(t);return n(r)?null:r}startTTLTimeout_(t=this.steeringManifest.ttl){const n=t*1e3;this.ttlTimeout_=Ft.setTimeout(()=>{this.requestSteeringManifest()},n)}clearTTLTimeout_(){Ft.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new nNt}addAvailablePathway(t){t&&this.availablePathways_.add(t)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(t){return this.availablePathways_.delete(t)}didDASHTagChange(t,n){return!n&&this.steeringManifest.reloadUri||n&&(xg(t,n.serverURL)!==this.steeringManifest.reloadUri||n.defaultServiceLocation!==this.defaultPathway||n.queryBeforeStart!==this.queryBeforeStart||n.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const myi=(e,t)=>{let n=null;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(null,r)},t)}},gyi=10;let ex;const vyi=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],yyi=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},byi=function({currentPlaylist:e,buffered:t,currentTime:n,nextPlaylist:r,bufferLowWaterLine:i,bufferHighWaterLine:o,duration:a,bufferBasedABR:s,log:l}){if(!r)return mn.log.warn("We received no playlist to switch to. Please check your stream."),!1;const u=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(r.id===e.id)return!1;const c=!!c4(t,n).length;if(!e.endList)return!c&&typeof e.partTargetDuration=="number"?(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${u} as current playlist is live`),!0);const d=wOe(t,n),h=s?Wf.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Wf.MAX_BUFFER_LOW_WATER_LINE;if(a<h)return l(`${u} as duration < max low water line (${a} < ${h})`),!0;const f=r.attributes.BANDWIDTH,g=e.attributes.BANDWIDTH;if(f<g&&(!s||d<o)){let m=`${u} as next bandwidth < current bandwidth (${f} < ${g})`;return s&&(m+=` and forwardBuffer < bufferHighWaterLine (${d} < ${o})`),l(m),!0}if((!s||f>g)&&d>=i){let m=`${u} as forwardBuffer >= bufferLowWaterLine (${d} >= ${i})`;return s&&(m+=` and next bandwidth > current bandwidth (${f} > ${g})`),l(m),!0}return l(`not ${u} as no switching criteria met`),!1};class wyi extends mn.EventTarget{constructor(t){super(),this.fastQualityChange_=myi(this.fastQualityChange_.bind(this),100);const{src:n,withCredentials:r,tech:i,bandwidth:o,externVhs:a,useCueTags:s,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:c,cacheEncryptionKeys:d,bufferBasedABR:h,leastPixelDiffSelector:f,captionServices:g,experimentalUseMMS:m}=t;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:b}=t;(b===null||typeof b>"u")&&(b=1/0),ex=a,this.bufferBasedABR=!!h,this.leastPixelDiffSelector=!!f,this.withCredentials=r,this.tech_=i,this.vhs_=i.vhs,this.player_=t.player_,this.sourceType_=c,this.useCueTags_=s,this.playlistExclusionDuration=l,this.maxPlaylistRetries=b,this.enableLowInitialPlaylist=u,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:b,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=hyi(),m&&Ft.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new Ft.ManagedMediaSource,this.usingManagedMediaSource_=!0,mn.log("Using ManagedMediaSource")):Ft.MediaSource&&(this.mediaSource=new Ft.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=zf(),this.hasPlayed_=!1,this.syncController_=new eyi(t),this.segmentMetadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ryi,this.sourceUpdater_=new GMt(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new tyi,this.keyStatusMap_=new Map;const w={vhs:this.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:o,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:t.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new IOe(n,this.vhs_,Us(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new h4(n,this.vhs_,Us(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new LOe(Us(w,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),t),this.audioSegmentLoader_=new LOe(Us(w,{loaderType:"audio"}),t),this.subtitleSegmentLoader_=new Yvi(Us(w,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((y,x)=>{function E(){i.off("vttjserror",T),y()}function T(){i.off("vttjsloaded",E),x()}i.one("vttjsloaded",E),i.one("vttjserror",T),i.addWebVttScript_()})}),t);const _=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new pyi(this.vhs_.xhr,_),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),vyi.forEach(y=>{this[y+"_"]=yyi.bind(this,y)}),this.logger_=l0("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(C,()=>{const y=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-y,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const t=this.mainAppendsToLoadedData_(),n=this.audioAppendsToLoadedData_();return t===-1||n===-1?-1:t+n}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(t="abr"){const n=this.selectPlaylist();n&&this.shouldSwitchToMedia_(n)&&this.switchMedia_(n,t)}switchMedia_(t,n,r){const i=this.media(),o=i&&(i.id||i.uri),a=t&&(t.id||t.uri);if(o&&o!==a){this.logger_(`switch media ${o} -> ${a} from ${n}`);const s={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:n};this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${n}`})}this.mainPlaylistLoader_.media(t,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{const n=this.mediaTypes_[t],r=n?n.activeGroup():null,i=this.contentSteeringController_.getPathway();if(r&&i){const a=(r.length?r[0].playlists:r.playlists).filter(s=>s.attributes.serviceLocation===i);a.length&&this.mediaTypes_[t].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=Ft.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(Ft.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const t=this.main(),n=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return n;const r=t.mediaGroups.AUDIO,i=Object.keys(r);let o;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)o=this.mediaTypes_.AUDIO.activeTrack();else{const s=r.main||i.length&&r[i[0]];for(const l in s)if(s[l].default){o={label:l};break}}if(!o)return n;const a=[];for(const s in r)if(r[s][o.label]){const l=r[s][o.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(t.playlists.length)for(let u=0;u<t.playlists.length;u++){const c=t.playlists[u];c.attributes&&c.attributes.AUDIO&&c.attributes.AUDIO===s&&a.push(c)}}return a.length?a:n}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;EOe(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,n.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.mainSegmentLoader_.load()),fyi({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),n),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let n=this.mainPlaylistLoader_.media();if(!n){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;n=this.initialMedia_}this.handleUpdatedMediaPlaylist(n)}),this.mainPlaylistLoader_.on("error",()=>{const n=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:n.playlist,error:n})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const n=this.mainPlaylistLoader_.media(),r=n.targetDuration*1.5*1e3;EOe(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(n,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const n=this.mainPlaylistLoader_.media();if(n.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(n)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(n=>{this.mainPlaylistLoader_.on(n,r=>{this.player_.trigger(vd({},r))})})}handleUpdatedMediaPlaylist(t){this.useCueTags_&&this.updateAdCues_(t),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!t.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(t,n){const r=t.mediaGroups||{};let i=!0;const o=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const s in r.AUDIO[a])r.AUDIO[a][s].uri||(i=!1);i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),ex.Playlist.isAes(n)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),o.length&&Object.keys(r.AUDIO[o[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(t){const n=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),i=this.bufferLowWaterLine(),o=this.bufferHighWaterLine(),a=this.tech_.buffered();return byi({buffered:a,currentTime:r,currentPlaylist:n,nextPlaylist:t,bufferLowWaterLine:i,bufferHighWaterLine:o,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const i=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(i)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",r=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:gyi}))});const t=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(r=>{this.mainSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))}),this.audioSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))}),this.subtitleSegmentLoader_.on(r,i=>{this.player_.trigger(vd({},i))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(t=this.selectPlaylist()){if(t&&t===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(t,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const t=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<t.start(0))return this.tech_.setCurrentTime(t.end(t.length-1))}setupFirstPlay(){const t=this.mainPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList||t.start){const n=this.seekable();if(!n.length)return!1;const r=n.end(0);let i=r;if(t.start){const o=t.start.timeOffset;if(o<0){const a=this.mainPlaylistLoader_.main,s=ex.Playlist.liveEdgeDelay(a,t),l=r+s;i=Math.max(Math.min(l+o,r),n.start(0))}else i=Math.min(r,o)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const t=this.tech_.play();typeof t<"u"&&typeof t.then=="function"&&t.then(null,n=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const t=this.inbandTextTracks_.metadataTrack_.cues;if(!t||!t.length)return;const n=this.duration();t[t.length-1].endTime=isNaN(n)||Math.abs(n)===1/0?Number.MAX_VALUE:n}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let t=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const n=this.mainSegmentLoader_.getCurrentMediaInfo_();!n||n.hasVideo?t=t&&this.audioSegmentLoader_.ended_:t=this.audioSegmentLoader_.ended_}t&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(t){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(t,this.duration());if(r===null)return!1;const i=ex.Playlist.playlistEnd(t,r),o=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return i-o<=OS;const s=a.end(a.length-1);return s-o<=OS&&i-s<=OS}excludePlaylist({playlistToExclude:t=this.mainPlaylistLoader_.media(),error:n={},playlistExclusionDuration:r}){if(t=t||this.mainPlaylistLoader_.media(),r=r||n.playlistExclusionDuration||this.playlistExclusionDuration,!t){this.error=n,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}t.playlistErrors_++;const i=this.mainPlaylistLoader_.main.playlists,o=i.filter(dae),a=o.length===1&&o[0]===t;if(i.length===1&&r!==1/0)return mn.log.warn(`Problem encountered with playlist ${t.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const g=this.pathwayAttribute_(t),m=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(g),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(g)},m);return}let f=!1;i.forEach(g=>{if(g===t)return;const m=g.excludeUntil;typeof m<"u"&&m!==1/0&&(f=!0,delete g.excludeUntil)}),f&&(mn.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let s;t.playlistErrors_>this.maxPlaylistRetries?s=1/0:s=Date.now()+r*1e3,t.excludeUntil=s,n.reason&&(t.lastExcludeReason_=n.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const l=this.selectPlaylist();if(!l){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const u=n.internal?this.logger_:mn.log.warn,c=n.message?" "+n.message:"";u(`${n.internal?"Internal problem":"Problem"} encountered with playlist ${t.id}.${c} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==t.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==t.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const d=l.targetDuration/2*1e3||5*1e3,h=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=d;return this.switchMedia_(l,"exclude",a||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(t,n){const r=[],i=t==="all";(i||t==="main")&&r.push(this.mainPlaylistLoader_);const o=[];(i||t==="audio")&&o.push("AUDIO"),(i||t==="subtitle")&&(o.push("CLOSED-CAPTIONS"),o.push("SUBTITLES")),o.forEach(a=>{const s=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;s&&r.push(s)}),["main","audio","subtitle"].forEach(a=>{const s=this[`${a}SegmentLoader_`];s&&(t===a||t==="all")&&r.push(s)}),r.forEach(a=>n.forEach(s=>{typeof a[s]=="function"&&a[s]()}))}setCurrentTime(t){const n=c4(this.tech_.buffered(),t);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(n&&n.length)return t;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const t=this.mainPlaylistLoader_.media();return t?t.endList?this.mediaSource?this.mediaSource.duration:ex.Playlist.duration(t):1/0:0}seekable(){return this.seekable_}getSeekableRange_(t,n){const r=t.media();if(!r)return null;const i=this.syncController_.getMediaSequenceSync(n);if(i&&i.isReliable){const s=i.start,l=i.end;if(!isFinite(s)||!isFinite(l))return null;const u=ex.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),c=Math.max(s,l-u);return zf([[s,c]])}const o=this.syncController_.getExpiredTime(r,this.duration());if(o===null)return null;const a=ex.Playlist.seekable(r,o,ex.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(t,n){if(!n)return t;const r=t.start(0),i=t.end(0),o=n.start(0),a=n.end(0);return o>i||r>a?t:zf([[Math.max(r,o),Math.min(i,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!t)return;let n;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!n))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,n),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${WPt(this.seekable_)}]`);const i={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:i}),this.tech_.trigger("seekablechanged")}updateDuration(t){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,t),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(t){const i=this.seekable();if(!i.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<i.end(i.length-1))&&this.sourceUpdater_.setDuration(i.end(i.length-1));return}const n=this.tech_.buffered();let r=ex.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(r=Math.max(r,n.end(n.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(t=>{const n=this.mediaTypes_[t].groups;for(const r in n)n[r].forEach(i=>{i.playlistLoader&&i.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const t=!!this.mediaTypes_.AUDIO.activePlaylistLoader,n=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=t?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!n||!r)}getCodecsOrExclude_(){const t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;const r=VW(this.main(),n),i={},o=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(i.video=r.video||t.main.videoCodec||phi),t.main.isMuxed&&(i.video+=`,${r.audio||t.main.audioCodec||_Rt}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||o)&&(i.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||_Rt,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!i.audio&&!i.video){this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(u,c)=>u?yW(c,this.usingManagedMediaSource_):c2e(c),s={};let l;if(["video","audio"].forEach(function(u){if(i.hasOwnProperty(u)&&!a(t[u].isFmp4,i[u])){const c=t[u].isFmp4?"browser":"muxer";s[c]=s[c]||[],s[c].push(i[u]),u==="audio"&&(l=c)}}),o&&l&&n.attributes.AUDIO){const u=n.attributes.AUDIO;this.main().playlists.forEach(c=>{(c.attributes&&c.attributes.AUDIO)===u&&c!==n&&(c.excludeUntil=1/0)}),this.logger_(`excluding audio group ${u} as ${l} does not support codec(s): "${i.audio}"`)}if(Object.keys(s).length){const u=Object.keys(s).reduce((c,d)=>(c&&(c+=", "),c+=`${d} does not support codec(s): "${s[d].join(",")}"`,c),"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:u},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const u=[];if(["video","audio"].forEach(c=>{const d=(SS(this.sourceUpdater_.codecs[c]||"")[0]||{}).type,h=(SS(i[c]||"")[0]||{}).type;d&&h&&d.toLowerCase()!==h.toLowerCase()&&u.push(`"${this.sourceUpdater_.codecs[c]}" -> "${i[c]}"`)}),u.length){this.excludePlaylist({playlistToExclude:n,error:{message:`Codec switching not supported: ${u.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return i}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const t=this.getCodecsOrExclude_();if(!t)return;this.sourceUpdater_.createSourceBuffers(t);const n=[t.video,t.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(n)}excludeUnsupportedVariants_(){const t=this.main().playlists,n=[];Object.keys(t).forEach(r=>{const i=t[r];if(n.indexOf(i.id)!==-1)return;n.push(i.id);const o=VW(this.main,i),a=[];o.audio&&!c2e(o.audio)&&!yW(o.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${o.audio}`),o.video&&!c2e(o.video)&&!yW(o.video,this.usingManagedMediaSource_)&&a.push(`video codec ${o.video}`),o.text&&o.text==="stpp.ttml.im1t"&&a.push(`text codec ${o.text}`),a.length&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(t){const n=[],r=this.main().playlists,i=BW(SS(t)),o=uMt(i),a=i.video&&SS(i.video)[0]||null,s=i.audio&&SS(i.audio)[0]||null;Object.keys(r).forEach(l=>{const u=r[l];if(n.indexOf(u.id)!==-1||u.excludeUntil===1/0)return;n.push(u.id);const c=[],d=VW(this.mainPlaylistLoader_.main,u),h=uMt(d);if(!(!d.audio&&!d.video)){if(h!==o&&c.push(`codec count "${h}" !== "${o}"`),!this.sourceUpdater_.canChangeType()){const f=d.video&&SS(d.video)[0]||null,g=d.audio&&SS(d.audio)[0]||null;f&&a&&f.type.toLowerCase()!==a.type.toLowerCase()&&c.push(`video codec "${f.type}" !== "${a.type}"`),g&&s&&g.type.toLowerCase()!==s.type.toLowerCase()&&c.push(`audio codec "${g.type}" !== "${s.type}"`)}c.length&&(u.excludeUntil=1/0,this.logger_(`excluding ${u.id}: ${c.join(" && ")}`))}})}updateAdCues_(t){let n=0;const r=this.seekable();r.length&&(n=r.start(0)),Xvi(t,this.cueTagsTrack_,n)}goalBufferLength(){const t=this.tech_.currentTime(),n=Wf.GOAL_BUFFER_LENGTH,r=Wf.GOAL_BUFFER_LENGTH_RATE,i=Math.max(n,Wf.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+t*r,i)}bufferLowWaterLine(){const t=this.tech_.currentTime(),n=Wf.BUFFER_LOW_WATER_LINE,r=Wf.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(n,Wf.MAX_BUFFER_LOW_WATER_LINE),o=Math.max(n,Wf.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+t*r,this.bufferBasedABR?o:i)}bufferHighWaterLine(){return Wf.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(t){VMt(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Ovi({inbandTextTracks:this.inbandTextTracks_,dateRanges:t})}addMetadataToTextTrack(t,n,r){const i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();VMt(this.inbandTextTracks_,t,this.tech_),kvi({inbandTextTracks:this.inbandTextTracks_,metadataArray:n,timestampOffset:i,videoDuration:r})}pathwayAttribute_(t){return t.attributes["PATHWAY-ID"]||t.attributes.serviceLocation}initContentSteeringController_(){const t=this.main();if(t.contentSteering){for(const n of t.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(n));if(this.contentSteeringController_.assignTagProperties(t.uri,t.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(n=>{this.contentSteeringController_.on(n,r=>{this.trigger(vd({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const n=this.main();(this.contentSteeringController_.didDASHTagChange(n.uri,n.contentSteering)||(()=>{const o=this.contentSteeringController_.getAvailablePathways(),a=[];for(const s of n.playlists){const l=s.attributes.serviceLocation;if(l&&(a.push(l),!o.has(l)))return!0}return!!(!a.length&&o.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const t=this.contentSteeringController_.getPathway();if(!t)return;this.handlePathwayClones_();const r=this.main().playlists,i=new Set;let o=!1;Object.keys(r).forEach(a=>{const s=r[a],l=this.pathwayAttribute_(s),u=l&&t!==l;s.excludeUntil===1/0&&s.lastExcludeReason_==="content-steering"&&!u&&(delete s.excludeUntil,delete s.lastExcludeReason_,o=!0);const d=!s.excludeUntil&&s.excludeUntil!==1/0;!i.has(s.id)&&u&&d&&(i.add(s.id),s.excludeUntil=1/0,s.lastExcludeReason_="content-steering",this.logger_(`excluding ${s.id} for ${s.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const s=this.mediaTypes_[a];if(s.activePlaylistLoader){const l=s.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==t&&(o=!0)}}),o&&this.changeSegmentPathway_()}handlePathwayClones_(){const n=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||i&&i.size){for(const[a,s]of r.entries())i.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(a));for(const[a,s]of i.entries()){const l=r.get(a);if(!l){n.filter(c=>c.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(c=>{this.mainPlaylistLoader_.addClonePathway(s,c)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(l,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(t,n){if(t["BASE-ID"]!==n["BASE-ID"]||t.ID!==n.ID||t["URI-REPLACEMENT"].HOST!==n["URI-REPLACEMENT"].HOST)return!1;const r=t["URI-REPLACEMENT"].PARAMS,i=n["URI-REPLACEMENT"].PARAMS;for(const o in r)if(r[o]!==i[o])return!1;for(const o in i)if(r[o]!==i[o])return!1;return!0}changeSegmentPathway_(){const t=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(t,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let t=0;const n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=this.mainPlaylistLoader_.getKeyIdSet(r);!i||!i.size||i.forEach(o=>{const a="usable",s=this.keyStatusMap_.has(o)&&this.keyStatusMap_.get(o)===a,l=r.lastExcludeReason_===n&&r.excludeUntil===1/0;s?s&&l&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${o} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==n&&(r.excludeUntil=1/0,r.lastExcludeReason_=n,this.logger_(`excluding playlist ${r.id} because the key ID ${o} doesn't exist in the keyStatusMap or is not ${a}`)),t++)})}),t>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const i=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,o=r.excludeUntil===1/0&&r.lastExcludeReason_===n;i&&o&&(delete r.excludeUntil,mn.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${n} key IDs`))})}addKeyStatus_(t,n){const o=(typeof t=="string"?t:Gvi(t)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${n}' with key ID ${o} added to the keyStatusMap`),this.keyStatusMap_.set(o,n)}updatePlaylistByKeyStatus(t,n){this.addKeyStatus_(t,n),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const _yi=(e,t,n)=>r=>{const i=e.main.playlists[t],o=COe(i),a=dae(i);if(typeof r>"u")return a;r?delete i.disabled:i.disabled=!0;const s={renditionInfo:{id:t,bandwidth:i.attributes.BANDWIDTH,resolution:i.attributes.RESOLUTION,codecs:i.attributes.CODECS},cause:"fast-quality"};return r!==a&&!o&&(r?(n(i),e.trigger({type:"renditionenabled",metadata:s})):e.trigger({type:"renditiondisabled",metadata:s})),r};class Syi{constructor(t,n,r){const{playlistController_:i}=t,o=i.fastQualityChange_.bind(i);if(n.attributes){const a=n.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=VW(i.main(),n),this.playlist=n,this.id=r,this.enabled=_yi(t.playlists,n.id,o)}}const Cyi=function(e){e.representations=()=>{const t=e.playlistController_.main(),n=FW(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return n?n.filter(r=>!COe(r)).map((r,i)=>new Syi(e,r,r.id)):[]}},rNt=["seeking","seeked","pause","playing","error"];class Eyi extends mn.EventTarget{constructor(t){super(),this.playlistController_=t.playlistController,this.tech_=t.tech,this.seekable=t.seekable,this.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=t.liveRangeSafeTimeDelta,this.media=t.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=l0("PlaybackWatcher"),this.logger_("initialize");const n=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),i=()=>this.techWaiting_(),o=()=>this.resetTimeUpdate_(),a=this.playlistController_,s=["main","subtitle","audio"],l={};s.forEach(c=>{l[c]={reset:()=>this.resetSegmentDownloads_(c),updateend:()=>this.checkSegmentDownloads_(c)},a[`${c}SegmentLoader_`].on("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].on("playlistupdate",l[c].reset),this.tech_.on(["seeked","seeking"],l[c].reset)});const u=c=>{["main","audio"].forEach(d=>{a[`${d}SegmentLoader_`][c]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=()=>u("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",i),this.tech_.on(rNt,o),this.tech_.on("canplay",r),this.tech_.one("play",n),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",i),this.tech_.off(rNt,o),this.tech_.off("canplay",r),this.tech_.off("play",n),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),s.forEach(c=>{a[`${c}SegmentLoader_`].off("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].off("playlistupdate",l[c].reset),this.tech_.off(["seeked","seeking"],l[c].reset)}),this.checkCurrentTimeTimeout_&&Ft.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&Ft.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=Ft.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(t){const n=this.playlistController_[`${t}SegmentLoader_`];this[`${t}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${t} loader`),this[`${t}StalledDownloads_`]=0,this[`${t}Buffered_`]=n.buffered_()}checkSegmentDownloads_(t){const n=this.playlistController_,r=n[`${t}SegmentLoader_`],i=r.buffered_(),o=fgi(this[`${t}Buffered_`],i);if(this[`${t}Buffered_`]=i,o){const a={bufferedRanges:i};n.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(t);return}this[`${t}StalledDownloads_`]++,this.logger_(`found #${this[`${t}StalledDownloads_`]} ${t} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:oR(i)}),!(this[`${t}StalledDownloads_`]<10)&&(this.logger_(`${t} loader stalled download exclusion`),this.resetSegmentDownloads_(t),this.tech_.trigger({type:"usage",name:`vhs-${t}-download-exclusion`}),t!=="subtitle"&&n.excludePlaylist({error:{message:`Excessive ${t} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const t=this.tech_.currentTime(),n=this.tech_.buffered();if(this.lastRecordedTime===t&&(!n.length||t+OS>=n.end(n.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&t===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(t===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(zf([this.lastRecordedTime,t]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=t}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const n=this.seekable(),r=this.tech_.currentTime(),i=this.afterSeekableWindow_(n,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let o;if(i&&(o=n.end(n.length-1)),this.beforeSeekableWindow_(n,r)){const g=n.start(0);o=g+(g===n.end(0)?0:OS)}if(typeof o<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${WPt(n)}. Seeking to ${o}.`),this.tech_.setCurrentTime(o),!0;const a=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,u=a.videoBuffer?a.videoBuffered():null,c=this.media(),d=c.partTargetDuration?c.partTargetDuration:(c.targetDuration-AS)*2,h=[l,u];for(let g=0;g<h.length;g++){if(!h[g])continue;if(wOe(h[g],r)<d)return!1}const f=cae(s,r);return f.length===0?!1:(o=f.start(0)+OS,this.logger_(`Buffered region starts (${f.start(0)}) just beyond seek point (${r}). Seeking to ${o}.`),this.tech_.setCurrentTime(o),!0)}waiting_(){if(this.techWaiting_())return;const t=this.tech_.currentTime(),n=this.tech_.buffered(),r=c4(n,t);if(r.length&&t+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.logger_(`Stopped at ${t} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const t=this.seekable(),n=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(t,n)){const s=t.end(t.length-1);return this.logger_(`Fell out of live window at time ${n}. Seeking to live point (seekable end) ${s}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(s),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:n}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=cae(i,n);return a.length>0?(this.logger_(`Stopped at ${n} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(n),!0):!1}afterSeekableWindow_(t,n,r,i=!1){if(!t.length)return!1;let o=t.end(t.length-1)+OS;const a=!r.endList,s=typeof r.partTargetDuration=="number";return a&&(s||i)&&(o=t.end(t.length-1)+r.targetDuration*3),n>o}beforeSeekableWindow_(t,n){return!!(t.length&&t.start(0)>0&&n<t.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:t,audioBuffered:n,currentTime:r}){if(!t)return;let i;if(t.length&&n.length){const o=c4(t,r-3),a=c4(t,r),s=c4(n,r);s.length&&!a.length&&o.length&&(i={start:o.end(0),end:s.end(0)})}else cae(t,r).length||(i=this.gapFromVideoUnderflow_(t,r));return i?(this.logger_(`Encountered a gap in video from ${i.start} to ${i.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(t){const n=this.tech_.buffered(),r=this.tech_.currentTime(),i=cae(n,r);if(this.resetTimeUpdate_(),i.length===0||r!==t)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",t,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+AS);const o={gapInfo:{from:r,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:o}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(t,n){const r=ugi(t);for(let i=0;i<r.length;i++){const o=r.start(i),a=r.end(i);if(n-o<4&&n-o>2)return{start:o,end:a}}return null}}const xyi={errorInterval:30,getSource(e){const n=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return e(n)}},iNt=function(e,t){let n=0,r=0;const i=Us(xyi,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const o=function(){r&&e.currentTime(r)},a=function(c){c!=null&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",o),e.src(c),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},s=function(){if(Date.now()-n<i.errorInterval*1e3){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!i.getSource||typeof i.getSource!="function"){mn.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return n=Date.now(),i.getSource.call(e,a)},l=function(){e.off("loadedmetadata",o),e.off("error",s),e.off("dispose",l)},u=function(c){l(),iNt(e,c)};e.on("error",s),e.on("dispose",l),e.reloadSourceOnError=u},Tyi=function(e){iNt(this,e)};var oNt="3.17.3",kyi="7.1.0",Dyi="1.3.1",Ayi="7.2.0",Oyi="4.0.2";const fc={PlaylistLoader:h4,Playlist:Tg,utils:Ngi,STANDARD_PLAYLIST_SELECTOR:FMt,INITIAL_PLAYLIST_SELECTOR:Svi,lastBandwidthSelector:FMt,movingAverageBandwidthSelector:wvi,comparePlaylistBandwidth:MOe,comparePlaylistResolution:bvi,xhr:pMt()};Object.keys(Wf).forEach(e=>{Object.defineProperty(fc,e,{get(){return mn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Wf[e]},set(t){if(mn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),typeof t!="number"||t<0){mn.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}Wf[e]=t}})});const aNt="videojs-vhs",sNt=function(e,t){const n=t.media();let r=-1;for(let i=0;i<e.length;i++)if(e[i].id===n.id){r=i;break}e.selectedIndex_=r,e.trigger({selectedIndex:r,type:"change"})},Iyi=function(e,t){t.representations().forEach(n=>{e.addQualityLevel(n)}),sNt(e,t.playlists)};fc.canPlaySource=function(){return mn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Ryi=(e,t,n)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=BW(SS(t.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const i=j3(r.video),o=j3(r.audio),a={};for(const s in e)a[s]={},o&&(a[s].audioContentType=o),i&&(a[s].videoContentType=i),t.contentProtection&&t.contentProtection[s]&&t.contentProtection[s].pssh&&(a[s].pssh=t.contentProtection[s].pssh),typeof e[s]=="string"&&(a[s].url=e[s]);return Us(e,a)},$yi=(e,t)=>e.reduce((n,r)=>{if(!r.contentProtection)return n;const i=t.reduce((o,a)=>{const s=r.contentProtection[a];return s&&s.pssh&&(o[a]={pssh:s.pssh}),o},{});return Object.keys(i).length&&n.push(i),n},[]),Pyi=({player:e,sourceKeySystems:t,audioMedia:n,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const i=n?r.concat([n]):r,o=$yi(i,Object.keys(t)),a=[],s=[];return o.forEach(l=>{s.push(new Promise((u,c)=>{e.tech_.one("keysessioncreated",u)})),a.push(new Promise((u,c)=>{e.eme.initializeMediaKeys({keySystems:l},d=>{if(d){c(d);return}u()})}))}),Promise.race([Promise.all(a),Promise.race(s)])},Myi=({player:e,sourceKeySystems:t,media:n,audioMedia:r})=>{const i=Ryi(t,n,r);return i?(e.currentSource().keySystems=i,i&&!e.eme?(mn.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},lNt=()=>{if(!Ft.localStorage)return null;const e=Ft.localStorage.getItem(aNt);if(!e)return null;try{return JSON.parse(e)}catch{return null}},Nyi=e=>{if(!Ft.localStorage)return!1;let t=lNt();t=t?Us(t,e):e;try{Ft.localStorage.setItem(aNt,JSON.stringify(t))}catch{return!1}return t},Lyi=e=>e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(e.substring(e.indexOf(",")+1)):e,uNt=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},cNt=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},dNt=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},fNt=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};fc.supportsNativeHls=function(){if(!sr||!sr.createElement)return!1;const e=sr.createElement("video");return mn.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(n){return/maybe|probably/i.test(e.canPlayType(n))}):!1}(),fc.supportsNativeDash=function(){return!sr||!sr.createElement||!mn.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(sr.createElement("video").canPlayType("application/dash+xml"))}(),fc.supportsTypeNatively=e=>e==="hls"?fc.supportsNativeHls:e==="dash"?fc.supportsNativeDash:!1,fc.isSupported=function(){return mn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},fc.xhr.onRequest=function(e){uNt(fc.xhr,e)},fc.xhr.onResponse=function(e){cNt(fc.xhr,e)},fc.xhr.offRequest=function(e){dNt(fc.xhr,e)},fc.xhr.offResponse=function(e){fNt(fc.xhr,e)};const Fyi=mn.getComponent("Component");class hNt extends Fyi{constructor(t,n,r){if(super(n,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=l0("VhsHandler"),n.options_&&n.options_.playerId){const i=mn.getPlayer(n.options_.playerId);this.player_=i}if(this.tech_=n,this.source_=t,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(sr,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],i=>{const o=sr.fullscreenElement||sr.webkitFullscreenElement||sr.mozFullScreenElement||sr.msFullscreenElement;o&&o.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(t={}){if(this.options_=Us(this.options_,t),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=lNt();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Wf.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Wf.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const n=this.options_.customPixelRatio;typeof n=="number"&&n>=0&&(this.customPixelRatio=n)}setOptions(t={}){this.setOptions_(t)}src(t,n){if(!t)return;this.setOptions_(),this.options_.src=Lyi(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=fc,this.options_.sourceType=SRt(n),this.options_.seekTo=o=>{this.tech_.setCurrentTime(o)},this.options_.player_=this.player_,this.playlistController_=new wyi(this.options_);const r=Us({liveRangeSafeTimeDelta:OS},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Eyi(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const o=mn.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),o.error(a)});const i=this.options_.bufferBasedABR?fc.movingAverageBandwidthSelector(.55):fc.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):i.bind(this),this.playlistController_.selectInitialPlaylist=fc.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(o){this.playlistController_.selectPlaylist=o.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(o){this.playlistController_.mainSegmentLoader_.throughput.rate=o,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let o=this.playlistController_.mainSegmentLoader_.bandwidth;const a=Ft.navigator.connection||Ft.navigator.mozConnection||Ft.navigator.webkitConnection,s=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=s&&o>=s?o=Math.max(o,l):o=l}return o},set(o){this.playlistController_.mainSegmentLoader_.bandwidth=o,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const o=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(o+a))},set(){mn.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>oR(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>oR(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&Nyi({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Cyi(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=Ft.URL.createObjectURL(this.playlistController_.mediaSource),(mn.browser.IS_ANY_SAFARI||mn.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Pyi({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(n=>{this.logger_("error while creating EME key session",n),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=Myi({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!n){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const t=mn.players[this.tech_.options_.playerId];!t||!t.qualityLevels||this.qualityLevels_||(this.qualityLevels_=t.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{Iyi(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{sNt(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":oNt,"mux.js":kyi,"mpd-parser":Dyi,"m3u8-parser":Ayi,"aes-decrypter":Oyi}}version(){return this.constructor.version()}canChangeType(){return GMt.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(t){this.playlistController_.setCurrentTime(t)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&Ft.URL.revokeObjectURL&&(Ft.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(t,n){return Hgi({playlist:this.playlistController_.media(),time:t,callback:n})}seekToProgramTime(t,n,r=!0,i=2){return bMt({programTime:t,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:n})}setupXhrHooks_(){this.xhr.onRequest=t=>{uNt(this.xhr,t)},this.xhr.onResponse=t=>{cNt(this.xhr,t)},this.xhr.offRequest=t=>{dNt(this.xhr,t)},this.xhr.offResponse=t=>{fNt(this.xhr,t)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const t=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],n=["gapjumped","playedrangeschanged"];t.forEach(r=>{this.playlistController_.on(r,i=>{this.player_.trigger(vd({},i))})}),n.forEach(r=>{this.playbackWatcher_.on(r,i=>{this.player_.trigger(vd({},i))})})}}const gae={name:"videojs-http-streaming",VERSION:oNt,canHandleSource(e,t={}){const n=Us(mn.options,t);return!n.vhs.experimentalUseMMS&&!yW("avc1.4d400d,mp4a.40.2",!1)?!1:gae.canPlayType(e.type,n)},handleSource(e,t,n={}){const r=Us(mn.options,n);return t.vhs=new hNt(e,t,r),t.vhs.xhr=pMt(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const n=SRt(e);if(!n)return"";const r=gae.getOverrideNative(t);return!fc.supportsTypeNatively(n)||r?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,n=!(mn.browser.IS_ANY_SAFARI||mn.browser.IS_IOS),{overrideNative:r=n}=t;return r}};yW("avc1.4d400d,mp4a.40.2",!0)&&mn.getTech("Html5").registerSourceHandler(gae,0),mn.VhsHandler=hNt,mn.VhsSourceHandler=gae,mn.Vhs=fc,mn.use||mn.registerComponent("Vhs",fc),mn.options.vhs=mn.options.vhs||{},(!mn.getPlugin||!mn.getPlugin("reloadSourceOnError"))&&mn.registerPlugin("reloadSourceOnError",Tyi),typeof mn>"u"&&console.warn(" videojs not detected");var Byi=mn.getPlugin("plugin"),Vyi=function(e){function t(n,r){var i;return Ifi(this,t),i=Ofi(this,t,[n]),XIt(i,"defaultOptions",{beforeElement:"fullscreenToggle",textControl:"Download video",name:"downloadButton",downloadURL:null}),i.options=KI(KI({},i.defaultOptions),r),i.player.on("ready",function(){var o=this,a=mn.getComponent("Button"),s=new a(n,{className:"vjs-icon-file-download"});s.el_.title="Download",s.on("click",ZIt(gW().m(function c(){var d,h,f,g,m,b;return gW().w(function(w){for(;;)switch(w.n){case 0:if(d=function(C){var y=C.split("/"),x=y[y.length-1],E=x.split("?")[0];return E},h=o.player().lastSource_.player,!h){w.n=3;break}return w.n=1,fetch(h);case 1:return f=w.v,w.n=2,f.blob();case 2:g=w.v,m=window.URL.createObjectURL(g),b=document.createElement("a"),b.href=m,b.download=d(m)||h.split("/").pop(),b.click(),window.URL.revokeObjectURL(m);case 3:return w.a(2)}},c)})));var l=n.getChild("ControlBar").el(),u=n.controlBar.getChild("fullscreenToggle");l.insertBefore(s.el(),u.el())}),i}return $fi(t,e),Rfi(t)}(Byi);mn.registerPlugin("DownloadVideoJs",Vyi);var Uyi=Math.floor,jyi=Math.ceil,pNt=Math.max,mNt=Math.min,Hyi=.002,zyi=1;function Wyi(e,t,n){var r=n,i=0;if(e<=.5){var o=e*r+Hyi*r+zyi;i=mNt(pNt(Uyi(o),1),t)}else{var a=e*r;i=mNt(pNt(jyi(a),1),t)}return i}var qyi=function(t){var n=t.videoPlayer,r=t.videoJsProps,i=K(0),o=K(!0),a=K(null),s=function(_){return String(_.toFixed(0)).padStart(2,"0")},l=24,u=K(),c=q(function(){return KI({playbackRates:[.5,1,1.5,2],plugins:{DownloadVideoJs:{text:"Download"}},userActions:{hotkeys:{playPauseKey:function(_){return _.which===32}}}},r.value)}),d=function(){var w=ZIt(gW().m(function _(C){var y,x,E,T,O,A,D,R,N,$;return gW().w(function(P){for(;;)switch(P.n){case 0:if(y=C.now,C.eventSource,!f.value){P.n=2;break}if(E=(x=a.value)===null||x===void 0?void 0:x.currentTime(),!(E===void 0||Number.isNaN(Number(E)))){P.n=1;break}return P.a(2);case 1:T=Wyi(E,i.value,l),O=Math.floor(E/3600),A=Math.floor(E%3600/60),D=Math.floor(E%60),R=Math.floor(T%l),N="".concat(s(O),":").concat(s(A),":").concat(s(D),":").concat(s(R)),$=u.value.querySelector(".vjs-remaining-time.vjs-time-control.vjs-control"),$.innerText=N;case 2:f.value=Number(y),n.value&&n.value.requestVideoFrameCallback(function(B,F){return d({now:B,eventSource:"requestVideoFrameCallback"})});case 3:return P.a(2)}},_)}));return function(C){return w.apply(this,arguments)}}(),h=function(_){var C,y=(C=a.value)===null||C===void 0?void 0:C.currentTime();d({now:y,eventSource:_})},f=K(0),g=function(){a.value&&(a.value.on("loadedmetadata",function(_){var C,y,x,E;o.value=!0,(C=n.value)===null||C===void 0||C.requestVideoFrameCallback(function(T,O){return d({now:0,eventSource:"loadedmetadata"})}),(y=a.value)===null||y===void 0||y.on("onpause",function(T){return h("onpause")}),(x=a.value)===null||x===void 0||x.on("stopped",function(T){return h("onpause")}),(E=a.value)===null||E===void 0||E.on("ended",function(T){return h("ended")})}),a.value.on("canplaythrough",function(){var _,C=((_=a.value)===null||_===void 0?void 0:_.duration())||0;i.value=Math.ceil(C*l)}),a.value.on("error",function(){var _,C=(_=a.value)===null||_===void 0?void 0:_.error();C&&console.log(C),o.value=!1}))},m=function(){try{if(!n.value){console.error("videoPlayer is not defined");return}a.value=mn(n.value,c.value,function(){g()})}catch(_){console.error("Error in video player setup",_)}};ai(function(){a.value&&a.value.dispose()});var b=function(_){var C,y;(C=a.value)===null||C===void 0||C.src(_),(y=a.value)===null||y===void 0||y.load()};return{initVideoPlayer:m,wrapperPlayer:u,videoJsInstance:a,setNewSource:b}},Gyi={key:0,class:"loading"},gNt=wt({__name:"VideoPlayer",props:{sources:{type:Array,required:!0,default:function(){return[{src:"https://vjs.zencdn.net/v/oceans.mp4",type:"video/mp4"},{src:"https://ik.imagekit.io/opqldywkf/21x9.mp4",type:"video/mp4"}]}},poster:{type:String,required:!0,default:void 0},fps:{type:Number,required:!1,default:24}},setup:function(t){var n=t,r=K(null),i=q(function(){return{controls:!0,autoplay:!1,fluid:!1,fill:!0,responsive:!0,sources:n.sources,poster:n.poster||void 0}}),o=qyi({videoPlayer:r,videoJsProps:i}),a=o.initVideoPlayer,s=o.wrapperPlayer,l=o.setNewSource;yn(function(){a()}),gt(function(){return n.sources},function(d){l(d)},{deep:!0,immediate:!0});var u=K(!1),c=function(h){console.error("Error loading video",h)};return function(d,h){return j(),se("div",{class:"video-wrapper",ref_key:"wrapperPlayer",ref:s},[De("video",rn({ref_key:"videoPlayer",ref:r},i.value,{class:"video-js vjs-has-started",onError:c}),null,16),u.value?(j(),se("div",Gyi,YAe(h[0]||(h[0]=[De("span",{class:"loader"},null,-1)])))):Ke("v-if",!0)],512)}}});gNt.__file="packages/player-component/components/video-player/VideoPlayer.vue";var Kyi={key:0,class:"media-player-header"},Yyi={key:0,class:"document-content"},Zyi={class:"document-content-file"},Xyi=["src"],Jyi={key:2,class:"video-player"},Qyi=["src"],ebi={key:4,class:"document-content"},tbi={class:"document-content-file"},nbi={class:"prev-button"},rbi={class:"next-button"},ibi={key:6,class:"media-player-control"},vae=wt({__name:"index",props:{listItems:{type:Array,required:!0,default:function(){return[]}},sharedStyles:{type:Object,required:!1,default:function(){return{}}},downloadConfiguration:{type:null,required:!1},showHeader:{type:Boolean,required:!1,default:!0},name:{type:String,required:!0,default:""},disabled:{type:Boolean,required:!1,default:!1},openIn:{type:Object,required:!1,default:void 0}},emits:["openInArboReview","download","onErrorVideo","event-trigger","change","changeName","onError"],setup:function(t,n){var r=n.expose,i=n.emit,o=t,a=i,s=K(0),l=function(){s.value<o.listItems.length-1?s.value++:s.value=0},u=function(){s.value>0?s.value--:s.value=o.listItems.length-1},c=function(){s.value=0},d=function(){console.log("onDownload",A.value),E(A.value.src,A.value.name)},h=K(),f=K(!1),g=function(){var F=h.value;console.log("Toggling fullscreen for player:",document.fullscreenElement),F&&(document.fullscreenElement?document.exitFullscreen().catch(function(){}):F.requestFullscreen().catch(function(){}))},m=function(){u()},b=function(){l()},w=function(F){a("changeName",F)},_=function(F){a("openInArboReview",F)},C=function(F){a("onErrorVideo",F)},y=function(F){a("onError",{event:F})},x=function(F){var z=F.event,G=F.player,ee=F.which,fe=F.data;a("event-trigger",{event:z,player:G,which:ee,data:fe})},E=function(F,z){console.log("onDownload",F,z);var G=KI({mode:"cors",method:"GET"},o.downloadConfiguration);console.log("aaa",F,z);var ee=function(oe){var U=oe.split("/"),L=U[U.length-1],Y=L.split("?")[0];return Y};console.log("Downloading file:",F),fetch(F,KI({},G)).then(function(fe){return fe.blob()}).then(function(fe){var oe=window.URL.createObjectURL(fe),U=document.createElement("a");U.href=oe;var L=ee(z||F);L||(L=F.split("/").pop()||"download"),L=L.split("?")[0],L.includes("_Expires=")&&(L=L.split("_Expires=")[0]),U.type=fe.type,U.download=L,U.click(),window.URL.revokeObjectURL(oe)}).catch(function(fe){console.error("Error downloading the file:",fe)}),a("download",F)},T=function(F){s.value=F},O=K(o.name);gt(function(){return o.name},function(B){O.value=B},{immediate:!0});var A=q(function(){var B={src:"",type:"other",id:"",fileType:""};return o.listItems[s.value]&&(B=o.listItems[s.value]),B}),D=q(function(){var B=A.value;return{sources:[{src:B.src,type:B.fileType}],poster:B.poster||null,fps:B.framePerSecond,controls:!0,autoplay:!1,fluid:!1,fill:!0,responsive:!0}}),R=q(function(){return KI({},o.sharedStyles)}),N=q(function(){return o.listItems.length>1});gt(function(){return o.listItems},function(){s.value>o.listItems.length-1&&c()});var $=function(F){var z=o.listItems.findIndex(function(G){return G.src===F});T(z)},P=q(function(){var B,F,z,G,ee,fe={download:((B=A.value)===null||B===void 0?void 0:B.type)!=="video"&&((F=A.value)===null||F===void 0?void 0:F.type)!=="pdf",fullscreen:((z=A.value)===null||z===void 0?void 0:z.type)!=="video"&&((G=A.value)===null||G===void 0?void 0:G.type)!=="other"};if(((ee=A.value)===null||ee===void 0?void 0:ee.type)!=="video")return fe});return r({setCurrentIndex:T,selectPreviewItem:$}),gt([s,A],function(){a("change",{index:s.value,state:KI({},A.value)})}),yn(function(){document.addEventListener("fullscreenchange",function(){var B=!!document.fullscreenElement;f.value=B})}),function(B,F){var z=Ja("arbo-tooltip");return j(),se("div",{class:"media-player video-js",style:pn(R.value)},[t.showHeader?(j(),se("div",Kyi,[Me(Z(Nte),{size:"h3",modelValue:O.value,"onUpdate:modelValue":F[0]||(F[0]=function(G){return O.value=G}),onFinish:w,disabled:t.disabled},null,8,["modelValue","disabled"]),t.openIn?(j(),ot(Z(or),{key:0,"prefix-tooltip":t.openIn.tooltip,onClick:F[1]||(F[1]=function(G){return _(A.value.src)}),type:"primary",style:{minWidth:"125px",justifyContent:"flex-start",fontSize:"14px"},label:t.openIn.label,"prefix-icon":t.openIn.icon,size:"small"},null,8,["prefix-tooltip","label","prefix-icon"])):Ke("v-if",!0)])):Ke("v-if",!0),De("div",{class:"media-player-preview",ref_key:"mediaPlayer",ref:h},[A.value===void 0?(j(),se("div",Yyi,[De("div",Zyi,[Me(Z(to),{name:"File"})]),F[2]||(F[2]=De("h3",{class:"document-content-title"},"No preview available.",-1))])):A.value.type==="image"?(j(),se("img",{key:1,class:"media-player-image",src:A.value.src,alt:"",onError:y},null,40,Xyi)):A.value.type==="video"?(j(),se("div",Jyi,[(j(),ot(gNt,rn({key:A.value.src},D.value,{onOnError:C,onEventTrigger:x}),null,16))])):A.value.type==="pdf"?(j(),se("embed",{key:3,onError:y,width:"100%",height:"100%",src:A.value.src,type:"application/pdf"},null,40,Qyi)):(j(),se("div",ebi,[De("div",tbi,[Me(Z(to),{name:"File"})]),F[3]||(F[3]=De("h3",{class:"document-content-title"},"No preview available.",-1))])),N.value?(j(),se(Ht,{key:5},[$t((j(),se("div",nbi,[Me(Z(Fd),{"suffix-icon":"ArrowLeft",label:"",onClick:m},{suffix:qe(function(G){var ee=G.suffixIcon;return[Me(Z(or),{type:"secondary",label:"",class:"navigate-button"},{default:qe(function(){return[Me(Z(to),{name:ee},null,8,["name"])]}),_:2},1024)]}),_:1})])),[[z,{content:"Previous",delay:[300,0],hideOnClick:!1}]]),$t((j(),se("div",rbi,[Me(Z(Fd),{"suffix-icon":"ArrowRight",label:"",onClick:b},{suffix:qe(function(G){var ee=G.suffixIcon;return[Me(Z(or),{type:"secondary",label:"",class:"navigate-button"},{default:qe(function(){return[Me(Z(to),{name:ee},null,8,["name"])]}),_:2},1024)]}),_:1})])),[[z,{content:"Next",delay:[300,0],hideOnClick:!1}]])],64)):Ke("v-if",!0),P.value?(j(),se("div",ibi,[P.value.download?$t((j(),se("button",{key:0,onClick:d,class:"vjs-control vjs-button vjs-icon-file-download",type:"button","aria-disabled":"false",title:"Download"},YAe(F[4]||(F[4]=[De("span",{class:"vjs-icon-placeholder","aria-hidden":"true"},null,-1),De("span",{class:"vjs-control-text","aria-live":"polite"},null,-1)])))),[[z,{content:"Download",delay:[300,0],hideOnClick:!1}]]):Ke("v-if",!0),P.value.fullscreen?$t((j(),se("button",{key:1,class:"vjs-fullscreen-control vjs-control vjs-button",onClick:g},YAe(F[5]||(F[5]=[De("span",{class:"vjs-icon-placeholder","aria-hidden":"true"},null,-1)])))),[[z,{content:"Fullscreen",delay:[300,0],hideOnClick:!1}]]):Ke("v-if",!0)])):Ke("v-if",!0)],512)],4)}}});vae.__scopeId="data-v-e1151a7a",vae.__file="packages/player-component/components/index.vue";/*!
1153
1153
  * vue-draggable-next v2.3.0
1154
1154
  * (c) 2025 Anish George
1155
1155
  * @license MIT