From 2d9095eba672fb44dcfbf122fcf56e026dfb64ec Mon Sep 17 00:00:00 2001 From: da-in Date: Sun, 26 Nov 2023 00:21:49 +0000 Subject: [PATCH] deploy: c3d92d971a53fa05d39f19b06adde58988ce5273 --- 404.html | 5 +- assets/index--6VigWKk.js | 273 -------------------------------------- assets/index-5nUgs8zv.js | 277 +++++++++++++++++++++++++++++++++++++++ index.html | 5 +- 4 files changed, 281 insertions(+), 279 deletions(-) delete mode 100644 assets/index--6VigWKk.js create mode 100644 assets/index-5nUgs8zv.js diff --git a/404.html b/404.html index ad33f95..f10b8f6 100644 --- a/404.html +++ b/404.html @@ -2,11 +2,10 @@ - - + Vite + React + TS - + diff --git a/assets/index--6VigWKk.js b/assets/index--6VigWKk.js deleted file mode 100644 index dd75f9f..0000000 --- a/assets/index--6VigWKk.js +++ /dev/null @@ -1,273 +0,0 @@ -function eb(t,e){for(var i=0;in[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function i(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=i(r);fetch(r.href,s)}})();var $l=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function iv(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var i=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}),i}var nv={exports:{}},Uu={},rv={exports:{}},le={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fo=Symbol.for("react.element"),tb=Symbol.for("react.portal"),ib=Symbol.for("react.fragment"),nb=Symbol.for("react.strict_mode"),rb=Symbol.for("react.profiler"),sb=Symbol.for("react.provider"),ab=Symbol.for("react.context"),ob=Symbol.for("react.forward_ref"),lb=Symbol.for("react.suspense"),ub=Symbol.for("react.memo"),cb=Symbol.for("react.lazy"),cg=Symbol.iterator;function db(t){return t===null||typeof t!="object"?null:(t=cg&&t[cg]||t["@@iterator"],typeof t=="function"?t:null)}var sv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},av=Object.assign,ov={};function As(t,e,i){this.props=t,this.context=e,this.refs=ov,this.updater=i||sv}As.prototype.isReactComponent={};As.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};As.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lv(){}lv.prototype=As.prototype;function yf(t,e,i){this.props=t,this.context=e,this.refs=ov,this.updater=i||sv}var vf=yf.prototype=new lv;vf.constructor=yf;av(vf,As.prototype);vf.isPureReactComponent=!0;var dg=Array.isArray,uv=Object.prototype.hasOwnProperty,_f={current:null},cv={key:!0,ref:!0,__self:!0,__source:!0};function dv(t,e,i){var n,r={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)uv.call(e,n)&&!cv.hasOwnProperty(n)&&(r[n]=e[n]);var o=arguments.length-2;if(o===1)r.children=i;else if(1>>1,Te=H[fe];if(0>>1;fer(xr,te))vir(Sr,xr)?(H[fe]=Sr,H[vi]=te,fe=vi):(H[fe]=xr,H[yi]=te,fe=yi);else if(vir(Sr,te))H[fe]=Sr,H[vi]=te,fe=vi;else break e}}return ee}function r(H,ee){var te=H.sortIndex-ee.sortIndex;return te!==0?te:H.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],p=1,g=null,v=3,S=!1,_=!1,w=!1,I=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(H){for(var ee=i(c);ee!==null;){if(ee.callback===null)n(c);else if(ee.startTime<=H)n(c),ee.sortIndex=ee.expirationTime,e(l,ee);else break;ee=i(c)}}function k(H){if(w=!1,C(H),!_)if(i(l)!==null)_=!0,ue(L);else{var ee=i(c);ee!==null&&Ce(k,ee.startTime-H)}}function L(H,ee){_=!1,w&&(w=!1,x($),$=-1),S=!0;var te=v;try{for(C(ee),g=i(l);g!==null&&(!(g.expirationTime>ee)||H&&!ne());){var fe=g.callback;if(typeof fe=="function"){g.callback=null,v=g.priorityLevel;var Te=fe(g.expirationTime<=ee);ee=t.unstable_now(),typeof Te=="function"?g.callback=Te:g===i(l)&&n(l),C(ee)}else n(l);g=i(l)}if(g!==null)var Ui=!0;else{var yi=i(c);yi!==null&&Ce(k,yi.startTime-ee),Ui=!1}return Ui}finally{g=null,v=te,S=!1}}var N=!1,F=null,$=-1,K=5,Y=-1;function ne(){return!(t.unstable_now()-YH||125fe?(H.sortIndex=te,e(c,H),i(l)===null&&H===i(c)&&(w?(x($),$=-1):w=!0,Ce(k,te-fe))):(H.sortIndex=Te,e(l,H),_||S||(_=!0,ue(L))),H},t.unstable_shouldYield=ne,t.unstable_wrapCallback=function(H){var ee=v;return function(){var te=v;v=ee;try{return H.apply(this,arguments)}finally{v=te}}}})(mv);pv.exports=mv;var Eb=pv.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var gv=G,zt=Eb;function j(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gd=Object.prototype.hasOwnProperty,bb=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fg={},pg={};function Cb(t){return Gd.call(pg,t)?!0:Gd.call(fg,t)?!1:bb.test(t)?pg[t]=!0:(fg[t]=!0,!1)}function wb(t,e,i,n){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Db(t,e,i,n){if(e===null||typeof e>"u"||wb(t,e,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function St(t,e,i,n,r,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var nt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){nt[t]=new St(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];nt[e]=new St(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){nt[t]=new St(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){nt[t]=new St(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){nt[t]=new St(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){nt[t]=new St(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){nt[t]=new St(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){nt[t]=new St(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){nt[t]=new St(t,5,!1,t.toLowerCase(),null,!1,!1)});var xf=/[\-:]([a-z])/g;function Sf(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(xf,Sf);nt[e]=new St(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(xf,Sf);nt[e]=new St(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(xf,Sf);nt[e]=new St(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){nt[t]=new St(t,1,!1,t.toLowerCase(),null,!1,!1)});nt.xlinkHref=new St("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){nt[t]=new St(t,1,!1,t.toLowerCase(),null,!0,!0)});function Ef(t,e,i,n){var r=nt.hasOwnProperty(e)?nt[e]:null;(r!==null?r.type!==0:n||!(2o||r[a]!==s[o]){var l=` -`+r[a].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{td=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?pa(t):""}function Ab(t){switch(t.tag){case 5:return pa(t.type);case 16:return pa("Lazy");case 13:return pa("Suspense");case 19:return pa("SuspenseList");case 0:case 2:case 15:return t=id(t.type,!1),t;case 11:return t=id(t.type.render,!1),t;case 1:return t=id(t.type,!0),t;default:return""}}function Yd(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Mr:return"Fragment";case Rr:return"Portal";case Xd:return"Profiler";case bf:return"StrictMode";case Kd:return"Suspense";case Qd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case _v:return(t.displayName||"Context")+".Consumer";case vv:return(t._context.displayName||"Context")+".Provider";case Cf:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case wf:return e=t.displayName||null,e!==null?e:Yd(t.type)||"Memo";case gn:e=t._payload,t=t._init;try{return Yd(t(e))}catch{}}return null}function kb(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yd(e);case 8:return e===bf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function On(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function xv(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Pb(t){var e=xv(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function tl(t){t._valueTracker||(t._valueTracker=Pb(t))}function Sv(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=xv(t)?t.checked?"true":"false":t.value),t=n,t!==i?(e.setValue(t),!0):!1}function Vl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Jd(t,e){var i=e.checked;return Me({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function gg(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=On(e.value!=null?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Ev(t,e){e=e.checked,e!=null&&Ef(t,"checked",e,!1)}function Zd(t,e){Ev(t,e);var i=On(e.value),n=e.type;if(i!=null)n==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?eh(t,e.type,i):e.hasOwnProperty("defaultValue")&&eh(t,e.type,On(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function yg(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function eh(t,e,i){(e!=="number"||Vl(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var ma=Array.isArray;function Yr(t,e,i,n){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=il.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $a(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var ba={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ib=["Webkit","ms","Moz","O"];Object.keys(ba).forEach(function(t){Ib.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ba[e]=ba[t]})});function Dv(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||ba.hasOwnProperty(t)&&ba[t]?(""+e).trim():e+"px"}function Av(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=Dv(i,e[i],n);i==="float"&&(i="cssFloat"),n?t.setProperty(i,r):t[i]=r}}var Lb=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nh(t,e){if(e){if(Lb[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(j(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(j(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(j(61))}if(e.style!=null&&typeof e.style!="object")throw Error(j(62))}}function rh(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sh=null;function Df(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ah=null,Jr=null,Zr=null;function Tg(t){if(t=go(t)){if(typeof ah!="function")throw Error(j(280));var e=t.stateNode;e&&(e=Hu(e),ah(t.stateNode,t.type,e))}}function kv(t){Jr?Zr?Zr.push(t):Zr=[t]:Jr=t}function Pv(){if(Jr){var t=Jr,e=Zr;if(Zr=Jr=null,Tg(t),e)for(t=0;t>>=0,t===0?32:31-(zb(t)/Hb|0)|0}var nl=64,rl=4194304;function ga(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Wl(t,e){var i=t.pendingLanes;if(i===0)return 0;var n=0,r=t.suspendedLanes,s=t.pingedLanes,a=i&268435455;if(a!==0){var o=a&~r;o!==0?n=ga(o):(s&=a,s!==0&&(n=ga(s)))}else a=i&~r,a!==0?n=ga(a):s!==0&&(n=ga(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&r)&&(r=n&-n,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(n&4&&(n|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0i;i++)e.push(t);return e}function po(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-hi(e),t[e]=i}function Xb(t,e){var i=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=wa),kg=" ",Pg=!1;function Qv(t,e){switch(t){case"keyup":return SC.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yv(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Br=!1;function bC(t,e){switch(t){case"compositionend":return Yv(e);case"keypress":return e.which!==32?null:(Pg=!0,kg);case"textInput":return t=e.data,t===kg&&Pg?null:t;default:return null}}function CC(t,e){if(Br)return t==="compositionend"||!Rf&&Qv(t,e)?(t=Xv(),Dl=Lf=xn=null,Br=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:i,offset:e-t};t=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Ng(i)}}function t_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?t_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function i_(){for(var t=window,e=Vl();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=Vl(t.document)}return e}function Mf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function NC(t){var e=i_(),i=t.focusedElem,n=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&t_(i.ownerDocument.documentElement,i)){if(n!==null&&Mf(i)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=i.textContent.length,s=Math.min(n.start,r);n=n.end===void 0?s:Math.min(n.end,r),!t.extend&&s>n&&(r=n,n=s,s=r),r=Rg(i,s);var a=Rg(i,n);r&&a&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,Fr=null,hh=null,Aa=null,fh=!1;function Mg(t,e,i){var n=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;fh||Fr==null||Fr!==Vl(n)||(n=Fr,"selectionStart"in n&&Mf(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Aa&&Ga(Aa,n)||(Aa=n,n=Kl(hh,"onSelect"),0$r||(t.current=_h[$r],_h[$r]=null,$r--)}function Se(t,e){$r++,_h[$r]=t.current,t.current=e}var Nn={},ut=Un(Nn),kt=Un(!1),cr=Nn;function cs(t,e){var i=t.type.contextTypes;if(!i)return Nn;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function Pt(t){return t=t.childContextTypes,t!=null}function Yl(){Ae(kt),Ae(ut)}function zg(t,e,i){if(ut.current!==Nn)throw Error(j(168));Se(ut,e),Se(kt,i)}function d_(t,e,i){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in e))throw Error(j(108,kb(t)||"Unknown",r));return Me({},i,n)}function Jl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Nn,cr=ut.current,Se(ut,t),Se(kt,kt.current),!0}function Hg(t,e,i){var n=t.stateNode;if(!n)throw Error(j(169));i?(t=d_(t,e,cr),n.__reactInternalMemoizedMergedChildContext=t,Ae(kt),Ae(ut),Se(ut,t)):Ae(kt),Se(kt,i)}var Hi=null,qu=!1,gd=!1;function h_(t){Hi===null?Hi=[t]:Hi.push(t)}function WC(t){qu=!0,h_(t)}function jn(){if(!gd&&Hi!==null){gd=!0;var t=0,e=ge;try{var i=Hi;for(ge=1;t>=a,r-=a,Gi=1<<32-hi(e)+r|i<$?(K=F,F=null):K=F.sibling;var Y=v(x,F,C[$],k);if(Y===null){F===null&&(F=K);break}t&&F&&Y.alternate===null&&e(x,F),T=s(Y,T,$),N===null?L=Y:N.sibling=Y,N=Y,F=K}if($===C.length)return i(x,F),Le&&Qn(x,$),L;if(F===null){for(;$$?(K=F,F=null):K=F.sibling;var ne=v(x,F,Y.value,k);if(ne===null){F===null&&(F=K);break}t&&F&&ne.alternate===null&&e(x,F),T=s(ne,T,$),N===null?L=ne:N.sibling=ne,N=ne,F=K}if(Y.done)return i(x,F),Le&&Qn(x,$),L;if(F===null){for(;!Y.done;$++,Y=C.next())Y=g(x,Y.value,k),Y!==null&&(T=s(Y,T,$),N===null?L=Y:N.sibling=Y,N=Y);return Le&&Qn(x,$),L}for(F=n(x,F);!Y.done;$++,Y=C.next())Y=S(F,x,$,Y.value,k),Y!==null&&(t&&Y.alternate!==null&&F.delete(Y.key===null?$:Y.key),T=s(Y,T,$),N===null?L=Y:N.sibling=Y,N=Y);return t&&F.forEach(function(he){return e(x,he)}),Le&&Qn(x,$),L}function I(x,T,C,k){if(typeof C=="object"&&C!==null&&C.type===Mr&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case el:e:{for(var L=C.key,N=T;N!==null;){if(N.key===L){if(L=C.type,L===Mr){if(N.tag===7){i(x,N.sibling),T=r(N,C.props.children),T.return=x,x=T;break e}}else if(N.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===gn&&Yg(L)===N.type){i(x,N.sibling),T=r(N,C.props),T.ref=na(x,N,C),T.return=x,x=T;break e}i(x,N);break}else e(x,N);N=N.sibling}C.type===Mr?(T=sr(C.props.children,x.mode,k,C.key),T.return=x,x=T):(k=Rl(C.type,C.key,C.props,null,x.mode,k),k.ref=na(x,T,C),k.return=x,x=k)}return a(x);case Rr:e:{for(N=C.key;T!==null;){if(T.key===N)if(T.tag===4&&T.stateNode.containerInfo===C.containerInfo&&T.stateNode.implementation===C.implementation){i(x,T.sibling),T=r(T,C.children||[]),T.return=x,x=T;break e}else{i(x,T);break}else e(x,T);T=T.sibling}T=bd(C,x.mode,k),T.return=x,x=T}return a(x);case gn:return N=C._init,I(x,T,N(C._payload),k)}if(ma(C))return _(x,T,C,k);if(Js(C))return w(x,T,C,k);dl(x,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,T!==null&&T.tag===6?(i(x,T.sibling),T=r(T,C),T.return=x,x=T):(i(x,T),T=Ed(C,x.mode,k),T.return=x,x=T),a(x)):i(x,T)}return I}var hs=T_(!0),x_=T_(!1),yo={},ki=Un(yo),Ya=Un(yo),Ja=Un(yo);function ir(t){if(t===yo)throw Error(j(174));return t}function qf(t,e){switch(Se(Ja,e),Se(Ya,t),Se(ki,yo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ih(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=ih(e,t)}Ae(ki),Se(ki,e)}function fs(){Ae(ki),Ae(Ya),Ae(Ja)}function S_(t){ir(Ja.current);var e=ir(ki.current),i=ih(e,t.type);e!==i&&(Se(Ya,t),Se(ki,i))}function Wf(t){Ya.current===t&&(Ae(ki),Ae(Ya))}var Oe=Un(0);function ru(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var yd=[];function Gf(){for(var t=0;ti?i:4,t(!0);var n=vd.transition;vd.transition={};try{t(!1),e()}finally{ge=i,vd.transition=n}}function F_(){return ii().memoizedState}function QC(t,e,i){var n=Pn(t);if(i={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null},U_(t))j_(e,i);else if(i=g_(t,e,i,n),i!==null){var r=_t();fi(i,t,n,r),$_(i,e,n)}}function YC(t,e,i){var n=Pn(t),r={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null};if(U_(t))j_(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,i);if(r.hasEagerState=!0,r.eagerState=o,mi(o,a)){var l=e.interleaved;l===null?(r.next=r,zf(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}i=g_(t,e,r,n),i!==null&&(r=_t(),fi(i,t,n,r),$_(i,e,n))}}function U_(t){var e=t.alternate;return t===Re||e!==null&&e===Re}function j_(t,e){ka=su=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function $_(t,e,i){if(i&4194240){var n=e.lanes;n&=t.pendingLanes,i|=n,e.lanes=i,kf(t,i)}}var au={readContext:ti,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useInsertionEffect:rt,useLayoutEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useMutableSource:rt,useSyncExternalStore:rt,useId:rt,unstable_isNewReconciler:!1},JC={readContext:ti,useCallback:function(t,e){return xi().memoizedState=[t,e===void 0?null:e],t},useContext:ti,useEffect:Zg,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,Il(4194308,4,O_.bind(null,e,t),i)},useLayoutEffect:function(t,e){return Il(4194308,4,t,e)},useInsertionEffect:function(t,e){return Il(4,2,t,e)},useMemo:function(t,e){var i=xi();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var n=xi();return e=i!==void 0?i(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=QC.bind(null,Re,t),[n.memoizedState,t]},useRef:function(t){var e=xi();return t={current:t},e.memoizedState=t},useState:Jg,useDebugValue:Jf,useDeferredValue:function(t){return xi().memoizedState=t},useTransition:function(){var t=Jg(!1),e=t[0];return t=KC.bind(null,t[1]),xi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var n=Re,r=xi();if(Le){if(i===void 0)throw Error(j(407));i=i()}else{if(i=e(),Je===null)throw Error(j(349));hr&30||C_(n,e,i)}r.memoizedState=i;var s={value:i,getSnapshot:e};return r.queue=s,Zg(D_.bind(null,n,s,t),[t]),n.flags|=2048,to(9,w_.bind(null,n,s,i,e),void 0,null),i},useId:function(){var t=xi(),e=Je.identifierPrefix;if(Le){var i=Xi,n=Gi;i=(n&~(1<<32-hi(n)-1)).toString(32)+i,e=":"+e+"R"+i,i=Za++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(i,{is:n.is}):(t=a.createElement(i),i==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,i),t[bi]=e,t[Qa]=n,Q_(t,e,!1,!1),e.stateNode=t;e:{switch(a=rh(i,n),i){case"dialog":De("cancel",t),De("close",t),r=n;break;case"iframe":case"object":case"embed":De("load",t),r=n;break;case"video":case"audio":for(r=0;rms&&(e.flags|=128,n=!0,ra(s,!1),e.lanes=4194304)}else{if(!n)if(t=ru(a),t!==null){if(e.flags|=128,n=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),ra(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Le)return st(e),null}else 2*$e()-s.renderingStartTime>ms&&i!==1073741824&&(e.flags|=128,n=!0,ra(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(i=s.last,i!==null?i.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=$e(),e.sibling=null,i=Oe.current,Se(Oe,n?i&1|2:i&1),e):(st(e),null);case 22:case 23:return rp(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?Bt&1073741824&&(st(e),e.subtreeFlags&6&&(e.flags|=8192)):st(e),null;case 24:return null;case 25:return null}throw Error(j(156,e.tag))}function aw(t,e){switch(Ff(e),e.tag){case 1:return Pt(e.type)&&Yl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return fs(),Ae(kt),Ae(ut),Gf(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Wf(e),null;case 13:if(Ae(Oe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(j(340));ds()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ae(Oe),null;case 4:return fs(),null;case 10:return Vf(e.type._context),null;case 22:case 23:return rp(),null;case 24:return null;default:return null}}var fl=!1,at=!1,ow=typeof WeakSet=="function"?WeakSet:Set,X=null;function qr(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(n){Be(t,e,n)}else i.current=null}function Ih(t,e,i){try{i()}catch(n){Be(t,e,n)}}var l0=!1;function lw(t,e){if(ph=Gl,t=i_(),Mf(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var n=i.getSelection&&i.getSelection();if(n&&n.rangeCount!==0){i=n.anchorNode;var r=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{i.nodeType,s.nodeType}catch{i=null;break e}var a=0,o=-1,l=-1,c=0,p=0,g=t,v=null;t:for(;;){for(var S;g!==i||r!==0&&g.nodeType!==3||(o=a+r),g!==s||n!==0&&g.nodeType!==3||(l=a+n),g.nodeType===3&&(a+=g.nodeValue.length),(S=g.firstChild)!==null;)v=g,g=S;for(;;){if(g===t)break t;if(v===i&&++c===r&&(o=a),v===s&&++p===n&&(l=a),(S=g.nextSibling)!==null)break;g=v,v=g.parentNode}g=S}i=o===-1||l===-1?null:{start:o,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(mh={focusedElem:t,selectionRange:i},Gl=!1,X=e;X!==null;)if(e=X,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,X=t;else for(;X!==null;){e=X;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var w=_.memoizedProps,I=_.memoizedState,x=e.stateNode,T=x.getSnapshotBeforeUpdate(e.elementType===e.type?w:ui(e.type,w),I);x.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(j(163))}}catch(k){Be(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,X=t;break}X=e.return}return _=l0,l0=!1,_}function Pa(t,e,i){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var r=n=n.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&Ih(e,i,s)}r=r.next}while(r!==n)}}function Xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.create;i.destroy=n()}i=i.next}while(i!==e)}}function Lh(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function Z_(t){var e=t.alternate;e!==null&&(t.alternate=null,Z_(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[bi],delete e[Qa],delete e[vh],delete e[HC],delete e[qC])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function e1(t){return t.tag===5||t.tag===3||t.tag===4}function u0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||e1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Oh(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=Ql));else if(n!==4&&(t=t.child,t!==null))for(Oh(t,e,i),t=t.sibling;t!==null;)Oh(t,e,i),t=t.sibling}function Nh(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Nh(t,e,i),t=t.sibling;t!==null;)Nh(t,e,i),t=t.sibling}var et=null,ci=!1;function pn(t,e,i){for(i=i.child;i!==null;)t1(t,e,i),i=i.sibling}function t1(t,e,i){if(Ai&&typeof Ai.onCommitFiberUnmount=="function")try{Ai.onCommitFiberUnmount(ju,i)}catch{}switch(i.tag){case 5:at||qr(i,e);case 6:var n=et,r=ci;et=null,pn(t,e,i),et=n,ci=r,et!==null&&(ci?(t=et,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):et.removeChild(i.stateNode));break;case 18:et!==null&&(ci?(t=et,i=i.stateNode,t.nodeType===8?md(t.parentNode,i):t.nodeType===1&&md(t,i),qa(t)):md(et,i.stateNode));break;case 4:n=et,r=ci,et=i.stateNode.containerInfo,ci=!0,pn(t,e,i),et=n,ci=r;break;case 0:case 11:case 14:case 15:if(!at&&(n=i.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){r=n=n.next;do{var s=r,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Ih(i,e,a),r=r.next}while(r!==n)}pn(t,e,i);break;case 1:if(!at&&(qr(i,e),n=i.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=i.memoizedProps,n.state=i.memoizedState,n.componentWillUnmount()}catch(o){Be(i,e,o)}pn(t,e,i);break;case 21:pn(t,e,i);break;case 22:i.mode&1?(at=(n=at)||i.memoizedState!==null,pn(t,e,i),at=n):pn(t,e,i);break;default:pn(t,e,i)}}function c0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new ow),e.forEach(function(n){var r=yw.bind(null,t,n);i.has(n)||(i.add(n),n.then(r,r))})}}function li(t,e){var i=e.deletions;if(i!==null)for(var n=0;nr&&(r=a),n&=~s}if(n=r,n=$e()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*cw(n/1960))-n,10t?16:t,Sn===null)var n=!1;else{if(t=Sn,Sn=null,uu=0,de&6)throw Error(j(331));var r=de;for(de|=4,X=t.current;X!==null;){var s=X,a=s.child;if(X.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l$e()-ip?rr(t,0):tp|=i),It(t,e)}function u1(t,e){e===0&&(t.mode&1?(e=rl,rl<<=1,!(rl&130023424)&&(rl=4194304)):e=1);var i=_t();t=tn(t,e),t!==null&&(po(t,e,i),It(t,i))}function gw(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),u1(t,i)}function yw(t,e){var i=0;switch(t.tag){case 13:var n=t.stateNode,r=t.memoizedState;r!==null&&(i=r.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(j(314))}n!==null&&n.delete(e),u1(t,i)}var c1;c1=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||kt.current)At=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return At=!1,rw(t,e,i);At=!!(t.flags&131072)}else At=!1,Le&&e.flags&1048576&&f_(e,eu,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Ll(t,e),t=e.pendingProps;var r=cs(e,ut.current);ts(e,i),r=Kf(null,e,n,t,r,i);var s=Qf();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Pt(n)?(s=!0,Jl(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Hf(e),r.updater=Wu,e.stateNode=r,r._reactInternals=e,bh(e,n,t,i),e=Dh(null,e,n,!0,s,i)):(e.tag=0,Le&&s&&Bf(e),pt(null,e,r,i),e=e.child),e;case 16:n=e.elementType;e:{switch(Ll(t,e),t=e.pendingProps,r=n._init,n=r(n._payload),e.type=n,r=e.tag=_w(n),t=ui(n,t),r){case 0:e=wh(null,e,n,t,i);break e;case 1:e=s0(null,e,n,t,i);break e;case 11:e=n0(null,e,n,t,i);break e;case 14:e=r0(null,e,n,ui(n.type,t),i);break e}throw Error(j(306,n,""))}return e;case 0:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:ui(n,r),wh(t,e,n,r,i);case 1:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:ui(n,r),s0(t,e,n,r,i);case 3:e:{if(G_(e),t===null)throw Error(j(387));n=e.pendingProps,s=e.memoizedState,r=s.element,y_(t,e),nu(e,n,null,i);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=ps(Error(j(423)),e),e=a0(t,e,n,i,r);break e}else if(n!==r){r=ps(Error(j(424)),e),e=a0(t,e,n,i,r);break e}else for(jt=Dn(e.stateNode.containerInfo.firstChild),$t=e,Le=!0,di=null,i=x_(e,null,n,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ds(),n===r){e=nn(t,e,i);break e}pt(t,e,n,i)}e=e.child}return e;case 5:return S_(e),t===null&&xh(e),n=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,gh(n,r)?a=null:s!==null&&gh(n,s)&&(e.flags|=32),W_(t,e),pt(t,e,a,i),e.child;case 6:return t===null&&xh(e),null;case 13:return X_(t,e,i);case 4:return qf(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=hs(e,null,n,i):pt(t,e,n,i),e.child;case 11:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:ui(n,r),n0(t,e,n,r,i);case 7:return pt(t,e,e.pendingProps,i),e.child;case 8:return pt(t,e,e.pendingProps.children,i),e.child;case 12:return pt(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(n=e.type._context,r=e.pendingProps,s=e.memoizedProps,a=r.value,Se(tu,n._currentValue),n._currentValue=a,s!==null)if(mi(s.value,a)){if(s.children===r.children&&!kt.current){e=nn(t,e,i);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=Qi(-1,i&-i),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?l.next=l:(l.next=p.next,p.next=l),c.pending=l}}s.lanes|=i,l=s.alternate,l!==null&&(l.lanes|=i),Sh(s.return,i,e),o.lanes|=i;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(j(341));a.lanes|=i,o=a.alternate,o!==null&&(o.lanes|=i),Sh(a,i,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}pt(t,e,r.children,i),e=e.child}return e;case 9:return r=e.type,n=e.pendingProps.children,ts(e,i),r=ti(r),n=n(r),e.flags|=1,pt(t,e,n,i),e.child;case 14:return n=e.type,r=ui(n,e.pendingProps),r=ui(n.type,r),r0(t,e,n,r,i);case 15:return H_(t,e,e.type,e.pendingProps,i);case 17:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:ui(n,r),Ll(t,e),e.tag=1,Pt(n)?(t=!0,Jl(e)):t=!1,ts(e,i),__(e,n,r),bh(e,n,r,i),Dh(null,e,n,!0,t,i);case 19:return K_(t,e,i);case 22:return q_(t,e,i)}throw Error(j(156,e.tag))};function d1(t,e){return Bv(t,e)}function vw(t,e,i,n){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(t,e,i,n){return new vw(t,e,i,n)}function ap(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _w(t){if(typeof t=="function")return ap(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Cf)return 11;if(t===wf)return 14}return 2}function In(t,e){var i=t.alternate;return i===null?(i=Jt(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Rl(t,e,i,n,r,s){var a=2;if(n=t,typeof t=="function")ap(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Mr:return sr(i.children,r,s,e);case bf:a=8,r|=8;break;case Xd:return t=Jt(12,i,e,r|2),t.elementType=Xd,t.lanes=s,t;case Kd:return t=Jt(13,i,e,r),t.elementType=Kd,t.lanes=s,t;case Qd:return t=Jt(19,i,e,r),t.elementType=Qd,t.lanes=s,t;case Tv:return Qu(i,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case vv:a=10;break e;case _v:a=9;break e;case Cf:a=11;break e;case wf:a=14;break e;case gn:a=16,n=null;break e}throw Error(j(130,t==null?t:typeof t,""))}return e=Jt(a,i,e,r),e.elementType=t,e.type=n,e.lanes=s,e}function sr(t,e,i,n){return t=Jt(7,t,n,e),t.lanes=i,t}function Qu(t,e,i,n){return t=Jt(22,t,n,e),t.elementType=Tv,t.lanes=i,t.stateNode={isHidden:!1},t}function Ed(t,e,i){return t=Jt(6,t,null,e),t.lanes=i,t}function bd(t,e,i){return e=Jt(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Tw(t,e,i,n,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rd(0),this.expirationTimes=rd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rd(0),this.identifierPrefix=n,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function op(t,e,i,n,r,s,a,o,l){return t=new Tw(t,e,i,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Jt(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hf(s),t}function xw(t,e,i){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m1)}catch(t){console.error(t)}}m1(),fv.exports=qt;var ww=fv.exports,v0=ww;Wd.createRoot=v0.createRoot,Wd.hydrateRoot=v0.hydrateRoot;var g1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_0=Ki.createContext&&Ki.createContext(g1),Ln=function(){return Ln=Object.assign||function(t){for(var e,i=1,n=arguments.length;i"u")throw new Error(e)}function dp(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Iw(){return Math.random().toString(36).substr(2,8)}function x0(t,e){return{usr:t.state,key:t.key,idx:e}}function Uh(t,e,i,n){return i===void 0&&(i=null),no({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Is(e):e,{state:i,key:e&&e.key||n||Iw()})}function _1(t){let{pathname:e="/",search:i="",hash:n=""}=t;return i&&i!=="?"&&(e+=i.charAt(0)==="?"?i:"?"+i),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Is(t){let e={};if(t){let i=t.indexOf("#");i>=0&&(e.hash=t.substr(i),t=t.substr(0,i));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function Lw(t,e,i,n){n===void 0&&(n={});let{window:r=document.defaultView,v5Compat:s=!1}=n,a=r.history,o=En.Pop,l=null,c=p();c==null&&(c=0,a.replaceState(no({},a.state,{idx:c}),""));function p(){return(a.state||{idx:null}).idx}function g(){o=En.Pop;let I=p(),x=I==null?null:I-c;c=I,l&&l({action:o,location:w.location,delta:x})}function v(I,x){o=En.Push;let T=Uh(w.location,I,x);i&&i(T,I),c=p()+1;let C=x0(T,c),k=w.createHref(T);try{a.pushState(C,"",k)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;r.location.assign(k)}s&&l&&l({action:o,location:w.location,delta:1})}function S(I,x){o=En.Replace;let T=Uh(w.location,I,x);i&&i(T,I),c=p();let C=x0(T,c),k=w.createHref(T);a.replaceState(C,"",k),s&&l&&l({action:o,location:w.location,delta:0})}function _(I){let x=r.location.origin!=="null"?r.location.origin:r.location.href,T=typeof I=="string"?I:_1(I);return Xe(x,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,x)}let w={get action(){return o},get location(){return t(r,a)},listen(I){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(T0,g),l=I,()=>{r.removeEventListener(T0,g),l=null}},createHref(I){return e(r,I)},createURL:_,encodeLocation(I){let x=_(I);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:v,replace:S,go(I){return a.go(I)}};return w}var S0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(S0||(S0={}));function Ow(t,e,i){i===void 0&&(i="/");let n=typeof e=="string"?Is(e):e,r=S1(n.pathname||"/",i);if(r==null)return null;let s=T1(t);Nw(s);let a=null;for(let o=0;a==null&&o{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};l.relativePath.startsWith("/")&&(Xe(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=ar([n,l.relativePath]),p=i.concat(l);s.children&&s.children.length>0&&(Xe(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),T1(s.children,e,p,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:$w(c,s.index),routesMeta:p})};return t.forEach((s,a)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))r(s,a);else for(let l of x1(s.path))r(s,a,l)}),e}function x1(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),s=i.replace(/\?$/,"");if(n.length===0)return r?[s,""]:[s];let a=x1(n.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),r&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function Nw(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:Vw(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}const Rw=/^:\w+$/,Mw=3,Bw=2,Fw=1,Uw=10,jw=-2,E0=t=>t==="*";function $w(t,e){let i=t.split("/"),n=i.length;return i.some(E0)&&(n+=jw),e&&(n+=Bw),i.filter(r=>!E0(r)).reduce((r,s)=>r+(Rw.test(s)?Mw:s===""?Fw:Uw),n)}function Vw(t,e){return t.length===e.length&&t.slice(0,-1).every((n,r)=>n===e[r])?t[t.length-1]-e[e.length-1]:0}function zw(t,e){let{routesMeta:i}=t,n={},r="/",s=[];for(let a=0;a{let{paramName:v,isOptional:S}=p;if(v==="*"){let w=o[g]||"";a=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const _=o[g];return S&&!_?c[v]=void 0:c[v]=Gw(_||"",v),c},{}),pathname:s,pathnameBase:a,pattern:t}}function qw(t,e,i){e===void 0&&(e=!1),i===void 0&&(i=!0),dp(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:(\w+)(\?)?/g,(a,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function Ww(t){try{return decodeURI(t)}catch(e){return dp(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Gw(t,e){try{return decodeURIComponent(t)}catch(i){return dp(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+i+").")),t}}function S1(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let i=e.endsWith("/")?e.length-1:e.length,n=t.charAt(i);return n&&n!=="/"?null:t.slice(i)||"/"}function Xw(t,e){e===void 0&&(e="/");let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?Is(t):t;return{pathname:i?i.startsWith("/")?i:Kw(i,e):e,search:eD(n),hash:tD(r)}}function Kw(t,e){let i=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?i.length>1&&i.pop():r!=="."&&i.push(r)}),i.length>1?i.join("/"):"/"}function Cd(t,e,i,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Qw(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function Yw(t){return Qw(t).map((e,i)=>i===t.length-1?e.pathname:e.pathnameBase)}function Jw(t,e,i,n){n===void 0&&(n=!1);let r;typeof t=="string"?r=Is(t):(r=no({},t),Xe(!r.pathname||!r.pathname.includes("?"),Cd("?","pathname","search",r)),Xe(!r.pathname||!r.pathname.includes("#"),Cd("#","pathname","hash",r)),Xe(!r.search||!r.search.includes("#"),Cd("#","search","hash",r)));let s=t===""||r.pathname==="",a=s?"/":r.pathname,o;if(a==null)o=i;else if(n){let g=e[e.length-1].replace(/^\//,"").split("/");if(a.startsWith("..")){let v=a.split("/");for(;v[0]==="..";)v.shift(),g.pop();r.pathname=v.join("/")}o="/"+g.join("/")}else{let g=e.length-1;if(a.startsWith("..")){let v=a.split("/");for(;v[0]==="..";)v.shift(),g-=1;r.pathname=v.join("/")}o=g>=0?e[g]:"/"}let l=Xw(r,o),c=a&&a!=="/"&&a.endsWith("/"),p=(s||a===".")&&i.endsWith("/");return!l.pathname.endsWith("/")&&(c||p)&&(l.pathname+="/"),l}const ar=t=>t.join("/").replace(/\/\/+/g,"/"),Zw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),eD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,tD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function iD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const E1=["post","put","patch","delete"];new Set(E1);const nD=["get",...E1];new Set(nD);/** - * React Router v6.20.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function hu(){return hu=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),G.useCallback(function(l,c){if(c===void 0&&(c={}),!a.current)return;if(typeof l=="number"){i.go(l);return}let p=Jw(l,JSON.parse(s),r,c.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:ar([e,p.pathname])),(c.replace?i.replace:i.push)(p,c.state,c)},[e,i,s,r,t])}function aD(){let{matches:t}=G.useContext(_r),e=t[t.length-1];return e?e.params:{}}function oD(t,e){return lD(t,e)}function lD(t,e,i){nc()||Xe(!1);let{navigator:n}=G.useContext(tc),{matches:r}=G.useContext(_r),s=r[r.length-1],a=s?s.params:{};s&&s.pathname;let o=s?s.pathnameBase:"/";s&&s.route;let l=C1(),c;if(e){var p;let w=typeof e=="string"?Is(e):e;o==="/"||(p=w.pathname)!=null&&p.startsWith(o)||Xe(!1),c=w}else c=l;let g=c.pathname||"/",v=o==="/"?g:g.slice(o.length)||"/",S=Ow(t,{pathname:v}),_=fD(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:ar([o,n.encodeLocation?n.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?o:ar([o,n.encodeLocation?n.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),r,i);return e&&_?G.createElement(ic.Provider,{value:{location:hu({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:En.Pop}},_):_}function uD(){let t=yD(),e=iD(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return G.createElement(G.Fragment,null,G.createElement("h2",null,"Unexpected Application Error!"),G.createElement("h3",{style:{fontStyle:"italic"}},e),i?G.createElement("pre",{style:r},i):null,s)}const cD=G.createElement(uD,null);class dD extends G.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,i){return i.location!==e.location||i.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||i.error,location:i.location,revalidation:e.revalidation||i.revalidation}}componentDidCatch(e,i){console.error("React Router caught the following error during render",e,i)}render(){return this.state.error?G.createElement(_r.Provider,{value:this.props.routeContext},G.createElement(b1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hD(t){let{routeContext:e,match:i,children:n}=t,r=G.useContext(hp);return r&&r.static&&r.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=i.route.id),G.createElement(_r.Provider,{value:e},n)}function fD(t,e,i){var n;if(e===void 0&&(e=[]),i===void 0&&(i=null),t==null){var r;if((r=i)!=null&&r.errors)t=i.matches;else return null}let s=t,a=(n=i)==null?void 0:n.errors;if(a!=null){let o=s.findIndex(l=>l.route.id&&(a==null?void 0:a[l.route.id]));o>=0||Xe(!1),s=s.slice(0,Math.min(s.length,o+1))}return s.reduceRight((o,l,c)=>{let p=l.route.id?a==null?void 0:a[l.route.id]:null,g=null;i&&(g=l.route.errorElement||cD);let v=e.concat(s.slice(0,c+1)),S=()=>{let _;return p?_=g:l.route.Component?_=G.createElement(l.route.Component,null):l.route.element?_=l.route.element:_=o,G.createElement(hD,{match:l,routeContext:{outlet:o,matches:v,isDataRoute:i!=null},children:_})};return i&&(l.route.ErrorBoundary||l.route.errorElement||c===0)?G.createElement(dD,{location:i.location,revalidation:i.revalidation,component:g,error:p,children:S(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):S()},null)}var D1=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(D1||{}),fu=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(fu||{});function pD(t){let e=G.useContext(hp);return e||Xe(!1),e}function mD(t){let e=G.useContext(rD);return e||Xe(!1),e}function gD(t){let e=G.useContext(_r);return e||Xe(!1),e}function A1(t){let e=gD(),i=e.matches[e.matches.length-1];return i.route.id||Xe(!1),i.route.id}function yD(){var t;let e=G.useContext(b1),i=mD(fu.UseRouteError),n=A1(fu.UseRouteError);return e||((t=i.errors)==null?void 0:t[n])}function vD(){let{router:t}=pD(D1.UseNavigateStable),e=A1(fu.UseNavigateStable),i=G.useRef(!1);return w1(()=>{i.current=!0}),G.useCallback(function(r,s){s===void 0&&(s={}),i.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,hu({fromRouteId:e},s)))},[t,e])}function Ml(t){Xe(!1)}function _D(t){let{basename:e="/",children:i=null,location:n,navigationType:r=En.Pop,navigator:s,static:a=!1}=t;nc()&&Xe(!1);let o=e.replace(/^\/*/,"/"),l=G.useMemo(()=>({basename:o,navigator:s,static:a}),[o,s,a]);typeof n=="string"&&(n=Is(n));let{pathname:c="/",search:p="",hash:g="",state:v=null,key:S="default"}=n,_=G.useMemo(()=>{let w=S1(c,o);return w==null?null:{location:{pathname:w,search:p,hash:g,state:v,key:S},navigationType:r}},[o,c,p,g,v,S,r]);return _==null?null:G.createElement(tc.Provider,{value:l},G.createElement(ic.Provider,{children:i,value:_}))}function TD(t){let{children:e,location:i}=t;return oD(jh(e),i)}new Promise(()=>{});function jh(t,e){e===void 0&&(e=[]);let i=[];return G.Children.forEach(t,(n,r)=>{if(!G.isValidElement(n))return;let s=[...e,r];if(n.type===G.Fragment){i.push.apply(i,jh(n.props.children,s));return}n.type!==Ml&&Xe(!1),!n.props.index||!n.props.children||Xe(!1);let a={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=jh(n.props.children,s)),i.push(a)}),i}/** - * React Router DOM v6.20.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const xD="startTransition",b0=gb[xD];function SD(t){let{basename:e,children:i,future:n,window:r}=t,s=G.useRef();s.current==null&&(s.current=Pw({window:r,v5Compat:!0}));let a=s.current,[o,l]=G.useState({action:a.action,location:a.location}),{v7_startTransition:c}=n||{},p=G.useCallback(g=>{c&&b0?b0(()=>l(g)):l(g)},[l,c]);return G.useLayoutEffect(()=>a.listen(p),[a,p]),G.createElement(_D,{basename:e,children:i,location:o.location,navigationType:o.action,navigator:a})}var C0;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(C0||(C0={}));var w0;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(w0||(w0={}));const ED=({title:t})=>{const e=rc(),i=()=>{e(-1)};return q.jsxs("div",{className:"fixed top-0 left-0 flex w-full justify-between p-6 gradient z-40",children:[q.jsx("div",{className:"text-red font-bold text-2xl break-keep",children:t}),q.jsx("button",{onClick:i,children:q.jsx(kw,{size:"24"})})]})};function bD(t){return v1({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M403.002 217.001C388.998 148.002 328.998 96 256 96c-57.998 0-107.998 32.998-132.998 81.001C63.002 183.002 16 233.998 16 296c0 65.996 53.999 120 120 120h260c55 0 100-45 100-100 0-52.998-40.996-96.001-92.998-98.999zM288 276v76h-64v-76h-68l100-100 100 100h-68z"}}]})(t)}const CD={video:!0},wD=()=>{const t=G.useRef(null),e=G.useRef(null),[i,n]=G.useState(!1),r=rc(),s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia(CD);t.current&&!t.current.srcObject&&(t.current.srcObject=l,e.current=new MediaRecorder(l),e.current.ondataavailable=c=>{c.data.size>0},e.current.onstop=()=>{console.log("Recording stopped. Sending data to the server...")},e.current.start(1e3))}catch(l){console.error("Error accessing camera:",l)}};G.useEffect(()=>(s(),()=>{e.current&&e.current.state==="recording"&&e.current.stop()}),[]);const a=G.useRef(null),o=()=>{var c,p;const l=(p=(c=a==null?void 0:a.current)==null?void 0:c.files)==null?void 0:p[0];if(console.log(l),l){n(!0);const g=new FormData;g.append("video",l),g.append("file_name",l==null?void 0:l.name),fetch("http://14.35.173.13:38228/api/video/upload",{method:"POST",body:g}).then(v=>v.json()).then(v=>{console.log("Upload success:",v)}).catch(v=>{console.error("Upload error:",v)}).finally(()=>{n(!1),r(`/view/${l==null?void 0:l.name}`)})}};return q.jsxs(q.Fragment,{children:[q.jsx("video",{className:"video",width:"100%",autoPlay:!0,ref:t}),q.jsxs("div",{className:"fixed top-0 left-0 w-full h-full",children:[q.jsx(ED,{title:"AI BLUR 콘텐츠 등록"}),q.jsx("div",{className:"h-full flex flex-col justify-center items-center backdrop-blur",children:i?q.jsxs(q.Fragment,{children:[q.jsx("span",{className:"font-bold",children:"블러를 입히는 중 입니다. 잠시만 기다려주세요."}),q.jsx("br",{}),q.jsx("span",{className:"loader"})]}):q.jsxs(q.Fragment,{children:[q.jsx("label",{htmlFor:"file",className:"font-bold",children:"블러처리 할 파일을 등록해주세요."}),q.jsx("label",{htmlFor:"file",children:q.jsx(bD,{color:"#FFFFFF",size:"72"})}),q.jsx("input",{id:"file",type:"file",className:"hidden",ref:a,onChange:o})]})})]})]})},DD=()=>q.jsx("div",{className:"text-white font-bold w-full h-full fixed top-0 left-0 bg-black flex justify-center items-center z-40",children:q.jsx("span",{className:"splash text-3xl text-[#E21401]",children:"AI Blur"})});var va;typeof window<"u"?va=window:typeof $l<"u"?va=$l:typeof self<"u"?va=self:va={};var sc=va;const A=un(sc),AD={},kD=Object.freeze(Object.defineProperty({__proto__:null,default:AD},Symbol.toStringTag,{value:"Module"})),PD=iv(kD);var D0=typeof $l<"u"?$l:typeof window<"u"?window:{},ID=PD,_a;typeof document<"u"?_a=document:(_a=D0["__GLOBAL_DOCUMENT_CACHE@4"],_a||(_a=D0["__GLOBAL_DOCUMENT_CACHE@4"]=ID));var k1=_a;const V=un(k1);var $h={exports:{}};(function(t,e){function i(l){if(l&&typeof l=="object"){var c=l.which||l.keyCode||l.charCode;c&&(l=c)}if(typeof l=="number")return a[l];var p=String(l),g=n[p.toLowerCase()];if(g)return g;var g=r[p.toLowerCase()];if(g)return g;if(p.length===1)return p.charCodeAt(0)}i.isEventKey=function(c,p){if(c&&typeof c=="object"){var g=c.which||c.keyCode||c.charCode;if(g==null)return!1;if(typeof p=="string"){var v=n[p.toLowerCase()];if(v)return v===g;var v=r[p.toLowerCase()];if(v)return v===g}else if(typeof p=="number")return p===g;return!1}},e=t.exports=i;var n=e.code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};/*! - * Programatically add the following - */for(s=97;s<123;s++)n[String.fromCharCode(s)]=s-32;for(var s=48;s<58;s++)n[s-48]=s;for(s=1;s<13;s++)n["f"+s]=s+111;for(s=0;s<10;s++)n["numpad "+s]=s+96;var a=e.names=e.title={};for(s in n)a[n[s]]=s;for(var o in r)n[o]=r[o]})($h,$h.exports);var LD=$h.exports;const re=un(LD);var OD=ND;function ND(t,e){var i,n=null;try{i=JSON.parse(t,e)}catch(r){n=r}return[n,i]}const RD=un(OD);var fp={exports:{}};function rn(){return rn=Object.assign?Object.assign.bind():function(t){for(var e=1;e=400&&r.statusCode<=599){var a=s;if(i)if($D.TextDecoder){var o=zD(r.headers&&r.headers["content-type"]);try{a=new TextDecoder(o).decode(s)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(s));e({cause:a});return}e(null,s)}};function zD(t){return t===void 0&&(t=""),t.toLowerCase().split(";").reduce(function(e,i){var n=i.split("="),r=n[0],s=n[1];return r.trim()==="charset"?s.trim():e},"utf-8")}var HD=VD,P1=sc,qD=BD,WD=FD;Pi.httpHandler=HD;/** - * @license - * slighly modified parse-headers 2.0.2 - * Copyright (c) 2014 David Björklund - * Available under the MIT license - * - */var GD=function(e){var i={};return e&&e.trim().split(` -`).forEach(function(n){var r=n.indexOf(":"),s=n.slice(0,r).trim().toLowerCase(),a=n.slice(r+1).trim();typeof i[s]>"u"?i[s]=a:Array.isArray(i[s])?i[s].push(a):i[s]=[i[s],a]}),i};fp.exports=Pi;fp.exports.default=Pi;Pi.XMLHttpRequest=P1.XMLHttpRequest||YD;Pi.XDomainRequest="withCredentials"in new Pi.XMLHttpRequest?Pi.XMLHttpRequest:P1.XDomainRequest;XD(["get","put","post","patch","head","delete"],function(t){Pi[t==="delete"?"del":t]=function(e,i,n){return i=I1(e,i,n),i.method=t.toUpperCase(),L1(i)}});function XD(t,e){for(var i=0;i"u")throw new Error("callback argument missing");var e=!1,i=function(C,k,L){e||(e=!0,t.callback(C,k,L))};function n(){o.readyState===4&&setTimeout(a,0)}function r(){var T=void 0;if(o.response?T=o.response:T=o.responseText||QD(o),w)try{T=JSON.parse(T)}catch{}return T}function s(T){return clearTimeout(I),T instanceof Error||(T=new Error(""+(T||"Unknown XMLHttpRequest Error"))),T.statusCode=0,i(T,x)}function a(){if(!c){var T;clearTimeout(I),t.useXDR&&o.status===void 0?T=200:T=o.status===1223?204:o.status;var C=x,k=null;return T!==0?(C={body:r(),statusCode:T,method:g,headers:{},url:p,rawRequest:o},o.getAllResponseHeaders&&(C.headers=GD(o.getAllResponseHeaders()))):k=new Error("Internal XMLHttpRequest Error"),i(k,C,C.body)}}var o=t.xhr||null;o||(t.cors||t.useXDR?o=new Pi.XDomainRequest:o=new Pi.XMLHttpRequest);var l,c,p=o.url=t.uri||t.url,g=o.method=t.method||"GET",v=t.body||t.data,S=o.headers=t.headers||{},_=!!t.sync,w=!1,I,x={body:void 0,headers:{},statusCode:0,method:g,url:p,rawRequest:o};if("json"in t&&t.json!==!1&&(w=!0,S.accept||S.Accept||(S.Accept="application/json"),g!=="GET"&&g!=="HEAD"&&(S["content-type"]||S["Content-Type"]||(S["Content-Type"]="application/json"),v=JSON.stringify(t.json===!0?v:t.json))),o.onreadystatechange=n,o.onload=a,o.onerror=s,o.onprogress=function(){},o.onabort=function(){c=!0},o.ontimeout=s,o.open(g,p,!_,t.username,t.password),_||(o.withCredentials=!!t.withCredentials),!_&&t.timeout>0&&(I=setTimeout(function(){if(!c){c=!0,o.abort("timeout");var T=new Error("XMLHttpRequest timeout");T.code="ETIMEDOUT",s(T)}},t.timeout)),o.setRequestHeader)for(l in S)S.hasOwnProperty(l)&&o.setRequestHeader(l,S[l]);else if(t.headers&&!KD(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(o.responseType=t.responseType),"beforeSend"in t&&typeof t.beforeSend=="function"&&t.beforeSend(o),o.send(v||null),o}function QD(t){try{if(t.responseType==="document")return t.responseXML;var e=t.responseXML&&t.responseXML.documentElement.nodeName==="parsererror";if(t.responseType===""&&!e)return t.responseXML}catch{}return null}function YD(){}var JD=fp.exports;const O1=un(JD);var N1={exports:{}},A0=k1,pp=Object.create||function(){function t(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function Ut(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}Ut.prototype=pp(Error.prototype);Ut.prototype.constructor=Ut;Ut.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function mp(t){function e(n,r,s,a){return(n|0)*3600+(r|0)*60+(s|0)+(a|0)/1e3}var i=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?e(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?e(i[1],i[2],0,i[4]):e(0,i[1],i[2],i[4]):null}function Oa(){this.values=pp(null)}Oa.prototype={set:function(t,e){!this.get(t)&&e!==""&&(this.values[t]=e)},get:function(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,i){for(var n=0;n=0&&e<=100)?(this.set(t,e),!0):!1}};function Ta(t,e,i,n){var r=n?t.split(n):[t];for(var s in r)if(typeof r[s]=="string"){var a=r[s].split(i);if(a.length===2){var o=a[0].trim(),l=a[1].trim();e(o,l)}}}function ZD(t,e,i){var n=t;function r(){var o=mp(t);if(o===null)throw new Ut(Ut.Errors.BadTimeStamp,"Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,l){var c=new Oa;Ta(o,function(p,g){switch(p){case"region":for(var v=i.length-1;v>=0;v--)if(i[v].id===g){c.set(p,i[v].region);break}break;case"vertical":c.alt(p,g,["rl","lr"]);break;case"line":var S=g.split(","),_=S[0];c.integer(p,_),c.percent(p,_)&&c.set("snapToLines",!1),c.alt(p,_,["auto"]),S.length===2&&c.alt("lineAlign",S[1],["start","center","end"]);break;case"position":S=g.split(","),c.percent(p,S[0]),S.length===2&&c.alt("positionAlign",S[1],["start","center","end"]);break;case"size":c.percent(p,g);break;case"align":c.alt(p,g,["start","center","end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");try{l.line=c.get("line","auto")}catch{}l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100);try{l.align=c.get("align","center")}catch{l.align=c.get("align","middle")}try{l.position=c.get("position","auto")}catch{l.position=c.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},l.align)}l.positionAlign=c.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},l.align)}function a(){t=t.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),t.substr(0,3)!=="-->")throw new Ut(Ut.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);t=t.substr(3),a(),e.endTime=r(),a(),s(t,e)}var wd=A0.createElement&&A0.createElement("textarea"),eA={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},k0={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},tA={v:"title",lang:"lang"},P0={rt:"ruby"};function R1(t,e){function i(){if(!e)return null;function _(I){return e=e.substr(I.length),I}var w=e.match(/^([^<]*)(<[^>]*>?)?/);return _(w[1]?w[1]:w[2])}function n(_){return wd.innerHTML=_,_=wd.textContent,wd.textContent="",_}function r(_,w){return!P0[w.localName]||P0[w.localName]===_.localName}function s(_,w){var I=eA[_];if(!I)return null;var x=t.document.createElement(I),T=tA[_];return T&&w&&(x[T]=w.trim()),x}for(var a=t.document.createElement("div"),o=a,l,c=[];(l=i())!==null;){if(l[0]==="<"){if(l[1]==="/"){c.length&&c[c.length-1]===l.substr(2).replace(">","")&&(c.pop(),o=o.parentNode);continue}var p=mp(l.substr(1,l.length-2)),g;if(p){g=t.document.createProcessingInstruction("timestamp",p),o.appendChild(g);continue}var v=l.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!v||(g=s(v[1],v[3]),!g)||!r(o,g))continue;if(v[2]){var S=v[2].split(".");S.forEach(function(_){var w=/^bg_/.test(_),I=w?_.slice(3):_;if(k0.hasOwnProperty(I)){var x=w?"background-color":"color",T=k0[I];g.style[x]=T}}),g.className=S.join(" ")}c.push(v[1]),o.appendChild(g),o=g;continue}o.appendChild(t.document.createTextNode(n(l)))}return a}var I0=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function iA(t){for(var e=0;e=i[0]&&t<=i[1])return!0}return!1}function nA(t){var e=[],i="",n;if(!t||!t.childNodes)return"ltr";function r(o,l){for(var c=l.childNodes.length-1;c>=0;c--)o.push(l.childNodes[c])}function s(o){if(!o||!o.length)return null;var l=o.pop(),c=l.textContent||l.innerText;if(c){var p=c.match(/^.*(\n|\r)/);return p?(o.length=0,p[0]):c}if(l.tagName==="ruby")return s(o);if(l.childNodes)return r(o,l),s(o)}for(r(e,t);i=s(e);)for(var a=0;a=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var e=t.track,i=e.textTrackList,n=0,r=0;rt.left&&this.topt.top};gt.prototype.overlapsAny=function(t){for(var e=0;e=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right};gt.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}};gt.prototype.intersectPercentage=function(t){var e=Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left)),i=Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top)),n=e*i;return n/(this.height*this.width)};gt.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}};gt.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,i=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,n=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t;var r={left:t.left,right:t.right,top:t.top||n,height:t.height||e,bottom:t.bottom||n+(t.height||e),width:t.width||i};return r};function sA(t,e,i,n){function r(I,x){for(var T,C=new gt(I),k=1,L=0;LN&&(T=new gt(I),k=N),I=new gt(C)}return T||C}var s=new gt(e),a=e.cue,o=rA(a),l=[];if(a.snapToLines){var c;switch(a.vertical){case"":l=["+y","-y"],c="height";break;case"rl":l=["+x","-x"],c="width";break;case"lr":l=["-x","+x"],c="width";break}var p=s.lineHeight,g=p*Math.round(o),v=i[c]+p,S=l[0];Math.abs(g)>v&&(g=g<0?-1:1,g*=Math.ceil(v/p)*p),o<0&&(g+=a.vertical===""?i.height:i.width,l=l.reverse()),s.move(S,g)}else{var _=s.lineHeight/i.height*100;switch(a.lineAlign){case"center":o-=_/2;break;case"end":o-=_;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}l=["+y","-x","+x","-y"],s=new gt(e)}var w=r(s,l);e.move(w.toCSSCompatValues(i))}function Ls(){}Ls.StringDecoder=function(){return{decode:function(t){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};Ls.convertCueToDOMTree=function(t,e){return!t||!e?null:R1(t,e)};var aA=.05,oA="sans-serif",lA="1.5%";Ls.processCues=function(t,e,i){if(!t||!e||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=t.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=lA,i.appendChild(n);function r(p){for(var g=0;g")===-1){e.cue.id=a;continue}case"CUE":try{ZD(a,e.cue,e.regionList)}catch(p){e.reportOrThrowError(p),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var c=a.indexOf("-->")!==-1;if(!a||c&&(l=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` -`),e.cue.text+=a.replace(/\u2028/g,` -`).replace(/u2029/g,` -`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(p){e.reportOrThrowError(p),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),(t.cue||t.state==="HEADER")&&(t.buffer+=` - -`,t.parse()),t.state==="INITIAL")throw new Ut(Ut.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};var uA=Ls,cA="auto",dA={"":1,lr:1,rl:1},hA={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function fA(t){if(typeof t!="string")return!1;var e=dA[t.toLowerCase()];return e?t.toLowerCase():!1}function Dd(t){if(typeof t!="string")return!1;var e=hA[t.toLowerCase()];return e?t.toLowerCase():!1}function M1(t,e,i){this.hasBeenReset=!1;var n="",r=!1,s=t,a=e,o=i,l=null,c="",p=!0,g="auto",v="start",S="auto",_="auto",w=100,I="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(x){n=""+x}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(x){r=!!x}},startTime:{enumerable:!0,get:function(){return s},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");s=x,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");a=x,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(x){o=""+x,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(x){l=x,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return c},set:function(x){var T=fA(x);if(T===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");c=T,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(x){p=!!x,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return g},set:function(x){if(typeof x!="number"&&x!==cA)throw new SyntaxError("Line: an invalid number or illegal string was specified.");g=x,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return v},set:function(x){var T=Dd(x);T?(v=T,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return S},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");S=x,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return _},set:function(x){var T=Dd(x);T?(_=T,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return w},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");w=x,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return I},set:function(x){var T=Dd(x);if(!T)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");I=T,this.hasBeenReset=!0}}}),this.displayState=void 0}M1.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var pA=M1,mA={"":!0,up:!0};function gA(t){if(typeof t!="string")return!1;var e=mA[t.toLowerCase()];return e?t.toLowerCase():!1}function aa(t){return typeof t=="number"&&t>=0&&t<=100}function yA(){var t=100,e=3,i=0,n=100,r=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(o){if(!aa(o))throw new Error("Width must be between 0 and 100.");t=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!aa(o))throw new Error("RegionAnchorX must be between 0 and 100.");n=o}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(o){if(!aa(o))throw new Error("RegionAnchorY must be between 0 and 100.");i=o}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(o){if(!aa(o))throw new Error("ViewportAnchorY must be between 0 and 100.");s=o}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(o){if(!aa(o))throw new Error("ViewportAnchorX must be between 0 and 100.");r=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var l=gA(o);l===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=l}}})}var vA=yA,sn=sc,Tr=N1.exports={WebVTT:uA,VTTCue:pA,VTTRegion:vA};sn.vttjs=Tr;sn.WebVTT=Tr.WebVTT;var _A=Tr.VTTCue,TA=Tr.VTTRegion,xA=sn.VTTCue,SA=sn.VTTRegion;Tr.shim=function(){sn.VTTCue=_A,sn.VTTRegion=TA};Tr.restore=function(){sn.VTTCue=xA,sn.VTTRegion=SA};sn.VTTCue||Tr.shim();var EA=N1.exports;const L0=un(EA);var B1={exports:{}};(function(t,e){(function(i){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,p){if(p=p||{},l=l.trim(),c=c.trim(),!c){if(!p.alwaysNormalize)return l;var g=o.parseURL(l);if(!g)throw new Error("Error trying to parse base URL.");return g.path=o.normalizePath(g.path),o.buildURLFromParts(g)}var v=o.parseURL(c);if(!v)throw new Error("Error trying to parse relative URL.");if(v.scheme)return p.alwaysNormalize?(v.path=o.normalizePath(v.path),o.buildURLFromParts(v)):c;var S=o.parseURL(l);if(!S)throw new Error("Error trying to parse base URL.");if(!S.netLoc&&S.path&&S.path[0]!=="/"){var _=r.exec(S.path);S.netLoc=_[1],S.path=_[2]}S.netLoc&&!S.path&&(S.path="/");var w={scheme:S.scheme,netLoc:v.netLoc,path:null,params:v.params,query:v.query,fragment:v.fragment};if(!v.netLoc&&(w.netLoc=S.netLoc,v.path[0]!=="/"))if(!v.path)w.path=S.path,v.params||(w.params=S.params,v.query||(w.query=S.query));else{var I=S.path,x=I.substring(0,I.lastIndexOf("/")+1)+v.path;w.path=o.normalizePath(x)}return w.path===null&&(w.path=p.alwaysNormalize?o.normalizePath(v.path):v.path),o.buildURLFromParts(w)},parseURL:function(l){var c=n.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};t.exports=o})()})(B1);var bA=B1.exports;const mu=un(bA);var O0="http://example.com",CA=function(e,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(e)&&(e=A.location&&A.location.href||"");var n=typeof A.URL=="function",r=/^\/\//.test(e),s=!A.location&&!/\/\//i.test(e);if(n?e=new A.URL(e,A.location||O0):/\/\//i.test(e)||(e=mu.buildAbsoluteURL(A.location&&A.location.href||"",e)),n){var a=new URL(i,e);return s?a.href.slice(O0.length):r?a.href.slice(a.protocol.length):a.href}return mu.buildAbsoluteURL(e,i)},gp=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(n,r){this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(r)},e.off=function(n,r){if(!this.listeners[n])return!1;var s=this.listeners[n].indexOf(r);return this.listeners[n]=this.listeners[n].slice(0),this.listeners[n].splice(s,1),s>-1},e.trigger=function(n){var r=this.listeners[n];if(r)if(arguments.length===2)for(var s=r.length,a=0;a-1;i=this.buffer.indexOf(` -`))this.trigger("data",this.buffer.substring(0,i)),this.buffer=this.buffer.substring(i+1)}}const AA=" ",Ad=function(t){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},kA=function(){const t="[^=]*",e='"[^"]*"|[^,]*',i="(?:"+t+")=(?:"+e+")";return new RegExp("(?:^|,)("+i+")")},Xt=function(t){const e={};if(!t)return e;const i=t.split(kA());let n=i.length,r;for(;n--;)i[n]!==""&&(r=/([^=]*)=(.*)/.exec(i[n]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e};class PA extends gp{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let i,n;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((s,a)=>{const o=a(e);return o===e?s:s.concat([o])},[e]).forEach(s=>{for(let a=0;as),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:n(s),customType:i,segment:r}),!0})}addTagMapper({expression:e,map:i}){const n=r=>e.test(r)?i(r):r;this.tagMappers.push(n)}}const IA=t=>t.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Xn=function(t){const e={};return Object.keys(t).forEach(function(i){e[IA(i)]=t[i]}),e},kd=function(t){const{serverControl:e,targetDuration:i,partTargetDuration:n}=t;if(!e)return;const r="#EXT-X-SERVER-CONTROL",s="holdBack",a="partHoldBack",o=i&&i*3,l=n&&n*2;i&&!e.hasOwnProperty(s)&&(e[s]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[s]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&r&&(n.map=r),!n.key&&s&&(n.key=s),!n.timeline&&typeof p=="number"&&(n.timeline=p),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(_){let w,I;({tag(){({version(){_.version&&(this.manifest.version=_.version)},"allow-cache"(){this.manifest.allowCache=_.allowed,"allowed"in _||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const x={};"length"in _&&(n.byterange=x,x.length=_.length,"offset"in _||(_.offset=g)),"offset"in _&&(n.byterange=x,x.offset=_.offset),g=x.offset+x.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),_.duration>0&&(n.duration=_.duration),_.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!_.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(_.attributes.METHOD==="NONE"){s=null;return}if(!_.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(_.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:_.attributes};return}if(_.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:_.attributes.URI};return}if(_.attributes.KEYFORMAT===c){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(_.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(_.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),_.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(_.attributes.KEYID&&_.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:_.attributes.KEYFORMAT,keyId:_.attributes.KEYID.substring(2)},pssh:F1(_.attributes.URI.split(",")[1])};return}_.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:_.attributes.METHOD||"AES-128",uri:_.attributes.URI},typeof _.attributes.IV<"u"&&(s.iv=_.attributes.IV)},"media-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+_.number});return}this.manifest.mediaSequence=_.number},"discontinuity-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+_.number});return}this.manifest.discontinuitySequence=_.number,p=_.number},"playlist-type"(){if(!/VOD|EVENT/.test(_.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+_.playlist});return}this.manifest.playlistType=_.playlistType},map(){r={},_.uri&&(r.uri=_.uri),_.byterange&&(r.byterange=_.byterange),s&&(r.key=s)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||l,!_.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),rn(n.attributes,_.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(_.attributes&&_.attributes.TYPE&&_.attributes["GROUP-ID"]&&_.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const x=this.manifest.mediaGroups[_.attributes.TYPE];x[_.attributes["GROUP-ID"]]=x[_.attributes["GROUP-ID"]]||{},w=x[_.attributes["GROUP-ID"]],I={default:/yes/i.test(_.attributes.DEFAULT)},I.default?I.autoselect=!0:I.autoselect=/yes/i.test(_.attributes.AUTOSELECT),_.attributes.LANGUAGE&&(I.language=_.attributes.LANGUAGE),_.attributes.URI&&(I.uri=_.attributes.URI),_.attributes["INSTREAM-ID"]&&(I.instreamId=_.attributes["INSTREAM-ID"]),_.attributes.CHARACTERISTICS&&(I.characteristics=_.attributes.CHARACTERISTICS),_.attributes.FORCED&&(I.forced=/yes/i.test(_.attributes.FORCED)),w[_.attributes.NAME]=I},discontinuity(){p+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=_.dateTimeString,this.manifest.dateTimeObject=_.dateTimeObject),n.dateTimeString=_.dateTimeString,n.dateTimeObject=_.dateTimeObject},targetduration(){if(!isFinite(_.duration)||_.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+_.duration});return}this.manifest.targetDuration=_.duration,kd.call(this,this.manifest)},start(){if(!_.attributes||isNaN(_.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:_.attributes["TIME-OFFSET"],precise:_.attributes.PRECISE}},"cue-out"(){n.cueOut=_.data},"cue-out-cont"(){n.cueOutCont=_.data},"cue-in"(){n.cueIn=_.data},skip(){this.manifest.skip=Xn(_.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",_.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const x=this.manifest.segments.length,T=Xn(_.attributes);n.parts=n.parts||[],n.parts.push(T),T.byterange&&(T.byterange.hasOwnProperty("offset")||(T.byterange.offset=v),v=T.byterange.offset+T.byterange.length);const C=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${C} for segment #${x}`,_.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((k,L)=>{k.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${L} lacks required attribute(s): LAST-PART`})})},"server-control"(){const x=this.manifest.serverControl=Xn(_.attributes);x.hasOwnProperty("canBlockReload")||(x.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),kd.call(this,this.manifest),x.canSkipDateranges&&!x.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const x=this.manifest.segments.length,T=Xn(_.attributes),C=T.type&&T.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(T),T.byterange&&(T.byterange.hasOwnProperty("offset")||(T.byterange.offset=C?v:0,C&&(v=T.byterange.offset+T.byterange.length)));const k=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${k} for segment #${x}`,_.attributes,["TYPE","URI"]),!!T.type)for(let L=0;Lg&&(p-=g,p-=g,p-=tt(2))}return Number(p)},zA=function(e,i){var n=i===void 0?{}:i,r=n.le,s=r===void 0?!1:r;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=tt(e);for(var a=jA(e),o=new Uint8Array(new ArrayBuffer(a)),l=0;l=i.length&&c.call(i,function(p,g){var v=l[g]?l[g]&e[a+g]:e[a+g];return p===v})},M0="http://example.com",yp=function(e,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(e)&&(e=A.location&&A.location.href||"");var n=typeof A.URL=="function",r=/^\/\//.test(e),s=!A.location&&!/\/\//i.test(e);if(n?e=new A.URL(e,A.location||M0):/\/\//i.test(e)||(e=mu.buildAbsoluteURL(A.location&&A.location.href||"",e)),n){var a=new URL(i,e);return s?a.href.slice(M0.length):r?a.href.slice(a.protocol.length):a.href}return mu.buildAbsoluteURL(e,i)},qA=function(e,i,n){i.forEach(function(r){for(var s in e.mediaGroups[r])for(var a in e.mediaGroups[r][s]){var o=e.mediaGroups[r][s][a];n(o,r,s,a)}})},$n={},dn={};function WA(t,e,i){if(i===void 0&&(i=Array.prototype),t&&typeof i.find=="function")return i.find.call(t,e);for(var n=0;n=0&&t=0){for(var r=e.length-1;n0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n}e=e.nodeType==gs?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==gs?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function i2(t){return t=="<"&&"<"||t==">"&&">"||t=="&"&&"&"||t=='"'&&"""||"&#"+t.charCodeAt()+";"}vo(Nt,ye);vo(Nt,ye.prototype);function ao(t,e){if(e(t))return!0;if(t=t.firstChild)do if(ao(t,e))return!0;while(t=t.nextSibling)}function _o(){this.ownerDocument=this}function ek(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===so.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function n2(t,e,i,n){t&&t._inc++;var r=i.namespaceURI;r===so.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Tp(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var r=e.firstChild,s=0;r;)n[s++]=r,r=r.nextSibling;n.length=s,delete n[n.length]}}}function r2(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Tp(t.ownerDocument,t),e}function tk(t){return t&&(t.nodeType===ye.DOCUMENT_NODE||t.nodeType===ye.DOCUMENT_FRAGMENT_NODE||t.nodeType===ye.ELEMENT_NODE)}function ik(t){return t&&(Li(t)||xp(t)||on(t)||t.nodeType===ye.DOCUMENT_FRAGMENT_NODE||t.nodeType===ye.COMMENT_NODE||t.nodeType===ye.PROCESSING_INSTRUCTION_NODE)}function on(t){return t&&t.nodeType===ye.DOCUMENT_TYPE_NODE}function Li(t){return t&&t.nodeType===ye.ELEMENT_NODE}function xp(t){return t&&t.nodeType===ye.TEXT_NODE}function $0(t,e){var i=t.childNodes||[];if(Ii(i,Li)||on(e))return!1;var n=Ii(i,on);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function V0(t,e){var i=t.childNodes||[];function n(s){return Li(s)&&s!==e}if(Ii(i,n))return!1;var r=Ii(i,on);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function nk(t,e,i){if(!tk(t))throw new Ve(wt,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new Ve(Z1,"child not in parent");if(!ik(e)||on(e)&&t.nodeType!==ye.DOCUMENT_NODE)throw new Ve(wt,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function rk(t,e,i){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===ye.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Li);if(s.length>1||Ii(r,xp))throw new Ve(wt,"More than one element or text in fragment");if(s.length===1&&!$0(t,i))throw new Ve(wt,"Element in fragment can not be inserted before doctype")}if(Li(e)&&!$0(t,i))throw new Ve(wt,"Only one element can be added and only after doctype");if(on(e)){if(Ii(n,on))throw new Ve(wt,"Only one doctype is allowed");var a=Ii(n,Li);if(i&&n.indexOf(a)1||Ii(r,xp))throw new Ve(wt,"More than one element or text in fragment");if(s.length===1&&!V0(t,i))throw new Ve(wt,"Element in fragment can not be inserted before doctype")}if(Li(e)&&!V0(t,i))throw new Ve(wt,"Only one element can be added and only after doctype");if(on(e)){let l=function(c){return on(c)&&c!==i};var o=l;if(Ii(n,l))throw new Ve(wt,"Only one doctype is allowed");var a=Ii(n,Li);if(i&&n.indexOf(a)0&&ao(i.documentElement,function(r){if(r!==i&&r.nodeType===pi){var s=r.getAttribute("class");if(s){var a=t===s;if(!a){var o=B0(s);a=e.every(YA(o))}a&&n.push(r)}}}),n})},createElement:function(t){var e=new mr;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Yi;var i=e.attributes=new yu;return i._ownerElement=e,e},createDocumentFragment:function(){var t=new lc;return t.ownerDocument=this,t.childNodes=new Yi,t},createTextNode:function(t){var e=new Sp;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Ep;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new bp;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new wp;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new _u;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Cp;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new mr,n=e.split(":"),r=i.attributes=new yu;return i.childNodes=new Yi,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=e,r._ownerElement=i,i},createAttributeNS:function(t,e){var i=new _u,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}};Ot(_o,ye);function mr(){this._nsMap={}}mr.prototype={nodeType:pi,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===an?this.insertBefore(t,null):sk(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new ys(this,function(e){var i=[];return ao(e,function(n){n!==e&&n.nodeType==pi&&(t==="*"||n.tagName==t)&&i.push(n)}),i})},getElementsByTagNameNS:function(t,e){return new ys(this,function(i){var n=[];return ao(i,function(r){r!==i&&r.nodeType===pi&&(t==="*"||r.namespaceURI===t)&&(e==="*"||r.localName==e)&&n.push(r)}),n})}};_o.prototype.getElementsByTagName=mr.prototype.getElementsByTagName;_o.prototype.getElementsByTagNameNS=mr.prototype.getElementsByTagNameNS;Ot(mr,ye);function _u(){}_u.prototype.nodeType=gs;Ot(_u,ye);function To(){}To.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Ze[wt])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){var n=this.data.substring(0,t),r=this.data.substring(t+e);i=n+i+r,this.nodeValue=this.data=i,this.length=i.length}};Ot(To,ye);function Sp(){}Sp.prototype={nodeName:"#text",nodeType:gu,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};Ot(Sp,To);function Ep(){}Ep.prototype={nodeName:"#comment",nodeType:Q1};Ot(Ep,To);function bp(){}bp.prototype={nodeName:"#cdata-section",nodeType:G1};Ot(bp,To);function oc(){}oc.prototype.nodeType=J1;Ot(oc,ye);function a2(){}a2.prototype.nodeType=ZA;Ot(a2,ye);function o2(){}o2.prototype.nodeType=JA;Ot(o2,ye);function Cp(){}Cp.prototype.nodeType=X1;Ot(Cp,ye);function lc(){}lc.prototype.nodeName="#document-fragment";lc.prototype.nodeType=an;Ot(lc,ye);function wp(){}wp.prototype.nodeType=K1;Ot(wp,ye);function l2(){}l2.prototype.serializeToString=function(t,e,i){return u2.call(t,e,i)};ye.prototype.toString=u2;function u2(t,e){var i=[],n=this.nodeType==9&&this.documentElement||this,r=n.prefix,s=n.namespaceURI;if(s&&r==null){var r=n.lookupPrefix(s);if(r==null)var a=[{namespace:s,prefix:null}]}return Gr(this,i,t,e,a),i.join("")}function z0(t,e,i){var n=t.prefix||"",r=t.namespaceURI;if(!r||n==="xml"&&r===so.XML||r===so.XMLNS)return!1;for(var s=i.length;s--;){var a=i[s];if(a.prefix===n)return a.namespace!==r}return!0}function Id(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,i2),'"')}function Gr(t,e,i,n,r){if(r||(r=[]),n)if(t=n(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case pi:var s=t.attributes,a=s.length,x=t.firstChild,o=t.tagName;i=so.isHTML(t.namespaceURI)||i;var l=o;if(!i&&!t.prefix&&t.namespaceURI){for(var c,p=0;p=0;g--){var v=r[g];if(v.prefix===""&&v.namespace===t.namespaceURI){c=v.namespace;break}}if(c!==t.namespaceURI)for(var g=r.length-1;g>=0;g--){var v=r[g];if(v.namespace===t.namespaceURI){v.prefix&&(l=v.prefix+":"+o);break}}}e.push("<",l);for(var S=0;S"),i&&/^script$/i.test(o))for(;x;)x.data?e.push(x.data):Gr(x,e,i,n,r.slice()),x=x.nextSibling;else for(;x;)Gr(x,e,i,n,r.slice()),x=x.nextSibling;e.push("")}else e.push("/>");return;case Y1:case an:for(var x=t.firstChild;x;)Gr(x,e,i,n,r.slice()),x=x.nextSibling;return;case gs:return Id(e,t.name,t.value);case gu:return e.push(t.data.replace(/[<&>]/g,i2));case G1:return e.push("");case Q1:return e.push("");case J1:var T=t.publicId,C=t.systemId;if(e.push("");else if(C&&C!=".")e.push(" SYSTEM ",C,">");else{var k=t.internalSubset;k&&e.push(" [",k,"]"),e.push(">")}return;case K1:return e.push("");case X1:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function c2(t,e,i){var n;switch(e.nodeType){case pi:n=e.cloneNode(!1),n.ownerDocument=t;case an:break;case gs:i=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var r=e.firstChild;r;)n.appendChild(c2(t,r,i)),r=r.nextSibling;return n}function zh(t,e,i){var n=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=e[r];typeof s!="object"&&s!=n[r]&&(n[r]=s)}switch(e.childNodes&&(n.childNodes=new Yi),n.ownerDocument=t,n.nodeType){case pi:var a=e.attributes,o=n.attributes=new yu,l=a.length;o._ownerElement=n;for(var c=0;c",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` -`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(h2);var Dp={},oo=dn.NAMESPACE,Hh=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,H0=new RegExp("[\\-\\.0-9"+Hh.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),q0=new RegExp("^"+Hh.source+H0.source+"*(?::"+Hh.source+H0.source+"*)?$"),oa=0,mn=1,Ar=2,la=3,kr=4,Pr=5,ua=6,gl=7;function vs(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,vs)}vs.prototype=new Error;vs.prototype.name=vs.name;function f2(){}f2.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),p2(e,e={}),ak(t,e,i,n,this.errorHandler),n.endDocument()}};function ak(t,e,i,n,r){function s(ue){if(ue>65535){ue-=65536;var Ce=55296+(ue>>10),H=56320+(ue&1023);return String.fromCharCode(Ce,H)}else return String.fromCharCode(ue)}function a(ue){var Ce=ue.slice(1,-1);return Object.hasOwnProperty.call(i,Ce)?i[Ce]:Ce.charAt(0)==="#"?s(parseInt(Ce.substr(1).replace("x","0x"))):(r.error("entity not found:"+ue),ue)}function o(ue){if(ue>w){var Ce=t.substring(w,ue).replace(/&#?\w+;/g,a);v&&l(w),n.characters(Ce,0,ue-w),w=ue}}function l(ue,Ce){for(;ue>=p&&(Ce=g.exec(t));)c=Ce.index,p=c+Ce[0].length,v.lineNumber++;v.columnNumber=ue-c+1}for(var c=0,p=0,g=/.*(?:\r\n?|\n)|.*$/g,v=n.locator,S=[{currentNSMap:e}],_={},w=0;;){try{var I=t.indexOf("<",w);if(I<0){if(!t.substr(w).match(/^\s*$/)){var x=n.doc,T=x.createTextNode(t.substr(w));x.appendChild(T),n.currentElement=T}return}switch(I>w&&o(I),t.charAt(I+1)){case"/":var ne=t.indexOf(">",I+3),C=t.substring(I+2,ne).replace(/[ \t\n\r]+$/g,""),k=S.pop();ne<0?(C=t.substring(I+2).replace(/[\s<].*/,""),r.error("end tag name: "+C+" is not complete:"+k.tagName),ne=I+1+C.length):C.match(/\sw?w=ne:o(Math.max(I,w)+1)}}function W0(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function ok(t,e,i,n,r,s){function a(v,S,_){i.attributeNames.hasOwnProperty(v)&&s.fatalError("Attribute "+v+" redefined"),i.addValue(v,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),_)}for(var o,l,c=++e,p=oa;;){var g=t.charAt(c);switch(g){case"=":if(p===mn)o=t.slice(e,c),p=la;else if(p===Ar)p=la;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===la||p===mn)if(p===mn&&(s.warning('attribute value must after "="'),o=t.slice(e,c)),e=c+1,c=t.indexOf(g,e),c>0)l=t.slice(e,c),a(o,l,e-1),p=Pr;else throw new Error("attribute value no end '"+g+"' match");else if(p==kr)l=t.slice(e,c),a(o,l,e),s.warning('attribute "'+o+'" missed start quot('+g+")!!"),e=c+1,p=Pr;else throw new Error('attribute value must after "="');break;case"/":switch(p){case oa:i.setTagName(t.slice(e,c));case Pr:case ua:case gl:p=gl,i.closed=!0;case kr:case mn:break;case Ar:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),p==oa&&i.setTagName(t.slice(e,c)),c;case">":switch(p){case oa:i.setTagName(t.slice(e,c));case Pr:case ua:case gl:break;case kr:case mn:l=t.slice(e,c),l.slice(-1)==="/"&&(i.closed=!0,l=l.slice(0,-1));case Ar:p===Ar&&(l=o),p==kr?(s.warning('attribute "'+l+'" missed quot(")!'),a(o,l,e)):((!oo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case la:throw new Error("attribute value missed!!")}return c;case"€":g=" ";default:if(g<=" ")switch(p){case oa:i.setTagName(t.slice(e,c)),p=ua;break;case mn:o=t.slice(e,c),p=Ar;break;case kr:var l=t.slice(e,c);s.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case Pr:p=ua;break}else switch(p){case Ar:i.tagName,(!oo.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=c,p=mn;break;case Pr:s.warning('attribute space is required"'+o+'"!!');case ua:p=mn,e=c;break;case la:p=kr,e=c;break;case gl:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function G0(t,e,i){for(var n=t.tagName,r=null,g=t.length;g--;){var s=t[g],a=s.qName,o=s.value,v=a.indexOf(":");if(v>0)var l=s.prefix=a.slice(0,v),c=a.slice(v+1),p=l==="xmlns"&&c;else c=a,l=null,p=a==="xmlns"&&"";s.localName=c,p!==!1&&(r==null&&(r={},p2(i,i={})),i[p]=r[p]=o,s.uri=oo.XMLNS,e.startPrefixMapping(p,o))}for(var g=t.length;g--;){s=t[g];var l=s.prefix;l&&(l==="xml"&&(s.uri=oo.XML),l!=="xmlns"&&(s.uri=i[l||""]))}var v=n.indexOf(":");v>0?(l=t.prefix=n.slice(0,v),c=t.localName=n.slice(v+1)):(l=null,c=t.localName=n);var S=t.uri=i[l||""];if(e.startElement(S,c,n,t),t.closed){if(e.endElement(S,c,n),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&e.endPrefixMapping(l)}else return t.currentNSMap=i,t.localNSMap=r,!0}function lk(t,e,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var s=t.indexOf("",e),a=t.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(i)?(r.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),s)}return e+1}function uk(t,e,i,n){var r=n[i];return r==null&&(r=t.lastIndexOf(""),r",e+4);return s>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var a=hk(t,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var l=a[1][0],c=!1,p=!1;o>3&&(/^public$/i.test(a[2][0])?(c=a[3][0],p=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var g=a[o-1];return i.startDTD(l,c,p),i.endDTD(),g.index+g[0].length}}return-1}function dk(t,e,i){var n=t.indexOf("?>",e);if(n){var r=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function m2(){this.attributeNames={}}m2.prototype={setTagName:function(t){if(!q0.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!q0.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function hk(t,e){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(t);i=r.exec(t);)if(n.push(i),i[1])return n}Dp.XMLReader=f2;Dp.ParseError=vs;var fk=dn,pk=$n,X0=h2,g2=Dp,mk=pk.DOMImplementation,K0=fk.NAMESPACE,gk=g2.ParseError,yk=g2.XMLReader;function y2(t){return t.replace(/\r[\n\u0085]/g,` -`).replace(/[\r\u0085\u2028]/g,` -`)}function v2(t){this.options=t||{locator:{}}}v2.prototype.parseFromString=function(t,e){var i=this.options,n=new yk,r=i.domBuilder||new xo,s=i.errorHandler,a=i.locator,o=i.xmlns||{},l=/\/x?html?$/.test(e),c=l?X0.HTML_ENTITIES:X0.XML_ENTITIES;a&&r.setDocumentLocator(a),n.errorHandler=vk(s,r,a),n.domBuilder=i.domBuilder||r,l&&(o[""]=K0.HTML),o.xml=o.xml||K0.XML;var p=i.normalizeLineEndings||y2;return t&&typeof t=="string"?n.parse(p(t),o,c):n.errorHandler.error("invalid doc source"),r.doc};function vk(t,e,i){if(!t){if(e instanceof xo)return e;t=e}var n={},r=t instanceof Function;i=i||{};function s(a){var o=t[a];!o&&r&&(o=t.length==2?function(l){t(a,l)}:t),n[a]=o&&function(l){o("[xmldom "+a+"] "+l+qh(i))}||function(){}}return s("warning"),s("error"),s("fatalError"),n}function xo(){this.cdata=!1}function Ir(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}xo.prototype={startDocument:function(){this.doc=new mk().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var r=this.doc,s=r.createElementNS(t,i||e),a=n.length;yl(this,s),this.currentElement=s,this.locator&&Ir(this.locator,s);for(var o=0;o=e+i||e?new java.lang.String(t,e,i)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){xo.prototype[t]=function(){return null}});function yl(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}uc.__DOMHandler=xo;uc.normalizeLineEndings=y2;uc.DOMParser=v2;var _k=uc.DOMParser;/*! @name mpd-parser @version 1.2.2 @license Apache-2.0 */const Y0=t=>!!t&&typeof t=="object",Ye=(...t)=>t.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(n=>{Array.isArray(e[n])&&Array.isArray(i[n])?e[n]=e[n].concat(i[n]):Y0(e[n])&&Y0(i[n])?e[n]=Ye(e[n],i[n]):e[n]=i[n]}),e),{}),_2=t=>Object.keys(t).map(e=>t[e]),Tk=(t,e)=>{const i=[];for(let n=t;nt.reduce((e,i)=>e.concat(i),[]),T2=t=>{if(!t.length)return[];const e=[];for(let i=0;it.reduce((i,n,r)=>(n[e]&&i.push(r),i),[]),Sk=(t,e)=>_2(t.reduce((i,n)=>(n.forEach(r=>{i[e(r)]=r}),i),{}));var Ts={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const lo=({baseUrl:t="",source:e="",range:i="",indexRange:n=""})=>{const r={uri:e,resolvedUri:yp(t||"",e)};if(i||n){const a=(i||n).split("-");let o=A.BigInt?A.BigInt(a[0]):parseInt(a[0],10),l=A.BigInt?A.BigInt(a[1]):parseInt(a[1],10);o{let e;return typeof t.offset=="bigint"||typeof t.length=="bigint"?e=A.BigInt(t.offset)+A.BigInt(t.length)-A.BigInt(1):e=t.offset+t.length-1,`${t.offset}-${e}`},J0=t=>(t&&typeof t!="number"&&(t=parseInt(t,10)),isNaN(t)?null:t),bk={static(t){const{duration:e,timescale:i=1,sourceDuration:n,periodDuration:r}=t,s=J0(t.endNumber),a=e/i;return typeof s=="number"?{start:0,end:s}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:n/a}},dynamic(t){const{NOW:e,clientOffset:i,availabilityStartTime:n,timescale:r=1,duration:s,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=t,c=J0(t.endNumber),p=(e+i)/1e3,g=n+a,S=p+o-g,_=Math.ceil(S*r/s),w=Math.floor((p-g-l)*r/s),I=Math.floor((p-g)*r/s);return{start:Math.max(0,w),end:typeof c=="number"?c:Math.min(_,I)}}},Ck=t=>e=>{const{duration:i,timescale:n=1,periodStart:r,startNumber:s=1}=t;return{number:s+e,duration:i/n,timeline:r,time:e*i}},Ap=t=>{const{type:e,duration:i,timescale:n=1,periodDuration:r,sourceDuration:s}=t,{start:a,end:o}=bk[e](t),l=Tk(a,o).map(Ck(t));if(e==="static"){const c=l.length-1,p=typeof r=="number"?r:s;l[c].duration=p-i/n*c}return l},x2=t=>{const{baseUrl:e,initialization:i={},sourceDuration:n,indexRange:r="",periodStart:s,presentationTime:a,number:o=0,duration:l}=t;if(!e)throw new Error(Ts.NO_BASE_URL);const c=lo({baseUrl:e,source:i.sourceURL,range:i.range}),p=lo({baseUrl:e,source:e,indexRange:r});if(p.map=c,l){const g=Ap(t);g.length&&(p.duration=g[0].duration,p.timeline=g[0].timeline)}else n&&(p.duration=n,p.timeline=s);return p.presentationTime=a||s,p.number=o,[p]},kp=(t,e,i)=>{const n=t.sidx.map?t.sidx.map:null,r=t.sidx.duration,s=t.timeline||0,a=t.sidx.byterange,o=a.offset+a.length,l=e.timescale,c=e.references.filter(I=>I.referenceType!==1),p=[],g=t.endList?"static":"dynamic",v=t.sidx.timeline;let S=v,_=t.mediaSequence||0,w;typeof e.firstOffset=="bigint"?w=A.BigInt(o)+e.firstOffset:w=o+e.firstOffset;for(let I=0;ISk(t,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),Ak=(t,e)=>{for(let i=0;i{let e=[];return qA(t,wk,(i,n,r,s)=>{e=e.concat(i.playlists||[])}),e},ey=({playlist:t,mediaSequence:e})=>{t.mediaSequence=e,t.segments.forEach((i,n)=>{i.number=t.mediaSequence+n})},kk=({oldPlaylists:t,newPlaylists:e,timelineStarts:i})=>{e.forEach(n=>{n.discontinuitySequence=i.findIndex(function({timeline:l}){return l===n.timeline});const r=Ak(t,n.attributes.NAME);if(!r||n.sidx)return;const s=n.segments[0],a=r.segments.findIndex(function(l){return Math.abs(l.presentationTime-s.presentationTime)r.timeline||r.segments.length&&n.timeline>r.segments[r.segments.length-1].timeline)&&n.discontinuitySequence--;return}r.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),ey({playlist:n,mediaSequence:r.segments[a].number})})},Pk=({oldManifest:t,newManifest:e})=>{const i=t.playlists.concat(Z0(t)),n=e.playlists.concat(Z0(e));return e.timelineStarts=S2([t.timelineStarts,e.timelineStarts]),kk({oldPlaylists:i,newPlaylists:n,timelineStarts:e.timelineStarts}),e},cc=t=>t&&t.uri+"-"+Ek(t.byterange),Ld=t=>{const e=t.reduce(function(n,r){return n[r.attributes.baseUrl]||(n[r.attributes.baseUrl]=[]),n[r.attributes.baseUrl].push(r),n},{});let i=[];return Object.values(e).forEach(n=>{const r=_2(n.reduce((s,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return s[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),s[o].segments.push(...a.segments)),a.attributes.contentProtection&&(s[o].attributes.contentProtection=a.attributes.contentProtection)):(s[o]=a,s[o].attributes.timelineStarts=[]),s[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),s},{}));i=i.concat(r)}),i.map(n=>(n.discontinuityStarts=xk(n.segments||[],"discontinuity"),n))},Pp=(t,e)=>{const i=cc(t.sidx),n=i&&e[i]&&e[i].sidx;return n&&kp(t,n,t.sidx.resolvedUri),t},Ik=(t,e={})=>{if(!Object.keys(e).length)return t;for(const i in t)t[i]=Pp(t[i],e);return t},Lk=({attributes:t,segments:e,sidx:i,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:s},a)=>{const o={attributes:{NAME:t.id,BANDWIDTH:t.bandwidth,CODECS:t.codecs,"PROGRAM-ID":1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuitySequence:r,discontinuityStarts:s,timelineStarts:t.timelineStarts,mediaSequence:n,segments:e};return t.contentProtection&&(o.contentProtection=t.contentProtection),t.serviceLocation&&(o.attributes.serviceLocation=t.serviceLocation),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},Ok=({attributes:t,segments:e,mediaSequence:i,discontinuityStarts:n,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);const s={NAME:t.id,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1};t.codecs&&(s.CODECS=t.codecs);const a={attributes:s,uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:n,discontinuitySequence:r,mediaSequence:i,segments:e};return t.serviceLocation&&(a.attributes.serviceLocation=t.serviceLocation),a},Nk=(t,e={},i=!1)=>{let n;const r=t.reduce((s,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let c=a.attributes.label||"main";if(l&&!a.attributes.label){const g=o?` (${o})`:"";c=`${a.attributes.lang}${g}`}s[c]||(s[c]={language:l,autoselect:!0,default:o==="main",playlists:[],uri:""});const p=Pp(Lk(a,i),e);return s[c].playlists.push(p),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),s},{});if(!n){const s=Object.keys(r)[0];r[s].default=!0}return r},Rk=(t,e={})=>t.reduce((i,n)=>{const r=n.attributes.label||n.attributes.lang||"text";return i[r]||(i[r]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),i[r].playlists.push(Pp(Ok(n),e)),i},{}),Mk=t=>t.reduce((e,i)=>(i&&i.forEach(n=>{const{channel:r,language:s}=n;e[s]={autoselect:!1,default:!1,instreamId:r,language:s},n.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[s].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[s]["3D"]=n["3D"])}),e),{}),Bk=({attributes:t,segments:e,sidx:i,discontinuityStarts:n})=>{const r={attributes:{NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:n,timelineStarts:t.timelineStarts,segments:e};return t.frameRate&&(r.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(r.contentProtection=t.contentProtection),t.serviceLocation&&(r.attributes.serviceLocation=t.serviceLocation),i&&(r.sidx=i),r},Fk=({attributes:t})=>t.mimeType==="video/mp4"||t.mimeType==="video/webm"||t.contentType==="video",Uk=({attributes:t})=>t.mimeType==="audio/mp4"||t.mimeType==="audio/webm"||t.contentType==="audio",jk=({attributes:t})=>t.mimeType==="text/vtt"||t.contentType==="text",$k=(t,e)=>{t.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:n}){return n===i.timeline}),i.segments&&i.segments.forEach((n,r)=>{n.number=r})})},ty=t=>t?Object.keys(t).reduce((e,i)=>{const n=t[i];return e.concat(n.playlists)},[]):[],Vk=({dashPlaylists:t,locations:e,contentSteering:i,sidxMapping:n={},previousManifest:r,eventStream:s})=>{if(!t.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:c}=t[0].attributes,p=Ld(t.filter(Fk)).map(Bk),g=Ld(t.filter(Uk)),v=Ld(t.filter(jk)),S=t.map(k=>k.attributes.captionServices).filter(Boolean),_={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:Ik(p,n)};c>=0&&(_.minimumUpdatePeriod=c*1e3),e&&(_.locations=e),i&&(_.contentSteering=i),o==="dynamic"&&(_.suggestedPresentationDelay=l),s&&s.length>0&&(_.eventStream=s);const w=_.playlists.length===0,I=g.length?Nk(g,n,w):null,x=v.length?Rk(v,n):null,T=p.concat(ty(I),ty(x)),C=T.map(({timelineStarts:k})=>k);return _.timelineStarts=S2(C),$k(T,_.timelineStarts),I&&(_.mediaGroups.AUDIO.audio=I),x&&(_.mediaGroups.SUBTITLES.subs=x),S.length&&(_.mediaGroups["CLOSED-CAPTIONS"].cc=Mk(S)),r?Pk({oldManifest:r,newManifest:_}):_},zk=(t,e,i)=>{const{NOW:n,clientOffset:r,availabilityStartTime:s,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=t,c=(n+r)/1e3,p=s+o,v=c+l-p;return Math.ceil((v*a-e)/i)},E2=(t,e)=>{const{type:i,minimumUpdatePeriod:n=0,media:r="",sourceDuration:s,timescale:a=1,startNumber:o=1,periodStart:l}=t,c=[];let p=-1;for(let g=0;gp&&(p=w);let I;if(_<0){const C=g+1;C===e.length?i==="dynamic"&&n>0&&r.indexOf("$Number$")>0?I=zk(t,p,S):I=(s*a-p)/S:I=(e[C].t-p)/S}else I=_+1;const x=o+c.length+I;let T=o+c.length;for(;T(e,i,n,r)=>{if(e==="$$")return"$";if(typeof t[i]>"u")return e;const s=""+t[i];return i==="RepresentationID"||(n?r=parseInt(r,10):r=1,s.length>=r)?s:`${new Array(r-s.length+1).join("0")}${s}`},iy=(t,e)=>t.replace(Hk,qk(e)),Wk=(t,e)=>!t.duration&&!e?[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]:t.duration?Ap(t):E2(t,e),Gk=(t,e)=>{const i={RepresentationID:t.id,Bandwidth:t.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=t,r=lo({baseUrl:t.baseUrl,source:iy(n.sourceURL,i),range:n.range});return Wk(t,e).map(a=>{i.Number=a.number,i.Time=a.time;const o=iy(t.media||"",i),l=t.timescale||1,c=t.presentationTimeOffset||0,p=t.periodStart+(a.time-c)/l;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:yp(t.baseUrl||"",o),map:r,number:a.number,presentationTime:p}})},Xk=(t,e)=>{const{baseUrl:i,initialization:n={}}=t,r=lo({baseUrl:i,source:n.sourceURL,range:n.range}),s=lo({baseUrl:i,source:e.media,range:e.mediaRange});return s.map=r,s},Kk=(t,e)=>{const{duration:i,segmentUrls:n=[],periodStart:r}=t;if(!i&&!e||i&&e)throw new Error(Ts.SEGMENT_TIME_UNSPECIFIED);const s=n.map(l=>Xk(t,l));let a;return i&&(a=Ap(t)),e&&(a=E2(t,e)),a.map((l,c)=>{if(s[c]){const p=s[c],g=t.timescale||1,v=t.presentationTimeOffset||0;return p.timeline=l.timeline,p.duration=l.duration,p.number=l.number,p.presentationTime=r+(l.time-v)/g,p}}).filter(l=>l)},Qk=({attributes:t,segmentInfo:e})=>{let i,n;e.template?(n=Gk,i=Ye(t,e.template)):e.base?(n=x2,i=Ye(t,e.base)):e.list&&(n=Kk,i=Ye(t,e.list));const r={attributes:t};if(!n)return r;const s=n(i,e.segmentTimeline);if(i.duration){const{duration:a,timescale:o=1}=i;i.duration=a/o}else s.length?i.duration=s.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):i.duration=0;return r.attributes=i,r.segments=s,e.base&&i.indexRange&&(r.sidx=s[0],r.segments=[]),r},Yk=t=>t.map(Qk),Ie=(t,e)=>T2(t.childNodes).filter(({tagName:i})=>i===e),So=t=>t.textContent.trim(),Jk=t=>parseFloat(t.split("/").reduce((e,i)=>e/i)),Lr=t=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!o)return 0;const[l,c,p,g,v,S]=o.slice(1);return parseFloat(l||0)*31536e3+parseFloat(c||0)*2592e3+parseFloat(p||0)*86400+parseFloat(g||0)*3600+parseFloat(v||0)*60+parseFloat(S||0)},Zk=t=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),Date.parse(t)),ny={mediaPresentationDuration(t){return Lr(t)},availabilityStartTime(t){return Zk(t)/1e3},minimumUpdatePeriod(t){return Lr(t)},suggestedPresentationDelay(t){return Lr(t)},type(t){return t},timeShiftBufferDepth(t){return Lr(t)},start(t){return Lr(t)},width(t){return parseInt(t,10)},height(t){return parseInt(t,10)},bandwidth(t){return parseInt(t,10)},frameRate(t){return Jk(t)},startNumber(t){return parseInt(t,10)},timescale(t){return parseInt(t,10)},presentationTimeOffset(t){return parseInt(t,10)},duration(t){const e=parseInt(t,10);return isNaN(e)?Lr(t):e},d(t){return parseInt(t,10)},t(t){return parseInt(t,10)},r(t){return parseInt(t,10)},presentationTime(t){return parseInt(t,10)},DEFAULT(t){return t}},ze=t=>t&&t.attributes?T2(t.attributes).reduce((e,i)=>{const n=ny[i.name]||ny.DEFAULT;return e[i.name]=n(i.value),e},{}):{},e3={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},dc=(t,e)=>e.length?_s(t.map(function(i){return e.map(function(n){const r=So(n),s=yp(i.baseUrl,r),a=Ye(ze(n),{baseUrl:s});return s!==r&&!a.serviceLocation&&i.serviceLocation&&(a.serviceLocation=i.serviceLocation),a})})):t,Ip=t=>{const e=Ie(t,"SegmentTemplate")[0],i=Ie(t,"SegmentList")[0],n=i&&Ie(i,"SegmentURL").map(g=>Ye({tag:"SegmentURL"},ze(g))),r=Ie(t,"SegmentBase")[0],s=i||e,a=s&&Ie(s,"SegmentTimeline")[0],o=i||r||e,l=o&&Ie(o,"Initialization")[0],c=e&&ze(e);c&&l?c.initialization=l&&ze(l):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});const p={template:c,segmentTimeline:a&&Ie(a,"S").map(g=>ze(g)),list:i&&Ye(ze(i),{segmentUrls:n,initialization:ze(l)}),base:r&&Ye(ze(r),{initialization:ze(l)})};return Object.keys(p).forEach(g=>{p[g]||delete p[g]}),p},t3=(t,e,i)=>n=>{const r=Ie(n,"BaseURL"),s=dc(e,r),a=Ye(t,ze(n)),o=Ip(n);return s.map(l=>({segmentInfo:Ye(i,o),attributes:Ye(a,l)}))},i3=t=>t.reduce((e,i)=>{const n=ze(i);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const r=e3[n.schemeIdUri];if(r){e[r]={attributes:n};const s=Ie(i,"cenc:pssh")[0];if(s){const a=So(s);e[r].pssh=a&&F1(a)}}return e},{}),n3=t=>{if(t.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof t.value!="string"?[]:t.value.split(";")).map(i=>{let n,r;return r=i,/^CC\d=/.test(i)?[n,r]=i.split("="):/^CC\d$/.test(i)&&(n=i),{channel:n,language:r}});if(t.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof t.value!="string"?[]:t.value.split(";")).map(i=>{const n={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[r,s=""]=i.split("=");n.channel=r,n.language=i,s.split(",").forEach(a=>{const[o,l]=a.split(":");o==="lang"?n.language=l:o==="er"?n.easyReader=Number(l):o==="war"?n.aspectRatio=Number(l):o==="3D"&&(n["3D"]=Number(l))})}else n.language=i;return n.channel&&(n.channel="SERVICE"+n.channel),n})},r3=t=>_s(Ie(t.node,"EventStream").map(e=>{const i=ze(e),n=i.schemeIdUri;return Ie(e,"Event").map(r=>{const s=ze(r),a=s.presentationTime||0,o=i.timescale||1,l=s.duration||0,c=a/o+t.attributes.start;return{schemeIdUri:n,value:i.value,id:s.id,start:c,end:c+l/o,messageData:So(r)||s.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),s3=(t,e,i)=>n=>{const r=ze(n),s=dc(e,Ie(n,"BaseURL")),a=Ie(n,"Role")[0],o={role:ze(a)};let l=Ye(t,r,o);const c=Ie(n,"Accessibility")[0],p=n3(ze(c));p&&(l=Ye(l,{captionServices:p}));const g=Ie(n,"Label")[0];if(g&&g.childNodes.length){const I=g.childNodes[0].nodeValue.trim();l=Ye(l,{label:I})}const v=i3(Ie(n,"ContentProtection"));Object.keys(v).length&&(l=Ye(l,{contentProtection:v}));const S=Ip(n),_=Ie(n,"Representation"),w=Ye(i,S);return _s(_.map(t3(l,s,w)))},a3=(t,e)=>(i,n)=>{const r=dc(e,Ie(i.node,"BaseURL")),s=Ye(t,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(s.periodDuration=i.attributes.duration);const a=Ie(i.node,"AdaptationSet"),o=Ip(i.node);return _s(a.map(s3(s,r,o)))},o3=(t,e)=>{if(t.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!t.length)return null;const i=Ye({serverURL:So(t[0])},ze(t[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},l3=({attributes:t,priorPeriodAttributes:e,mpdType:i})=>typeof t.start=="number"?t.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,u3=(t,e={})=>{const{manifestUri:i="",NOW:n=Date.now(),clientOffset:r=0,eventHandler:s=function(){}}=e,a=Ie(t,"Period");if(!a.length)throw new Error(Ts.INVALID_NUMBER_OF_PERIOD);const o=Ie(t,"Location"),l=ze(t),c=dc([{baseUrl:i}],Ie(t,"BaseURL")),p=Ie(t,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=n,l.clientOffset=r,o.length&&(l.locations=o.map(So));const g=[];return a.forEach((v,S)=>{const _=ze(v),w=g[S-1];_.start=l3({attributes:_,priorPeriodAttributes:w?w.attributes:null,mpdType:l.type}),g.push({node:v,attributes:_})}),{locations:l.locations,contentSteeringInfo:o3(p,s),representationInfo:_s(g.map(a3(l,c))),eventStream:_s(g.map(r3))}},b2=t=>{if(t==="")throw new Error(Ts.DASH_EMPTY_MANIFEST);const e=new _k;let i,n;try{i=e.parseFromString(t,"application/xml"),n=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Ts.DASH_INVALID_XML);return n},c3=t=>{const e=Ie(t,"UTCTiming")[0];if(!e)return null;const i=ze(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ts.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},d3=(t,e={})=>{const i=u3(b2(t),e),n=Yk(i.representationInfo);return Vk({dashPlaylists:n,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},h3=t=>c3(b2(t));var C2=Math.pow(2,32),f3=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;n+=12,r--)i.references.push({referenceType:(t[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return i},g3=m3;const y3=un(g3);var v3=J([73,68,51]),_3=function(e,i){i===void 0&&(i=0),e=J(e);var n=e[i+5],r=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],s=(n&16)>>4;return s?r+20:r+10},xa=function t(e,i){return i===void 0&&(i=0),e=J(e),e.length-i<10||!Pe(e,v3,{offset:i})?i:(i+=_3(e,i),t(e,i))},sy=function(e){return typeof e=="string"?z1(e):e},T3=function(e){return Array.isArray(e)?e.map(function(i){return sy(i)}):[sy(e)]},x3=function t(e,i,n){n===void 0&&(n=!1),i=T3(i),e=J(e);var r=[];if(!i.length)return r;for(var s=0;s>>0,o=e.subarray(s+4,s+8);if(a===0)break;var l=s+a;if(l>e.length){if(n)break;l=e.length}var c=e.subarray(s+8,l);Pe(o,i[0])&&(i.length===1?r.push(c):r.push.apply(r,t(c,i.slice(1),n))),s=l}return r},vl={EBML:J([26,69,223,163]),DocType:J([66,130]),Segment:J([24,83,128,103]),SegmentInfo:J([21,73,169,102]),Tracks:J([22,84,174,107]),Track:J([174]),TrackNumber:J([215]),DefaultDuration:J([35,227,131]),TrackEntry:J([174]),TrackType:J([131]),FlagDefault:J([136]),CodecID:J([134]),CodecPrivate:J([99,162]),VideoTrack:J([224]),AudioTrack:J([225]),Cluster:J([31,67,182,117]),Timestamp:J([231]),TimestampScale:J([42,215,177]),BlockGroup:J([160]),BlockDuration:J([155]),Block:J([161]),SimpleBlock:J([163])},Wh=[128,64,32,16,8,4,2,1],S3=function(e){for(var i=1,n=0;n=i.length)return i.length;var r=Tu(i,n,!1);if(Pe(e.bytes,r.bytes))return n;var s=Tu(i,n+r.length);return t(e,i,n+s.length+s.value+r.length)},oy=function t(e,i){i=E3(i),e=J(e);var n=[];if(!i.length)return n;for(var r=0;re.length?e.length:o+a.value,c=e.subarray(o,l);Pe(i[0],s.bytes)&&(i.length===1?n.push(c):n=n.concat(t(c,i.slice(1))));var p=s.length+a.length+c.length;r+=p}return n},C3=J([0,0,0,1]),w3=J([0,0,1]),D3=J([0,0,3]),A3=function(e){for(var i=[],n=1;n>1&63),n.indexOf(c)!==-1&&(a=s+l),s+=l+(i==="h264"?1:2)}return e.subarray(0,0)},k3=function(e,i,n){return w2(e,"h264",i,n)},P3=function(e,i,n){return w2(e,"h265",i,n)},ft={webm:J([119,101,98,109]),matroska:J([109,97,116,114,111,115,107,97]),flac:J([102,76,97,67]),ogg:J([79,103,103,83]),ac3:J([11,119]),riff:J([82,73,70,70]),avi:J([65,86,73]),wav:J([87,65,86,69]),"3gp":J([102,116,121,112,51,103]),mp4:J([102,116,121,112]),fmp4:J([115,116,121,112]),mov:J([102,116,121,112,113,116]),moov:J([109,111,111,118]),moof:J([109,111,111,102])},xs={aac:function(e){var i=xa(e);return Pe(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=xa(e);return Pe(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=oy(e,[vl.EBML,vl.DocType])[0];return Pe(i,ft.webm)},mkv:function(e){var i=oy(e,[vl.EBML,vl.DocType])[0];return Pe(i,ft.matroska)},mp4:function(e){if(xs["3gp"](e)||xs.mov(e))return!1;if(Pe(e,ft.mp4,{offset:4})||Pe(e,ft.fmp4,{offset:4})||Pe(e,ft.moof,{offset:4})||Pe(e,ft.moov,{offset:4}))return!0},mov:function(e){return Pe(e,ft.mov,{offset:4})},"3gp":function(e){return Pe(e,ft["3gp"],{offset:4})},ac3:function(e){var i=xa(e);return Pe(e,ft.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},Op=9e4,Np,Rp,hc,Mp,D2,A2,k2;Np=function(t){return t*Op};Rp=function(t,e){return t*e};hc=function(t){return t/Op};Mp=function(t,e){return t/e};D2=function(t,e){return Np(Mp(t,e))};A2=function(t,e){return Rp(hc(t),e)};k2=function(t,e,i){return hc(i?t:t-e)};var xu={ONE_SECOND_IN_TS:Op,secondsToVideoTs:Np,secondsToAudioTs:Rp,videoTsToSeconds:hc,audioTsToSeconds:Mp,audioTsToVideoTs:D2,videoTsToAudioTs:A2,metadataTsToSeconds:k2};/** - * @license - * Video.js 8.6.1 - * Copyright Brightcove, Inc. - * Available under Apache License Version 2.0 - * - * - * Includes vtt.js - * Available under Apache License Version 2.0 - * - */var P2="8.6.1";const qi={},Rn=function(t,e){return qi[t]=qi[t]||[],e&&(qi[t]=qi[t].concat(e)),qi[t]},O3=function(t,e){Rn(t,e)},I2=function(t,e){const i=Rn(t).indexOf(e);return i<=-1?!1:(qi[t]=qi[t].slice(),qi[t].splice(i,1),!0)},N3=function(t,e){Rn(t,[].concat(e).map(i=>{const n=(...r)=>(I2(t,n),i(...r));return n}))},Su={prefixed:!0},Fl=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],ly=Fl[0];let Sa;for(let t=0;t(n,r,s)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let l=t;if(n!=="log"&&s.unshift(n.toUpperCase()+":"),i&&(l=`%c${t}`,s.unshift(i)),s.unshift(l+":"),bt){bt.push([].concat(s));const p=bt.length-1e3;bt.splice(0,p>0?p:0)}if(!A.console)return;let c=A.console[n];!c&&n==="debug"&&(c=A.console.info||A.console.log),!(!c||!a||!o.test(n))&&c[Array.isArray(s)?"apply":"call"](A.console,s)};function Xh(t,e=":",i=""){let n="info",r;const s=function(...a){r("log",n,a)};return r=R3(t,s,i),s.createLogger=(a,o,l)=>{const c=o!==void 0?o:e,p=l!==void 0?l:i,g=`${t} ${c} ${a}`;return Xh(g,c,p)},s.createNewLogger=(a,o,l)=>Xh(a,o,l),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},s.level=a=>{if(typeof a=="string"){if(!s.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},s.history=()=>bt?[].concat(bt):[],s.history.filter=a=>(bt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),s.history.clear=()=>{bt&&(bt.length=0)},s.history.disable=()=>{bt!==null&&(bt.length=0,bt=null)},s.history.enable=()=>{bt===null&&(bt=[])},s.error=(...a)=>r("error",n,a),s.warn=(...a)=>r("warn",n,a),s.debug=(...a)=>r("debug",n,a),s}const oe=Xh("VIDEOJS"),L2=oe.createLogger,M3=Object.prototype.toString,O2=function(t){return Ni(t)?Object.keys(t):[]};function ns(t,e){O2(t).forEach(i=>e(t[i],i))}function N2(t,e,i=0){return O2(t).reduce((n,r)=>e(n,t[r],r),i)}function Ni(t){return!!t&&typeof t=="object"}function Ss(t){return Ni(t)&&M3.call(t)==="[object Object]"&&t.constructor===Object}function xe(...t){const e={};return t.forEach(i=>{i&&ns(i,(n,r)=>{if(!Ss(n)){e[r]=n;return}Ss(e[r])||(e[r]={}),e[r]=xe(e[r],n)})}),e}function R2(t={}){const e=[];for(const i in t)if(t.hasOwnProperty(i)){const n=t[i];e.push(n)}return e}function fc(t,e,i,n=!0){const r=a=>Object.defineProperty(t,e,{value:a,enumerable:!0,writable:!0}),s={configurable:!0,enumerable:!0,get(){const a=i();return r(a),a}};return n&&(s.set=r),Object.defineProperty(t,e,s)}var B3=Object.freeze({__proto__:null,each:ns,reduce:N2,isObject:Ni,isPlain:Ss,merge:xe,values:R2,defineLazyProperty:fc});let Bp=!1,M2=null,Ri=!1,B2,F2=!1,rs=!1,ss=!1,Mi=!1,Fp=null,pc=null,U2=null,Eu=!1,mc=!1,bu=!1,gc=!1;const uo=!!(Os()&&("ontouchstart"in A||A.navigator.maxTouchPoints||A.DocumentTouch&&A.document instanceof A.DocumentTouch)),Or=A.navigator&&A.navigator.userAgentData;Or&&(Ri=Or.platform==="Android",rs=!!Or.brands.find(t=>t.brand==="Microsoft Edge"),ss=!!Or.brands.find(t=>t.brand==="Chromium"),Mi=!rs&&ss,Fp=pc=(Or.brands.find(t=>t.brand==="Chromium")||{}).version||null,mc=Or.platform==="Windows");if(!ss){const t=A.navigator&&A.navigator.userAgent||"";Bp=/iPod/i.test(t),M2=function(){const e=t.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Ri=/Android/i.test(t),B2=function(){const e=t.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const i=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return i&&n?parseFloat(e[1]+"."+e[2]):i||null}(),F2=/Firefox/i.test(t),rs=/Edg/i.test(t),ss=/Chrome/i.test(t)||/CriOS/i.test(t),Mi=!rs&&ss,Fp=pc=function(){const e=t.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),U2=function(){const e=/MSIE\s(\d+)\.\d/.exec(t);let i=e&&parseFloat(e[1]);return!i&&/Trident\/7.0/i.test(t)&&/rv:11.0/.test(t)&&(i=11),i}(),Eu=/Safari/i.test(t)&&!Mi&&!Ri&&!rs,mc=/Windows/i.test(t),bu=/iPad/i.test(t)||Eu&&uo&&!/iPhone/i.test(t),gc=/iPhone/i.test(t)&&!bu}const Tt=gc||bu||Bp,yc=(Eu||Tt)&&!Mi;var F3=Object.freeze({__proto__:null,get IS_IPOD(){return Bp},get IOS_VERSION(){return M2},get IS_ANDROID(){return Ri},get ANDROID_VERSION(){return B2},get IS_FIREFOX(){return F2},get IS_EDGE(){return rs},get IS_CHROMIUM(){return ss},get IS_CHROME(){return Mi},get CHROMIUM_VERSION(){return Fp},get CHROME_VERSION(){return pc},get IE_VERSION(){return U2},get IS_SAFARI(){return Eu},get IS_WINDOWS(){return mc},get IS_IPAD(){return bu},get IS_IPHONE(){return gc},TOUCH_ENABLED:uo,IS_IOS:Tt,IS_ANY_SAFARI:yc});function uy(t){return typeof t=="string"&&!!t.trim()}function U3(t){if(t.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Os(){return V===A.document}function Ns(t){return Ni(t)&&t.nodeType===1}function j2(){try{return A.parent!==A.self}catch{return!0}}function $2(t){return function(e,i){if(!uy(e))return V[t](null);uy(i)&&(i=V.querySelector(i));const n=Ns(i)?i:V;return n[t]&&n[t](e)}}function ae(t="div",e={},i={},n){const r=V.createElement(t);return Object.getOwnPropertyNames(e).forEach(function(s){const a=e[s];s==="textContent"?Vn(r,a):(r[s]!==a||s==="tabIndex")&&(r[s]=a)}),Object.getOwnPropertyNames(i).forEach(function(s){r.setAttribute(s,i[s])}),n&&Up(r,n),r}function Vn(t,e){return typeof t.textContent>"u"?t.innerText=e:t.textContent=e,t}function Kh(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function Na(t,e){return U3(e),t.classList.contains(e)}function lr(t,...e){return t.classList.add(...e.reduce((i,n)=>i.concat(n.split(/\s+/)),[])),t}function vc(t,...e){return t?(t.classList.remove(...e.reduce((i,n)=>i.concat(n.split(/\s+/)),[])),t):(oe.warn("removeClass was called with an element that doesn't exist"),null)}function V2(t,e,i){return typeof i=="function"&&(i=i(t,e)),typeof i!="boolean"&&(i=void 0),e.split(/\s+/).forEach(n=>t.classList.toggle(n,i)),t}function z2(t,e){Object.getOwnPropertyNames(e).forEach(function(i){const n=e[i];n===null||typeof n>"u"||n===!1?t.removeAttribute(i):t.setAttribute(i,n===!0?"":n)})}function vn(t){const e={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(t&&t.attributes&&t.attributes.length>0){const n=t.attributes;for(let r=n.length-1;r>=0;r--){const s=n[r].name;let a=n[r].value;i.includes(s)&&(a=a!==null),e[s]=a}}return e}function H2(t,e){return t.getAttribute(e)}function Es(t,e,i){t.setAttribute(e,i)}function _c(t,e){t.removeAttribute(e)}function q2(){V.body.focus(),V.onselectstart=function(){return!1}}function W2(){V.onselectstart=function(){return!0}}function bs(t){if(t&&t.getBoundingClientRect&&t.parentNode){const e=t.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(i[n]=e[n])}),i.height||(i.height=parseFloat(Cs(t,"height"))),i.width||(i.width=parseFloat(Cs(t,"width"))),i}}function co(t){if(!t||t&&!t.offsetParent)return{left:0,top:0,width:0,height:0};const e=t.offsetWidth,i=t.offsetHeight;let n=0,r=0;for(;t.offsetParent&&t!==V[Su.fullscreenElement];)n+=t.offsetLeft,r+=t.offsetTop,t=t.offsetParent;return{left:n,top:r,width:e,height:i}}function Tc(t,e){const i={x:0,y:0};if(Tt){let p=t;for(;p&&p.nodeName.toLowerCase()!=="html";){const g=Cs(p,"transform");if(/^matrix/.test(g)){const v=g.slice(7,-1).split(/,\s/).map(Number);i.x+=v[4],i.y+=v[5]}else if(/^matrix3d/.test(g)){const v=g.slice(9,-1).split(/,\s/).map(Number);i.x+=v[12],i.y+=v[13]}p=p.parentNode}}const n={},r=co(e.target),s=co(t),a=s.width,o=s.height;let l=e.offsetY-(s.top-r.top),c=e.offsetX-(s.left-r.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-s.left,l=e.changedTouches[0].pageY+s.top,Tt&&(c-=i.x,l-=i.y)),n.y=1-Math.max(0,Math.min(1,l/o)),n.x=Math.max(0,Math.min(1,c/a)),n}function G2(t){return Ni(t)&&t.nodeType===3}function xc(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function X2(t){return typeof t=="function"&&(t=t()),(Array.isArray(t)?t:[t]).map(e=>{if(typeof e=="function"&&(e=e()),Ns(e)||G2(e))return e;if(typeof e=="string"&&/\S/.test(e))return V.createTextNode(e)}).filter(e=>e)}function Up(t,e){return X2(e).forEach(i=>t.appendChild(i)),t}function K2(t,e){return Up(xc(t),e)}function ho(t){return t.button===void 0&&t.buttons===void 0||t.button===0&&t.buttons===void 0||t.type==="mouseup"&&t.button===0&&t.buttons===0?!0:!(t.button!==0||t.buttons!==1)}const Mn=$2("querySelector"),Q2=$2("querySelectorAll");function Cs(t,e){if(!t||!e)return"";if(typeof A.getComputedStyle=="function"){let i;try{i=A.getComputedStyle(t)}catch{return""}return i?i.getPropertyValue(e)||i[e]:""}return""}function Y2(t){[...V.styleSheets].forEach(e=>{try{const i=[...e.cssRules].map(r=>r.cssText).join(""),n=V.createElement("style");n.textContent=i,t.document.head.appendChild(n)}catch{const n=V.createElement("link");n.rel="stylesheet",n.type=e.type,n.media=e.media.mediaText,n.href=e.href,t.document.head.appendChild(n)}})}var J2=Object.freeze({__proto__:null,isReal:Os,isEl:Ns,isInFrame:j2,createEl:ae,textContent:Vn,prependTo:Kh,hasClass:Na,addClass:lr,removeClass:vc,toggleClass:V2,setAttributes:z2,getAttributes:vn,getAttribute:H2,setAttribute:Es,removeAttribute:_c,blockTextSelection:q2,unblockTextSelection:W2,getBoundingClientRect:bs,findPosition:co,getPointerPosition:Tc,isTextNode:G2,emptyEl:xc,normalizeContent:X2,appendContent:Up,insertContent:K2,isSingleLeftClick:ho,$:Mn,$$:Q2,computedStyle:Cs,copyStyleSheetsToWindow:Y2});let Z2=!1,Qh;const j3=function(){if(Qh.options.autoSetup===!1)return;const t=Array.prototype.slice.call(V.getElementsByTagName("video")),e=Array.prototype.slice.call(V.getElementsByTagName("audio")),i=Array.prototype.slice.call(V.getElementsByTagName("video-js")),n=t.concat(e,i);if(n&&n.length>0)for(let r=0,s=n.length;r-1&&(r={passive:!0}),t.addEventListener(e,n.dispatcher,r)}else t.attachEvent&&t.attachEvent("on"+e,n.dispatcher)}function lt(t,e,i){if(!yt.has(t))return;const n=yt.get(t);if(!n.handlers)return;if(Array.isArray(e))return jp(lt,t,e,i);const r=function(a,o){n.handlers[o]=[],cy(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(t,a);return}const s=n.handlers[e];if(s){if(!i){r(t,e);return}if(i.guid)for(let a=0;a=e&&(t(...r),i=s)}},iT=function(t,e,i,n=A){let r;const s=()=>{n.clearTimeout(r),r=null},a=function(){const o=this,l=arguments;let c=function(){r=null,c=null,i||t.apply(o,l)};!r&&i&&t.apply(o,l),n.clearTimeout(r),r=n.setTimeout(c,e)};return a.cancel=s,a};var W3=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:ni,bind_:Ee,throttle:Fi,debounce:iT});let ca;class ri{on(e,i){const n=this.addEventListener;this.addEventListener=()=>{},Ht(this,e,i),this.addEventListener=n}off(e,i){lt(this,e,i)}one(e,i){const n=this.addEventListener;this.addEventListener=()=>{},Ec(this,e,i),this.addEventListener=n}any(e,i){const n=this.addEventListener;this.addEventListener=()=>{},$p(this,e,i),this.addEventListener=n}trigger(e){const i=e.type||e;typeof e=="string"&&(e={type:i}),e=Sc(e),this.allowedEvents_[i]&&this["on"+i]&&this["on"+i](e),Rs(this,e)}queueTrigger(e){ca||(ca=new Map);const i=e.type||e;let n=ca.get(this);n||(n=new Map,ca.set(this,n));const r=n.get(i);n.delete(i),A.clearTimeout(r);const s=A.setTimeout(()=>{n.delete(i),n.size===0&&(n=null,ca.delete(this)),this.trigger(e)},0);n.set(i,s)}}ri.prototype.allowedEvents_={};ri.prototype.addEventListener=ri.prototype.on;ri.prototype.removeEventListener=ri.prototype.off;ri.prototype.dispatchEvent=ri.prototype.trigger;const bc=t=>typeof t.name=="function"?t.name():typeof t.name=="string"?t.name:t.name_?t.name_:t.constructor&&t.constructor.name?t.constructor.name:typeof t,Ji=t=>t instanceof ri||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof t[e]=="function"),G3=(t,e)=>{Ji(t)?e():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(e))},Zh=t=>typeof t=="string"&&/\S/.test(t)||Array.isArray(t)&&!!t.length,Cu=(t,e,i)=>{if(!t||!t.nodeName&&!Ji(t))throw new Error(`Invalid target for ${bc(e)}#${i}; must be a DOM node or evented object.`)},nT=(t,e,i)=>{if(!Zh(t))throw new Error(`Invalid event type for ${bc(e)}#${i}; must be a non-empty string or array.`)},rT=(t,e,i)=>{if(typeof t!="function")throw new Error(`Invalid listener for ${bc(e)}#${i}; must be a function.`)},Od=(t,e,i)=>{const n=e.length<3||e[0]===t||e[0]===t.eventBusEl_;let r,s,a;return n?(r=t.eventBusEl_,e.length>=3&&e.shift(),[s,a]=e):[r,s,a]=e,Cu(r,t,i),nT(s,t,i),rT(a,t,i),a=Ee(t,a),{isTargetingSelf:n,target:r,type:s,listener:a}},Kn=(t,e,i,n)=>{Cu(t,t,e),t.nodeName?q3[e](t,i,n):t[e](i,n)},X3={on(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=Od(this,t,"on");if(Kn(i,"on",n,r),!e){const s=()=>this.off(i,n,r);s.guid=r.guid;const a=()=>this.off("dispose",s);a.guid=r.guid,Kn(this,"on","dispose",s),Kn(i,"on","dispose",a)}},one(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=Od(this,t,"one");if(e)Kn(i,"one",n,r);else{const s=(...a)=>{this.off(i,n,s),r.apply(null,a)};s.guid=r.guid,Kn(i,"one",n,s)}},any(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=Od(this,t,"any");if(e)Kn(i,"any",n,r);else{const s=(...a)=>{this.off(i,n,s),r.apply(null,a)};s.guid=r.guid,Kn(i,"any",n,s)}},off(t,e,i){if(!t||Zh(t))lt(this.eventBusEl_,t,e);else{const n=t,r=e;Cu(n,this,"off"),nT(r,this,"off"),rT(i,this,"off"),i=Ee(this,i),this.off("dispose",i),n.nodeName?(lt(n,r,i),lt(n,"dispose",i)):Ji(n)&&(n.off(r,i),n.off("dispose",i))}},trigger(t,e){Cu(this.eventBusEl_,this,"trigger");const i=t&&typeof t!="string"?t.type:t;if(!Zh(i))throw new Error(`Invalid event type for ${bc(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Rs(this.eventBusEl_,t,e)}};function Vp(t,e={}){const{eventBusKey:i}=e;if(i){if(!t[i].nodeName)throw new Error(`The eventBusKey "${i}" does not refer to an element.`);t.eventBusEl_=t[i]}else t.eventBusEl_=ae("span",{className:"vjs-event-bus"});return Object.assign(t,X3),t.eventedCallbacks&&t.eventedCallbacks.forEach(n=>{n()}),t.on("dispose",()=>{t.off(),[t,t.el_,t.eventBusEl_].forEach(function(n){n&&yt.has(n)&&yt.delete(n)}),A.setTimeout(()=>{t.eventBusEl_=null},0)}),t}const K3={state:{},setState(t){typeof t=="function"&&(t=t());let e;return ns(t,(i,n)=>{this.state[n]!==i&&(e=e||{},e[n]={from:this.state[n],to:i}),this.state[n]=i}),e&&Ji(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function sT(t,e){return Object.assign(t,K3),t.state=Object.assign({},t.state,e),typeof t.handleStateChanged=="function"&&Ji(t)&&t.on("statechanged",t.handleStateChanged),t}const Ra=function(t){return typeof t!="string"?t:t.replace(/./,e=>e.toLowerCase())},Fe=function(t){return typeof t!="string"?t:t.replace(/./,e=>e.toUpperCase())},aT=function(t,e){return Fe(t)===Fe(e)};var Q3=Object.freeze({__proto__:null,toLowerCase:Ra,toTitleCase:Fe,titleCaseEquals:aT});class B{constructor(e,i,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=xe({},this.options_),i=this.options_=xe(this.options_,i),this.id_=i.id||i.el&&i.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Bi()}`}this.name_=i.name||null,i.el?this.el_=i.el:i.createEl!==!1&&(this.el_=this.createEl()),i.className&&this.el_&&i.className.split(" ").forEach(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),i.evented!==!1&&(Vp(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),sT(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,i.initChildren!==!1&&this.initChildren(),this.ready(n),i.reportTouchActivity!==!1&&this.enableTouchActivity()}on(e,i){}off(e,i){}one(e,i){}any(e,i){}trigger(e,i){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let i=this.children_.length-1;i>=0;i--)this.children_[i].dispose&&this.children_[i].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=xe(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,i,n){return ae(e,i,n)}localize(e,i,n=e){const r=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),a=s&&s[r],o=r&&r.split("-")[0],l=s&&s[o];let c=n;return a&&a[e]?c=a[e]:l&&l[e]&&(c=l[e]),i&&(c=c.replace(/\{(\d+)\}/g,function(p,g){const v=i[g-1];let S=v;return typeof v>"u"&&(S=p),S})),c}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((n,r)=>n.concat(r),[]);let i=this;for(let n=0;n=0;r--)if(this.children_[r]===e){i=!0,this.children_.splice(r,1);break}if(!i)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Fe(e.name())]=null,this.childNameIndex_[Ra(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const i=this.options_,n=a=>{const o=a.name;let l=a.opts;if(i[o]!==void 0&&(l=i[o]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const c=this.addChild(o,l);c&&(this[o]=c)};let r;const s=B.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,l;return typeof a=="string"?(o=a,l=e[o]||this.options_[o]||{}):(o=a.name,l=a),{name:o,opts:l}}).filter(a=>{const o=B.getComponent(a.opts.componentClass||Fe(a.name));return o&&!s.isTech(o)}).forEach(n)}}buildCSSClass(){return""}ready(e,i=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}i?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(i){i.call(this)},this),this.trigger("ready")},1)}$(e,i){return Mn(e,i||this.contentEl())}$$(e,i){return Q2(e,i||this.contentEl())}hasClass(e){return Na(this.el_,e)}addClass(...e){lr(this.el_,...e)}removeClass(...e){vc(this.el_,...e)}toggleClass(e,i){V2(this.el_,e,i)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return H2(this.el_,e)}setAttribute(e,i){Es(this.el_,e,i)}removeAttribute(e){_c(this.el_,e)}width(e,i){return this.dimension("width",e,i)}height(e,i){return this.dimension("height",e,i)}dimensions(e,i){this.width(e,!0),this.height(i)}dimension(e,i,n){if(i!==void 0){(i===null||i!==i)&&(i=0),(""+i).indexOf("%")!==-1||(""+i).indexOf("px")!==-1?this.el_.style[e]=i:i==="auto"?this.el_.style[e]="":this.el_.style[e]=i+"px",n||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],s=r.indexOf("px");return parseInt(s!==-1?r.slice(0,s):this.el_["offset"+Fe(e)],10)}currentDimension(e){let i=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(i=Cs(this.el_,e),i=parseFloat(i),i===0||isNaN(i)){const n=`offset${Fe(e)}`;i=this.el_[n]}return i}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(re.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,i=null;const n=10,r=200;let s;this.on("touchstart",function(o){o.touches.length===1&&(i={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=A.performance.now(),s=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)s=!1;else if(i){const l=o.touches[0].pageX-i.pageX,c=o.touches[0].pageY-i.pageY;Math.sqrt(l*l+c*c)>n&&(s=!1)}});const a=function(){s=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){i=null,s===!0&&A.performance.now()-e{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},i),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),A.clearTimeout(e)),e}setInterval(e,i){e=Ee(this,e),this.clearTimersOnDispose_();const n=A.setInterval(e,i);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),A.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var i;return e=Ee(this,e),i=A.requestAnimationFrame(()=>{this.rafIds_.has(i)&&this.rafIds_.delete(i),e()}),this.rafIds_.add(i),i}requestNamedAnimationFrame(e,i){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),i=Ee(this,i);const n=this.requestAnimationFrame(()=>{i(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),A.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((n,r)=>this[i](r))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(e,i){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const n=B.getComponent("Tech"),r=n&&n.isTech(i),s=B===i||B.prototype.isPrototypeOf(i.prototype);if(r||!s){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Fe(e),B.components_||(B.components_={});const a=B.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,l=Object.keys(o);if(o&&l.length>0&&l.map(c=>o[c]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return B.components_[e]=i,B.components_[Ra(e)]=i,i}static getComponent(e){if(!(!e||!B.components_))return B.components_[e]}}B.registerComponent("Component",B);function Y3(t,e,i){if(typeof e!="number"||e<0||e>i)throw new Error(`Failed to execute '${t}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${i}).`)}function dy(t,e,i,n){return Y3(t,n,i.length-1),i[n][e]}function Nd(t){let e;return t===void 0||t.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:t.length,start:dy.bind(null,"start",0,t),end:dy.bind(null,"end",1,t)},A.Symbol&&A.Symbol.iterator&&(e[A.Symbol.iterator]=()=>(t||[]).values()),e}function Oi(t,e){return Array.isArray(t)?Nd(t):t===void 0||e===void 0?Nd():Nd([[t,e]])}const oT=function(t,e){t=t<0?0:t;let i=Math.floor(t%60),n=Math.floor(t/60%60),r=Math.floor(t/3600);const s=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(r=n=i="-"),r=r>0||a>0?r+":":"",n=((r||s>=10)&&n<10?"0"+n:n)+":",i=i<10?"0"+i:i,r+n+i};let zp=oT;function lT(t){zp=t}function uT(){zp=oT}function gr(t,e=t){return zp(t,e)}var J3=Object.freeze({__proto__:null,createTimeRanges:Oi,createTimeRange:Oi,setFormatTime:lT,resetFormatTime:uT,formatTime:gr});function cT(t,e){let i=0,n,r;if(!e)return 0;(!t||!t.length)&&(t=Oi(0,0));for(let s=0;se&&(r=e),i+=r-n;return i/e}function vt(t){if(t instanceof vt)return t;typeof t=="number"?this.code=t:typeof t=="string"?this.message=t:Ni(t)&&(typeof t.code=="number"&&(this.code=t.code),Object.assign(this,t)),this.message||(this.message=vt.defaultMessages[this.code]||"")}vt.prototype.code=0;vt.prototype.message="";vt.prototype.status=null;vt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];vt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let t=0;t{})}const ef=function(t){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((i,n,r)=>(t[n]&&(i[n]=t[n]),i),{cues:t.cues&&Array.prototype.map.call(t.cues,function(i){return{startTime:i.startTime,endTime:i.endTime,text:i.text,id:i.id}})})},Z3=function(t){const e=t.$$("track"),i=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const s=ef(r.track);return r.src&&(s.src=r.src),s}).concat(Array.prototype.filter.call(t.textTracks(),function(r){return i.indexOf(r)===-1}).map(ef))},e4=function(t,e){return t.forEach(function(i){const n=e.addRemoteTextTrack(i).track;!i.src&&i.cues&&i.cues.forEach(r=>n.addCue(r))}),e.textTracks()};var hy={textTracksToJson:Z3,jsonToTextTracks:e4,trackToJson_:ef};const Rd="vjs-modal-dialog";class Ms extends B{constructor(e,i){super(e,i),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=ae("div",{className:`${Rd}-content`},{role:"document"}),this.descEl_=ae("p",{className:`${Rd}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Vn(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Rd} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(!this.opened_){const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const i=this.closeable_=!!e;let n=this.getChild("closeButton");if(i&&!n){const r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close_)}!i&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const i=this.contentEl(),n=i.parentNode,r=i.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(i),this.empty(),K2(i,e),this.trigger("modalfill"),r?n.insertBefore(i,r):n.appendChild(i);const s=this.getChild("closeButton");s&&n.appendChild(s.el_)}empty(){this.trigger("beforemodalempty"),xc(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=V.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,(i.contains(e)||i===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),re.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault(),this.close();return}if(!re.isEventKey(e,"Tab"))return;const i=this.focusableEls_(),n=this.el_.querySelector(":focus");let r;for(let s=0;s(i instanceof A.HTMLAnchorElement||i instanceof A.HTMLAreaElement)&&i.hasAttribute("href")||(i instanceof A.HTMLInputElement||i instanceof A.HTMLSelectElement||i instanceof A.HTMLTextAreaElement||i instanceof A.HTMLButtonElement)&&!i.hasAttribute("disabled")||i instanceof A.HTMLIFrameElement||i instanceof A.HTMLObjectElement||i instanceof A.HTMLEmbedElement||i.hasAttribute("tabindex")&&i.getAttribute("tabindex")!==-1||i.hasAttribute("contenteditable"))}}Ms.prototype.options_={pauseOnOpen:!0,temporary:!0};B.registerComponent("ModalDialog",Ms);class ws extends ri{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let i=0;i{this.trigger({track:e,type:"labelchange",target:this})},Ji(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let i;for(let n=0,r=this.length;n=0;i--)if(e[i].enabled){Md(e,e[i]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Md(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Md(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Bd=function(t,e){for(let i=0;i=0;i--)if(e[i].selected){Bd(e,e[i]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let i=0;i{this.changing_||(this.changing_=!0,Bd(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class dT extends ws{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class n4{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let i=0,n=e.length;i0&&(A.console&&A.console.groupCollapsed&&A.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(r=>oe.error(r)),A.console&&A.console.groupEnd&&A.console.groupEnd()),i.flush()},my=function(t,e){const i={uri:t},n=Cc(t);n&&(i.cors=n);const r=e.tech_.crossOrigin()==="use-credentials";r&&(i.withCredentials=r),O1(i,Ee(this,function(s,a,o){if(s)return oe.error(s,a);e.loaded_=!0,typeof A.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){oe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return py(o,e)}):py(o,e)}))};class Eo extends Hp{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const i=xe(e,{kind:a4[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=fy[i.mode]||"disabled";const r=i.default;(i.kind==="metadata"||i.kind==="chapters")&&(n="hidden"),super(i),this.tech_=i.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const s=new wu(this.cues_),a=new wu(this.activeCues_);let o=!1;this.timeupdateHandler=Ee(this,function(c={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return n},set(c){fy[c]&&n!==c&&(n=c,!this.preload_&&n!=="disabled"&&this.cues.length===0&&my(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const c=this.tech_.currentTime(),p=[];for(let g=0,v=this.cues.length;g=c&&p.push(S)}if(o=!1,p.length!==this.activeCues_.length)o=!0;else for(let g=0;g{i=ln.LOADED,this.trigger({type:"load",target:this})})}}ln.prototype.allowedEvents_={load:"load"};ln.NONE=0;ln.LOADING=1;ln.LOADED=2;ln.ERROR=3;const ei={audio:{ListClass:t4,TrackClass:fT,capitalName:"Audio"},video:{ListClass:i4,TrackClass:pT,capitalName:"Video"},text:{ListClass:dT,TrackClass:Eo,capitalName:"Text"}};Object.keys(ei).forEach(function(t){ei[t].getterName=`${t}Tracks`,ei[t].privateName=`${t}Tracks_`});const Ds={remoteText:{ListClass:dT,TrackClass:Eo,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:n4,TrackClass:ln,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},mt=Object.assign({},ei,Ds);Ds.names=Object.keys(Ds);ei.names=Object.keys(ei);mt.names=[].concat(Ds.names).concat(ei.names);function l4(t,e,i,n,r={}){const s=t.textTracks();r.kind=e,i&&(r.label=i),n&&(r.language=n),r.tech=t;const a=new mt.text.TrackClass(r);return s.addTrack(a),a}class se extends B{constructor(e={},i=function(){}){e.reportTouchActivity=!1,super(null,e,i),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),mt.names.forEach(n=>{const r=mt[n];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new mt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ee(this,function(){const i=this.bufferedPercent();this.bufferedPercent_!==i&&this.trigger("progress"),this.bufferedPercent_=i,i===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Oi(0,0)}bufferedPercent(){return cT(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(ei.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(i=>{const n=this[`${i}Tracks`]()||[];let r=n.length;for(;r--;){const s=n[r];i==="text"&&this.removeRemoteTextTrack(s),n.removeTrack(s)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let i=e.length;for(;i--;){const n=e[i];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new vt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Oi(0,0):Oi()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){ei.names.forEach(e=>{const i=ei[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!A.WebVTT)if(V.body.contains(this.el())){if(!this.options_["vtt.js"]&&Ss(L0)&&Object.keys(L0).length>0){this.trigger("vttjsloaded");return}const e=V.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),A.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),i=this.remoteTextTracks(),n=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();const s=()=>this.trigger("texttrackchange"),a=()=>{s();for(let o=0;othis.autoRemoteTextTracks_.addTrack(n.track)),n}removeRemoteTextTrack(e){const i=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(i),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const i=Bi();return!this.isReady_||this.paused()?(this.queuedHanders_.add(i),this.one("playing",()=>{this.queuedHanders_.has(i)&&(this.queuedHanders_.delete(i),e())})):this.requestNamedAnimationFrame(i,e),i}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,i){return se.canPlayType(e.type)}static isTech(e){return e.prototype instanceof se||e instanceof se||e===se}static registerTech(e,i){if(se.techs_||(se.techs_={}),!se.isTech(i))throw new Error(`Tech ${e} must be a Tech`);if(!se.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!se.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Fe(e),se.techs_[e]=i,se.techs_[Ra(e)]=i,e!=="Tech"&&se.defaultTechOrder_.push(e),i}static getTech(e){if(e){if(se.techs_&&se.techs_[e])return se.techs_[e];if(e=Fe(e),A&&A.videojs&&A.videojs[e])return oe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),A.videojs[e]}}}mt.names.forEach(function(t){const e=mt[t];se.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});se.prototype.featuresVolumeControl=!0;se.prototype.featuresMuteControl=!0;se.prototype.featuresFullscreenResize=!1;se.prototype.featuresPlaybackRate=!1;se.prototype.featuresProgressEvents=!1;se.prototype.featuresSourceset=!1;se.prototype.featuresTimeupdateEvents=!1;se.prototype.featuresNativeTextTracks=!1;se.prototype.featuresVideoFrameCallback=!1;se.withSourceHandlers=function(t){t.registerSourceHandler=function(i,n){let r=t.sourceHandlers;r||(r=t.sourceHandlers=[]),n===void 0&&(n=r.length),r.splice(n,0,i)},t.canPlayType=function(i){const n=t.sourceHandlers||[];let r;for(let s=0;sJn(e,ur[e.type],i,t),1)}function d4(t,e){t.forEach(i=>i.setTech&&i.setTech(e))}function h4(t,e,i){return t.reduceRight(Gp(i),e[i]())}function f4(t,e,i,n){return e[i](t.reduce(Gp(i),n))}function gy(t,e,i,n=null){const r="call"+Fe(i),s=t.reduce(Gp(r),n),a=s===Du,o=a?null:e[i](s);return g4(t,i,o,a),o}const p4={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},m4={setCurrentTime:1,setMuted:1,setVolume:1},yy={play:1,pause:1};function Gp(t){return(e,i)=>e===Du?Du:i[t]?i[t](e):e}function g4(t,e,i,n){for(let r=t.length-1;r>=0;r--){const s=t[r];s[e]&&s[e](n,i)}}function y4(t){tf[t.id()]=null}function v4(t,e){const i=tf[t.id()];let n=null;if(i==null)return n=e(t),tf[t.id()]=[[e,n]],n;for(let r=0;r{if(!e)return"";if(t.cache_.source.src===e&&t.cache_.source.type)return t.cache_.source.type;const i=t.cache_.sources.filter(r=>r.src===e);if(i.length)return i[0].type;const n=t.$$("source");for(let r=0;r - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`;class S4 extends B{constructor(e,i,n){const r=xe({createEl:!1},i);if(super(e,r,n),!i.playerOptions.sources||i.playerOptions.sources.length===0)for(let s=0,a=i.playerOptions.techOrder;sthis.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",i={},n={}){i=Object.assign({className:this.buildCSSClass(),tabIndex:0},i),e==="button"&&oe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=i.tabIndex;const r=ae(e,i,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=ae("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,i=this.el()){if(e===void 0)return this.controlText_||"Need Text";const n=this.localize(e);this.controlText_=e,Vn(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&i.setAttribute("title",n)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){re.isEventKey(e,"Space")||re.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("ClickableComponent",wc);class nf extends wc{constructor(e,i){super(e,i),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return ae("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const i=this.player().poster();this.setSrc(i),i?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(ae("picture",{className:"vjs-poster",tabIndex:-1},{},ae("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Ci(this.player_.play()):this.player_.pause())}}nf.prototype.crossorigin=nf.prototype.crossOrigin;B.registerComponent("PosterImage",nf);const Kt="#222",_y="#ccc",E4={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Fd(t,e){let i;if(t.length===4)i=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else if(t.length===7)i=t.slice(1);else throw new Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+e+")"}function da(t,e,i){try{t.style[e]=i}catch{return}}function Ty(t){return t?`${t}px`:""}class b4 extends B{constructor(e,i,n){super(e,i,n);const r=a=>this.updateDisplay(a),s=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Ee(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);const a=A.screen.orientation||A,o=A.screen.orientation?"change":"orientationchange";a.addEventListener(o,s),e.on("dispose",()=>a.removeEventListener(o,s));const l=this.options_.playerOptions.tracks||[];for(let c=0;c.1&&(n>r?s=Math.round((e-i*r)/2):a=Math.round((i-e/r)/2)),da(this.el_,"insetInline",Ty(s)),da(this.el_,"insetBlock",Ty(a))}updateDisplayState(e){const i=this.player_.textTrackSettings.getValues(),n=e.activeCues;let r=n.length;for(;r--;){const s=n[r];if(!s)continue;const a=s.displayState;if(i.color&&(a.firstChild.style.color=i.color),i.textOpacity&&da(a.firstChild,"color",Fd(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(a.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&da(a.firstChild,"backgroundColor",Fd(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?da(a,"backgroundColor",Fd(i.windowColor,i.windowOpacity)):a.style.backgroundColor=i.windowColor),i.edgeStyle&&(i.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Kt}, 2px 2px 4px ${Kt}, 2px 2px 5px ${Kt}`:i.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Kt}, 2px 2px ${Kt}, 3px 3px ${Kt}`:i.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${_y}, 0 1px ${_y}, -1px -1px ${Kt}, 0 -1px ${Kt}`:i.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}`)),i.fontPercent&&i.fontPercent!==1){const o=A.parseFloat(a.style.fontSize);a.style.fontSize=o*i.fontPercent+"px",a.style.height="auto",a.style.top="auto"}i.fontFamily&&i.fontFamily!=="default"&&(i.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=E4[i.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof A.WebVTT!="function"||e.every(n=>!n.activeCues))return;const i=[];for(let n=0;nthis.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const i=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){Ci(i),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const s=()=>r.focus();Ma(i)?i.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}gT.prototype.controlText_="Play Video";B.registerComponent("BigPlayButton",gT);class w4 extends Vt{constructor(e,i){super(e,i),this.setIcon("cancel"),this.controlText(i&&i.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){re.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("CloseButton",w4);class yT extends Vt{constructor(e,i={}){super(e,i),i.replay=i.replay===void 0||i.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),i.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Ci(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",i=>this.handleSeeked(i))}}yT.prototype.controlText_="Play";B.registerComponent("PlayToggle",yT);class Bs extends B{constructor(e,i){super(e,i),this.on(e,["timeupdate","ended"],n=>this.updateContent(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),i=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=ae("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return i.appendChild(n),this.contentEl_=ae("span",{className:`${e}-display`},{role:"presentation"}),i.appendChild(this.contentEl_),i}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=gr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let i=this.textNode_;i&&this.contentEl_.firstChild!==i&&(i=null,oe.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=V.createTextNode(this.formattedTime_),this.textNode_&&(i?this.contentEl_.replaceChild(this.textNode_,i):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Bs.prototype.labelText_="Time";Bs.prototype.controlText_="Time";B.registerComponent("TimeDisplay",Bs);class Xp extends Bs{buildCSSClass(){return"vjs-current-time"}updateContent(e){let i;this.player_.ended()?i=this.player_.duration():i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(i)}}Xp.prototype.labelText_="Current Time";Xp.prototype.controlText_="Current Time";B.registerComponent("CurrentTimeDisplay",Xp);class Kp extends Bs{constructor(e,i){super(e,i);const n=r=>this.updateContent(r);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const i=this.player_.duration();this.updateTextNode_(i)}}Kp.prototype.labelText_="Duration";Kp.prototype.controlText_="Duration";B.registerComponent("DurationDisplay",Kp);class D4 extends B{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return i.appendChild(n),e.appendChild(i),e}}B.registerComponent("TimeDivider",D4);class Qp extends Bs{constructor(e,i){super(e,i),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(ae("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let i;this.player_.ended()?i=0:this.player_.remainingTimeDisplay?i=this.player_.remainingTimeDisplay():i=this.player_.remainingTime(),this.updateTextNode_(i)}}Qp.prototype.labelText_="Remaining Time";Qp.prototype.controlText_="Remaining Time";B.registerComponent("RemainingTimeDisplay",Qp);class A4 extends B{constructor(e,i){super(e,i),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=ae("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(ae("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(V.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}B.registerComponent("LiveDisplay",A4);class vT extends Vt{constructor(e,i){super(e,i),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=ae("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}vT.prototype.controlText_="Seek to live, currently playing live";B.registerComponent("SeekToLive",vT);function bo(t,e,i){return t=Number(t),Math.min(i,Math.max(e,isNaN(t)?e:t))}var k4=Object.freeze({__proto__:null,clamp:bo});class Yp extends B{constructor(e,i){super(e,i),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,i={},n={}){return i.className=i.className+" vjs-slider",i=Object.assign({tabIndex:0},i),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,i,n)}handleMouseDown(e){const i=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Mi&&e.preventDefault(),q2(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(i,"mousemove",this.handleMouseMove_),this.on(i,"mouseup",this.handleMouseUp_),this.on(i,"touchmove",this.handleMouseMove_),this.on(i,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const i=this.bar.el_.ownerDocument;W2(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(i,"mousemove",this.handleMouseMove_),this.off(i,"mouseup",this.handleMouseUp_),this.off(i,"touchmove",this.handleMouseMove_),this.off(i,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const i=this.vertical()?"height":"width";this.bar.el().style[i]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(bo(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const i=Tc(this.el_,e);return this.vertical()?i.y:i.x}handleKeyDown(e){re.isEventKey(e,"Left")||re.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):re.isEventKey(e,"Right")||re.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}B.registerComponent("Slider",Yp);const Ud=(t,e)=>bo(t/e*100,0,100).toFixed(2)+"%";class P4 extends B{constructor(e,i){super(e,i),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),i=ae("span",{className:"vjs-control-text"}),n=ae("span",{textContent:this.localize("Loaded")}),r=V.createTextNode(": ");return this.percentageEl_=ae("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const i=this.player_.liveTracker,n=this.player_.buffered(),r=i&&i.isLive()?i.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),a=this.partEls_,o=Ud(s,r);this.percent_!==o&&(this.el_.style.width=o,Vn(this.percentageEl_,o),this.percent_=o);for(let l=0;ln.length;l--)this.el_.removeChild(a[l-1]);a.length=n.length})}}B.registerComponent("LoadProgressBar",P4);class I4 extends B{constructor(e,i){super(e,i),this.update=Fi(Ee(this,this.update),ni)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,i,n){const r=co(this.el_),s=bs(this.player_.el()),a=e.width*i;if(!s||!r)return;const o=e.left-s.left+a,l=e.width-a+(s.right-e.right);let c=r.width/2;or.width&&(c=r.width),c=Math.round(c),this.el_.style.right=`-${c}px`,this.write(n)}write(e){Vn(this.el_,e)}updateTime(e,i,n,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),l=o-i*o;s=(l<1?"":"-")+gr(l,o)}else s=gr(n,a);this.update(e,i,s),r&&r()})}}B.registerComponent("TimeTooltip",I4);class Jp extends B{constructor(e,i){super(e,i),this.setIcon("circle"),this.update=Fi(Ee(this,this.update),ni)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,i){const n=this.getChild("timeTooltip");if(!n)return;const r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,i,r)}}Jp.prototype.options_={children:[]};!Tt&&!Ri&&Jp.prototype.options_.children.push("timeTooltip");B.registerComponent("PlayProgressBar",Jp);class _T extends B{constructor(e,i){super(e,i),this.update=Fi(Ee(this,this.update),ni)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,i){const n=i*this.player_.duration();this.getChild("timeTooltip").updateTime(e,i,n,()=>{this.el_.style.left=`${e.width*i}px`})}}_T.prototype.options_={children:["timeTooltip"]};B.registerComponent("MouseTimeDisplay",_T);const Tl=5,xy=12;class Zp extends Yp{constructor(e,i){super(e,i),this.setEventHandlers_()}setEventHandlers_(){this.update_=Ee(this,this.update),this.update=Fi(this.update_,ni),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in V&&"visibilityState"in V&&this.on(V,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){V.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,ni))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(V.visibilityState==="hidden")return;const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let s=this.player_.duration();r&&r.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(i*100).toFixed(2)),this.percent_=i),(this.currentTime_!==n||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[gr(n,s),gr(s,s)],"{1} of {2}")),this.currentTime_=n,this.duration_=s),this.bar&&this.bar.update(bs(this.el()),this.getProgress())}),i}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let i;const n=this.player_.liveTracker;return n&&n.isLive()?(i=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(i=1)):i=e/this.player_.duration(),i}handleMouseDown(e){ho(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,i=!1){if(!ho(e)||isNaN(this.player_.duration()))return;!i&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const r=this.calculateDistance(e),s=this.player_.liveTracker;if(!s||!s.isLive())n=r*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(r>=.99){s.seekToLiveEdge();return}const a=s.seekableStart(),o=s.liveCurrentTime();if(n=a+r*s.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.userSeek_(n)}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Ci(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+Tl)}stepBack(){this.userSeek_(this.player_.currentTime()-Tl)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const i=this.player_.liveTracker;if(re.isEventKey(e,"Space")||re.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(re.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(re.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(re(e))){e.preventDefault(),e.stopPropagation();const n=(re.codes[re(e)]-re.codes[0])*10/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else re.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-Tl*xy)):re.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+Tl*xy)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in V&&"visibilityState"in V&&this.off(V,"visibilitychange",this.toggleVisibility_),super.dispose()}}Zp.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};!Tt&&!Ri&&Zp.prototype.options_.children.splice(1,0,"mouseTimeDisplay");B.registerComponent("SeekBar",Zp);class TT extends B{constructor(e,i){super(e,i),this.handleMouseMove=Fi(Ee(this,this.handleMouseMove),ni),this.throttledHandleMouseSeek=Fi(Ee(this,this.handleMouseSeek),ni),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const i=this.getChild("seekBar");if(!i)return;const n=i.getChild("playProgressBar"),r=i.getChild("mouseTimeDisplay");if(!n&&!r)return;const s=i.el(),a=co(s);let o=Tc(s,e).x;o=bo(o,0,1),r&&r.update(a,o),n&&n.update(a,i.getProgress())}handleMouseSeek(e){const i=this.getChild("seekBar");i&&i.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Ci(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const i=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(i,"mousemove",this.throttledHandleMouseSeek),this.on(i,"touchmove",this.throttledHandleMouseSeek),this.on(i,"mouseup",this.handleMouseUpHandler_),this.on(i,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}TT.prototype.options_={children:["seekBar"]};B.registerComponent("ProgressControl",TT);class xT extends Vt{constructor(e,i){super(e,i),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){V.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in A?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof V.exitPictureInPicture=="function"&&super.show()}}xT.prototype.controlText_="Picture-in-Picture";B.registerComponent("PictureInPictureToggle",xT);class ST extends Vt{constructor(e,i){super(e,i),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),V[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ST.prototype.controlText_="Fullscreen";B.registerComponent("FullscreenToggle",ST);const L4=function(t,e){e.tech_&&!e.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})};class O4 extends B{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}B.registerComponent("VolumeLevel",O4);class N4 extends B{constructor(e,i){super(e,i),this.update=Fi(Ee(this,this.update),ni)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,i,n,r){if(!n){const s=bs(this.el_),a=bs(this.player_.el()),o=e.width*i;if(!a||!s)return;const l=e.left-a.left+o,c=e.width-o+(a.right-e.right);let p=s.width/2;ls.width&&(p=s.width),this.el_.style.right=`-${p}px`}this.write(`${r}%`)}write(e){Vn(this.el_,e)}updateVolume(e,i,n,r,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,i,n,r.toFixed(0)),s&&s()})}}B.registerComponent("VolumeLevelTooltip",N4);class ET extends B{constructor(e,i){super(e,i),this.update=Fi(Ee(this,this.update),ni)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,i,n){const r=100*i;this.getChild("volumeLevelTooltip").updateVolume(e,i,n,r,()=>{n?this.el_.style.bottom=`${e.height*i}px`:this.el_.style.left=`${e.width*i}px`})}}ET.prototype.options_={children:["volumeLevelTooltip"]};B.registerComponent("MouseVolumeLevelDisplay",ET);class Dc extends Yp{constructor(e,i){super(e,i),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){ho(e)&&super.handleMouseDown(e)}handleMouseMove(e){const i=this.getChild("mouseVolumeLevelDisplay");if(i){const n=this.el(),r=bs(n),s=this.vertical();let a=Tc(n,e);a=s?a.y:a.x,a=bo(a,0,1),i.update(r,a,s)}ho(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const i=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",i),this.el_.setAttribute("aria-valuetext",i+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Dc.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Tt&&!Ri&&Dc.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Dc.prototype.playerEvent="volumechange";B.registerComponent("VolumeBar",Dc);class bT extends B{constructor(e,i={}){i.vertical=i.vertical||!1,(typeof i.volumeBar>"u"||Ss(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),super(e,i),L4(this,e),this.throttledHandleMouseMove=Fi(Ee(this,this.handleMouseMove),ni),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const i=this.el_.ownerDocument;this.on(i,"mousemove",this.throttledHandleMouseMove),this.on(i,"touchmove",this.throttledHandleMouseMove),this.on(i,"mouseup",this.handleMouseUpHandler_),this.on(i,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const i=this.el_.ownerDocument;this.off(i,"mousemove",this.throttledHandleMouseMove),this.off(i,"touchmove",this.throttledHandleMouseMove),this.off(i,"mouseup",this.handleMouseUpHandler_),this.off(i,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}bT.prototype.options_={children:["volumeBar"]};B.registerComponent("VolumeControl",bT);const R4=function(t,e){e.tech_&&!e.tech_.featuresMuteControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresMuteControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})};class CT extends Vt{constructor(e,i){super(e,i),R4(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const i=this.player_.volume(),n=this.player_.lastVolume_();if(i===0){const r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let i=3;this.setIcon("volume-high"),Tt&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),i=0):e<.33?(this.setIcon("volume-low"),i=1):e<.67&&(this.setIcon("volume-medium"),i=2),vc(this.el_,[0,1,2,3].reduce((n,r)=>n+`${r?" ":""}vjs-vol-${r}`,"")),lr(this.el_,`vjs-vol-${i}`)}updateControlText_(){const i=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==i&&this.controlText(i)}}CT.prototype.controlText_="Mute";B.registerComponent("MuteToggle",CT);class wT extends B{constructor(e,i={}){typeof i.inline<"u"?i.inline=i.inline:i.inline=!0,(typeof i.volumeControl>"u"||Ss(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),super(e,i),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){re.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Ht(V,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),lt(V,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){re.isEventKey(e,"Esc")&&this.handleMouseOut()}}wT.prototype.options_={children:["muteToggle","volumeControl"]};B.registerComponent("VolumePanel",wT);class M4 extends Vt{constructor(e,i){super(e,i),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const i=this.player_.currentTime(),n=this.player_.liveTracker,r=n&&n.isLive()?n.seekableEnd():this.player_.duration();let s;i+this.skipTime<=r?s=i+this.skipTime:s=r,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}B.registerComponent("SkipForward",M4);class DT extends Vt{constructor(e,i){super(e,i),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const i=this.player_.currentTime(),n=this.player_.liveTracker,r=n&&n.isLive()&&n.seekableStart();let s;r&&i-this.skipTime<=r?s=r:i>=this.skipTime?s=i-this.skipTime:s=0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}DT.prototype.controlText_="Skip Backward";B.registerComponent("SkipBackward",DT);class AT extends B{constructor(e,i){super(e,i),i&&(this.menuButton_=i.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}addEventListenerForItem(e){e instanceof B&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof B&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const i=this.addChild(e);i&&this.addEventListenerForItem(i)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=ae(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const i=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),Ht(i,"click",function(n){n.preventDefault(),n.stopImmediatePropagation()}),i}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const i=e.relatedTarget||V.activeElement;if(!this.children().some(n=>n.el()===i)){const n=this.menuButton_;n&&n.buttonPressed_&&i!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const i=this.children();if(!Array.isArray(i))return;const n=i.filter(r=>r.el()===e.target)[0];if(!n)return;n.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){re.isEventKey(e,"Left")||re.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(re.isEventKey(e,"Right")||re.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const i=this.children().slice();i.length&&i[0].hasClass("vjs-menu-title")&&i.shift(),i.length>0&&(e<0?e=0:e>=i.length&&(e=i.length-1),this.focusedChild_=e,i[e].el_.focus())}}B.registerComponent("Menu",AT);class em extends B{constructor(e,i={}){super(e,i),this.menuButton_=new Vt(e,i),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const n=Vt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=s=>this.handleClick(s);this.handleMenuKeyUp_=s=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",s=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Ht(V,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",s=>this.handleMouseLeave(s)),this.on("keydown",s=>this.handleSubmenuKeyDown(s))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new AT(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const i=ae("li",{className:"vjs-menu-title",textContent:Fe(this.options_.title),tabIndex:-1}),n=new B(this.player_,{el:i});e.addItem(n)}if(this.items=this.createItems(),this.items)for(let i=0;ire.isEventKey(e,i))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}B.registerComponent("MenuItem",Co);class wo extends Co{constructor(e,i){const n=i.track,r=e.textTracks();i.label=n.label||n.language||"Unknown",i.selected=n.mode==="showing",super(e,i),this.track=n,this.kinds=(i.kinds||[i.kind||this.track.kind]).filter(Boolean);const s=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],s),r.addEventListener("change",s),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),r.removeEventListener("change",s),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof A.Event!="object")try{o=new A.Event("change")}catch{}o||(o=V.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const i=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let r=0;r-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const i=this.player().textTracks();let n=!0;for(let r=0,s=i.length;r-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}B.registerComponent("OffTextTrackMenuItem",kT);class Fs extends tm{constructor(e,i={}){i.tracks=e.textTracks(),super(e,i)}createItems(e=[],i=wo){let n;this.label_&&(n=`${this.label_} off`),e.push(new kT(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let s=0;s-1){const o=new i(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}B.registerComponent("TextTrackButton",Fs);class PT extends Co{constructor(e,i){const n=i.track,r=i.cue,s=e.currentTime();i.selectable=!0,i.multiSelectable=!1,i.label=r.text,i.selected=r.startTime<=s&&s{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),super.update()):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.kind===this.kind_)return n}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Fe(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const i=this.track_.cues;if(!i)return e;for(let n=0,r=i.length;n-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Fe(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new sm(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,IT),e}}om.prototype.kinds_=["captions","subtitles"];om.prototype.controlText_="Subtitles";B.registerComponent("SubsCapsButton",om);class LT extends Co{constructor(e,i){const n=i.track,r=e.audioTracks();i.label=n.label||n.language||"Unknown",i.selected=n.enabled,super(e,i),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const s=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",s),this.on("dispose",()=>{r.removeEventListener("change",s)})}createEl(e,i,n){const r=super.createEl(e,i,n),s=r.querySelector(".vjs-menu-item-text");return["main-desc","description"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(ae("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const i=this.player_.audioTracks();for(let n=0;nthis.update(s))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}lm.prototype.contentElType="button";B.registerComponent("PlaybackRateMenuItem",lm);class NT extends em{constructor(e,i){super(e,i),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=ae("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),i=[];for(let n=e.length-1;n>=0;n--)i.push(new lm(this.player(),{rate:e[n]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}NT.prototype.controlText_="Playback Rate";B.registerComponent("PlaybackRateMenuButton",NT);class RT extends B{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",i={},n={}){return i.className||(i.className=this.buildCSSClass()),super.createEl(e,i,n)}}B.registerComponent("Spacer",RT);class F4 extends RT{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}B.registerComponent("CustomControlSpacer",F4);class MT extends B{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}MT.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};B.registerComponent("ControlBar",MT);class BT extends Ms{constructor(e,i){super(e,i),this.on(e,"error",n=>this.open(n))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}BT.prototype.options_=Object.assign({},Ms.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});B.registerComponent("ErrorDisplay",BT);const jd="vjs-text-track-settings",Sy=["#000","Black"],Ey=["#00F","Blue"],by=["#0FF","Cyan"],Cy=["#0F0","Green"],wy=["#F0F","Magenta"],Dy=["#F00","Red"],Ay=["#FFF","White"],ky=["#FF0","Yellow"],$d=["1","Opaque"],Vd=["0.5","Semi-Transparent"],Py=["0","Transparent"],Zn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Sy,Ay,Dy,Cy,Ey,ky,wy,by]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[$d,Vd,Py]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ay,Sy,Dy,Cy,Ey,ky,wy,by]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:t=>t==="1.00"?null:Number(t)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[$d,Vd]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Py,Vd,$d]}};Zn.windowColor.options=Zn.backgroundColor.options;function FT(t,e){if(e&&(t=e(t)),t&&t!=="none")return t}function U4(t,e){const i=t.options[t.options.selectedIndex].value;return FT(i,e)}function j4(t,e,i){if(e){for(let n=0;n{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),ns(Zn,n=>{this.on(this.$(n.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,i="",n="label"){const r=Zn[e],s=r.id.replace("%s",this.id_),a=[i,s].join(" ").trim();return[`<${n} id="${s}" class="${n==="label"?"vjs-label":""}">`,this.localize(r.label),``,`").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return ae("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return ae("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return ae("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return N2(Zn,(e,i,n)=>{const r=U4(this.$(i.selector),i.parser);return r!==void 0&&(e[n]=r),e},{})}setValues(e){ns(Zn,(i,n)=>{j4(this.$(i.selector),e[n],i.parser)})}setDefaults(){ns(Zn,e=>{const i=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=i})}restoreSettings(){let e;try{e=JSON.parse(A.localStorage.getItem(jd))}catch(i){oe.warn(i)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?A.localStorage.setItem(jd,JSON.stringify(e)):A.localStorage.removeItem(jd)}catch(i){oe.warn(i)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,i=e&&e.subsCapsButton,n=e&&e.captionsButton;i?i.focus():n&&n.focus()}handleLanguagechange(){this.fill()}}B.registerComponent("TextTrackSettings",$4);class V4 extends B{constructor(e,i){let n=i.ResizeObserver||A.ResizeObserver;i.ResizeObserver===null&&(n=!1);const r=xe({createEl:!n,reportTouchActivity:!1},i);super(e,r),this.ResizeObserver=i.ResizeObserver||A.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=iT(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const s=this.debouncedHandler_;let a=this.unloadListener_=function(){lt(this,"resize",s),lt(this,"unload",a),a=null};Ht(this.el_.contentWindow,"unload",a),Ht(this.el_.contentWindow,"resize",s)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}B.registerComponent("ResizeManager",V4);const z4={trackingThreshold:20,liveTolerance:15};class H4 extends B{constructor(e,i){const n=xe(z4,i,{createEl:!1});super(e,n),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const i=Number(A.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(i-this.lastTime_)/1e3;this.lastTime_=i,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),s=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-s)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,ni),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),i=[];let n=e?e.length:0;for(;n--;)i.push(e.end(n));return i.length?i.sort()[i.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),i=[];let n=e?e.length:0;for(;n--;)i.push(e.start(n));return i.length?i.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}B.registerComponent("LiveTracker",H4);class q4 extends B{constructor(e,i){super(e,i),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:ae("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Bi()}`}),description:ae("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Bi()}`})},ae("div",{className:"vjs-title-bar"},{},R2(this.els))}updateDom_(){const e=this.player_.tech_,i=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const s=this.state[r],a=this.els[r],o=n[r];xc(a),s&&Vn(a,s),i&&(i.removeAttribute(o),s&&i.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,i=e&&e.el_;i&&(i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}B.registerComponent("TitleBar",q4);const rf=t=>{const e=t.el();if(e.hasAttribute("src"))return t.triggerSourceset(e.src),!0;const i=t.$$("source"),n=[];let r="";if(!i.length)return!1;for(let s=0;s{let i={};for(let n=0;nUT([t.el(),A.HTMLMediaElement.prototype,A.Element.prototype,W4],"innerHTML"),Iy=function(t){const e=t.el();if(e.resetSourceWatch_)return;const i={},n=G4(t),r=s=>(...a)=>{const o=s.apply(e,a);return rf(t),o};["append","appendChild","insertAdjacentHTML"].forEach(s=>{e[s]&&(i[s]=e[s],e[s]=r(i[s]))}),Object.defineProperty(e,"innerHTML",xe(n,{set:r(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(i).forEach(s=>{e[s]=i[s]}),Object.defineProperty(e,"innerHTML",n)},t.one("sourceset",e.resetSourceWatch_)},X4=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?hT(A.Element.prototype.getAttribute.call(this,"src")):""},set(t){return A.Element.prototype.setAttribute.call(this,"src",t),t}}),K4=t=>UT([t.el(),A.HTMLMediaElement.prototype,X4],"src"),Q4=function(t){if(!t.featuresSourceset)return;const e=t.el();if(e.resetSourceset_)return;const i=K4(t),n=e.setAttribute,r=e.load;Object.defineProperty(e,"src",xe(i,{set:s=>{const a=i.set.call(e,s);return t.triggerSourceset(e.src),a}})),e.setAttribute=(s,a)=>{const o=n.call(e,s,a);return/src/i.test(s)&&t.triggerSourceset(e.src),o},e.load=()=>{const s=r.call(e);return rf(t)||(t.triggerSourceset(""),Iy(t)),s},e.currentSrc?t.triggerSourceset(e.currentSrc):rf(t)||Iy(t),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=n,Object.defineProperty(e,"src",i),e.resetSourceWatch_&&e.resetSourceWatch_()}};class W extends se{constructor(e,i){super(e,i);const n=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const s=this.el_.childNodes;let a=s.length;const o=[];for(;a--;){const l=s[a];l.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(l),this.remoteTextTracks().addTrack(l.track),this.textTracks().addTrack(l.track),!r&&!this.el_.hasAttribute("crossorigin")&&Cc(l.src)&&(r=!0)):o.push(l))}for(let l=0;l{i=[];for(let s=0;se.removeEventListener("change",n));const r=()=>{for(let s=0;s{e.removeEventListener("change",n),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",r)})}overrideNative_(e,i){if(i!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(r=>{this.el()[`${n}Tracks`].removeEventListener(r,this[`${n}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!i,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const i=ei[e],n=this.el()[i.getterName],r=this[i.getterName]();if(!this[`featuresNative${i.capitalName}Tracks`]||!n||!n.addEventListener)return;const s={change:o=>{const l={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(l),e==="text"&&this[Ds.remoteText.getterName]().trigger(l)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let l=0;l{const l=s[o];n.addEventListener(o,l),this.on("dispose",c=>n.removeEventListener(o,l))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){ei.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),W.disposeMediaElement(e),e=n}else{e=V.createElement("video");const n=this.options_.tag&&vn(this.options_.tag),r=xe({},n);(!uo||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,z2(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Es(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const i=["loop","muted","playsinline","autoplay"];for(let n=0;n=2&&i.push("loadeddata"),e.readyState>=3&&i.push("canplay"),e.readyState>=4&&i.push("canplaythrough"),this.ready(function(){i.forEach(function(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&yc?this.el_.fastSeek(e):this.el_.currentTime=e}catch(i){oe(i,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Ri&&Mi&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",()=>{this.off("webkitbeginfullscreen",i),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Ci(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(i){this.trigger("fullscreenerror",i)}},0);else try{e.webkitEnterFullScreen()}catch(i){this.trigger("fullscreenerror",i)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}reset(){W.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,i,n):super.addTextTrack(e,i,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const i=V.createElement("track");return e.kind&&(i.kind=e.kind),e.label&&(i.label=e.label),(e.language||e.srclang)&&(i.srclang=e.language||e.srclang),e.default&&(i.default=e.default),e.id&&(i.id=e.id),e.src&&(i.src=e.src),i}addRemoteTextTrack(e,i){const n=super.addRemoteTextTrack(e,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const i=this.$$("track");let n=i.length;for(;n--;)(e===i[n]||e===i[n].track)&&this.el().removeChild(i[n])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),A.performance&&(e.creationTime=A.performance.now()),e}}fc(W,"TEST_VID",function(){if(!Os())return;const t=V.createElement("video"),e=V.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",t.appendChild(e),t});W.isSupported=function(){try{W.TEST_VID.volume=.5}catch{return!1}return!!(W.TEST_VID&&W.TEST_VID.canPlayType)};W.canPlayType=function(t){return W.TEST_VID.canPlayType(t)};W.canPlaySource=function(t,e){return W.canPlayType(t.type)};W.canControlVolume=function(){try{const t=W.TEST_VID.volume;W.TEST_VID.volume=t/2+.1;const e=t!==W.TEST_VID.volume;return e&&Tt?(A.setTimeout(()=>{W&&W.prototype&&(W.prototype.featuresVolumeControl=t!==W.TEST_VID.volume)}),!1):e}catch{return!1}};W.canMuteVolume=function(){try{const t=W.TEST_VID.muted;return W.TEST_VID.muted=!t,W.TEST_VID.muted?Es(W.TEST_VID,"muted","muted"):_c(W.TEST_VID,"muted","muted"),t!==W.TEST_VID.muted}catch{return!1}};W.canControlPlaybackRate=function(){if(Ri&&Mi&&pc<58)return!1;try{const t=W.TEST_VID.playbackRate;return W.TEST_VID.playbackRate=t/2+.1,t!==W.TEST_VID.playbackRate}catch{return!1}};W.canOverrideAttributes=function(){try{const t=()=>{};Object.defineProperty(V.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(V.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(V.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(V.createElement("audio"),"innerHTML",{get:t,set:t})}catch{return!1}return!0};W.supportsNativeTextTracks=function(){return yc||Tt&&Mi};W.supportsNativeVideoTracks=function(){return!!(W.TEST_VID&&W.TEST_VID.videoTracks)};W.supportsNativeAudioTracks=function(){return!!(W.TEST_VID&&W.TEST_VID.audioTracks)};W.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([t,e]){fc(W.prototype,t,()=>W[e](),!0)});W.prototype.featuresVolumeControl=W.canControlVolume();W.prototype.movingMediaElementInDOM=!Tt;W.prototype.featuresFullscreenResize=!0;W.prototype.featuresProgressEvents=!0;W.prototype.featuresTimeupdateEvents=!0;W.prototype.featuresVideoFrameCallback=!!(W.TEST_VID&&W.TEST_VID.requestVideoFrameCallback);W.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),typeof t.load=="function"&&function(){try{t.load()}catch{}}()}};W.resetMediaElement=function(t){if(!t)return;const e=t.querySelectorAll("source");let i=e.length;for(;i--;)t.removeChild(e[i]);t.removeAttribute("src"),typeof t.load=="function"&&function(){try{t.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(t){W.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){W.prototype["set"+Fe(t)]=function(e){this.el_[t]=e,e?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(t){W.prototype[t]=function(){return this.el_[t]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){W.prototype["set"+Fe(t)]=function(e){this.el_[t]=e}});["pause","load","play"].forEach(function(t){W.prototype[t]=function(){return this.el_[t]()}});se.withSourceHandlers(W);W.nativeSourceHandler={};W.nativeSourceHandler.canPlayType=function(t){try{return W.TEST_VID.canPlayType(t)}catch{return""}};W.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return W.nativeSourceHandler.canPlayType(t.type);if(t.src){const i=Wp(t.src);return W.nativeSourceHandler.canPlayType(`video/${i}`)}return""};W.nativeSourceHandler.handleSource=function(t,e,i){e.setSrc(t.src)};W.nativeSourceHandler.dispose=function(){};W.registerSourceHandler(W.nativeSourceHandler);se.registerTech("Html5",W);const jT=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],zd={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},sf=["tiny","xsmall","small","medium","large","xlarge","huge"],Ul={};sf.forEach(t=>{const e=t.charAt(0)==="x"?`x-${t.substring(1)}`:t;Ul[t]=`vjs-layout-${e}`});const Y4={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class be extends B{constructor(e,i,n){if(e.id=e.id||i.id||`vjs_video_${Bi()}`,i=Object.assign(be.getTagSettings(e),i),i.initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,!i.language){const a=e.closest("[lang]");a&&(i.language=a.getAttribute("lang"))}if(super(null,i,n),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.isFullscreen_=!1,this.log=L2(this.id_),this.fsApi_=Su,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&vn(e),this.language(this.options_.language),i.languages){const a={};Object.getOwnPropertyNames(i.languages).forEach(function(o){a[o.toLowerCase()]=i.languages[o]}),this.languages_=a}else this.languages_=be.prototype.options_.languages;this.resetCache_(),this.poster_=i.poster||"",this.controls_=!!i.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),i.plugins&&Object.keys(i.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Vp(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Ht(V,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=xe(this.options_);if(i.plugins&&Object.keys(i.plugins).forEach(a=>{this[a](i.plugins[a])}),i.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(i.playbackRates),i.experimentalSvgIcons){const o=new A.DOMParser().parseFromString(x4,"image/svg+xml");if(o.querySelector("parsererror"))oe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const c=o.documentElement;c.style.display="none",this.el_.appendChild(c),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),uo&&this.addClass("vjs-touch-enabled"),Tt||this.addClass("vjs-workinghover"),be.players[this.id_]=this;const s=P2.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),lt(V,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),lt(V,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),be.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),y4(this),mt.names.forEach(e=>{const i=mt[e],n=this[i.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,i,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";n?i=this.el_=e.parentNode:r||(i=this.el_=super.createEl("div"));const s=vn(e);if(r){for(i=this.el_=e,e=this.tag=V.createElement("video");i.children.length;)e.appendChild(i.firstChild);Na(i,"video-js")||lr(i,"video-js"),i.appendChild(e),n=this.playerElIngest_=i,Object.keys(i).forEach(o=>{try{e[o]=i[o]}catch{}})}if(e.setAttribute("tabindex","-1"),s.tabindex="-1",Mi&&mc&&(e.setAttribute("role","application"),s.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(o){r&&o==="class"||i.setAttribute(o,s[o]),r&&e.setAttribute(o,s[o])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=i.player=this,this.addClass("vjs-paused"),A.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=eT("vjs-styles-dimensions");const o=Mn(".vjs-styles-defaults"),l=Mn("head");l.insertBefore(this.styleEl_,o?o.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const a=e.getElementsByTagName("a");for(let o=0;o"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){oe.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,i){const n=e+"_";if(i===void 0)return this[n]||0;if(i===""||i==="auto"){this[n]=void 0,this.updateStyleEl_();return}const r=parseFloat(i);if(isNaN(r)){oe.error(`Improper value "${i}" supplied for for ${e}`);return}this[n]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ji(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),G3(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(A.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,c=this.tech_&&this.tech_.el();c&&(o>=0&&(c.width=o),l>=0&&(c.height=l));return}let e,i,n,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const s=n.split(":"),a=s[1]/s[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?i=this.height_:i=e*a,/^[^a-zA-Z]/.test(this.id())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),tT(this.styleEl_,` - .${r} { - width: ${e}px; - height: ${i}px; - } - - .${r}.vjs-fluid:not(.vjs-audio-only-mode) { - padding-top: ${a*100}%; - } - `)}loadTech_(e,i){this.tech_&&this.unloadTech_();const n=Fe(e),r=e.charAt(0).toLowerCase()+e.slice(1);n!=="Html5"&&this.tag&&(se.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;let s=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(s=!1);const a={source:i,autoplay:s,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${r}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};mt.names.forEach(l=>{const c=mt[l];a[c.getterName]=this[c.privateName]}),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),i&&i.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=se.getTech(e);if(!o)throw new Error(`No Tech named '${n}' exists! '${n}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Ee(this,this.handleTechReady_),!0),hy.jsonToTextTracks(this.textTracksJson_||[],this.tech_),jT.forEach(l=>{this.on(this.tech_,l,c=>this[`handleTech${Fe(l)}_`](c))}),Object.keys(zd).forEach(l=>{this.on(this.tech_,l,c=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${zd[l]}_`].bind(this),event:c});return}this[`handleTech${zd[l]}_`](c)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,c)=>this.handleTechFullscreenChange_(l,c)),this.on(this.tech_,"fullscreenerror",(l,c)=>this.handleTechFullscreenError_(l,c)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(n!=="Html5"||!this.tag)&&Kh(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){mt.names.forEach(e=>{const i=mt[e];this[i.privateName]=this[i.getterName]()}),this.textTracksJson_=hy.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&oe.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. -See https://github.com/videojs/video.js/issues/2617 for more info. -`),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const i=()=>{const r=this.muted();this.muted(!0);const s=()=>{this.muted(r)};this.playTerminatedQueue_.push(s);const a=this.play();if(Ma(a))return a.catch(o=>{throw s(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),Ma(n)&&(n=n.catch(i))):e==="muted"&&!this.muted()?n=i():n=this.play(),!!Ma(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,n="";typeof i!="string"&&(i=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!n&&(n=T4(this,i)),this.cache_.source=xe({},e,{src:i,type:n});const r=this.cache_.sources.filter(l=>l.src&&l.src===i),s=[],a=this.$$("source"),o=[];for(let l=0;lthis.updateSourceCaches_(s);const n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=()=>{}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],s=>{if(s.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Ci(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),n=>n.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const i=e.target.player;if(i&&i!==this)return;const n=this.el();let r=V[this.fsApi_.fullscreenElement]===n;!r&&n.matches&&(r=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,i){this.ready(function(){if(e in m4)return f4(this.middleware_,this.tech_,e,i);if(e in yy)return gy(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(n){throw oe(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in p4)return h4(this.middleware_,this.tech_,e);if(e in yy)return gy(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(oe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(oe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(oe(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Ci){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),n=!!(yc||Tt);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&n&&this.load();return}const r=this.techGet_("play");n&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Oi(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Oi(0,0)),e}bufferedPercent(){return cT(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let n=e.end(e.length-1);return n>i&&(n=i),n}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((n,r)=>{function s(){i.off("fullscreenerror",o),i.off("fullscreenchange",a)}function a(){s(),n()}function o(c,p){s(),r(p)}i.one("fullscreenchange",a),i.one("fullscreenerror",o);const l=i.requestFullscreenHelper_(e);l&&(l.then(s,s),l.then(n,r))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const n=this.el_[this.fsApi_.requestFullscreen](i);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,n)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",s)}function s(){r(),i()}function a(l,c){r(),n(c)}e.one("fullscreenchange",s),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(i,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=V[this.fsApi_.exitFullscreen]();return e&&Ci(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=V.documentElement.style.overflow,Ht(V,"keydown",this.boundFullWindowOnEscKey_),V.documentElement.style.overflow="hidden",lr(V.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){re.isEventKey(e,"Esc")&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,lt(V,"keydown",this.boundFullWindowOnEscKey_),V.documentElement.style.overflow=this.docOrigOverflow,vc(V.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&A.documentPictureInPicture){const e=V.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(ae("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),A.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(Y2(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),i.addEventListener("pagehide",n=>{const r=n.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in V&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(A.documentPictureInPicture&&A.documentPictureInPicture.window)return A.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in V)return V.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(r=>{const s=r.tagName.toLowerCase();if(r.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return s==="input"?a.indexOf(r.type)===-1:["textarea"].indexOf(s)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:n=a=>re.isEventKey(a,"f"),muteKey:r=a=>re.isEventKey(a,"m"),playPauseKey:s=a=>re.isEventKey(a,"k")||re.isEventKey(a,"Space")}=i;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=B.getComponent("FullscreenToggle");V[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),B.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),B.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let n=0,r=this.options_.techOrder;n[o,se.getTech(o)]).filter(([o,l])=>l?l.isSupported():(oe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,l,c){let p;return o.some(g=>l.some(v=>{if(p=c(g,v),p)return!0})),p};let r;const s=o=>(l,c)=>o(c,l),a=([o,l],c)=>{if(l.canPlaySource(c,this.options_[o.toLowerCase()]))return{source:c,tech:o}};return this.options_.sourceOrder?r=n(e,i,s(a)):r=n(i,e,a),r||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=mT(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),c4(this,n[0],(r,s)=>{if(this.middleware_=s,i||(this.cache_.sources=n),this.updateSourceCaches_(r),this.src_(r)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}d4(s,this.tech_)}),n.length>1){const r=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},s=()=>{this.off("error",r)};this.one("error",r),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",s)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?aT(i.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Ci(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Ji(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:n,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:s}=n||{};e&&e.updateContent(),i&&i.updateContent(),r&&r.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Rn("beforeerror").forEach(i=>{const n=i(this,e);if(!(Ni(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new vt(e),this.addClass("vjs-error"),oe.error(`(CODE:${this.error_.code} ${vt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Rn("error").forEach(i=>i(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,n;const r=Ee(this,this.reportUserActivity),s=function(g){(g.screenX!==i||g.screenY!==n)&&(i=g.screenX,n=g.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(g){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",s),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");l&&!Tt&&!Ri&&(l.on("mouseenter",function(g){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(g){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let c;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(c);const g=this.options_.inactivityTimeout;g<=0||(c=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},g))};this.setInterval(p,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();e.forEach(r=>{r!==i&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,i,n){if(this.tech_)return this.tech_.addTextTrack(e,i,n)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Ji(this)&&this.trigger("languagechange"))}languages(){return xe(be.prototype.options_.languages,this.languages_)}toJSON(){const e=xe(this.options_),i=e.tracks;e.tracks=[];for(let n=0;n{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let n=0;nthis.addRemoteTextTrack(g,!1)),this.titleBar&&this.titleBar.update({title:p,description:a||r||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),n=Array.prototype.map.call(this.remoteTextTracks(),s=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),r={src:i,textTracks:n};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Au(r.poster)}]),r}return xe(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},n=vn(e),r=n["data-setup"];if(Na(e,"vjs-fill")&&(n.fill=!0),Na(e,"vjs-fluid")&&(n.fluid=!0),r!==null){const[s,a]=RD(r||"{}");s&&oe.error(s),Object.assign(n,a)}if(Object.assign(i,n),e.hasChildNodes()){const s=e.childNodes;for(let a=0,o=s.length;atypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}mt.names.forEach(function(t){const e=mt[t];be.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});be.prototype.crossorigin=be.prototype.crossOrigin;be.players={};const ha=A.navigator;be.prototype.options_={techOrder:se.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ha&&(ha.languages&&ha.languages[0]||ha.userLanguage||ha.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1};["ended","seeking","seekable","networkState","readyState"].forEach(function(t){be.prototype[t]=function(){return this.techGet_(t)}});jT.forEach(function(t){be.prototype[`handleTech${Fe(t)}_`]=function(){return this.trigger(t)}});B.registerComponent("Player",be);const ku="plugin",as="activePlugins_",Xr={},Pu=t=>Xr.hasOwnProperty(t),jl=t=>Pu(t)?Xr[t]:void 0,$T=(t,e)=>{t[as]=t[as]||{},t[as][e]=!0},Iu=(t,e,i)=>{const n=(i?"before":"")+"pluginsetup";t.trigger(n,e),t.trigger(n+":"+e.name,e)},J4=function(t,e){const i=function(){Iu(this,{name:t,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return $T(this,t),Iu(this,{name:t,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){i[n]=e[n]}),i},Ly=(t,e)=>(e.prototype.name=t,function(...i){Iu(this,{name:t,plugin:e,instance:null},!0);const n=new e(this,...i);return this[t]=()=>n,Iu(this,n.getEventHash()),n});class Lt{constructor(e){if(this.constructor===Lt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Vp(this),delete this.trigger,sT(this,this.constructor.defaultState),$T(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,i={}){return Rs(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[as][e]=!1,this.player=this.state=null,i[e]=Ly(e,Xr[e])}static isBasic(e){const i=typeof e=="string"?jl(e):e;return typeof i=="function"&&!Lt.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Pu(e))oe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(be.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return Xr[e]=i,e!==ku&&(Lt.isBasic(i)?be.prototype[e]=J4(e,i):be.prototype[e]=Ly(e,i)),i}static deregisterPlugin(e){if(e===ku)throw new Error("Cannot de-register base plugin.");Pu(e)&&(delete Xr[e],delete be.prototype[e])}static getPlugins(e=Object.keys(Xr)){let i;return e.forEach(n=>{const r=jl(n);r&&(i=i||{},i[n]=r)}),i}static getPluginVersion(e){const i=jl(e);return i&&i.VERSION||""}}Lt.getPlugin=jl;Lt.BASE_PLUGIN_NAME=ku;Lt.registerPlugin(ku,Lt);be.prototype.usingPlugin=function(t){return!!this[as]&&this[as][t]===!0};be.prototype.hasPlugin=function(t){return!!Pu(t)};function Z4(t,e){let i=!1;return function(...n){return i||oe.warn(t),i=!0,e.apply(this,n)}}function gi(t,e,i,n){return Z4(`${e} is deprecated and will be removed in ${t}.0; please use ${i} instead.`,n)}const VT=t=>t.indexOf("#")===0?t.slice(1):t;function M(t,e,i){let n=M.getPlayer(t);if(n)return e&&oe.warn(`Player "${t}" is already initialised. Options will not be applied.`),i&&n.ready(i),n;const r=typeof t=="string"?Mn("#"+VT(t)):t;if(!Ns(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof A.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&oe.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Rn("beforesetup").forEach(l=>{const c=l(r,xe(e));if(!Ni(c)||Array.isArray(c)){oe.error("please return an object in beforesetup hooks");return}e=xe(e,c)});const o=B.getComponent("Player");return n=new o(r,e,i),Rn("setup").forEach(l=>l(n)),n}M.hooks_=qi;M.hooks=Rn;M.hook=O3;M.hookOnce=N3;M.removeHook=I2;if(A.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Os()){let t=Mn(".vjs-styles-defaults");if(!t){t=eT("vjs-styles-defaults");const e=Mn("head");e&&e.insertBefore(t,e.firstChild),tT(t,` - .video-js { - width: 300px; - height: 150px; - } - - .vjs-fluid:not(.vjs-audio-only-mode) { - padding-top: 56.25% - } - `)}}Yh(1,M);M.VERSION=P2;M.options=be.prototype.options_;M.getPlayers=()=>be.players;M.getPlayer=t=>{const e=be.players;let i;if(typeof t=="string"){const n=VT(t),r=e[n];if(r)return r;i=Mn("#"+n)}else i=t;if(Ns(i)){const{player:n,playerId:r}=i;if(n||e[r])return n||e[r]}};M.getAllPlayers=()=>Object.keys(be.players).map(t=>be.players[t]).filter(Boolean);M.players=be.players;M.getComponent=B.getComponent;M.registerComponent=(t,e)=>(se.isTech(e)&&oe.warn(`The ${t} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),B.registerComponent.call(B,t,e));M.getTech=se.getTech;M.registerTech=se.registerTech;M.use=u4;Object.defineProperty(M,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(M.middleware,"TERMINATOR",{value:Du,writeable:!1,enumerable:!0});M.browser=F3;M.obj=B3;M.mergeOptions=gi(9,"videojs.mergeOptions","videojs.obj.merge",xe);M.defineLazyProperty=gi(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",fc);M.bind=gi(9,"videojs.bind","native Function.prototype.bind",Ee);M.registerPlugin=Lt.registerPlugin;M.deregisterPlugin=Lt.deregisterPlugin;M.plugin=(t,e)=>(oe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Lt.registerPlugin(t,e));M.getPlugins=Lt.getPlugins;M.getPlugin=Lt.getPlugin;M.getPluginVersion=Lt.getPluginVersion;M.addLanguage=function(t,e){return t=(""+t).toLowerCase(),M.options.languages=xe(M.options.languages,{[t]:e}),M.options.languages[t]};M.log=oe;M.createLogger=L2;M.time=J3;M.createTimeRange=gi(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Oi);M.createTimeRanges=gi(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Oi);M.formatTime=gi(9,"videojs.formatTime","videojs.time.formatTime",gr);M.setFormatTime=gi(9,"videojs.setFormatTime","videojs.time.setFormatTime",lT);M.resetFormatTime=gi(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",uT);M.parseUrl=gi(9,"videojs.parseUrl","videojs.url.parseUrl",qp);M.isCrossOrigin=gi(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Cc);M.EventTarget=ri;M.any=$p;M.on=Ht;M.one=Ec;M.off=lt;M.trigger=Rs;M.xhr=O1;M.TextTrack=Eo;M.AudioTrack=fT;M.VideoTrack=pT;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(t=>{M[t]=function(){return oe.warn(`videojs.${t}() is deprecated; use videojs.dom.${t}() instead`),J2[t].apply(null,arguments)}});M.computedStyle=gi(9,"videojs.computedStyle","videojs.dom.computedStyle",Cs);M.dom=J2;M.fn=W3;M.num=k4;M.str=Q3;M.url=o4;/*! @name videojs-contrib-quality-levels @version 4.0.0 @license Apache-2.0 */class eP{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(n){i.enabled_(n)}}),i}}class Lu extends M.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let i=this.getQualityLevelById(e.id);if(i)return i;const n=this.levels_.length;return i=new eP(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let n=0,r=this.length;nn&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,n=this.length;in,t.qualityLevels.VERSION=zT,n},HT=function(t){return tP(this,M.obj.merge({},t))};M.registerPlugin("qualityLevels",HT);HT.VERSION=zT;/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */const Ft=CA,Ou=(t,e)=>e&&e.responseURL&&t!==e.responseURL?e.responseURL:t,si=t=>M.log.debug?M.log.debug.bind(M,"VHS:",`${t} >`):function(){};function ve(...t){const e=M.obj||M;return(e.merge||e.mergeOptions).apply(e,t)}function ot(...t){const e=M.time||M;return(e.createTimeRanges||e.createTimeRanges).apply(e,t)}function iP(t){let e="";for(let i=0;i ${r})`}return e||"empty"}const Bn=1/30,wi=Bn*3,qT=function(t,e){const i=[];let n;if(t&&t.length)for(n=0;n=e})},xl=function(t,e){return qT(t,function(i){return i-Bn>=e})},nP=function(t){if(t.length<2)return ot();const e=[];for(let i=1;i{const e=[];if(!t||!t.length)return"";for(let i=0;i "+t.end(i));return e.join(", ")},sP=function(t,e,i=1){return((t.length?t.end(t.length-1):0)-e)/i},nr=t=>{const e=[];for(let i=0;is)){if(e>r&&e<=s){i+=s-e;continue}i+=s-r}}return i},cm=(t,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(n){i+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(i+=t.partTargetDuration)}),i},af=t=>(t.segments||[]).reduce((e,i,n)=>(i.parts?i.parts.forEach(function(r,s){e.push({duration:r.duration,segmentIndex:n,partIndex:s,part:r,segment:i})}):e.push({duration:i.duration,segmentIndex:n,partIndex:null,segment:i,part:null}),e),[]),GT=t=>{const e=t.segments&&t.segments.length&&t.segments[t.segments.length-1];return e&&e.parts||[]},XT=({preloadSegment:t})=>{if(!t)return;const{parts:e,preloadHints:i}=t;let n=(i||[]).reduce((r,s)=>r+(s.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},KT=(t,e)=>{if(e.endList)return 0;if(t&&t.suggestedPresentationDelay)return t.suggestedPresentationDelay;const i=GT(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},oP=function(t,e){let i=0,n=e-t.mediaSequence,r=t.segments[n];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;n--;){if(r=t.segments[n],typeof r.end<"u")return{result:i+r.end,precise:!0};if(i+=cm(t,r),typeof r.start<"u")return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},lP=function(t,e){let i=0,n,r=e-t.mediaSequence;for(;r"u"&&(e=t.mediaSequence+t.segments.length),e"u"){if(t.totalDuration)return t.totalDuration;if(!t.endList)return A.Infinity}return QT(t,e,i)},Ba=function({defaultDuration:t,durationList:e,startIndex:i,endIndex:n}){let r=0;if(i>n&&([i,n]=[n,i]),i<0){for(let s=i;s0)for(let c=l-1;c>=0;c--){const p=o[c];if(a+=p.duration,s){if(a<0)continue}else if(a+Bn<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r-Ba({defaultDuration:t.targetDuration,durationList:o,startIndex:l,endIndex:c})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(l<0){for(let c=l;c<0;c++)if(a-=t.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};l=0}for(let c=l;c0)continue}else if(a-Bn>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r+Ba({defaultDuration:t.targetDuration,durationList:o,startIndex:l,endIndex:c})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},ZT=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},dm=function(t){return t.excludeUntil&&t.excludeUntil===1/0},Ac=function(t){const e=ZT(t);return!t.disabled&&!e},dP=function(t){return t.disabled},hP=function(t){for(let e=0;e{if(t.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return t.playlists.filter(n=>Ac(n)?(n.attributes.BANDWIDTH||0)!t&&!e||!t&&e||t&&!e?!1:!!(t===e||t.id&&e.id&&t.id===e.id||t.resolvedUri&&e.resolvedUri&&t.resolvedUri===e.resolvedUri||t.uri&&e.uri&&t.uri===e.uri),Ny=function(t,e){const i=t&&t.mediaGroups&&t.mediaGroups.AUDIO||{};let n=!1;for(const r in i){for(const s in i[r])if(n=e(i[r][s]),n)break;if(n)break}return!!n},Do=t=>{if(!t||!t.playlists||!t.playlists.length)return Ny(t,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;ej1(s))||Ny(t,s=>hm(i,s))))return!1}return!0};var Dt={liveEdgeDelay:KT,duration:YT,seekable:uP,getMediaInfoForTime:cP,isEnabled:Ac,isDisabled:dP,isExcluded:ZT,isIncompatible:dm,playlistEnd:JT,isAes:hP,hasAttribute:ex,estimateSegmentRequestTime:fP,isLowestEnabledRendition:of,isAudioOnly:Do,playlistMatch:hm,segmentDurationWithParts:cm};const{log:tx}=M,fm=(t,e)=>`${t}-${e}`,pP=(t,e,i)=>`placeholder-uri-${t}-${e}-${i}`,mP=({onwarn:t,oninfo:e,manifestString:i,customTagParsers:n=[],customTagMappers:r=[],llhls:s})=>{const a=new LA;t&&a.on("warn",t),e&&a.on("info",e),n.forEach(c=>a.addParser(c)),r.forEach(c=>a.addTagMapper(c)),a.push(i),a.end();const o=a.manifest;if(s||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(c){o.hasOwnProperty(c)&&delete o[c]}),o.segments&&o.segments.forEach(function(c){["parts","preloadHints"].forEach(function(p){c.hasOwnProperty(p)&&delete c[p]})})),!o.targetDuration){let c=10;o.segments&&o.segments.length&&(c=o.segments.reduce((p,g)=>Math.max(p,g.duration),0)),t&&t(`manifest has no targetDuration defaulting to ${c}`),o.targetDuration=c}const l=GT(o);if(l.length&&!o.partTargetDuration){const c=l.reduce((p,g)=>Math.max(p,g.duration),0);t&&(t(`manifest has no partTargetDuration defaulting to ${c}`),tx.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=c}return o},Us=(t,e)=>{t.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(t.mediaGroups[i])for(const n in t.mediaGroups[i])for(const r in t.mediaGroups[i][n]){const s=t.mediaGroups[i][n][r];e(s,i,n,r)}})},ix=({playlist:t,uri:e,id:i})=>{t.id=i,t.playlistErrors_=0,e&&(t.uri=e),t.attributes=t.attributes||{}},gP=t=>{let e=t.playlists.length;for(;e--;){const i=t.playlists[e];ix({playlist:i,id:fm(e,i.uri)}),i.resolvedUri=Ft(t.uri,i.uri),t.playlists[i.id]=i,t.playlists[i.uri]=i,i.attributes.BANDWIDTH||tx.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},yP=t=>{Us(t,e=>{e.uri&&(e.resolvedUri=Ft(t.uri,e.uri))})},vP=(t,e)=>{const i=fm(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:A.location.href,resolvedUri:A.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[e]=n.playlists[0],n},nx=(t,e,i=pP)=>{t.uri=e;for(let r=0;r{if(!r.playlists||!r.playlists.length){if(n&&s==="AUDIO"&&!r.uri)for(let l=0;l(r.set(s.id,s),r),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((n,r)=>{if(!this.processedDateRanges_.has(r)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),i.push(n),!!n.class))if(e[n.class]){const s=e[n.class].push(n);n.classListIndex=s-1}else e[n.class]=[n],n.classListIndex=0});for(const n of i){const r=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&r[n.classListIndex+1]?n.endTime=r[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((n,r)=>{n.startDate.getTime(){if(e.endList||!e.serverControl)return t;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let r=e.mediaSequence+e.segments.length;if(n){const s=n.parts||[],a=XT(e)-1;a>-1&&a!==s.length-1&&(i._HLS_part=a),(a>-1||s.length)&&r--}i._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const n=new A.URL(t);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){i.hasOwnProperty(r)&&n.searchParams.set(r,i[r])}),t=n.toString()}return t},xP=(t,e)=>{if(!t)return e;const i=ve(t,e);if(t.preloadHints&&!e.preloadHints&&delete i.preloadHints,t.parts&&!e.parts)delete i.parts;else if(t.parts&&e.parts)for(let n=0;n{const n=t.slice(),r=e.slice();i=i||0;const s=[];let a;for(let o=0;o{!t.resolvedUri&&t.uri&&(t.resolvedUri=Ft(e,t.uri)),t.key&&!t.key.resolvedUri&&(t.key.resolvedUri=Ft(e,t.key.uri)),t.map&&!t.map.resolvedUri&&(t.map.resolvedUri=Ft(e,t.map.uri)),t.map&&t.map.key&&!t.map.key.resolvedUri&&(t.map.key.resolvedUri=Ft(e,t.map.key.uri)),t.parts&&t.parts.length&&t.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=Ft(e,i.uri))}),t.preloadHints&&t.preloadHints.length&&t.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=Ft(e,i.uri))})},sx=function(t){const e=t.segments||[],i=t.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let n=0;nt===e||t.segments&&e.segments&&t.segments.length===e.segments.length&&t.endList===e.endList&&t.mediaSequence===e.mediaSequence&&t.preloadSegment===e.preloadSegment,lf=(t,e,i=ax)=>{const n=ve(t,{}),r=n.playlists[e.id];if(!r||i(r,e))return null;e.segments=sx(e);const s=ve(r,e);if(s.preloadSegment&&!e.preloadSegment&&delete s.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{rx(a,s.resolvedUri)});for(let a=0;a{if(a.playlists)for(let p=0;p{const i=t.segments||[],n=i[i.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],s=r&&r.duration||n&&n.duration;return e&&s?s*1e3:(t.partTargetDuration||t.targetDuration||10)*500};class Qr extends _P{constructor(e,i,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=si("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=i,this.withCredentials=r,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const s=i.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new Ry,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=Ft(this.main.uri,e.uri);this.llhls&&(i=TP(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(n,r)=>{if(this.request){if(n)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,i,n){const{uri:r,id:s}=i;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:i}){return mP({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:i,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const s=i||this.parseManifest_({url:n,manifestString:e});s.lastRequest=Date.now(),ix({playlist:s,uri:n,id:r});const a=lf(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(uf(this.media(),!!a)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),A.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Ry,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(A.clearTimeout(this.finalRenditionTimeout),i){const a=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=A.setTimeout(this.media.bind(this,e,!1),a);return}const n=this.state,r=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(uf(e,!0)),!!r){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(a,o)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Ou(e.resolvedUri,o),a)return this.playlistRequestError(this.request,e,n);this.haveMetadata({playlistString:o.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}pause(){this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=A.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=A.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,i)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.src=Ou(this.src,i);const n=this.parseManifest_({manifestString:i.responseText,url:this.src});this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,nx(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=sx(n),n.segments.forEach(r=>{rx(r,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||A.location.href;this.main=vP(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:EP}=M,cf=function(t,e,i,n){const r=t.responseType==="arraybuffer"?t.response:t.responseText;!e&&r&&(t.responseTime=Date.now(),t.roundTripTime=t.responseTime-t.requestTime,t.bytesReceived=r.byteLength||r.length,t.bandwidth||(t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3))),i.headers&&(t.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(t.timedout=!0),!e&&!t.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(t&&(r||t.responseText)))),n(e,t)},bP=(t,e)=>{if(!t||!t.size)return;let i=e;return t.forEach(n=>{i=n(i)}),i},CP=(t,e,i,n)=>{!t||!t.size||t.forEach(r=>{r(e,i,n)})},ox=function(){const t=function e(i,n){i=ve({timeout:45e3},i);const r=e.beforeRequest||M.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||M.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||M.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(M.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(r));const o=M.Vhs.xhr.original===!0?EP:M.Vhs.xhr,l=bP(s,i);s.delete(r);const c=o(l||i,function(g,v){return CP(a,c,g,v),cf(c,g,v,n)}),p=c.abort;return c.abort=function(){return c.aborted=!0,p.apply(c,arguments)},c.uri=i.uri,c.requestTime=Date.now(),c};return t.original=!0,t},wP=function(t){let e;const i=t.offset;return typeof t.offset=="bigint"||typeof t.length=="bigint"?e=A.BigInt(t.offset)+A.BigInt(t.length)-A.BigInt(1):e=t.offset+t.length-1,"bytes="+i+"-"+e},df=function(t){const e={};return t.byterange&&(e.Range=wP(t.byterange)),e},DP=function(t,e){return t.start(e)+"-"+t.end(e)},AP=function(t,e){const i=t.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},kP=function(t){return t>=32&&t<126?String.fromCharCode(t):"."},lx=function(t){const e={};return Object.keys(t).forEach(i=>{const n=t[i];V1(n)?e[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[i]=n}),e},Nu=function(t){const e=t.byterange||{length:1/0,offset:0};return[e.length,e.offset,t.resolvedUri].join(",")},ux=function(t){return t.resolvedUri},cx=t=>{const e=Array.prototype.slice.call(t),i=16;let n="",r,s;for(let a=0;acx(t),IP=t=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+i,s=t-r;return new Date(e.dateTimeObject.getTime()+s*1e3)},NP=t=>t.transmuxedPresentationEnd-t.transmuxedPresentationStart-t.transmuxerPrependedSeconds,RP=(t,e)=>{let i;try{i=new Date(t)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(io?null:(i>new Date(s)&&(n=r),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Dt.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},MP=(t,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,n;for(let s=0;si){if(t>i+r.duration*dx)return null;n=r}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},BP=(t,e)=>{let i,n;try{i=new Date(t),n=new Date(e)}catch{}const r=i.getTime();return(n.getTime()-r)/1e3},FP=t=>{if(!t.segments||t.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!t||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const n=MP(e,t);if(!n)return i({message:"valid programTime was not found"});if(n.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:e},s=OP(e,n.segment);return s&&(r.programDateTime=s.toISOString()),i(null,r)},hx=({programTime:t,playlist:e,retryCount:i=2,seekTo:n,pauseAfterSeek:r=!0,tech:s,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof t>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!s.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!FP(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=RP(t,e);if(!o)return a({message:`${t} was not found in the stream`});const l=o.segment,c=BP(l.dateTimeObject,t);if(o.type==="estimate"){if(i===0)return a({message:`${t} is not buffered yet. Try again`});n(o.estimatedStart+c),s.one("seeked",()=>{hx({programTime:t,playlist:e,retryCount:i-1,seekTo:n,pauseAfterSeek:r,tech:s,callback:a})});return}const p=l.start+c,g=()=>a(null,s.currentTime());s.one("seeked",g),r&&s.pause(),n(p)},Hd=(t,e)=>{if(t.readyState===4)return e()},jP=(t,e,i)=>{let n=[],r,s=!1;const a=function(p,g,v,S){return g.abort(),s=!0,i(p,g,v,S)},o=function(p,g){if(s)return;if(p)return a(p,g,"",n);const v=g.responseText.substring(n&&n.byteLength||0,g.responseText.length);if(n=HA(n,z1(v,!0)),r=r||xa(n),n.length<10||r&&n.lengtha(p,g,"",n));const S=Lp(n);return S==="ts"&&n.length<188?Hd(g,()=>a(p,g,"",n)):!S&&n.length<376?Hd(g,()=>a(p,g,"",n)):a(null,g,S,n)},c=e({uri:t,beforeSend(p){p.overrideMimeType("text/plain; charset=x-user-defined"),p.addEventListener("progress",function({total:g,loaded:v}){return cf(p,null,{statusCode:p.status},o)})}},function(p,g){return cf(c,p,g,o)});return c},{EventTarget:$P}=M,My=function(t,e){if(!ax(t,e)||t.sidx&&e.sidx&&(t.sidx.offset!==e.sidx.offset||t.sidx.length!==e.sidx.length))return!1;if(!t.sidx&&e.sidx||t.sidx&&!e.sidx||t.segments&&!e.segments||!t.segments&&e.segments)return!1;if(!t.segments&&!e.segments)return!0;for(let i=0;i{const r=n.attributes.NAME||i;return`placeholder-uri-${t}-${e}-${r}`},zP=({mainXml:t,srcUrl:e,clientOffset:i,sidxMapping:n,previousManifest:r})=>{const s=d3(t,{manifestUri:e,clientOffset:i,sidxMapping:n,previousManifest:r});return nx(s,e,VP),s},HP=(t,e)=>{Us(t,(i,n,r,s)=>{s in e.mediaGroups[n][r]||delete t.mediaGroups[n][r][s]})},qP=(t,e,i)=>{let n=!0,r=ve(t,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let s=0;s{if(s.playlists&&s.playlists.length){const c=s.playlists[0].id,p=lf(r,s.playlists[0],My);p&&(r=p,l in r.mediaGroups[a][o]||(r.mediaGroups[a][o][l]=s),r.mediaGroups[a][o][l].playlists[0]=r.playlists[c],n=!1)}}),HP(r,e),e.minimumUpdatePeriod!==t.minimumUpdatePeriod&&(n=!1),n?null:r},WP=(t,e)=>(!t.map&&!e.map||!!(t.map&&e.map&&t.map.byterange.offset===e.map.byterange.offset&&t.map.byterange.length===e.map.byterange.length))&&t.uri===e.uri&&t.byterange.offset===e.byterange.offset&&t.byterange.length===e.byterange.length,By=(t,e)=>{const i={};for(const n in t){const s=t[n].sidx;if(s){const a=cc(s);if(!e[a])break;const o=e[a].sidxInfo;WP(o,s)&&(i[a]=e[a])}}return i},GP=(t,e)=>{let n=By(t.playlists,e);return Us(t,(r,s,a,o)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;n=ve(n,By(l,e))}}),n};class hf extends $P{constructor(e,i,n={},r){super(),this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:s=!1}=n;if(this.vhs_=i,this.withCredentials=s,this.addMetadataToTextTrack=n.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.media().attributes.serviceLocation||this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=si("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,i,n){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,i,n){const r=e.sidx&&cc(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){this.mediaRequest_=A.setTimeout(()=>n(!1),0);return}const s=Ou(e.sidx.resolvedUri),a=(o,l)=>{if(this.requestErrored_(o,l,i))return;const c=this.mainPlaylistLoader_.sidxMapping_;let p;try{p=y3(J(l.response).subarray(8))}catch(g){this.requestErrored_(g,l,i);return}return c[r]={sidxInfo:e.sidx,sidx:p},kp(e,p,e.sidx.resolvedUri),n(!0)};this.request=jP(s,this.vhs_.xhr,(o,l,c,p)=>{if(o)return a(o,l);if(!c||c!=="mp4")return a({status:l.status,message:`Unsupported ${c||"unknown"} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},l);const{offset:g,length:v}=e.sidx.byterange;if(p.length>=v+g)return a(o,{response:p.subarray(g,g+v),status:l.status,uri:l.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:df({byterange:e.sidx.byterange})},a)})}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},A.clearTimeout(this.minimumUpdatePeriodTimeout_),A.clearTimeout(this.mediaRequest_),A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,r=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(A.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout(()=>this.load(),n);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){this.mediaRequest_=A.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(i,n)=>{if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Ou(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const i=h3(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Ft(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(n,r)=>{if(!this.request)return;if(n)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let s;i.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?s=this.mainLoaded_:s=Date.parse(r.responseHeaders.date):s=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let i=zP({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(i=qP(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(A.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=A.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=GP(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const i=this.mainPlaylistLoader_.main.playlists,n=!this.media_||this.media_!==i[e];if(n?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=A.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},uf(this.media(),!!n)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}}var Qe={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const XP=t=>{const e=new Uint8Array(new ArrayBuffer(t.length));for(let i=0;i-1):!1},this.trigger=function(d){var f,h,m,y;if(f=u[d],!!f)if(arguments.length===2)for(m=f.length,h=0;h"u")){for(u in Q)Q.hasOwnProperty(u)&&(Q[u]=[u.charCodeAt(0),u.charCodeAt(1),u.charCodeAt(2),u.charCodeAt(3)]);ce=new Uint8Array([105,115,111,109]),ue=new Uint8Array([97,118,99,49]),dt=new Uint8Array([0,0,0,1]),Ce=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),H=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),ee={video:Ce,audio:H},Te=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),fe=new Uint8Array([0,0,0,0,0,0,0,0]),Ui=new Uint8Array([0,0,0,0,0,0,0,0]),yi=Ui,xr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),vi=Ui,te=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(u){var d=[],f=0,h,m,y;for(h=1;h>>1,u.samplingfrequencyindex<<7|u.channelcount<<3,6,1,2]))},p=function(){return o(Q.ftyp,ce,dt,ce,ue)},N=function(u){return o(Q.hdlr,ee[u])},g=function(u){return o(Q.mdat,u)},L=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,u.duration>>>24&255,u.duration>>>16&255,u.duration>>>8&255,u.duration&255,85,196,0,0]);return u.samplerate&&(d[12]=u.samplerate>>>24&255,d[13]=u.samplerate>>>16&255,d[14]=u.samplerate>>>8&255,d[15]=u.samplerate&255),o(Q.mdhd,d)},k=function(u){return o(Q.mdia,L(u),N(u.type),S(u))},v=function(u){return o(Q.mfhd,new Uint8Array([0,0,0,0,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255]))},S=function(u){return o(Q.minf,u.type==="video"?o(Q.vmhd,te):o(Q.smhd,fe),l(),$(u))},_=function(u,d){for(var f=[],h=d.length;h--;)f[h]=Y(d[h]);return o.apply(null,[Q.moof,v(u)].concat(f))},w=function(u){for(var d=u.length,f=[];d--;)f[d]=T(u[d]);return o.apply(null,[Q.moov,x(4294967295)].concat(f).concat(I(u)))},I=function(u){for(var d=u.length,f=[];d--;)f[d]=ne(u[d]);return o.apply(null,[Q.mvex].concat(f))},x=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(Q.mvhd,d)},F=function(u){var d=u.samples||[],f=new Uint8Array(4+d.length),h,m;for(m=0;m>>8),y.push(h[b].byteLength&255),y=y.concat(Array.prototype.slice.call(h[b]));for(b=0;b>>8),E.push(m[b].byteLength&255),E=E.concat(Array.prototype.slice.call(m[b]));if(D=[Q.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(Q.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([h.length],y,[m.length],E))),o(Q.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var P=f.sarRatio[0],O=f.sarRatio[1];D.push(o(Q.pasp,new Uint8Array([(P&4278190080)>>24,(P&16711680)>>16,(P&65280)>>8,P&255,(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255])))}return o.apply(null,D)},d=function(f){return o(Q.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),c(f))}}(),C=function(u){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,0,(u.duration&4278190080)>>24,(u.duration&16711680)>>16,(u.duration&65280)>>8,u.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(u.width&65280)>>8,u.width&255,0,0,(u.height&65280)>>8,u.height&255,0,0]);return o(Q.tkhd,d)},Y=function(u){var d,f,h,m,y,E,b;return d=o(Q.tfhd,new Uint8Array([0,0,0,58,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(u.baseMediaDecodeTime/a),b=Math.floor(u.baseMediaDecodeTime%a),f=o(Q.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255])),y=92,u.type==="audio"?(h=he(u,y),o(Q.traf,d,f,h)):(m=F(u),h=he(u,m.length+y),o(Q.traf,d,f,h,m))},T=function(u){return u.duration=u.duration||4294967295,o(Q.trak,C(u),k(u))},ne=function(u){var d=new Uint8Array([0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return u.type!=="video"&&(d[d.length-1]=0),o(Q.trex,d)},function(){var u,d,f;f=function(h,m){var y=0,E=0,b=0,D=0;return h.length&&(h[0].duration!==void 0&&(y=1),h[0].size!==void 0&&(E=2),h[0].flags!==void 0&&(b=4),h[0].compositionTimeOffset!==void 0&&(D=8)),[0,0,y|E|b|D,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(m&4278190080)>>>24,(m&16711680)>>>16,(m&65280)>>>8,m&255]},d=function(h,m){var y,E,b,D,P,O;for(D=h.samples||[],m+=20+16*D.length,b=f(D,m),E=new Uint8Array(b.length+D.length*16),E.set(b),y=b.length,O=0;O>>24,E[y++]=(P.duration&16711680)>>>16,E[y++]=(P.duration&65280)>>>8,E[y++]=P.duration&255,E[y++]=(P.size&4278190080)>>>24,E[y++]=(P.size&16711680)>>>16,E[y++]=(P.size&65280)>>>8,E[y++]=P.size&255,E[y++]=P.flags.isLeading<<2|P.flags.dependsOn,E[y++]=P.flags.isDependedOn<<6|P.flags.hasRedundancy<<4|P.flags.paddingValue<<1|P.flags.isNonSyncSample,E[y++]=P.flags.degradationPriority&61440,E[y++]=P.flags.degradationPriority&15,E[y++]=(P.compositionTimeOffset&4278190080)>>>24,E[y++]=(P.compositionTimeOffset&16711680)>>>16,E[y++]=(P.compositionTimeOffset&65280)>>>8,E[y++]=P.compositionTimeOffset&255;return o(Q.trun,E)},u=function(h,m){var y,E,b,D,P,O;for(D=h.samples||[],m+=20+8*D.length,b=f(D,m),y=new Uint8Array(b.length+D.length*8),y.set(b),E=b.length,O=0;O>>24,y[E++]=(P.duration&16711680)>>>16,y[E++]=(P.duration&65280)>>>8,y[E++]=P.duration&255,y[E++]=(P.size&4278190080)>>>24,y[E++]=(P.size&16711680)>>>16,y[E++]=(P.size&65280)>>>8,y[E++]=P.size&255;return o(Q.trun,y)},he=function(h,m){return h.type==="audio"?u(h,m):d(h,m)}}();var Sr={ftyp:p,mdat:g,moof:_,moov:w,initSegment:function(u){var d=p(),f=w(u),h;return h=new Uint8Array(d.byteLength+f.byteLength),h.set(d),h.set(f,d.byteLength),h}},Vx=function(u){var d,f,h=[],m=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,h.byteLength=0,d=0;d1&&(d=u.shift(),u.byteLength-=d.byteLength,u.nalCount-=d.nalCount,u[0][0].dts=d.dts,u[0][0].pts=d.pts,u[0][0].duration+=d.duration),u},qx=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},gm=function(u,d){var f=qx();return f.dataOffset=d,f.compositionTimeOffset=u.pts-u.dts,f.duration=u.duration,f.size=4*u.length,f.size+=u.byteLength,u.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},Wx=function(u,d){var f,h,m,y,E,b=d||0,D=[];for(f=0;fko.ONE_SECOND_IN_TS/2))){for(P=Zx()[u.samplerate],P||(P=d[0].data),O=0;O=f?u:(d.minSegmentDts=1/0,u.filter(function(h){return h.dts>=f?(d.minSegmentDts=Math.min(d.minSegmentDts,h.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},nS=function(u){var d,f,h=[];for(d=0;d=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(u),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ji.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},ji.prototype.addText=function(u){this.rows[this.rowIdx]+=u},ji.prototype.backspace=function(){if(!this.isEmpty()){var u=this.rows[this.rowIdx];this.rows[this.rowIdx]=u.substr(0,u.length-1)}};var Lo=function(u,d,f){this.serviceNum=u,this.text="",this.currentWindow=new ji(-1),this.windows=[],this.stream=f,typeof d=="string"&&this.createTextDecoder(d)};Lo.prototype.init=function(u,d){this.startPts=u;for(var f=0;f<8;f++)this.windows[f]=new ji(f),typeof d=="function"&&(this.windows[f].beforeRowOverflow=d)},Lo.prototype.setCurrentWindow=function(u){this.currentWindow=this.windows[u]},Lo.prototype.createTextDecoder=function(u){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(u)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+u+" encoding. "+d})}};var _e=function(u){u=u||{},_e.prototype.init.call(this);var d=this,f=u.captionServices||{},h={},m;Object.keys(f).forEach(y=>{m=f[y],/^SERVICE/.test(y)&&(h[y]=m.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(y){y.type===3?(d.new708Packet(),d.add708Bytes(y)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(y))}};_e.prototype=new Rc,_e.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},_e.prototype.add708Bytes=function(u){var d=u.ccData,f=d>>>8,h=d&255;this.current708Packet.ptsVals.push(u.pts),this.current708Packet.data.push(f),this.current708Packet.data.push(h)},_e.prototype.push708Packet=function(){var u=this.current708Packet,d=u.data,f=null,h=null,m=0,y=d[m++];for(u.seq=y>>6,u.sizeCode=y&63;m>5,h=y&31,f===7&&h>0&&(y=d[m++],f=y),this.pushServiceBlock(f,m,h),h>0&&(m+=h-1)},_e.prototype.pushServiceBlock=function(u,d,f){var h,m=d,y=this.current708Packet.data,E=this.services[u];for(E||(E=this.initService(u,m));m("0"+(Z&255).toString(16)).slice(-2)).join("")}if(m?(R=[b,D],u++):R=[b],d.textDecoder_&&!h)O=d.textDecoder_.decode(new Uint8Array(R));else if(m){const U=z(R);O=String.fromCharCode(parseInt(U,16))}else O=yS(E|b);return P.pendingNewLine&&!P.isEmpty()&&P.newLine(this.getPts(u)),P.pendingNewLine=!1,P.addText(O),u},_e.prototype.multiByteCharacter=function(u,d){var f=this.current708Packet.data,h=f[u+1],m=f[u+2];return Io(h)&&Io(m)&&(u=this.handleText(++u,d,{isMultiByte:!0})),u},_e.prototype.setCurrentWindow=function(u,d){var f=this.current708Packet.data,h=f[u],m=h&7;return d.setCurrentWindow(m),u},_e.prototype.defineWindow=function(u,d){var f=this.current708Packet.data,h=f[u],m=h&7;d.setCurrentWindow(m);var y=d.currentWindow;return h=f[++u],y.visible=(h&32)>>5,y.rowLock=(h&16)>>4,y.columnLock=(h&8)>>3,y.priority=h&7,h=f[++u],y.relativePositioning=(h&128)>>7,y.anchorVertical=h&127,h=f[++u],y.anchorHorizontal=h,h=f[++u],y.anchorPoint=(h&240)>>4,y.rowCount=h&15,h=f[++u],y.columnCount=h&63,h=f[++u],y.windowStyle=(h&56)>>3,y.penStyle=h&7,y.virtualRowCount=y.rowCount+1,u},_e.prototype.setWindowAttributes=function(u,d){var f=this.current708Packet.data,h=f[u],m=d.currentWindow.winAttr;return h=f[++u],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=f[++u],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=f[++u],m.borderType+=(h&128)>>5,m.wordWrap=(h&64)>>6,m.printDirection=(h&48)>>4,m.scrollDirection=(h&12)>>2,m.justify=h&3,h=f[++u],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,u},_e.prototype.flushDisplayed=function(u,d){for(var f=[],h=0;h<8;h++)d.windows[h].visible&&!d.windows[h].isEmpty()&&f.push(d.windows[h].getText());d.endPts=u,d.text=f.join(` - -`),this.pushCaption(d),d.startPts=u},_e.prototype.pushCaption=function(u){u.text!==""&&(this.trigger("data",{startPts:u.startPts,endPts:u.endPts,text:u.text,stream:"cc708_"+u.serviceNum}),u.text="",u.startPts=u.endPts)},_e.prototype.displayWindows=function(u,d){var f=this.current708Packet.data,h=f[++u],m=this.getPts(u);this.flushDisplayed(m,d);for(var y=0;y<8;y++)h&1<>4,m.offset=(h&12)>>2,m.penSize=h&3,h=f[++u],m.italics=(h&128)>>7,m.underline=(h&64)>>6,m.edgeType=(h&56)>>3,m.fontStyle=h&7,u},_e.prototype.setPenColor=function(u,d){var f=this.current708Packet.data,h=f[u],m=d.currentWindow.penColor;return h=f[++u],m.fgOpacity=(h&192)>>6,m.fgRed=(h&48)>>4,m.fgGreen=(h&12)>>2,m.fgBlue=h&3,h=f[++u],m.bgOpacity=(h&192)>>6,m.bgRed=(h&48)>>4,m.bgGreen=(h&12)>>2,m.bgBlue=h&3,h=f[++u],m.edgeRed=(h&48)>>4,m.edgeGreen=(h&12)>>2,m.edgeBlue=h&3,u},_e.prototype.setPenLocation=function(u,d){var f=this.current708Packet.data,h=f[u],m=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,h=f[++u],m.row=h&15,h=f[++u],m.column=h&63,u},_e.prototype.reset=function(u,d){var f=this.getPts(u);return this.flushDisplayed(f,d),this.initService(d.serviceNum,u)};var vS={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Oo=function(u){return u===null?"":(u=vS[u]||u,String.fromCharCode(u))},No=14,_S=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],zn=function(){for(var u=[],d=No+1;d--;)u.push({text:"",indent:0,offset:0});return u},ke=function(u,d){ke.prototype.init.call(this),this.field_=u||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var h,m,y,E,b;if(h=f.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),y=h>>>8,E=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(f.pts),this.flushDisplayed(f.pts),m=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=m,this.startPts_=f.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(f.pts),this.displayed_=zn();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=zn();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=zn()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,b=Oo(y|E),this[this.mode_](f.pts,b),this.column_++;else if(this.isExtCharacter(y,E))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),y=(y&3)<<8,b=Oo(y|E),this[this.mode_](f.pts,b),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(E&14)===14&&this.addFormatting(f.pts,["i"]),(E&1)===1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const P=E&3;this.nonDisplayed_[this.row_].offset=P,this.column_+=P}else if(this.isPAC(y,E)){var D=_S.indexOf(h&7968);if(this.mode_==="rollUp"&&(D-this.rollUpRows_+1<0&&(D=this.rollUpRows_-1),this.setRollUp(f.pts,D)),D!==this.row_&&(this.clearFormatting(f.pts),this.row_=D),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(h&16)===16){const P=(h&14)>>1;this.column_=P*4,this.nonDisplayed_[this.row_].indent+=P}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),b=Oo(y),b+=Oo(E),this[this.mode_](f.pts,b),this.column_+=b.length)}};ke.prototype=new Rc,ke.prototype.flushDisplayed=function(u){const d=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},f=[];this.displayed_.forEach((h,m)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{d(m)}h.text.length&&f.push({text:h.text,line:m+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&d(m)}),f.length&&this.trigger("data",{startPts:this.startPts_,endPts:u,content:f,stream:this.name_})},ke.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=zn(),this.nonDisplayed_=zn(),this.lastControlCode_=null,this.column_=0,this.row_=No,this.rollUpRows_=2,this.formatting_=[]},ke.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},ke.prototype.isSpecialCharacter=function(u,d){return u===this.EXT_&&d>=48&&d<=63},ke.prototype.isExtCharacter=function(u,d){return(u===this.EXT_+1||u===this.EXT_+2)&&d>=32&&d<=63},ke.prototype.isMidRowCode=function(u,d){return u===this.EXT_&&d>=32&&d<=47},ke.prototype.isOffsetControlCode=function(u,d){return u===this.OFFSET_&&d>=33&&d<=35},ke.prototype.isPAC=function(u,d){return u>=this.BASE_&&u=64&&d<=127},ke.prototype.isColorPAC=function(u){return u>=64&&u<=79||u>=96&&u<=127},ke.prototype.isNormalChar=function(u){return u>=32&&u<=127},ke.prototype.setRollUp=function(u,d){if(this.mode_!=="rollUp"&&(this.row_=No,this.mode_="rollUp",this.flushDisplayed(u),this.nonDisplayed_=zn(),this.displayed_=zn()),d!==void 0&&d!==this.row_)for(var f=0;f"},"");this[this.mode_](u,f)},ke.prototype.clearFormatting=function(u){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(f,h){return f+""},"");this.formatting_=[],this[this.mode_](u,d)}},ke.prototype.popOn=function(u,d){var f=this.nonDisplayed_[this.row_].text;f+=d,this.nonDisplayed_[this.row_].text=f},ke.prototype.rollUp=function(u,d){var f=this.displayed_[this.row_].text;f+=d,this.displayed_[this.row_].text=f},ke.prototype.shiftRowsUp_=function(){var u;for(u=0;ud&&(f=-1);Math.abs(d-u)>SS;)u+=f*xS;return u},Bc=function(u){var d,f;Bc.prototype.init.call(this),this.type_=u||Em,this.push=function(h){this.type_!==Em&&h.type!==this.type_||(f===void 0&&(f=h.dts),h.dts=Mc(h.dts,f),h.pts=Mc(h.pts,f),d=h.dts,this.trigger("data",h))},this.flush=function(){f=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Bc.prototype=new TS;var bm={TimestampRolloverStream:Bc,handleRollover:Mc},ES=(u,d,f)=>{if(!u)return-1;for(var h=f;h";u.data[0]===Bo.Utf8&&(f=Mo(u.data,0,d),!(f<0)&&(u.mimeType=$s(u.data,d,f),d=f+1,u.pictureType=u.data[d],d++,h=Mo(u.data,0,d),!(h<0)&&(u.description=js(u.data,d,h),d=h+1,u.mimeType===m?u.url=$s(u.data,d,u.data.length):u.pictureData=u.data.subarray(d,u.data.length))))},"T*":function(u){u.data[0]===Bo.Utf8&&(u.value=js(u.data,1,u.data.length).replace(/\0*$/,""),u.values=u.value.split("\0"))},TXXX:function(u){var d;u.data[0]===Bo.Utf8&&(d=Mo(u.data,0,1),d!==-1&&(u.description=js(u.data,1,d),u.value=js(u.data,d+1,u.data.length).replace(/\0*$/,""),u.data=u.value))},"W*":function(u){u.url=$s(u.data,0,u.data.length).replace(/\0.*$/,"")},WXXX:function(u){var d;u.data[0]===Bo.Utf8&&(d=Mo(u.data,0,1),d!==-1&&(u.description=js(u.data,1,d),u.url=$s(u.data,d+1,u.data.length).replace(/\0.*$/,"")))},PRIV:function(u){var d;for(d=0;d>>2;Z*=4,Z+=U[7]&3,O.timeStamp=Z,b.pts===void 0&&b.dts===void 0&&(b.pts=O.timeStamp,b.dts=O.timeStamp),this.trigger("timestamp",O)}b.frames.push(O),D+=10,D+=P}while(D>>4>1&&(E+=m[E]+1),y.pid===0)y.type="pat",u(m.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",u(m.subarray(E),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([m,E,y]):this.processPes_(m,E,y)},this.processPes_=function(m,y,E){E.pid===this.programMapTable.video?E.streamType=ai.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=ai.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=m.subarray(y),this.trigger("data",E)}},Hs.prototype=new Fc,Hs.STREAM_TYPES={h264:27,adts:15},jo=function(){var u=this,d=!1,f={data:[],size:0},h={data:[],size:0},m={data:[],size:0},y,E=function(D,P){var O;const R=D[0]<<16|D[1]<<8|D[2];P.data=new Uint8Array,R===1&&(P.packetLength=6+(D[4]<<8|D[5]),P.dataAlignmentIndicator=(D[6]&4)!==0,O=D[7],O&192&&(P.pts=(D[9]&14)<<27|(D[10]&255)<<20|(D[11]&254)<<12|(D[12]&255)<<5|(D[13]&254)>>>3,P.pts*=4,P.pts+=(D[13]&6)>>>1,P.dts=P.pts,O&64&&(P.dts=(D[14]&14)<<27|(D[15]&255)<<20|(D[16]&254)<<12|(D[17]&255)<<5|(D[18]&254)>>>3,P.dts*=4,P.dts+=(D[18]&6)>>>1)),P.data=D.subarray(9+D[8]))},b=function(D,P,O){var R=new Uint8Array(D.size),z={type:P},U=0,Z=0,ie=!1,qe;if(!(!D.data.length||D.size<9)){for(z.trackId=D.data[0].pid,U=0;U>5,D=((d[m+6]&3)+1)*1024,P=D*LS/Am[(d[m+2]&60)>>>2],d.byteLength-m>>6&3)+1,channelcount:(d[m+2]&1)<<2|(d[m+3]&192)>>>6,samplerate:Am[(d[m+2]&60)>>>2],samplingfrequencyindex:(d[m+2]&60)>>>2,samplesize:16,data:d.subarray(m+7+E,m+y)}),f++,m+=y}typeof O=="number"&&(this.skipWarn_(O,m),O=null),d=d.subarray(m)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},$o.prototype=new IS;var OS=$o,km;km=function(u){var d=u.byteLength,f=0,h=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+h},this.loadWord=function(){var m=u.byteLength-d,y=new Uint8Array(4),E=Math.min(4,d);if(E===0)throw new Error("no bytes available");y.set(u.subarray(m,m+E)),f=new DataView(y.buffer).getUint32(0),h=E*8,d-=E},this.skipBits=function(m){var y;h>m?(f<<=m,h-=m):(m-=h,y=Math.floor(m/8),m-=y*8,d-=y,this.loadWord(),f<<=m,h-=m)},this.readBits=function(m){var y=Math.min(h,m),E=f>>>32-y;return h-=y,h>0?f<<=y:d>0&&this.loadWord(),y=m-y,y>0?E<>>m)return f<<=m,h-=m,m;return this.loadWord(),m+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var m=this.skipLeadingZeros();return this.readBits(m+1)-1},this.readExpGolomb=function(){var m=this.readUnsignedExpGolomb();return 1&m?1+m>>>1:-1*(m>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var NS=km,Pm=i,RS=NS,Vo,qs,Im;qs=function(){var u=0,d,f;qs.prototype.init.call(this),this.push=function(h){var m;f?(m=new Uint8Array(f.byteLength+h.data.byteLength),m.set(f),m.set(h.data,f.byteLength),f=m):f=h.data;for(var y=f.byteLength;u3&&this.trigger("data",f.subarray(u+3)),f=null,u=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},qs.prototype=new Pm,Im={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Vo=function(){var u=new qs,d,f,h,m,y,E,b;Vo.prototype.init.call(this),d=this,this.push=function(D){D.type==="video"&&(f=D.trackId,h=D.pts,m=D.dts,u.push(D))},u.on("data",function(D){var P={trackId:f,pts:h,dts:m,data:D,nalUnitTypeCode:D[0]&31};switch(P.nalUnitTypeCode){case 5:P.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:P.nalUnitType="sei_rbsp",P.escapedRBSP=y(D.subarray(1));break;case 7:P.nalUnitType="seq_parameter_set_rbsp",P.escapedRBSP=y(D.subarray(1)),P.config=E(P.escapedRBSP);break;case 8:P.nalUnitType="pic_parameter_set_rbsp";break;case 9:P.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",P)}),u.on("done",function(){d.trigger("done")}),u.on("partialdone",function(){d.trigger("partialdone")}),u.on("reset",function(){d.trigger("reset")}),u.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){u.flush()},this.partialFlush=function(){u.partialFlush()},this.reset=function(){u.reset()},this.endTimeline=function(){u.endTimeline()},b=function(D,P){var O=8,R=8,z,U;for(z=0;z>4;return f=f>=0?f:0,m?f+20:f+10},Om=function(u,d){return u.length-d<10||u[d]!==73||u[d+1]!==68||u[d+2]!==51?d:(d+=Lm(u,d),Om(u,d))},FS=function(u){var d=Om(u,0);return u.length>=d+2&&(u[d]&255)===255&&(u[d+1]&240)===240&&(u[d+1]&22)===16},Nm=function(u){return u[0]<<21|u[1]<<14|u[2]<<7|u[3]},US=function(u,d,f){var h,m="";for(h=d;h>5,h=u[d+4]<<3,m=u[d+3]&6144;return m|h|f},VS=function(u,d){return u[d]===73&&u[d+1]===68&&u[d+2]===51?"timed-metadata":u[d]&!0&&(u[d+1]&240)===240?"audio":null},zS=function(u){for(var d=0;d+5>>2]}return null},HS=function(u){var d,f,h,m;d=10,u[5]&64&&(d+=4,d+=Nm(u.subarray(10,14)));do{if(f=Nm(u.subarray(d+4,d+8)),f<1)return null;if(m=String.fromCharCode(u[d],u[d+1],u[d+2],u[d+3]),m==="PRIV"){h=u.subarray(d+10,d+f+10);for(var y=0;y>>2;return D*=4,D+=b[7]&3,D}break}}d+=10,d+=f}while(d=3;){if(u[m]===73&&u[m+1]===68&&u[m+2]===51){if(u.length-m<10||(h=Rm.parseId3TagSize(u,m),m+h>u.length))break;E={type:"timed-metadata",data:u.subarray(m,m+h)},this.trigger("data",E),m+=h;continue}else if((u[m]&255)===255&&(u[m+1]&240)===240){if(u.length-m<7||(h=Rm.parseAdtsSize(u,m),m+h>u.length))break;b={type:"audio",data:u.subarray(m,m+h),pts:d,dts:d},this.trigger("data",b),m+=h;continue}m++}y=u.length-m,y>0?u=u.subarray(m):u=new Uint8Array},this.reset=function(){u=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){u=new Uint8Array,this.trigger("endedtimeline")}},zo.prototype=new qS;var WS=zo,GS=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],XS=GS,KS=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],QS=KS,Ho=i,Ws=Sr,Gs=Qx,qo=sS,oi=cS,$i=PS,Wo=we,Mm=OS,YS=MS.H264Stream,JS=WS,ZS=Vc.isLikelyAacData,eE=we.ONE_SECOND_IN_TS,zc=XS,Hc=QS,Xs,br,Go,Hn,tE=function(u,d){d.stream=u,this.trigger("log",d)},Bm=function(u,d){for(var f=Object.keys(d),h=0;h=-P&&R<=D&&(!z||O>R)&&(z=Z,O=R)));return z?z.gop:null},this.alignGopsAtStart_=function(b){var D,P,O,R,z,U,Z,ie;for(z=b.byteLength,U=b.nalCount,Z=b.duration,D=P=0;DO.pts){D++;continue}P++,z-=R.byteLength,U-=R.nalCount,Z-=R.duration}return P===0?b:P===b.length?null:(ie=b.slice(P),ie.byteLength=z,ie.duration=Z,ie.nalCount=U,ie.pts=ie[0].pts,ie.dts=ie[0].dts,ie)},this.alignGopsAtEnd_=function(b){var D,P,O,R,z,U;for(D=m.length-1,P=b.length-1,z=null,U=!1;D>=0&&P>=0;){if(O=m[D],R=b[P],O.pts===R.pts){U=!0;break}if(O.pts>R.pts){D--;continue}D===m.length-1&&(z=P),P--}if(!U&&z===null)return null;var Z;if(U?Z=P:Z=z,Z===0)return b;var ie=b.slice(Z),qe=ie.reduce(function(Gt,Wn){return Gt.byteLength+=Wn.byteLength,Gt.duration+=Wn.duration,Gt.nalCount+=Wn.nalCount,Gt},{byteLength:0,duration:0,nalCount:0});return ie.byteLength=qe.byteLength,ie.duration=qe.duration,ie.nalCount=qe.nalCount,ie.pts=ie[0].pts,ie.dts=ie[0].dts,ie},this.alignGopsWith=function(b){m=b}},Xs.prototype=new Ho,Hn=function(u,d){this.numberOfTracks=0,this.metadataStream=d,u=u||{},typeof u.remux<"u"?this.remuxTracks=!!u.remux:this.remuxTracks=!0,typeof u.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=u.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Hn.prototype.init.call(this),this.push=function(f){if(f.content||f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},Hn.prototype=new Ho,Hn.prototype.flush=function(u){var d=0,f={captions:[],captionStreams:{},metadata:[],info:{}},h,m,y,E=0,b;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,Hc.forEach(function(D){f.info[D]=this.videoTrack[D]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,zc.forEach(function(D){f.info[D]=this.audioTrack[D]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?f.type=this.pendingTracks[0].type:f.type="combined",this.emittedTracks+=this.pendingTracks.length,y=Ws.initSegment(this.pendingTracks),f.initSegment=new Uint8Array(y.byteLength),f.initSegment.set(y),f.data=new Uint8Array(this.pendingBytes),b=0;b=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Hn.prototype.setRemux=function(u){this.remuxTracks=u},Go=function(u){var d=this,f=!0,h,m;Go.prototype.init.call(this),u=u||{},this.baseMediaDecodeTime=u.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new $i.MetadataStream,y.aacStream=new JS,y.audioTimestampRolloverStream=new $i.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new $i.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Mm,y.coalesceStream=new Hn(u,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(E){y.aacStream.setTimestamp(E.timeStamp)}),y.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||y.audioSegmentStream||(m=m||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new br(m,u),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),d.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Bm(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new $i.MetadataStream,y.packetStream=new $i.TransportPacketStream,y.parseStream=new $i.TransportParseStream,y.elementaryStream=new $i.ElementaryStream,y.timestampRolloverStream=new $i.TimestampRolloverStream,y.adtsStream=new Mm,y.h264Stream=new YS,y.captionStream=new $i.CaptionStream(u),y.coalesceStream=new Hn(u,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(E){var b;if(E.type==="metadata"){for(b=E.tracks.length;b--;)!h&&E.tracks[b].type==="video"?(h=E.tracks[b],h.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!m&&E.tracks[b].type==="audio"&&(m=E.tracks[b],m.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);h&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new Xs(h,u),y.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(D){m&&!u.keepOriginalTimestamps&&(m.timelineStartInfo=D,y.audioSegmentStream.setEarliestDts(D.dts-d.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(D){m&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(D)}),y.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),m&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new br(m,u),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,d.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Bm(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;u.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),m&&(m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,oi.clearDtsInfo(m),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),h&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,oi.clearDtsInfo(h),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){m&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;u.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var E=this;return function(b){b.stream=y,E.trigger("log",b)}},this.push=function(y){if(f){var E=ZS(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){f=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Go.prototype=new Ho;var iE={Transmuxer:Go,VideoSegmentStream:Xs,AudioSegmentStream:br,AUDIO_PROPERTIES:zc,VIDEO_PROPERTIES:Hc,generateSegmentTimingInfo:qc},nE=function(u){return u>>>0},rE=function(u){return("00"+u.toString(16)).slice(-2)},Xo={toUnsigned:nE,toHexString:rE},sE=function(u){var d="";return d+=String.fromCharCode(u[0]),d+=String.fromCharCode(u[1]),d+=String.fromCharCode(u[2]),d+=String.fromCharCode(u[3]),d},Um=sE,aE=Xo.toUnsigned,oE=Um,jm=function(u,d){var f=[],h,m,y,E,b;if(!d.length)return null;for(h=0;h1?h+m:u.byteLength,y===d[0]&&(d.length===1?f.push(u.subarray(h+8,E)):(b=jm(u.subarray(h+8,E),d.slice(1)),b.length&&(f=f.concat(b)))),h=E;return f},$m=jm,lE=Xo.toUnsigned,uE=s.getUint64,cE=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=uE(u.subarray(4)):d.baseMediaDecodeTime=lE(u[4]<<24|u[5]<<16|u[6]<<8|u[7]),d},Vm=cE,dE=function(u){return{isLeading:(u[0]&12)>>>2,dependsOn:u[0]&3,isDependedOn:(u[1]&192)>>>6,hasRedundancy:(u[1]&48)>>>4,paddingValue:(u[1]&14)>>>1,isNonSyncSample:u[1]&1,degradationPriority:u[2]<<8|u[3]}},hE=dE,zm=hE,fE=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4)),samples:[]},f=new DataView(u.buffer,u.byteOffset,u.byteLength),h=d.flags[2]&1,m=d.flags[2]&4,y=d.flags[1]&1,E=d.flags[1]&2,b=d.flags[1]&4,D=d.flags[1]&8,P=f.getUint32(4),O=8,R;for(h&&(d.dataOffset=f.getInt32(O),O+=4),m&&P&&(R={flags:zm(u.subarray(O,O+4))},O+=4,y&&(R.duration=f.getUint32(O),O+=4),E&&(R.size=f.getUint32(O),O+=4),D&&(d.version===1?R.compositionTimeOffset=f.getInt32(O):R.compositionTimeOffset=f.getUint32(O),O+=4),d.samples.push(R),P--);P--;)R={},y&&(R.duration=f.getUint32(O),O+=4),E&&(R.size=f.getUint32(O),O+=4),b&&(R.flags=zm(u.subarray(O,O+4)),O+=4),D&&(d.version===1?R.compositionTimeOffset=f.getInt32(O):R.compositionTimeOffset=f.getUint32(O),O+=4),d.samples.push(R);return d},Hm=fE,pE=function(u){var d=new DataView(u.buffer,u.byteOffset,u.byteLength),f={version:u[0],flags:new Uint8Array(u.subarray(1,4)),trackId:d.getUint32(4)},h=f.flags[2]&1,m=f.flags[2]&2,y=f.flags[2]&8,E=f.flags[2]&16,b=f.flags[2]&32,D=f.flags[0]&65536,P=f.flags[0]&131072,O;return O=8,h&&(O+=4,f.baseDataOffset=d.getUint32(12),O+=4),m&&(f.sampleDescriptionIndex=d.getUint32(O),O+=4),y&&(f.defaultSampleDuration=d.getUint32(O),O+=4),E&&(f.defaultSampleSize=d.getUint32(O),O+=4),b&&(f.defaultSampleFlags=d.getUint32(O)),D&&(f.durationIsEmpty=!0),!h&&P&&(f.baseDataOffsetIsMoof=!0),f},qm=pE,Ks;typeof window<"u"?Ks=window:typeof t<"u"?Ks=t:typeof self<"u"?Ks=self:Ks={};var Wm=Ks,mE=xm.discardEmulationPreventionBytes,gE=Sm.CaptionStream,Qs=$m,yE=Vm,vE=Hm,_E=qm,Gm=Wm,TE=function(u,d){for(var f=u,h=0;h0?yE(z[0]).baseMediaDecodeTime:0,Z=Qs(D,["trun"]),ie,qe;d===R&&Z.length>0&&(ie=SE(Z,U,O),qe=xE(b,ie,R),m[R]||(m[R]={seiNals:[],logs:[]}),m[R].seiNals=m[R].seiNals.concat(qe.seiNals),m[R].logs=m[R].logs.concat(qe.logs))}),m},bE=function(u,d,f){var h;if(d===null)return null;h=EE(u,d);var m=h[d]||{};return{seiNals:m.seiNals,logs:m.logs,timescale:f}},CE=function(){var u=!1,d,f,h,m,y,E;this.isInitialized=function(){return u},this.init=function(b){d=new gE,u=!0,E=b?b.isPartial:!1,d.on("data",function(D){D.startTime=D.startPts/m,D.endTime=D.endPts/m,y.captions.push(D),y.captionStreams[D.stream]=!0}),d.on("log",function(D){y.logs.push(D)})},this.isNewInit=function(b,D){return b&&b.length===0||D&&typeof D=="object"&&Object.keys(D).length===0?!1:h!==b[0]||m!==D[h]},this.parse=function(b,D,P){var O;if(this.isInitialized()){if(!D||!P)return null;if(this.isNewInit(D,P))h=D[0],m=P[h];else if(h===null||!m)return f.push(b),null}else return null;for(;f.length>0;){var R=f.shift();this.parse(R,D,P)}return O=bE(b,h,m),O&&O.logs&&(y.logs=y.logs.concat(O.logs)),O===null||!O.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(O.seiNals),this.flushStream(),y)},this.pushNals=function(b){if(!this.isInitialized()||!b||b.length===0)return null;b.forEach(function(D){d.push(D)})},this.flushStream=function(){if(!this.isInitialized())return null;E?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){f=[],h=null,m=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},wE=CE,DE=function(u){for(var d=0,f=String.fromCharCode(u[d]),h="";f!=="\0";)h+=f,d++,f=String.fromCharCode(u[d]);return h+=f,h},AE={uint8ToCString:DE},Ko=AE.uint8ToCString,kE=s.getUint64,PE=function(u){var d=4,f=u[0],h,m,y,E,b,D,P,O;if(f===0){h=Ko(u.subarray(d)),d+=h.length,m=Ko(u.subarray(d)),d+=m.length;var R=new DataView(u.buffer);y=R.getUint32(d),d+=4,b=R.getUint32(d),d+=4,D=R.getUint32(d),d+=4,P=R.getUint32(d),d+=4}else if(f===1){var R=new DataView(u.buffer);y=R.getUint32(d),d+=4,E=kE(u.subarray(d)),d+=8,D=R.getUint32(d),d+=4,P=R.getUint32(d),d+=4,h=Ko(u.subarray(d)),d+=h.length,m=Ko(u.subarray(d)),d+=m.length}O=new Uint8Array(u.subarray(d,u.byteLength));var z={scheme_id_uri:h,value:m,timescale:y||1,presentation_time:E,presentation_time_delta:b,event_duration:D,id:P,message_data:O};return LE(f,z)?z:void 0},IE=function(u,d,f,h){return u||u===0?u/d:h+f/d},LE=function(u,d){var f=d.scheme_id_uri!=="\0",h=u===0&&Xm(d.presentation_time_delta)&&f,m=u===1&&Xm(d.presentation_time)&&f;return!(u>1)&&h||m},Xm=function(u){return u!==void 0||u!==null},OE={parseEmsgBox:PE,scaleTime:IE},Qo=Xo.toUnsigned,Ys=Xo.toHexString,Ue=$m,Cr=Um,Wc=OE,NE=qm,RE=Hm,ME=Vm,BE=s.getUint64,Km,Qm,Ym,Jm,Zm,Gc,eg,Xc=Wm,FE=wm.parseId3Frames;Km=function(u){var d={},f=Ue(u,["moov","trak"]);return f.reduce(function(h,m){var y,E,b,D,P;return y=Ue(m,["tkhd"])[0],!y||(E=y[0],b=E===0?12:20,D=Qo(y[b]<<24|y[b+1]<<16|y[b+2]<<8|y[b+3]),P=Ue(m,["mdia","mdhd"])[0],!P)?null:(E=P[0],b=E===0?12:20,h[D]=Qo(P[b]<<24|P[b+1]<<16|P[b+2]<<8|P[b+3]),h)},d)},Qm=function(u,d){var f;f=Ue(d,["moof","traf"]);var h=f.reduce(function(m,y){var E=Ue(y,["tfhd"])[0],b=Qo(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),D=u[b]||9e4,P=Ue(y,["tfdt"])[0],O=new DataView(P.buffer,P.byteOffset,P.byteLength),R;P[0]===1?R=BE(P.subarray(4,12)):R=O.getUint32(4);let z;return typeof R=="bigint"?z=R/Xc.BigInt(D):typeof R=="number"&&!isNaN(R)&&(z=R/D),z11?(m.codec+=".",m.codec+=Ys(U[9]),m.codec+=Ys(U[10]),m.codec+=Ys(U[11])):m.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(m.codec)?(U=z.subarray(28),Z=Cr(U.subarray(4,8)),Z==="esds"&&U.length>20&&U[19]!==0?(m.codec+="."+Ys(U[19]),m.codec+="."+Ys(U[20]>>>2&63).replace(/^0/,"")):m.codec="mp4a.40.2"):m.codec=m.codec.toLowerCase())}var ie=Ue(h,["mdia","mdhd"])[0];ie&&(m.timescale=Gc(ie)),f.push(m)}),f},eg=function(u,d=0){var f=Ue(u,["emsg"]);return f.map(h=>{var m=Wc.parseEmsgBox(new Uint8Array(h)),y=FE(m.message_data);return{cueTime:Wc.scaleTime(m.presentation_time,m.timescale,m.presentation_time_delta,d),duration:Wc.scaleTime(m.event_duration,m.timescale),frames:y}})};var Kc={findBox:Ue,parseType:Cr,timescale:Km,startTime:Qm,compositionStartTime:Ym,videoTrackIds:Jm,tracks:Zm,getTimescaleFromMediaHeader:Gc,getEmsgID3:eg},Qc=Ro,tg=function(u){var d=u[1]&31;return d<<=8,d|=u[2],d},Yo=function(u){return!!(u[1]&64)},Jo=function(u){var d=0;return(u[3]&48)>>>4>1&&(d+=u[4]+1),d},UE=function(u,d){var f=tg(u);return f===0?"pat":f===d?"pmt":d?"pes":null},jE=function(u){var d=Yo(u),f=4+Jo(u);return d&&(f+=u[f]+1),(u[f+10]&31)<<8|u[f+11]},$E=function(u){var d={},f=Yo(u),h=4+Jo(u);if(f&&(h+=u[h]+1),!!(u[h+5]&1)){var m,y,E;m=(u[h+1]&15)<<8|u[h+2],y=3+m-4,E=(u[h+10]&15)<<8|u[h+11];for(var b=12+E;b=u.byteLength)return null;var h=null,m;return m=u[f+7],m&192&&(h={},h.pts=(u[f+9]&14)<<27|(u[f+10]&255)<<20|(u[f+11]&254)<<12|(u[f+12]&255)<<5|(u[f+13]&254)>>>3,h.pts*=4,h.pts+=(u[f+13]&6)>>>1,h.dts=h.pts,m&64&&(h.dts=(u[f+14]&14)<<27|(u[f+15]&255)<<20|(u[f+16]&254)<<12|(u[f+17]&255)<<5|(u[f+18]&254)>>>3,h.dts*=4,h.dts+=(u[f+18]&6)>>>1)),h},Yc=function(u){switch(u){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},HE=function(u){for(var d=4+Jo(u),f=u.subarray(d),h=0,m=0,y=!1,E;m3&&(E=Yc(f[m+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},qE={parseType:UE,parsePat:jE,parsePmt:$E,parsePayloadUnitStartIndicator:Yo,parsePesType:VE,parsePesTime:zE,videoPacketContainsKeyFrame:HE},ig=Ro,wr=bm.handleRollover,me={};me.ts=qE,me.aac=Vc;var qn=we.ONE_SECOND_IN_TS,ht=188,_i=71,WE=function(u,d){for(var f=0,h=ht,m,y;h=0;){if(u[h]===_i&&(u[m]===_i||m===u.byteLength)){switch(y=u.subarray(h,m),E=me.ts.parseType(y,d.pid),E){case"pes":b=me.ts.parsePesType(y,d.table),D=me.ts.parsePayloadUnitStartIndicator(y),b==="audio"&&D&&(P=me.ts.parsePesTime(y),P&&(P.type="audio",f.audio.push(P),O=!0));break}if(O)break;h-=ht,m-=ht;continue}h--,m--}},GE=function(u,d,f){for(var h=0,m=ht,y,E,b,D,P,O,R,z,U=!1,Z={data:[],size:0};m=0;){if(u[h]===_i&&u[m]===_i){switch(y=u.subarray(h,m),E=me.ts.parseType(y,d.pid),E){case"pes":b=me.ts.parsePesType(y,d.table),D=me.ts.parsePayloadUnitStartIndicator(y),b==="video"&&D&&(P=me.ts.parsePesTime(y),P&&(P.type="video",f.video.push(P),U=!0));break}if(U)break;h-=ht,m-=ht;continue}h--,m--}},XE=function(u,d){if(u.audio&&u.audio.length){var f=d;(typeof f>"u"||isNaN(f))&&(f=u.audio[0].dts),u.audio.forEach(function(y){y.dts=wr(y.dts,f),y.pts=wr(y.pts,f),y.dtsTime=y.dts/qn,y.ptsTime=y.pts/qn})}if(u.video&&u.video.length){var h=d;if((typeof h>"u"||isNaN(h))&&(h=u.video[0].dts),u.video.forEach(function(y){y.dts=wr(y.dts,h),y.pts=wr(y.pts,h),y.dtsTime=y.dts/qn,y.ptsTime=y.pts/qn}),u.firstKeyFrame){var m=u.firstKeyFrame;m.dts=wr(m.dts,h),m.pts=wr(m.pts,h),m.dtsTime=m.dts/qn,m.ptsTime=m.pts/qn}}},KE=function(u){for(var d=!1,f=0,h=null,m=null,y=0,E=0,b;u.length-E>=3;){var D=me.aac.parseType(u,E);switch(D){case"timed-metadata":if(u.length-E<10){d=!0;break}if(y=me.aac.parseId3TagSize(u,E),y>u.length){d=!0;break}m===null&&(b=u.subarray(E,E+y),m=me.aac.parseAacTimestamp(b)),E+=y;break;case"audio":if(u.length-E<7){d=!0;break}if(y=me.aac.parseAdtsSize(u,E),y>u.length){d=!0;break}h===null&&(b=u.subarray(E,E+y),h=me.aac.parseSampleRate(b)),f++,E+=y;break;default:E++;break}if(d)return null}if(h===null||m===null)return null;var P=qn/h,O={audio:[{type:"audio",dts:m,pts:m},{type:"audio",dts:m+f*1024*P,pts:m+f*1024*P}]};return O},QE=function(u){var d={pid:null,table:null},f={};WE(u,d);for(var h in d.table)if(d.table.hasOwnProperty(h)){var m=d.table[h];switch(m){case ig.H264_STREAM_TYPE:f.video=[],GE(u,d,f),f.video.length===0&&delete f.video;break;case ig.ADTS_STREAM_TYPE:f.audio=[],ng(u,d,f),f.audio.length===0&&delete f.audio;break}}return f},YE=function(u,d){var f=me.aac.isLikelyAacData(u),h;return f?h=KE(u):h=QE(u),!h||!h.audio&&!h.video?null:(XE(h,d),h)},JE={inspect:YE,parseAudioPes_:ng};const ZE=function(u,d){d.on("data",function(f){const h=f.initSegment;f.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const m=f.data;f.data=m.buffer,u.postMessage({action:"data",segment:f,byteOffset:m.byteOffset,byteLength:m.byteLength},[f.data])}),d.on("done",function(f){u.postMessage({action:"done"})}),d.on("gopInfo",function(f){u.postMessage({action:"gopInfo",gopInfo:f})}),d.on("videoSegmentTimingInfo",function(f){const h={start:{decode:we.videoTsToSeconds(f.start.dts),presentation:we.videoTsToSeconds(f.start.pts)},end:{decode:we.videoTsToSeconds(f.end.dts),presentation:we.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=we.videoTsToSeconds(f.prependedContentDuration)),u.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),d.on("audioSegmentTimingInfo",function(f){const h={start:{decode:we.videoTsToSeconds(f.start.dts),presentation:we.videoTsToSeconds(f.start.pts)},end:{decode:we.videoTsToSeconds(f.end.dts),presentation:we.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=we.videoTsToSeconds(f.prependedContentDuration)),u.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),d.on("id3Frame",function(f){u.postMessage({action:"id3Frame",id3Frame:f})}),d.on("caption",function(f){u.postMessage({action:"caption",caption:f})}),d.on("trackinfo",function(f){u.postMessage({action:"trackinfo",trackInfo:f})}),d.on("audioTimingInfo",function(f){u.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:we.videoTsToSeconds(f.start),end:we.videoTsToSeconds(f.end)}})}),d.on("videoTimingInfo",function(f){u.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:we.videoTsToSeconds(f.start),end:we.videoTsToSeconds(f.end)}})}),d.on("log",function(f){u.postMessage({action:"log",log:f})})};class rg{constructor(d,f){this.options=f||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new iE.Transmuxer(this.options),ZE(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new wE,this.captionParser.init());const f=new Uint8Array(d.data,d.byteOffset,d.byteLength),h=this.captionParser.parse(f,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:f.buffer},[f.buffer])}probeMp4StartTime({timescales:d,data:f}){const h=Kc.startTime(d,f);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:f},[f.buffer])}probeMp4Tracks({data:d}){const f=Kc.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:f,data:d},[d.buffer])}probeEmsgID3({data:d,offset:f}){const h=Kc.getEmsgID3(d,f);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:f}){const h=typeof f=="number"&&!isNaN(f)?f*we.ONE_SECOND_IN_TS:void 0,m=JE.inspect(d,h);let y=null;m&&(y={hasVideo:m.video&&m.video.length===2||!1,hasAudio:m.audio&&m.audio.length===2||!1},y.hasVideo&&(y.videoStart=m.video[0].ptsTime),y.hasAudio&&(y.audioStart=m.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const f=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(f)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const f=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(we.secondsToVideoTs(f)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(we.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(u){if(u.data.action==="init"&&u.data.options){this.messageHandlers=new rg(self,u.data.options);return}this.messageHandlers||(this.messageHandlers=new rg(self)),u.data&&u.data.action&&u.data.action!=="init"&&this.messageHandlers[u.data.action]&&this.messageHandlers[u.data.action](u.data)}}));var YP=px(QP);const JP=(t,e,i)=>{const{type:n,initSegment:r,captions:s,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:c}=t.data.segment;e.buffer.push({captions:s,captionStreams:a,metadata:o});const p=t.data.segment.boxes||{data:t.data.segment.data},g={type:n,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof l<"u"&&(g.videoFrameDtsTime=l),typeof c<"u"&&(g.videoFramePtsTime=c),i(g)},ZP=({transmuxedData:t,callback:e})=>{t.buffer=[],e(t)},eI=(t,e)=>{e.gopInfo=t.data.gopInfo},yx=t=>{const{transmuxer:e,bytes:i,audioAppendStart:n,gopsToAlignWith:r,remux:s,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:c,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:g,onId3:v,onCaptions:S,onDone:_,onEndedTimeline:w,onTransmuxerLog:I,isEndOfTimeline:x}=t,T={buffer:[]};let C=x;const k=L=>{e.currentTransmux===t&&(L.data.action==="data"&&JP(L,T,a),L.data.action==="trackinfo"&&o(L.data.trackInfo),L.data.action==="gopInfo"&&eI(L,T),L.data.action==="audioTimingInfo"&&l(L.data.audioTimingInfo),L.data.action==="videoTimingInfo"&&c(L.data.videoTimingInfo),L.data.action==="videoSegmentTimingInfo"&&p(L.data.videoSegmentTimingInfo),L.data.action==="audioSegmentTimingInfo"&&g(L.data.audioSegmentTimingInfo),L.data.action==="id3Frame"&&v([L.data.id3Frame],L.data.id3Frame.dispatchType),L.data.action==="caption"&&S(L.data.caption),L.data.action==="endedtimeline"&&(C=!1,w()),L.data.action==="log"&&I(L.data.log),L.data.type==="transmuxed"&&(C||(e.onmessage=null,ZP({transmuxedData:T,callback:_}),vx(e))))};if(e.onmessage=k,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof s<"u"&&e.postMessage({action:"setRemux",remux:s}),i.byteLength){const L=i instanceof ArrayBuffer?i:i.buffer,N=i instanceof ArrayBuffer?0:i.byteOffset;e.postMessage({action:"push",data:L,byteOffset:N,byteLength:i.byteLength},[L])}x&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},vx=t=>{t.currentTransmux=null,t.transmuxQueue.length&&(t.currentTransmux=t.transmuxQueue.shift(),typeof t.currentTransmux=="function"?t.currentTransmux():yx(t.currentTransmux))},Fy=(t,e)=>{t.postMessage({action:e}),vx(t)},_x=(t,e)=>{if(!e.currentTransmux){e.currentTransmux=t,Fy(e,t);return}e.transmuxQueue.push(Fy.bind(null,e,t))},tI=t=>{_x("reset",t)},iI=t=>{_x("endTimeline",t)},Tx=t=>{if(!t.transmuxer.currentTransmux){t.transmuxer.currentTransmux=t,yx(t);return}t.transmuxer.transmuxQueue.push(t)},nI=t=>{const e=new YP;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:t}),e};var qd={reset:tI,endTimeline:iI,transmux:Tx,createTransmuxer:nI};const Fa=function(t){const e=t.transmuxer,i=t.endAction||t.action,n=t.callback,r=rn({},t,{endAction:null,transmuxer:null,callback:null}),s=a=>{a.data.action===i&&(e.removeEventListener("message",s),a.data.data&&(a.data.data=new Uint8Array(a.data.data,t.byteOffset||0,t.byteLength||a.data.data.byteLength),t.data&&(t.data=a.data.data)),n(a.data))};if(e.addEventListener("message",s),t.data){const a=t.data instanceof ArrayBuffer;r.byteOffset=a?0:t.data.byteOffset,r.byteLength=t.data.byteLength;const o=[a?t.data:t.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},Di={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ff=t=>{t.forEach(e=>{e.abort()})},rI=t=>({bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}),sI=t=>{const e=t.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return n.bytesReceived=t.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n},pm=(t,e)=>e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Di.TIMEOUT,xhr:e}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Di.ABORTED,xhr:e}:t?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Di.FAILURE,xhr:e}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Di.FAILURE,xhr:e}:null,Uy=(t,e,i)=>(n,r)=>{const s=r.response,a=pm(n,r);if(a)return i(a,t);if(s.byteLength!==16)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Di.FAILURE,xhr:r},t);const o=new DataView(s),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let c=0;c{const i=Lp(t.map.bytes);if(i!=="mp4"){const n=t.map.resolvedUri||t.map.uri;return e({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${n}`,code:Di.FAILURE})}Fa({action:"probeMp4Tracks",data:t.map.bytes,transmuxer:t.transmuxer,callback:({tracks:n,data:r})=>(t.map.bytes=r,n.forEach(function(s){t.map.tracks=t.map.tracks||{},!t.map.tracks[s.type]&&(t.map.tracks[s.type]=s,typeof s.id=="number"&&s.timescale&&(t.map.timescales=t.map.timescales||{},t.map.timescales[s.id]=s.timescale))}),e(null))})},aI=({segment:t,finishProcessingFn:e})=>(i,n)=>{const r=pm(i,n);if(r)return e(r,t);const s=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=s,e(null,t);t.map.bytes=s,xx(t,function(a){if(a)return a.xhr=n,a.status=n.status,e(a,t);e(null,t)})},oI=({segment:t,finishProcessingFn:e,responseType:i})=>(n,r)=>{const s=pm(n,r);if(s)return e(s,t);const a=i==="arraybuffer"||!r.responseText?r.response:XP(r.responseText.substring(t.lastReachedChar||0));return t.stats=rI(r),t.key?t.encryptedBytes=new Uint8Array(a):t.bytes=new Uint8Array(a),e(null,t)},lI=({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})=>{const S=t.map&&t.map.tracks||{},_=!!(S.audio&&S.video);let w=n.bind(null,t,"audio","start");const I=n.bind(null,t,"audio","end");let x=n.bind(null,t,"video","start");const T=n.bind(null,t,"video","end"),C=()=>Tx({bytes:e,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:_,onData:k=>{k.type=k.type==="combined"?"video":k.type,p(t,k)},onTrackInfo:k=>{i&&(_&&(k.isMuxed=!0),i(t,k))},onAudioTimingInfo:k=>{w&&typeof k.start<"u"&&(w(k.start),w=null),I&&typeof k.end<"u"&&I(k.end)},onVideoTimingInfo:k=>{x&&typeof k.start<"u"&&(x(k.start),x=null),T&&typeof k.end<"u"&&T(k.end)},onVideoSegmentTimingInfo:k=>{r(k)},onAudioSegmentTimingInfo:k=>{s(k)},onId3:(k,L)=>{a(t,k,L)},onCaptions:k=>{o(t,[k])},isEndOfTimeline:l,onEndedTimeline:()=>{c()},onTransmuxerLog:v,onDone:k=>{g&&(k.type=k.type==="combined"?"video":k.type,g(null,t,k))}});Fa({action:"probeTs",transmuxer:t.transmuxer,data:e,baseStartTime:t.baseStartTime,callback:k=>{t.bytes=e=k.data;const L=k.result;L&&(i(t,{hasAudio:L.hasAudio,hasVideo:L.hasVideo,isMuxed:_}),i=null),C()}})},Sx=({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})=>{let S=new Uint8Array(e);if(L3(S)){t.isFmp4=!0;const{tracks:_}=t.map,w={isFmp4:!0,hasVideo:!!_.video,hasAudio:!!_.audio};_.audio&&_.audio.codec&&_.audio.codec!=="enca"&&(w.audioCodec=_.audio.codec),_.video&&_.video.codec&&_.video.codec!=="encv"&&(w.videoCodec=_.video.codec),_.video&&_.audio&&(w.isMuxed=!0),i(t,w);const I=(x,T)=>{p(t,{data:S,type:w.hasAudio&&!w.isMuxed?"audio":"video"}),T&&T.length&&a(t,T),x&&x.length&&o(t,x),g(null,t,{})};Fa({action:"probeMp4StartTime",timescales:t.map.timescales,data:S,transmuxer:t.transmuxer,callback:({data:x,startTime:T})=>{e=x.buffer,t.bytes=S=x,w.hasAudio&&!w.isMuxed&&n(t,"audio","start",T),w.hasVideo&&n(t,"video","start",T),Fa({action:"probeEmsgID3",data:S,transmuxer:t.transmuxer,offset:T,callback:({emsgData:C,id3Frames:k})=>{if(e=C.buffer,t.bytes=S=C,!_.video||!C.byteLength||!t.transmuxer){I(void 0,k);return}Fa({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:S,timescales:t.map.timescales,trackIds:[_.video.id],callback:L=>{e=L.data.buffer,t.bytes=S=L.data,L.logs.forEach(function(N){v(ve(N,{stream:"mp4CaptionParser"}))}),I(L.captions,k)}})}})}});return}if(!t.transmuxer){g(null,t,{});return}if(typeof t.container>"u"&&(t.container=Lp(S)),t.container!=="ts"&&t.container!=="aac"){i(t,{hasAudio:!1,hasVideo:!1}),g(null,t,{});return}lI({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})},Ex=function({id:t,key:e,encryptedBytes:i,decryptionWorker:n},r){const s=o=>{if(o.data.source===t){n.removeEventListener("message",s);const l=o.data.decrypted;r(new Uint8Array(l.bytes,l.byteOffset,l.byteLength))}};n.addEventListener("message",s);let a;e.bytes.slice?a=e.bytes.slice():a=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(lx({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},uI=({decryptionWorker:t,segment:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})=>{Ex({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:t},S=>{e.bytes=S,Sx({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})})},cI=({activeXhrs:t,decryptionWorker:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})=>{let S=0,_=!1;return(w,I)=>{if(!_){if(w)return _=!0,ff(t),g(w,I);if(S+=1,S===t.length){const x=function(){if(I.encryptedBytes)return uI({decryptionWorker:e,segment:I,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v});Sx({segment:I,bytes:I.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:g,onTransmuxerLog:v})};if(I.endOfAllRequests=Date.now(),I.map&&I.map.encryptedBytes&&!I.map.bytes)return Ex({decryptionWorker:e,id:I.requestId+"-init",encryptedBytes:I.map.encryptedBytes,key:I.map.key},T=>{I.map.bytes=T,xx(I,C=>{if(C)return ff(t),g(C,I);x()})});x()}}}},dI=({loadendState:t,abortFn:e})=>i=>{i.target.aborted&&e&&!t.calledAbortFn&&(e(),t.calledAbortFn=!0)},hI=({segment:t,progressFn:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p})=>g=>{if(!g.target.aborted)return t.stats=ve(t.stats,sI(g)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),e(g,t)},fI=({xhr:t,xhrOptions:e,decryptionWorker:i,segment:n,abortFn:r,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:g,isEndOfTimeline:v,endedTimelineFn:S,dataFn:_,doneFn:w,onTransmuxerLog:I})=>{const x=[],T=cI({activeXhrs:x,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:g,isEndOfTimeline:v,endedTimelineFn:S,dataFn:_,doneFn:w,onTransmuxerLog:I});if(n.key&&!n.key.bytes){const F=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&F.push(n.map.key);const $=ve(e,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),K=Uy(n,F,T),Y=t($,K);x.push(Y)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const ne=ve(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer"}),he=Uy(n,[n.map.key],T),Q=t(ne,he);x.push(Q)}const $=ve(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:df(n.map)}),K=aI({segment:n,finishProcessingFn:T}),Y=t($,K);x.push(Y)}const C=ve(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:df(n)}),k=oI({segment:n,finishProcessingFn:T,responseType:C.responseType}),L=t(C,k);L.addEventListener("progress",hI({segment:n,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:g,isEndOfTimeline:v,endedTimelineFn:S,dataFn:_})),x.push(L);const N={};return x.forEach(F=>{F.addEventListener("loadend",dI({loadendState:N,abortFn:r}))}),()=>ff(x)},pI=si("CodecUtils"),mI=function(t){const e=t.attributes||{};if(e.CODECS)return Si(e.CODECS)},bx=(t,e)=>{const i=e.attributes||{};return t&&t.mediaGroups&&t.mediaGroups.AUDIO&&i.AUDIO&&t.mediaGroups.AUDIO[i.AUDIO]},gI=(t,e)=>{if(!bx(t,e))return!0;const i=e.attributes||{},n=t.mediaGroups.AUDIO[i.AUDIO];for(const r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1},Ru=function(t){const e={};return t.forEach(({mediaType:i,type:n,details:r})=>{e[i]=e[i]||[],e[i].push(U1(`${n}${r}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){pI(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},jy=function(t){let e=0;return t.audio&&e++,t.video&&e++,e},Ua=function(t,e){const i=e.attributes||{},n=Ru(mI(e)||[]);if(bx(t,e)&&!n.audio&&!gI(t,e)){const r=Ru(NA(t,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Sl=si("PlaylistSelector"),$y=function(t){if(!t||!t.playlist)return;const e=t.playlist;return JSON.stringify({id:e.id,bandwidth:t.bandwidth,width:t.width,height:t.height,codecs:e.attributes&&e.attributes.CODECS||""})},Mu=function(t,e){if(!t)return"";const i=A.getComputedStyle(t);return i?i[e]:""},os=function(t,e){const i=t.slice();t.sort(function(n,r){const s=e(n,r);return s===0?i.indexOf(n)-i.indexOf(r):s})},mm=function(t,e){let i,n;return t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),i=i||A.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||A.Number.MAX_VALUE,i-n},yI=function(t,e){let i,n;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),i=i||A.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||A.Number.MAX_VALUE,i===n&&t.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?t.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-n};let Cx=function(t,e,i,n,r,s){if(!t)return;const a={bandwidth:e,width:i,height:n,limitRenditionByPlayerDimensions:r};let o=t.playlists;Dt.isAudioOnly(t)&&(o=s.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map(L=>{let N;const F=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.width,$=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.height;return N=L.attributes&&L.attributes.BANDWIDTH,N=N||A.Number.MAX_VALUE,{bandwidth:N,width:F,height:$,playlist:L}});os(l,(L,N)=>L.bandwidth-N.bandwidth),l=l.filter(L=>!Dt.isIncompatible(L.playlist));let c=l.filter(L=>Dt.isEnabled(L.playlist));c.length||(c=l.filter(L=>!Dt.isDisabled(L.playlist)));const p=c.filter(L=>L.bandwidth*Qe.BANDWIDTH_VARIANCEL.bandwidth===g.bandwidth)[0];if(r===!1){const L=v||c[0]||l[0];if(L&&L.playlist){let N="sortedPlaylistReps";return v&&(N="bandwidthBestRep"),c[0]&&(N="enabledPlaylistReps"),Sl(`choosing ${$y(L)} using ${N} with options`,a),L.playlist}return Sl("could not choose a playlist with options",a),null}const S=p.filter(L=>L.width&&L.height);os(S,(L,N)=>L.width-N.width);const _=S.filter(L=>L.width===i&&L.height===n);g=_[_.length-1];const w=_.filter(L=>L.bandwidth===g.bandwidth)[0];let I,x,T;w||(I=S.filter(L=>L.width>i||L.height>n),x=I.filter(L=>L.width===I[0].width&&L.height===I[0].height),g=x[x.length-1],T=x.filter(L=>L.bandwidth===g.bandwidth)[0]);let C;if(s.leastPixelDiffSelector){const L=S.map(N=>(N.pixelDiff=Math.abs(N.width-i)+Math.abs(N.height-n),N));os(L,(N,F)=>N.pixelDiff===F.pixelDiff?F.bandwidth-N.bandwidth:N.pixelDiff-F.pixelDiff),C=L[0]}const k=C||T||w||v||c[0]||l[0];if(k&&k.playlist){let L="sortedPlaylistReps";return C?L="leastPixelDiffRep":T?L="resolutionPlusOneRep":w?L="resolutionBestRep":v?L="bandwidthBestRep":c[0]&&(L="enabledPlaylistReps"),Sl(`choosing ${$y(k)} using ${L} with options`,a),k.playlist}return Sl("could not choose a playlist with options",a),null};const Vy=function(){const t=this.useDevicePixelRatio&&A.devicePixelRatio||1;return Cx(this.playlists.main,this.systemBandwidth,parseInt(Mu(this.tech_.el(),"width"),10)*t,parseInt(Mu(this.tech_.el(),"height"),10)*t,this.limitRenditionByPlayerDimensions,this.playlistController_)},vI=function(t){let e=-1,i=-1;if(t<0||t>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const n=this.useDevicePixelRatio&&A.devicePixelRatio||1;return e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=t*this.systemBandwidth+(1-t)*e,i=this.systemBandwidth),Cx(this.playlists.main,e,parseInt(Mu(this.tech_.el(),"width"),10)*n,parseInt(Mu(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},_I=function(t){const{main:e,currentTime:i,bandwidth:n,duration:r,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=t,c=e.playlists.filter(_=>!Dt.isIncompatible(_));let p=c.filter(Dt.isEnabled);p.length||(p=c.filter(_=>!Dt.isDisabled(_)));const v=p.filter(Dt.hasAttribute.bind(null,"BANDWIDTH")).map(_=>{const I=l.getSyncPoint(_,r,o,i)?1:2,T=Dt.estimateSegmentRequestTime(s,n,_)*I-a;return{playlist:_,rebufferingImpact:T}}),S=v.filter(_=>_.rebufferingImpact<=0);return os(S,(_,w)=>mm(w.playlist,_.playlist)),S.length?S[0]:(os(v,(_,w)=>_.rebufferingImpact-w.rebufferingImpact),v[0]||null)},TI=function(){const t=this.playlists.main.playlists.filter(Dt.isEnabled);return os(t,(i,n)=>mm(i,n)),t.filter(i=>!!Ua(this.playlists.main,i).video)[0]||null},xI=t=>{let e=0,i;return t.bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach(n=>{i.set(n,e),e+=n.byteLength})),i},SI=function(t,e,i){if(!t[i]){e.trigger({type:"usage",name:"vhs-608"});let n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);const r=e.textTracks().getTrackById(n);if(r)t[i]=r;else{const s=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=i,o=i,l=!1;const c=s[n];c&&(a=c.label,o=c.language,l=c.default),t[i]=e.addRemoteTextTrack({kind:"captions",id:n,default:l,label:a,language:o},!1).track}}},EI=function({inbandTextTracks:t,captionArray:e,timestampOffset:i}){if(!e)return;const n=A.WebKitDataCue||A.VTTCue;e.forEach(r=>{const s=r.stream;r.content?r.content.forEach(a=>{const o=new n(r.startTime+i,r.endTime+i,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",t[s].addCue(o)}):t[s].addCue(new n(r.startTime+i,r.endTime+i,r.text))})},bI=function(t){Object.defineProperties(t.frame,{id:{get(){return M.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return M.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return M.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})},CI=({inbandTextTracks:t,metadataArray:e,timestampOffset:i,videoDuration:n})=>{if(!e)return;const r=A.WebKitDataCue||A.VTTCue,s=t.metadataTrack_;if(!s||(e.forEach(p=>{const g=p.cueTime+i;typeof g!="number"||A.isNaN(g)||g<0||!(g<1/0)||!p.frames||!p.frames.length||p.frames.forEach(v=>{const S=new r(g,g,v.value||v.url||v.data||"");S.frame=v,S.value=v,bI(S),s.addCue(S)})}),!s.cues||!s.cues.length))return;const a=s.cues,o=[];for(let p=0;p{const v=p[g.startTime]||[];return v.push(g),p[g.startTime]=v,p},{}),c=Object.keys(l).sort((p,g)=>Number(p)-Number(g));c.forEach((p,g)=>{const v=l[p],S=isFinite(n)?n:0,_=Number(c[g+1])||S;v.forEach(w=>{w.endTime=_})})},wI={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},DI=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),AI=({inbandTextTracks:t,dateRanges:e})=>{const i=t.metadataTrack_;if(!i)return;const n=A.WebKitDataCue||A.VTTCue;e.forEach(r=>{for(const s of Object.keys(r)){if(DI.has(s))continue;const a=new n(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:wI[s],data:r[s]},(s==="scte35Out"||s==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(a)}r.processDateRange()})},zy=(t,e,i)=>{t.metadataTrack_||(t.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,M.browser.IS_ANY_SAFARI||(t.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ea=function(t,e,i){let n,r;if(i&&i.cues)for(n=i.cues.length;n--;)r=i.cues[n],r.startTime>=t&&r.endTime<=e&&i.removeCue(r)},kI=function(t){const e=t.cues;if(!e)return;const i={};for(let n=e.length-1;n>=0;n--){const r=e[n],s=`${r.startTime}-${r.endTime}-${r.text}`;i[s]?t.removeCue(r):i[s]=r}},PI=(t,e,i)=>{if(typeof e>"u"||e===null||!t.length)return[];const n=Math.ceil((e-i+3)*xu.ONE_SECOND_IN_TS);let r;for(r=0;rn);r++);return t.slice(r)},II=(t,e,i)=>{if(!e.length)return t;if(i)return e.slice();const n=e[0].pts;let r=0;for(r;r=n);r++);return t.slice(0,r).concat(e)},LI=(t,e,i,n)=>{const r=Math.ceil((e-n)*xu.ONE_SECOND_IN_TS),s=Math.ceil((i-n)*xu.ONE_SECOND_IN_TS),a=t.slice();let o=t.length;for(;o--&&!(t[o].pts<=s););if(o===-1)return a;let l=o+1;for(;l--&&!(t[l].pts<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a},OI=function(t,e){if(!t&&!e||!t&&e||t&&!e)return!1;if(t===e)return!0;const i=Object.keys(t).sort(),n=Object.keys(e).sort();if(i.length!==n.length)return!1;for(let r=0;ri))return s}return n.length===0?0:n[n.length-1]},fa=1,RI=500,Hy=t=>typeof t=="number"&&isFinite(t),El=1/60,MI=(t,e,i)=>t!=="main"||!e||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,BI=(t,e,i)=>{let n=e-Qe.BACK_BUFFER_LENGTH;t.length&&(n=Math.max(n,t.start(0)));const r=e-i;return Math.min(r,n)},Nr=t=>{const{startOfSegment:e,duration:i,segment:n,part:r,playlist:{mediaSequence:s,id:a,segments:o=[]},mediaIndex:l,partIndex:c,timeline:p}=t,g=o.length-1;let v="mediaIndex/partIndex increment";t.getMediaInfoForTime?v=`getMediaInfoForTime (${t.getMediaInfoForTime})`:t.isSyncRequest&&(v="getSyncSegmentCandidate (isSyncRequest)"),t.independent&&(v+=` with independent ${t.independent}`);const S=typeof c=="number",_=t.segment.uri?"segment":"pre-segment",w=S?XT({preloadSegment:n})-1:0;return`${_} [${s+l}/${s+g}]`+(S?` part [${c}/${w}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(S?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${i}] timeline [${p}] selected by [${v}] playlist [${a}]`},qy=t=>`${t}TimingInfo`,Wy=(t,e)=>t.length?t.end(t.length-1):e,FI=({segmentTimeline:t,currentTimeline:e,startOfSegment:i,buffered:n,calculateTimestampOffsetForEachSegment:r,overrideCheck:s})=>r?Wy(n,i):!s&&t===e?null:t{if(e===i)return!1;if(n==="audio"){const s=t.lastTimelineChange({type:"main"});return!s||s.to!==i}if(n==="main"&&r){const s=t.pendingTimelineChange({type:"audio"});return!(s&&s.to===i)}return!1},UI=t=>{let e=0;return["video","audio"].forEach(function(i){const n=t[`${i}TimingInfo`];if(!n)return;const{start:r,end:s}=n;let a;typeof r=="bigint"||typeof s=="bigint"?a=A.BigInt(s)-A.BigInt(r):typeof r=="number"&&typeof s=="number"&&(a=s-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&et?Math.round(t)>e+Bn:!1,jI=(t,e)=>{if(e!=="hls")return null;const i=UI({audioTimingInfo:t.audioTimingInfo,videoTimingInfo:t.videoTimingInfo});if(!i)return null;const n=t.playlist.targetDuration,r=Xy({segmentDuration:i,maxDuration:n*2}),s=Xy({segmentDuration:i,maxDuration:n}),a=`Segment with index ${t.mediaIndex} from playlist ${t.playlist.id} has a duration of ${i} when the reported duration is ${t.duration} and the target duration is ${n}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return r||s?{severity:r?"warn":"info",message:a}:null};class pf extends M.EventTarget{constructor(e,i={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.calculateTimestampOffsetForEachSegment_=e.calculateTimestampOffsetForEachSegment,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=si(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return qd.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,A.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&qd.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ot();if(this.loaderType_==="main"){const{hasAudio:i,hasVideo:n,isMuxed:r}=e;if(n&&i&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,i=!1){if(!e)return null;const n=Nu(e);let r=this.initSegments_[n];return i&&!r&&e.bytes&&(this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,i=!1){if(!e)return null;const n=ux(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&i&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(r||e).resolvedUri};return r&&(s.bytes=r.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,i={}){if(!e)return;const n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(n&&(n.id?s=n.id:n.uri&&(s=n.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-n.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}r&&(r.mediaIndex-=a,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}pause(){this.checkBufferTimeout_&&(A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&qd.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,i,n=()=>{},r=!1){if(i===1/0&&(i=this.duration_()),i<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let s=1;const a=()=>{s--,s===0&&n()};(r||!this.audioDisabled_)&&(s++,this.sourceUpdater_.removeAudio(e,i,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=LI(this.gopBuffer_,e,i,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,i,a));for(const o in this.inbandTextTracks_)Ea(e,i,this.inbandTextTracks_[o]);Ea(e,i,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.setTimeout(this.monitorBufferTick_.bind(this),RI)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&(typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,i=this.playlist_,n=this.partIndex){if(!i||!this.mediaSource_)return!1;const r=typeof e=="number"&&i.segments[e],s=e+1===i.segments.length,a=!r||!r.parts||n+1===r.parts.length;return i.endList&&this.mediaSource_.readyState==="open"&&s&&a}chooseNextRequest_(){const e=this.buffered_(),i=Oy(e)||0,n=um(e,this.currentTime_()),r=!this.hasPlayed_()&&n>=1,s=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||r||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=NI(this.currentTimeline_,a,i);else if(this.mediaIndex!==null){const v=a[this.mediaIndex],S=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=v.end?v.end:i,v.parts&&v.parts[S+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=S+1):o.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:v,startTime:S,partIndex:_}=Dt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?i:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${i}`:`currentTime ${this.currentTime_()}`,o.mediaIndex=v,o.startOfSegment=S,o.partIndex=_}const l=a[o.mediaIndex];let c=l&&typeof o.partIndex=="number"&&l.parts&&l.parts[o.partIndex];if(!l||typeof o.partIndex=="number"&&!c)return null;typeof o.partIndex!="number"&&l.parts&&(o.partIndex=0,c=l.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&c&&!p&&!c.independent)if(o.partIndex===0){const v=a[o.mediaIndex-1],S=v.parts&&v.parts.length&&v.parts[v.parts.length-1];S&&S.independent&&(o.mediaIndex-=1,o.partIndex=v.parts.length-1,o.independent="previous segment")}else l.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const g=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&g&&!this.seeking_()?null:this.generateSegmentInfo_(o)}generateSegmentInfo_(e){const{independent:i,playlist:n,mediaIndex:r,startOfSegment:s,isSyncRequest:a,partIndex:o,forceTimestampOffset:l,getMediaInfoForTime:c}=e,p=n.segments[r],g=typeof o=="number"&&p.parts[o],v={requestId:"segment-loader-"+Math.random(),uri:g&&g.resolvedUri||p.resolvedUri,mediaIndex:r,partIndex:g?o:null,isSyncRequest:a,startOfSegment:s,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:p.timeline,duration:g&&g.duration||p.duration,segment:p,part:g,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:c,independent:i},S=typeof l<"u"?l:this.isPendingTimestampOffset_;v.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:S});const _=Oy(this.sourceUpdater_.audioBuffered());return typeof _=="number"&&(v.audioAppendStart=_-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(v.gopsToAlignWith=PI(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),v}timestampOffsetForSegment_(e){return FI(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const i=this.currentTime_(),n=e.bandwidth,r=this.pendingSegment_.duration,s=Dt.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),a=sP(this.buffered_(),i,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const o=_I({main:this.vhs_.playlists.main,currentTime:i,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=s-a-o.rebufferingImpact;let p=.5;a<=Bn&&(p=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c{s[a.stream]=s[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=s[a.stream];o.startTime=Math.min(o.startTime,a.startTime+r),o.endTime=Math.max(o.endTime,a.endTime+r),o.captions.push(a)}),Object.keys(s).forEach(a=>{const{startTime:o,endTime:l,captions:c}=s[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${l} for ${a}`),SI(p,this.vhs_.tech_,a),Ea(o,l,p[a]),EI({captionArray:c,inbandTextTracks:p,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,i,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,i,n));return}this.addMetadataToTextTrack(n,i,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(i=>i())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(i=>i())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Gy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,i=this.getCurrentMediaInfo_();if(!e||!i)return!1;const{hasAudio:n,hasVideo:r,isMuxed:s}=i;return!(r&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Gy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,i));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[qy(i.type)].start;else{const r=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&r&&r.hasVideo;let a;s&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,i.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,i)}}updateAppendInitSegmentStatus(e,i){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[i]!==e.playlist&&(this.appendInitSegment_[i]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:i,map:n,playlist:r}){if(n){const s=Nu(n);if(this.activeInitSegmentId_===s)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=s}return i&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,i):null}handleQuotaExceededError_({segmentInfo:e,type:i,bytes:n},r){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+nr(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+nr(a).join(", "));const o=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(l-o<=fa&&p-c<=fa){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${nr(s).join(", ")}, video buffer: ${nr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:i,bytes:n}));const v=this.currentTime_()-fa;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${v}`),this.remove(0,v,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${fa}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=A.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},fa*1e3)},!0)}handleAppendError_({segmentInfo:e,type:i,bytes:n},r){if(r){if(r.code===wx){this.handleQuotaExceededError_({segmentInfo:e,type:i,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error(`${i} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data:r,bytes:s}){if(!s){const a=[r];let o=r.byteLength;n&&(a.unshift(n),o+=n.byteLength),s=xI({bytes:o,segments:a})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:i,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:i,bytes:s}))}handleSegmentTimingInfo_(e,i,n){if(!this.pendingSegment_||i!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,s=`${e}TimingInfo`;r[s]||(r[s]={}),r[s].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[s].transmuxedPresentationStart=n.start.presentation,r[s].transmuxedDecodeStart=n.start.decode,r[s].transmuxedPresentationEnd=n.end.presentation,r[s].transmuxedDecodeEnd=n.end.decode,r[s].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,i){const{type:n,data:r}=i;if(!r||!r.byteLength||n==="audio"&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:n,initSegment:i.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:s,data:r})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(()=>{const i=rn({},e,{forceTimestampOffset:!0});rn(e,this.generateSegmentInfo_(i)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||r&&s;this.logger_(`Requesting ${Nr(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=fI({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:l,stream:c})=>{this.logger_(`${Nr(e)} logged from transmuxer stream ${c} as a ${l}: ${o}`)}})}trimBackBuffer_(e){const i=BI(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);i>0&&this.remove(0,i)}createSimplifiedSegmentObj_(e){const i=e.segment,n=e.part,r={resolvedUri:n?n.resolvedUri:i.resolvedUri,byterange:n?n.byterange:i.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===i.timeline&&(s.videoTimingInfo?r.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(r.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),i.key){const a=i.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(i.key),r.key.iv=a}return i.map&&(r.map=this.initSegmentForMap(i.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,i){if(this.pendingSegment_.byteLength=i.bytesReceived,e"u"||c.end!==r+s?r:o.start}waitForAppendsToComplete_(e){const i=this.getCurrentMediaInfo_(e);if(!i){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:n,hasVideo:r,isMuxed:s}=i,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&n&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const i=MI(this.loaderType_,this.getCurrentMediaInfo_(),e);return i?(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let i=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),i=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),i=!0),i&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:i,timingInfo:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:i&&typeof i.transmuxedDecodeStart=="number"?i.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const i=this.getMediaInfo_(),r=this.loaderType_==="main"&&i&&i.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const i=jI(e,this.sourceType_);if(i&&(i.severity==="warn"?M.log.warn(i.message):this.logger_(i.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Nr(e)}`);return}this.logger_(`Appended ${Nr(e)}`),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const n=e.segment,r=e.part,s=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(s||a){this.logger_(`bad ${s?"segment":"part"} ${Nr(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},$I=["video","audio"],mf=(t,e)=>{const i=e[`${t}Buffer`];return i&&i.updating||e.queuePending[t]},VI=(t,e)=>{for(let i=0;i{if(e.queue.length===0)return;let i=0,n=e.queue[i];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),ls("audio",e),ls("video",e));return}if(t!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||mf(t,e))){if(n.type!==t){if(i=VI(t,e.queue),i===null)return;n=e.queue[i]}if(e.queue.splice(i,1),e.queuePending[t]=n,n.action(t,e),!n.doneFn){e.queuePending[t]=null,ls(t,e);return}}},Ax=(t,e)=>{const i=e[`${t}Buffer`],n=Dx(t);i&&(i.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),i.removeEventListener("error",e[`on${n}Error_`]),e.codecs[t]=null,e[`${t}Buffer`]=null)},Ei=(t,e)=>t&&e&&Array.prototype.indexOf.call(t.sourceBuffers,e)!==-1,Rt={appendBuffer:(t,e,i)=>(n,r)=>{const s=r[`${n}Buffer`];if(Ei(r.mediaSource,s)){r.logger_(`Appending segment ${e.mediaIndex}'s ${t.length} bytes to ${n}Buffer`);try{s.appendBuffer(t)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===wx?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,i(a)}}},remove:(t,e)=>(i,n)=>{const r=n[`${i}Buffer`];if(Ei(n.mediaSource,r)){n.logger_(`Removing ${t} to ${e} from ${i}Buffer`);try{r.remove(t,e)}catch{n.logger_(`Remove ${t} to ${e} from ${i}Buffer failed`)}}},timestampOffset:t=>(e,i)=>{const n=i[`${e}Buffer`];Ei(i.mediaSource,n)&&(i.logger_(`Setting ${e}timestampOffset to ${t}`),n.timestampOffset=t)},callback:t=>(e,i)=>{t()},endOfStream:t=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(i){M.log.warn("Failed to call media source endOfStream",i)}}},duration:t=>e=>{e.logger_(`Setting mediaSource duration to ${t}`);try{e.mediaSource.duration=t}catch(i){M.log.warn("Failed to set media source duration",i)}},abort:()=>(t,e)=>{if(e.mediaSource.readyState!=="open")return;const i=e[`${t}Buffer`];if(Ei(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(n){M.log.warn(`Failed to abort on ${t}Buffer`,n)}}},addSourceBuffer:(t,e)=>i=>{const n=Dx(t),r=ro(e);i.logger_(`Adding ${t}Buffer with codec ${e} to mediaSource`);const s=i.mediaSource.addSourceBuffer(r);s.addEventListener("updateend",i[`on${n}UpdateEnd_`]),s.addEventListener("error",i[`on${n}Error_`]),i.codecs[t]=e,i[`${t}Buffer`]=s},removeSourceBuffer:t=>e=>{const i=e[`${t}Buffer`];if(Ax(t,e),!!Ei(e.mediaSource,i)){e.logger_(`Removing ${t}Buffer with codec ${e.codecs[t]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(i)}catch(n){M.log.warn(`Failed to removeSourceBuffer ${t}Buffer`,n)}}},changeType:t=>(e,i)=>{const n=i[`${e}Buffer`],r=ro(t);Ei(i.mediaSource,n)&&i.codecs[e]!==t&&(i.logger_(`changing ${e}Buffer codec from ${i.codecs[e]} to ${t}`),n.changeType(r),i.codecs[e]=t)}},Mt=({type:t,sourceUpdater:e,action:i,doneFn:n,name:r})=>{e.queue.push({type:t,action:i,doneFn:n,name:r}),ls(t,e)},Ky=(t,e)=>i=>{const n=e[`${t}Buffered`](),r=iP(n);if(e.logger_(`${t} source buffer update end. Buffered: -`,r),e.queuePending[t]){const s=e.queuePending[t].doneFn;e.queuePending[t]=null,s&&s(e[`${t}Error_`])}ls(t,e)};class kx extends M.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>ls("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=si("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Ky("video",this),this.onAudioUpdateEnd_=Ky("audio",this),this.onVideoError_=i=>{this.videoError_=i},this.onAudioError_=i=>{this.audioError_=i},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,i){Mt({type:"mediaSource",sourceUpdater:this,action:Rt.addSourceBuffer(e,i),name:"addSourceBuffer"})}abort(e){Mt({type:e,sourceUpdater:this,action:Rt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){M.log.error("removeSourceBuffer is not supported!");return}Mt({type:"mediaSource",sourceUpdater:this,action:Rt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!M.browser.IS_FIREFOX&&A.MediaSource&&A.MediaSource.prototype&&typeof A.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return A.SourceBuffer&&A.SourceBuffer.prototype&&typeof A.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,i){if(!this.canChangeType()){M.log.error("changeType is not supported!");return}Mt({type:e,sourceUpdater:this,action:Rt.changeType(i),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(i=>{const n=e[i];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(i,n);this.canChangeType()&&this.changeType(i,n)})}appendBuffer(e,i){const{segmentInfo:n,type:r,bytes:s}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,i]),this.logger_(`delayed audio append of ${s.length} until video append`);return}const a=i;if(Mt({type:r,sourceUpdater:this,action:Rt.appendBuffer(s,n||{mediaIndex:-1},a),doneFn:i,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return Ei(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ot()}videoBuffered(){return Ei(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ot()}buffered(){const e=Ei(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,i=Ei(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return i&&!e?this.audioBuffered():e&&!i?this.videoBuffered():rP(this.audioBuffered(),this.videoBuffered())}setDuration(e,i=Wi){Mt({type:"mediaSource",sourceUpdater:this,action:Rt.duration(e),name:"duration",doneFn:i})}endOfStream(e=null,i=Wi){typeof e!="string"&&(e=void 0),Mt({type:"mediaSource",sourceUpdater:this,action:Rt.endOfStream(e),name:"endOfStream",doneFn:i})}removeAudio(e,i,n=Wi){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}Mt({type:"audio",sourceUpdater:this,action:Rt.remove(e,i),doneFn:n,name:"remove"})}removeVideo(e,i,n=Wi){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}Mt({type:"video",sourceUpdater:this,action:Rt.remove(e,i),doneFn:n,name:"remove"})}updating(){return!!(mf("audio",this)||mf("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Mt({type:"audio",sourceUpdater:this,action:Rt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Mt({type:"video",sourceUpdater:this,action:Rt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Mt({type:"audio",sourceUpdater:this,action:Rt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Mt({type:"video",sourceUpdater:this,action:Rt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),$I.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Ax(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Qy=t=>decodeURIComponent(escape(String.fromCharCode.apply(null,t))),Yy=new Uint8Array(` - -`.split("").map(t=>t.charCodeAt(0)));class zI extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class HI extends pf{constructor(e,i={}){super(e,i),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return ot();const e=this.subtitlesTrack_.cues,i=e[0].startTime,n=e[e.length-1].startTime;return ot([[i,n]])}initSegmentForMap(e,i=!1){if(!e)return null;const n=Nu(e);let r=this.initSegments_[n];if(i&&!r&&e.bytes){const s=Yy.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(Yy,e.bytes.byteLength),this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,i){Ea(e,i,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const i=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",i),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,i,n){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(i.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Di.TIMEOUT&&this.handleTimeout_(),e.code===Di.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,i.stats),i.key&&this.segmentKey(i.key,!0),this.state="APPENDING",this.trigger("appending");const s=r.segment;if(s.map&&(s.map.bytes=i.map.bytes),r.bytes=i.bytes,typeof A.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,i,n),()=>this.stopForError({message:"Error loading vtt.js"}));return}s.requested=!0;try{this.parseVTTCues_(r)}catch(a){this.stopForError({message:a.message});return}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(a=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new A.VTTCue(a.startTime,a.endTime,a.text):a)}),kI(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let i,n=!1;if(typeof A.WebVTT!="function")throw new zI;typeof A.TextDecoder=="function"?i=new A.TextDecoder("utf8"):(i=A.WebVTT.StringDecoder(),n=!0);const r=new A.WebVTT.Parser(A,A.vttjs,i);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=a=>{e.timestampmap=a},r.onparsingerror=a=>{M.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;n&&(a=Qy(a)),r.parse(a)}let s=e.bytes;n&&(s=Qy(s)),r.parse(s),r.flush()}updateTimeMapping_(e,i,n){const r=e.segment;if(!i)return;if(!e.cues.length){r.empty=!0;return}const s=e.timestampmap,a=s.MPEGTS/xu.ONE_SECOND_IN_TS-s.LOCAL+i.mapping;if(e.cues.forEach(o=>{o.startTime+=a,o.endTime+=a}),!n.syncInfo){const o=e.cues[0].startTime,l=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(o,l-r.duration)}}}}const qI=function(t,e){const i=t.cues;for(let n=0;n=r.adStartTime&&e<=r.adEndTime)return r}return null},WI=function(t,e,i=0){if(!t.segments)return;let n=i,r;for(let s=0;si!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(t,e,i,n,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let s=null,a=null;const o=af(e);r=r||0;for(let l=0;l{let s=null,a=null;r=r||0;const o=af(e);for(let l=0;l=S)&&(a=S,s={time:v,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return s}},{name:"Discontinuity",run:(t,e,i,n,r)=>{let s=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o=g)&&(a=g,s={time:p.time,segmentIndex:l,partIndex:null})}}}return s}},{name:"Playlist",run:(t,e,i,n,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class XI extends M.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=si("SyncController")}getSyncPoint(e,i,n,r){const s=this.runStrategies_(e,i,n,r);return s.length?this.selectSyncPoint_(s,{key:"time",value:r}):null}getExpiredTime(e,i){if(!e||!e.segments)return null;const n=this.runStrategies_(e,i,e.discontinuitySequence,0);if(!n.length)return null;const r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+Ba({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,i,n,r){const s=[];for(let a=0;aGI){M.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let r=n-1;r>=0;r--){const s=e.segments[r];if(s&&typeof s.start<"u"){i.syncInfo={mediaSequence:e.mediaSequence+r,time:s.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time}, mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const i=e.segments[0],n=i.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[i.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:i}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,i),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const s=r.dateTimeObject;r.discontinuity&&i&&s&&(this.timelineToDatetimeMappings[r.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,i,n){const r=e.segment,s=e.part;let a=this.timelines[e.timeline],o,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-i.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,l=i.end+a.mapping;else if(a)o=i.start+a.mapping,l=i.end+a.mapping;else return!1;return s&&(s.start=o,s.end=l),(!r.start||ol){let c;o<0?c=n.start-Ba({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex,endIndex:s}):c=n.end+Ba({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:c,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class KI extends M.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:i,to:n}){return typeof i=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:i,to:n}){return typeof i=="number"&&typeof n=="number"&&(this.lastTimelineChanges_[e]={type:e,from:i,to:n},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const QI=mx(gx(function(){var t=function(){function w(){this.listeners={}}var I=w.prototype;return I.on=function(T,C){this.listeners[T]||(this.listeners[T]=[]),this.listeners[T].push(C)},I.off=function(T,C){if(!this.listeners[T])return!1;var k=this.listeners[T].indexOf(C);return this.listeners[T]=this.listeners[T].slice(0),this.listeners[T].splice(k,1),k>-1},I.trigger=function(T){var C=this.listeners[T];if(C)if(arguments.length===2)for(var k=C.length,L=0;L>7)*283)^k]=k;for(L=N=0;!T[L];L^=K||1,N=$[N]||1)for(he=N^N<<1^N<<2^N<<3^N<<4,he=he>>8^he&255^99,T[L]=he,C[he]=L,ne=F[Y=F[K=F[L]]],ce=ne*16843009^Y*65537^K*257^L*16843008,Q=F[he]*257^he*16843008,k=0;k<4;k++)I[k][L]=Q=Q<<24^Q>>>8,x[k][he]=ce=ce<<24^ce>>>8;for(k=0;k<5;k++)I[k]=I[k].slice(0),x[k]=x[k].slice(0);return w};let n=null;class r{constructor(I){n||(n=i()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let x,T,C;const k=this._tables[0][4],L=this._tables[1],N=I.length;let F=1;if(N!==4&&N!==6&&N!==8)throw new Error("Invalid aes key size");const $=I.slice(0),K=[];for(this._key=[$,K],x=N;x<4*N+28;x++)C=$[x-1],(x%N===0||N===8&&x%N===4)&&(C=k[C>>>24]<<24^k[C>>16&255]<<16^k[C>>8&255]<<8^k[C&255],x%N===0&&(C=C<<8^C>>>24^F<<24,F=F<<1^(F>>7)*283)),$[x]=$[x-N]^C;for(T=0;x;T++,x--)C=$[T&3?x:x-4],x<=4||T<4?K[T]=C:K[T]=L[0][k[C>>>24]]^L[1][k[C>>16&255]]^L[2][k[C>>8&255]]^L[3][k[C&255]]}decrypt(I,x,T,C,k,L){const N=this._key[1];let F=I^N[0],$=C^N[1],K=T^N[2],Y=x^N[3],ne,he,Q;const ce=N.length/4-2;let dt,ue=4;const Ce=this._tables[1],H=Ce[0],ee=Ce[1],te=Ce[2],fe=Ce[3],Te=Ce[4];for(dt=0;dt>>24]^ee[$>>16&255]^te[K>>8&255]^fe[Y&255]^N[ue],he=H[$>>>24]^ee[K>>16&255]^te[Y>>8&255]^fe[F&255]^N[ue+1],Q=H[K>>>24]^ee[Y>>16&255]^te[F>>8&255]^fe[$&255]^N[ue+2],Y=H[Y>>>24]^ee[F>>16&255]^te[$>>8&255]^fe[K&255]^N[ue+3],ue+=4,F=ne,$=he,K=Q;for(dt=0;dt<4;dt++)k[(3&-dt)+L]=Te[F>>>24]<<24^Te[$>>16&255]<<16^Te[K>>8&255]<<8^Te[Y&255]^N[ue++],ne=F,F=$,$=K,K=Y,Y=ne}}class s extends t{constructor(){super(t),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(I){this.jobs.push(I),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(w){return w<<24|(w&65280)<<8|(w&16711680)>>8|w>>>24},o=function(w,I,x){const T=new Int32Array(w.buffer,w.byteOffset,w.byteLength>>2),C=new r(Array.prototype.slice.call(I)),k=new Uint8Array(w.byteLength),L=new Int32Array(k.buffer);let N,F,$,K,Y,ne,he,Q,ce;for(N=x[0],F=x[1],$=x[2],K=x[3],ce=0;ce{const T=w[x];v(T)?I[x]={bytes:T.buffer,byteOffset:T.byteOffset,byteLength:T.byteLength}:I[x]=T}),I};self.onmessage=function(w){const I=w.data,x=new Uint8Array(I.encrypted.bytes,I.encrypted.byteOffset,I.encrypted.byteLength),T=new Uint32Array(I.key.bytes,I.key.byteOffset,I.key.byteLength/4),C=new Uint32Array(I.iv.bytes,I.iv.byteOffset,I.iv.byteLength/4);new l(x,T,C,function(k,L){self.postMessage(_({source:I.source,decrypted:L}),[L.buffer])})}}));var YI=px(QI);const JI=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Px=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},gf=(t,e)=>{e.activePlaylistLoader=t,t.load()},ZI=(t,e)=>()=>{const{segmentLoaders:{[t]:i,main:n},mediaTypes:{[t]:r}}=e,s=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;if(!(a&&l&&a.id===l.id)&&(r.lastGroup_=a,r.lastTrack_=s,Px(i,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}i.resyncLoader(),gf(a.playlistLoader,r)}},e8=(t,e)=>()=>{const{segmentLoaders:{[t]:i},mediaTypes:{[t]:n}}=e;n.lastGroup_=null,i.abort(),i.pause()},t8=(t,e)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:s}}=e,a=s.activeTrack(),o=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_;if(!(c&&a&&c.id===a.id)&&(s.lastGroup_=o,s.lastTrack_=a,Px(n,s),!!o)){if(o.isMainPlaylist){if(!a||!c||a.id===c.id)return;const p=e.vhs.playlistController_,g=p.selectPlaylist();if(p.media()===g)return;s.logger_(`track change. Switching main audio from ${c.id} to ${a.id}`),i.pause(),r.resetEverything(),p.fastQualityChange_(g);return}if(t==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}n.setAudio(!0),r.setAudio(!1)}if(l===o.playlistLoader){gf(o.playlistLoader,s);return}n.track&&n.track(a),n.resetEverything(),gf(o.playlistLoader,s)}},Bu={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:i},excludePlaylist:n}=e,r=i.activeTrack(),s=i.activeGroup(),a=(s.filter(l=>l.default)[0]||s[0]).id,o=i.tracks[a];if(r===o){n({error:{message:"Problem encountered loading the default audio track."}});return}M.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in i.tracks)i.tracks[l].enabled=i.tracks[l]===o;i.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:i}}=e;M.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=i.activeTrack();n&&(n.mode="disabled"),i.onTrackChanged()}},Zy={AUDIO:(t,e,i)=>{if(!e)return;const{tech:n,requestOptions:r,segmentLoaders:{[t]:s}}=i;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,r),(!n.paused()||a.endList&&n.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),r),n.paused()||s.load()}),e.on("error",Bu[t](t,i))},SUBTITLES:(t,e,i)=>{const{tech:n,requestOptions:r,segmentLoaders:{[t]:s},mediaTypes:{[t]:a}}=i;e.on("loadedmetadata",()=>{const o=e.media();s.playlist(o,r),s.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),r),n.paused()||s.load()}),e.on("error",Bu[t](t,i))}},i8={AUDIO:(t,e)=>{const{vhs:i,sourceType:n,segmentLoaders:{[t]:r},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[t]:{groups:o,tracks:l,logger_:c}},mainPlaylistLoader:p}=e,g=Do(p.main);(!a[t]||Object.keys(a[t]).length===0)&&(a[t]={main:{default:{default:!0}}},g&&(a[t].main.default.playlists=p.main.playlists));for(const v in a[t]){o[v]||(o[v]=[]);for(const S in a[t][v]){let _=a[t][v][S],w;if(g?(c(`AUDIO group '${v}' label '${S}' is a main playlist`),_.isMainPlaylist=!0,w=null):n==="vhs-json"&&_.playlists?w=new Qr(_.playlists[0],i,s):_.resolvedUri?w=new Qr(_.resolvedUri,i,s):_.playlists&&n==="dash"?w=new hf(_.playlists[0],i,s,p):w=null,_=ve({id:S,playlistLoader:w},_),Zy[t](t,_.playlistLoader,e),o[v].push(_),typeof l[S]>"u"){const I=new M.AudioTrack({id:S,kind:JI(_),enabled:!1,language:_.language,default:_.default,label:S});l[S]=I}}}r.on("error",Bu[t](t,e))},SUBTITLES:(t,e)=>{const{tech:i,vhs:n,sourceType:r,segmentLoaders:{[t]:s},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[t]:{groups:l,tracks:c}},mainPlaylistLoader:p}=e;for(const g in o[t]){l[g]||(l[g]=[]);for(const v in o[t][g]){if(!n.options_.useForcedSubtitles&&o[t][g][v].forced)continue;let S=o[t][g][v],_;if(r==="hls")_=new Qr(S.resolvedUri,n,a);else if(r==="dash"){if(!S.playlists.filter(I=>I.excludeUntil!==1/0).length)return;_=new hf(S.playlists[0],n,a,p)}else r==="vhs-json"&&(_=new Qr(S.playlists?S.playlists[0]:S.resolvedUri,n,a));if(S=ve({id:v,playlistLoader:_},S),Zy[t](t,S.playlistLoader,e),l[g].push(S),typeof c[v]>"u"){const w=i.addRemoteTextTrack({id:v,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:v},!1).track;c[v]=w}}}s.on("error",Bu[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:i,main:{mediaGroups:n},mediaTypes:{[t]:{groups:r,tracks:s}}}=e;for(const a in n[t]){r[a]||(r[a]=[]);for(const o in n[t][a]){const l=n[t][a][o];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const c=i.options_.vhs&&i.options_.vhs.captionServices||{};let p={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[p.instreamId]&&(p=ve(p,c[p.instreamId])),p.default===void 0&&delete p.default,r[a].push(ve({id:o},l)),typeof s[o]>"u"){const g=i.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;s[o]=g}}}}},Ix=(t,e)=>{for(let i=0;ii=>{const{mainPlaylistLoader:n,mediaTypes:{[t]:{groups:r}}}=e,s=n.media();if(!s)return null;let a=null;s.attributes[t]&&(a=r[s.attributes[t]]);const o=Object.keys(r);if(!a)if(t==="AUDIO"&&o.length>1&&Do(e.main))for(let l=0;l"u"?a:i===null||!a?null:a.filter(l=>l.id===i.id)[0]||null},r8={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:i}}}=e;for(const n in i)if(i[n].enabled)return i[n];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:i}}}=e;for(const n in i)if(i[n].mode==="showing"||i[n].mode==="hidden")return i[n];return null}},s8=(t,{mediaTypes:e})=>()=>{const i=e[t].activeTrack();return i?e[t].activeGroup(i):null},a8=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(c=>{i8[c](c,t)});const{mediaTypes:e,mainPlaylistLoader:i,tech:n,vhs:r,segmentLoaders:{["AUDIO"]:s,main:a}}=t;["AUDIO","SUBTITLES"].forEach(c=>{e[c].activeGroup=n8(c,t),e[c].activeTrack=r8[c](c,t),e[c].onGroupChanged=ZI(c,t),e[c].onGroupChanging=e8(c,t),e[c].onTrackChanged=t8(c,t),e[c].getActiveGroup=s8(c,t)});const o=e.AUDIO.activeGroup();if(o){const c=(o.filter(g=>g.default)[0]||o[0]).id;e.AUDIO.tracks[c].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",l),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{n.audioTracks().removeEventListener("change",l),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const c in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[c])},o8=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Wi,activeTrack:Wi,getActiveGroup:Wi,onGroupChanged:Wi,onTrackChanged:Wi,lastTrack_:null,logger_:si(`MediaGroups[${e}]`)}}),t};class ev{constructor(){this.priority_=[]}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Ft(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}}class l8 extends M.EventTarget{constructor(e,i){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new ev,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.logger_=si("Content Steering"),this.xhr_=e,this.getBandwidth_=i}assignTagProperties(e,i){this.manifestType_=i.serverUri?"HLS":"DASH";const n=i.serverUri||i.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=this.queryBeforeStart?n:Ft(e,n),this.defaultPathway=i.pathwayId||i.defaultServiceLocation,this.queryBeforeStart=i.queryBeforeStart||!1,this.proxyServerUrl_=i.proxyServerURL||null,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"),this.queryBeforeStart&&this.requestSteeringManifest(this.steeringManifest.reloadUri)}requestSteeringManifest(e){const i=this.steeringManifest.reloadUri;if(!e&&!i)return;const n=e||this.getRequestURI(i);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:n},(r,s)=>{if(r){if(s.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(s.status===429){const o=s.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${o} seconds.`),this.startTTLTimeout_(parseInt(o,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}const a=JSON.parse(this.request_.responseText);this.startTTLTimeout_(),this.assignSteeringProperties_(a)})}setProxyServerUrl_(e){const i=new A.URL(e),n=new A.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(i.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const i=JSON.parse(A.atob(e));this.assignSteeringProperties_(i)}setSteeringParams_(e){const i=new A.URL(e),n=this.getPathway(),r=this.getBandwidth_();if(n){const s=`_${this.manifestType_}_pathway`;i.searchParams.set(s,n)}if(r){const s=`_${this.manifestType_}_throughput`;i.searchParams.set(s,r)}return i.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const n=(r=>{for(const s of r)if(this.availablePathways_.has(s))return s;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==n&&(this.currentPathway=n,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const i=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!i(r))return r}const n=this.setSteeringParams_(e);return i(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const i=e*1e3;this.ttlTimeout_=A.setTimeout(()=>{this.requestSteeringManifest()},i)}clearTTLTimeout_(){A.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.excludedPathways_=new Set,this.steeringManifest=new ev}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}}const u8=10;let Vi;const c8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],d8=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},h8=function({currentPlaylist:t,buffered:e,currentTime:i,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:a,bufferBasedABR:o,log:l}){if(!n)return M.log.warn("We received no playlist to switch to. Please check your stream."),!1;const c=`allowing switch ${t&&t.id||"null"} -> ${n.id}`;if(!t)return l(`${c} as current playlist is not set`),!0;if(n.id===t.id)return!1;const p=!!Kr(e,i).length;if(!t.endList)return!p&&typeof t.partTargetDuration=="number"?(l(`not ${c} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${c} as current playlist is live`),!0);const g=um(e,i),v=o?Qe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Qe.MAX_BUFFER_LOW_WATER_LINE;if(a_)&&g>=r){let w=`${c} as forwardBuffer >= bufferLowWaterLine (${g} >= ${r})`;return o&&(w+=` and next bandwidth > current bandwidth (${S} > ${_})`),l(w),!0}return l(`not ${c} as no switching criteria met`),!1};class f8 extends M.EventTarget{constructor(e){super();const{src:i,withCredentials:n,tech:r,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:c,sourceType:p,cacheEncryptionKeys:g,bufferBasedABR:v,leastPixelDiffSelector:S,captionServices:_}=e;if(!i)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:w}=e;(w===null||typeof w>"u")&&(w=1/0),Vi=a,this.bufferBasedABR=!!v,this.leastPixelDiffSelector=!!S,this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=p,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=w,this.enableLowInitialPlaylist=c,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:w,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=o8(),this.mediaSource=new A.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=ot(),this.hasPlayed_=!1,this.syncController_=new XI(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new YI,this.sourceUpdater_=new kx(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new KI;const I={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:_,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:g,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new hf(i,this.vhs_,ve(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Qr(i,this.vhs_,ve(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new pf(ve(I,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new pf(ve(I,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new HI(ve(I,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((C,k)=>{function L(){r.off("vttjserror",N),C()}function N(){r.off("vttjsloaded",L),k()}r.one("vttjsloaded",L),r.one("vttjserror",N),r.addWebVttScript_()})}),e);const x=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new l8(this.vhs_.xhr,x),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),c8.forEach(C=>{this[C+"_"]=d8.bind(this,C)}),this.logger_=si("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 T=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(T,()=>{const C=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-C,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),i=this.audioAppendsToLoadedData_();return e===-1||i===-1?-1:e+i}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const i=this.selectPlaylist();i&&this.shouldSwitchToMedia_(i)&&this.switchMedia_(i,e)}switchMedia_(e,i,n){const r=this.media(),s=r&&(r.id||r.uri),a=e.id||e.uri;s&&s!==a&&(this.logger_(`switch media ${s} -> ${a} from ${i}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${i}`})),this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const i=this.mediaTypes_[e],n=i?i.activeGroup():null,r=this.contentSteeringController_.getPathway();if(n&&r){const a=(n.length?n[0].playlists:n.playlists).filter(o=>o.attributes.serviceLocation===r);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=A.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(A.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),i=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return i;const n=e.mediaGroups.AUDIO,r=Object.keys(n);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||r.length&&n[r[0]];for(const l in o)if(o[l].default){s={label:l};break}}if(!s)return i;const a=[];for(const o in n)if(n[o][s.label]){const l=n[o][s.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(e.playlists.length)for(let c=0;c{const e=this.mainPlaylistLoader_.media(),i=e.targetDuration*1.5*1e3;of(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),a8({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(),e),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 e=this.mainPlaylistLoader_.media();if(!e){this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),i=e.targetDuration*1.5*1e3;of(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(e)&&(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"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,i){const n=e.mediaGroups||{};let r=!0;const s=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Vi.Playlist.isAes(i)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(n.AUDIO[s[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_(e){const i=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return h8({buffered:a,currentTime:n,currentPlaylist:i,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:s,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 i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),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.mainSegmentLoader_.on("earlyabort",i=>{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:u8}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),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()})}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()}fastQualityChange_(e=this.selectPlaylist()){if(e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments()}resetMainLoaderReplaceSegments(){const e=this.tech_.buffered(),i=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=i,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const i=this.duration();e[e.length-1].endTime=isNaN(i)||Math.abs(i)===1/0?Number.MAX_VALUE:i}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const i=this.mainSegmentLoader_.getCurrentMediaInfo_();!i||i.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const n=this.syncController_.getExpiredTime(e,this.duration());if(n===null)return!1;const r=Vi.Playlist.playlistEnd(e,n),s=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-s<=wi;const o=a.end(a.length-1);return o-s<=wi&&r-o<=wi}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:i={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||i.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=i,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,s=r.filter(Ac),a=s.length===1&&s[0]===e;if(r.length===1&&n!==1/0)return M.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const _=this.pathwayAttribute_(e),w=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(_),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(_)},w);return}let S=!1;r.forEach(_=>{if(_===e)return;const w=_.excludeUntil;typeof w<"u"&&w!==1/0&&(S=!0,delete _.excludeUntil)}),S&&(M.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,i.reason&&(e.lastExcludeReason_=i.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 c=i.internal?this.logger_:M.log.warn,p=i.message?" "+i.message:"";c(`${i.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const g=l.targetDuration/2*1e3||5*1e3,v=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=g;return this.switchMedia_(l,"exclude",a||v)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,i){const n=[],r=e==="all";(r||e==="main")&&n.push(this.mainPlaylistLoader_);const s=[];(r||e==="audio")&&s.push("AUDIO"),(r||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>i.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const i=Kr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(i&&i.length)return e;this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Vi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let i=this.mainPlaylistLoader_.media();if(!i)return;let n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return;const r=this.mainPlaylistLoader_.main,s=Vi.Playlist.seekable(i,n,Vi.Playlist.liveEdgeDelay(r,i));if(s.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),n=this.syncController_.getExpiredTime(i,this.duration()),n===null||(e=Vi.Playlist.seekable(i,n,Vi.Playlist.liveEdgeDelay(r,i)),e.length===0)))return;let a,o;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),o=this.seekable_.start(0)),e?e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=ot([[e.start(0)>s.start(0)?e.start(0):s.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const i=this.mediaTypes_[e].groups;for(const n in i)i[n].forEach(r=>{r.playlistLoader&&r.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 e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,i=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!i||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=Ua(this.main(),i),r={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=n.video||e.main.videoCodec||MA),e.main.isMuxed&&(r.video+=`,${n.audio||e.main.audioCodec||R0}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(r.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||R0,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(c,p)=>c?Bl(p):Pd(p),o={};let l;if(["video","audio"].forEach(function(c){if(r.hasOwnProperty(c)&&!a(e[c].isFmp4,r[c])){const p=e[c].isFmp4?"browser":"muxer";o[p]=o[p]||[],o[p].push(r[c]),c==="audio"&&(l=p)}}),s&&l&&i.attributes.AUDIO){const c=i.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===c&&p!==i&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${c} as ${l} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const c=Object.keys(o).reduce((p,g)=>(p&&(p+=", "),p+=`${g} does not support codec(s): "${o[g].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:c},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const c=[];if(["video","audio"].forEach(p=>{const g=(Si(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,v=(Si(r[p]||"")[0]||{}).type;g&&v&&g.toLowerCase()!==v.toLowerCase()&&c.push(`"${this.sourceUpdater_.codecs[p]}" -> "${r[p]}"`)}),c.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${c.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const i=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(i)}excludeUnsupportedVariants_(){const e=this.main().playlists,i=[];Object.keys(e).forEach(n=>{const r=e[n];if(i.indexOf(r.id)!==-1)return;i.push(r.id);const s=Ua(this.main,r),a=[];s.audio&&!Pd(s.audio)&&!Bl(s.audio)&&a.push(`audio codec ${s.audio}`),s.video&&!Pd(s.video)&&!Bl(s.video)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const i=[],n=this.main().playlists,r=Ru(Si(e)),s=jy(r),a=r.video&&Si(r.video)[0]||null,o=r.audio&&Si(r.audio)[0]||null;Object.keys(n).forEach(l=>{const c=n[l];if(i.indexOf(c.id)!==-1||c.excludeUntil===1/0)return;i.push(c.id);const p=[],g=Ua(this.mainPlaylistLoader_.main,c),v=jy(g);if(!(!g.audio&&!g.video)){if(v!==s&&p.push(`codec count "${v}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const S=g.video&&Si(g.video)[0]||null,_=g.audio&&Si(g.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${S.type}" !== "${a.type}"`),_&&o&&_.type.toLowerCase()!==o.type.toLowerCase()&&p.push(`audio codec "${_.type}" !== "${o.type}"`)}p.length&&(c.excludeUntil=1/0,this.logger_(`excluding ${c.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let i=0;const n=this.seekable();n.length&&(i=n.start(0)),WI(e,this.cueTagsTrack_,i)}goalBufferLength(){const e=this.tech_.currentTime(),i=Qe.GOAL_BUFFER_LENGTH,n=Qe.GOAL_BUFFER_LENGTH_RATE,r=Math.max(i,Qe.MAX_GOAL_BUFFER_LENGTH);return Math.min(i+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),i=Qe.BUFFER_LOW_WATER_LINE,n=Qe.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(i,Qe.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(i,Qe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(i+e*n,this.bufferBasedABR?s:r)}bufferHighWaterLine(){return Qe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){zy(this.inbandTextTracks_,"com.apple.streaming",this.tech_),AI({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,i,n){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();zy(this.inbandTextTracks_,e,this.tech_),CI({inbandTextTracks:this.inbandTextTracks_,metadataArray:i,timestampOffset:r,videoDuration:n})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(!e.contentSteering)return;const i=n=>{for(const r of n.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(r));this.contentSteeringController_.assignTagProperties(n.uri,n.contentSteering)};i(e),this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("mediaupdatetimeout",()=>{this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id),this.contentSteeringController_.abort(),this.contentSteeringController_.clearTTLTimeout_(),this.contentSteeringController_.clearAvailablePathways(),i(this.main())}),this.contentSteeringController_.queryBeforeStart||this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;const n=this.main().playlists,r=new Set;let s=!1;Object.keys(n).forEach(a=>{const o=n[a],l=this.pathwayAttribute_(o),c=l&&e!==l;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!c&&(delete o.excludeUntil,delete o.lastExcludeReason_,s=!0);const g=!o.excludeUntil&&o.excludeUntil!==1/0;!r.has(o.id)&&c&&g&&(r.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const l=o.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(s=!0)}}),s&&this.changeSegmentPathway_()}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}}const p8=(t,e,i)=>n=>{const r=t.main.playlists[e],s=dm(r),a=Ac(r);return typeof n>"u"?a:(n?delete r.disabled:r.disabled=!0,n!==a&&!s&&(i(),n?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),n)};class m8{constructor(e,i,n){const{playlistController_:r}=e,s=r.fastQualityChange_.bind(r);if(i.attributes){const a=i.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=i.attributes.BANDWIDTH,this.frameRate=i.attributes["FRAME-RATE"]}this.codecs=Ua(r.main(),i),this.playlist=i,this.id=n,this.enabled=p8(e.playlists,i.id,s)}}const g8=function(t){t.representations=()=>{const e=t.playlistController_.main(),i=Do(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return i?i.filter(n=>!dm(n)).map((n,r)=>new m8(t,n,n.id)):[]}},tv=["seeking","seeked","pause","playing","error"];class y8{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=si("PlaybackWatcher"),this.logger_("initialize");const i=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach(p=>{l[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",l[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",l[p].reset),this.tech_.on(["seeked","seeking"],l[p].reset)});const c=p=>{["main","audio"].forEach(g=>{a[`${g}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),c("off"))},this.clearSeekingAppendCheck_=()=>c("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),c("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(tv,s),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(tv,s),this.tech_.off("canplay",n),this.tech_.off("play",i),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",l[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",l[p].reset),this.tech_.off(["seeked","seeking"],l[p].reset)}),this.checkCurrentTimeTimeout_&&A.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&A.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=A.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const i=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=i.buffered_()}checkSegmentDownloads_(e){const i=this.playlistController_,n=i[`${e}SegmentLoader_`],r=n.buffered_(),s=aP(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,s){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:n.playlist_&&n.playlist_.id,buffered:nr(r)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&i.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),i=this.tech_.buffered();if(this.lastRecordedTime===e&&(!i.length||e+wi>=i.end(i.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const i=this.seekable(),n=this.tech_.currentTime(),r=this.afterSeekableWindow_(i,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let s;if(r&&(s=i.end(i.length-1)),this.beforeSeekableWindow_(i,n)){const _=i.start(0);s=_+(_===i.end(0)?0:wi)}if(typeof s<"u")return this.logger_(`Trying to seek outside of seekable at time ${n} with seekable range ${WT(i)}. Seeking to ${s}.`),this.tech_.setCurrentTime(s),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,c=a.videoBuffer?a.videoBuffered():null,p=this.media(),g=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Bn)*2,v=[l,c];for(let _=0;_ ${n.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),i=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,i)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${i}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const n=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:i}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=xl(r,i);return a.length>0?(this.logger_(`Stopped at ${i} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(i),!0):!1}afterSeekableWindow_(e,i,n,r=!1){if(!e.length)return!1;let s=e.end(e.length-1)+wi;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||r)&&(s=e.end(e.length-1)+n.targetDuration*3),i>s}beforeSeekableWindow_(e,i){return!!(e.length&&e.start(0)>0&&i2)return{start:s,end:a}}return null}}const v8={errorInterval:30,getSource(t){const i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(i)}},Lx=function(t,e){let i=0,n=0;const r=ve(v8,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){n&&t.currentTime(n)},a=function(p){p!=null&&(n=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(p),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},o=function(){if(Date.now()-i{Object.defineProperty(Ne,t,{get(){return M.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),Qe[t]},set(e){if(M.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){M.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}Qe[t]=e}})});const Nx="videojs-vhs",Rx=function(t,e){const i=e.media();let n=-1;for(let r=0;r{t.addQualityLevel(i)}),Rx(t,e.playlists)};Ne.canPlaySource=function(){return M.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const C8=(t,e,i)=>{if(!t)return t;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=Ru(Si(e.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);const r=ro(n.video),s=ro(n.audio),a={};for(const o in t)a[o]={},s&&(a[o].audioContentType=s),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof t[o]=="string"&&(a[o].url=t[o]);return ve(t,a)},w8=(t,e)=>t.reduce((i,n)=>{if(!n.contentProtection)return i;const r=e.reduce((s,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(s[a]={pssh:o.pssh}),s},{});return Object.keys(r).length&&i.push(r),i},[]),D8=({player:t,sourceKeySystems:e,audioMedia:i,mainPlaylists:n})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const r=i?n.concat([i]):n,s=w8(r,Object.keys(e)),a=[],o=[];return s.forEach(l=>{o.push(new Promise((c,p)=>{t.tech_.one("keysessioncreated",c)})),a.push(new Promise((c,p)=>{t.eme.initializeMediaKeys({keySystems:l},g=>{if(g){p(g);return}c()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},A8=({player:t,sourceKeySystems:e,media:i,audioMedia:n})=>{const r=C8(e,i,n);return r?(t.currentSource().keySystems=r,r&&!t.eme?(M.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Mx=()=>{if(!A.localStorage)return null;const t=A.localStorage.getItem(Nx);if(!t)return null;try{return JSON.parse(t)}catch{return null}},k8=t=>{if(!A.localStorage)return!1;let e=Mx();e=e?ve(e,t):t;try{A.localStorage.setItem(Nx,JSON.stringify(e))}catch{return!1}return e},P8=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,Bx=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},Fx=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},Ux=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},jx=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Ne.supportsNativeHls=function(){if(!V||!V.createElement)return!1;const t=V.createElement("video");return M.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(t.canPlayType(i))}):!1}();Ne.supportsNativeDash=function(){return!V||!V.createElement||!M.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(V.createElement("video").canPlayType("application/dash+xml"))}();Ne.supportsTypeNatively=t=>t==="hls"?Ne.supportsNativeHls:t==="dash"?Ne.supportsNativeDash:!1;Ne.isSupported=function(){return M.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ne.xhr.onRequest=function(t){Bx(Ne.xhr,t)};Ne.xhr.onResponse=function(t){Fx(Ne.xhr,t)};Ne.xhr.offRequest=function(t){Ux(Ne.xhr,t)};Ne.xhr.offResponse=function(t){jx(Ne.xhr,t)};const I8=M.getComponent("Component");class $x extends I8{constructor(e,i,n){if(super(i,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=si("VhsHandler"),i.options_&&i.options_.playerId){const r=M.getPlayer(i.options_.playerId);this.player_=r}if(this.tech_=i,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(V,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const s=V.fullscreenElement||V.webkitFullscreenElement||V.mozFullScreenElement||V.msFullscreenElement;s&&s.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_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!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=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!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 e=Mx();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Qe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Qe.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{typeof this.source_[e]<"u"&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,i){if(!e)return;this.setOptions_(),this.options_.src=P8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ne,this.options_.sourceType=$1(i),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.playlistController_=new f8(this.options_);const n=ve({liveRangeSafeTimeDelta:wi},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new y8(n),this.playlistController_.on("error",()=>{const s=M.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}),s.error(a)});const r=this.options_.bufferBasedABR?Ne.movingAverageBandwidthSelector(.55):Ne.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Ne.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(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=A.navigator.connection||A.navigator.mozConnection||A.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=o&&s>=o?s=Math.max(s,l):s=l}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){M.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:()=>nr(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:()=>nr(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&&k8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{g8(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_=A.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),D8({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(i=>{this.logger_("error while creating EME key session",i),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 e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=A8({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{if(n.status!=="output-restricted")return;const r=this.playlistController_.main();if(!r||!r.playlists)return;const s=[];r.playlists.forEach(a=>{a&&a.attributes&&a.attributes.RESOLUTION&&a.attributes.RESOLUTION.height>=720&&(!a.excludeUntil||a.excludeUntil<1/0)&&(a.excludeUntil=1/0,s.push(a))}),s.length&&(M.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...s),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!i){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=M.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{b8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Rx(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Ox,"mux.js":T8,"mpd-parser":x8,"m3u8-parser":S8,"aes-decrypter":E8}}version(){return this.constructor.version()}canChangeType(){return kx.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}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_&&A.URL.revokeObjectURL&&(A.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,i){return UP({playlist:this.playlistController_.media(),time:e,callback:i})}seekToProgramTime(e,i,n=!0,r=2){return hx({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:i})}setupXhrHooks_(){this.xhr.onRequest=e=>{Bx(this.xhr,e)},this.xhr.onResponse=e=>{Fx(this.xhr,e)},this.xhr.offRequest=e=>{Ux(this.xhr,e)},this.xhr.offResponse=e=>{jx(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const Fu={name:"videojs-http-streaming",VERSION:Ox,canHandleSource(t,e={}){const i=ve(M.options,e);return Fu.canPlayType(t.type,i)},handleSource(t,e,i={}){const n=ve(M.options,i);return e.vhs=new $x(t,e,n),e.vhs.xhr=ox(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const i=$1(t);if(!i)return"";const n=Fu.getOverrideNative(e);return!Ne.supportsTypeNatively(i)||n?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,i=!(M.browser.IS_ANY_SAFARI||M.browser.IS_IOS),{overrideNative:n=i}=e;return n}},L8=()=>Bl("avc1.4d400d,mp4a.40.2");L8()&&M.getTech("Html5").registerSourceHandler(Fu,0);M.VhsHandler=$x;M.VhsSourceHandler=Fu;M.Vhs=Ne;M.use||M.registerComponent("Vhs",Ne);M.options.vhs=M.options.vhs||{};(!M.getPlugin||!M.getPlugin("reloadSourceOnError"))&&M.registerPlugin("reloadSourceOnError",_8);const O8=({video:t})=>{var l;const[e,i]=G.useState(""),n="http://13.209.86.34:5002/api/chat/create",[r,s]=G.useState(void 0),a=async()=>{try{const c=await fetch(`http://13.209.86.34:5002/api/chat/list?video_name=${t}`);if(!c.ok)throw new Error("Network response was not ok");const g=(await c.json()).chats.slice(0,7).reverse();s({chats:g})}catch(c){console.error("Error fetching chat list:",c)}},o=async()=>{try{if(!(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({video_name:t,content:e})})).ok)throw new Error("Network response was not ok");console.log("Message sent successfully"),i("")}catch(c){console.error("Error sending message:",c)}};return G.useEffect(()=>{a();const c=setInterval(a,1e3);return()=>clearInterval(c)},[t]),q.jsxs("div",{className:"fixed bottom-0 left-0 w-full px-6",children:[q.jsx("div",{children:(l=r==null?void 0:r.chats)==null?void 0:l.map((c,p)=>q.jsxs("div",{className:"flex flex-row gap-4 w-full overflow-x-scroll mb-4",children:[q.jsx("div",{children:"익명"}),q.jsx("div",{className:"font-bold",children:c.content}),q.jsx("div",{className:"text-[12px]",children:c.created_at})]},p))}),q.jsxs("div",{className:"flex flex-row mb-4",children:[q.jsx("input",{className:"w-full px-4 py-2 input-style rounded-l",type:"text",placeholder:"내용을 입력하세요.",value:e,onChange:c=>i(c.target.value)}),q.jsx("button",{className:"bg-white px-4 py-2 text-black min-w-fit",onClick:o,children:"전송"})]})]})},N8=()=>{const t=G.useRef(null),{video:e}=aD();return G.useEffect(()=>{if(!t.current)return;const i={controls:!0,fluid:!0,sources:[{src:`https://furiosa-video.s3.ap-northeast-2.amazonaws.com/convert/${e}`,type:"video/mp4"}]},n=M(t.current,i,function(){console.log("Player is ready")});return()=>{n&&n.dispose()}},[e]),q.jsxs(q.Fragment,{children:[q.jsx("div",{"data-vjs-player":!0,children:q.jsx("video",{ref:t,className:"video-js vjs-big-play-centered"})}),q.jsx(O8,{video:e})]})},R8="/noc-client/assets/thumbnail-U4Odmowz.png",M8=({title:t,date:e})=>{const i=rc(),n=()=>{i(`/view/${t}`)};return q.jsx("button",{onClick:n,children:q.jsxs("div",{className:"rounded-xl w-[12rem] overflow-hidden text-left",children:[q.jsx("img",{src:R8,alt:"thumbnail"}),q.jsx("div",{className:"font-bold truncate",children:t}),q.jsx("span",{className:"text-[14px]",children:e})]})})},B8=({title:t,videoList:e})=>{var i;return console.log(e),q.jsxs("div",{className:"p-6",children:[q.jsx("span",{className:"text-2xl font-bold mb-2",children:t}),q.jsx("div",{className:"flex flex-row gap-4 w-full overflow-x-scroll mb-4",children:(i=e==null?void 0:e.list)==null?void 0:i.map((n,r)=>q.jsx(M8,{title:n.name,date:n.created_at},r))})]})},F8=()=>q.jsx("div",{className:"w-full h-30 bottom-0 p-6 pb-16 bg-[#232020]",children:q.jsx("span",{className:"opacity-25",children:"Sponsored by FURIOSA, elise"})}),U8=()=>{const t=rc(),[e,i]=G.useState(void 0),n="http://13.209.86.34:5002/api/video_list";G.useEffect(()=>{(async()=>{try{const a=await fetch(n);if(!a.ok)throw new Error("Network response was not ok");const o=await a.json();i(o)}catch(a){console.error("Error fetching data:",a)}})()},[n]);const r=()=>{t("/upload")};return q.jsx(q.Fragment,{children:q.jsxs("div",{className:"flex flex-col justify-between h-full w-full bg-black",children:[q.jsxs("div",{children:[q.jsx("div",{className:"mb-[1rem] p-6",children:q.jsx("span",{className:"text-[#E21401] text-3xl font-bold ",children:"AI Blur"})}),q.jsx(B8,{title:"HOT 10",videoList:e})]}),q.jsxs("div",{className:"flex items-center flex-col w-full",children:[q.jsx("div",{className:"flex w-full px-6 my-2",children:q.jsx("button",{onClick:r,className:"bg-[#E21401] py-2 px-4 w-full text-center rounded-l",children:"영상 업로드하기"})}),q.jsx(F8,{})]})]})})};function j8(){const[t,e]=G.useState(!0);return G.useEffect(()=>{const i=setTimeout(()=>{e(!1)},3e3);return()=>clearTimeout(i)},[]),q.jsx(q.Fragment,{children:q.jsxs(SD,{basename:"/noc-client",children:[t&&q.jsx(DD,{}),q.jsxs(TD,{children:[q.jsx(Ml,{path:"/",element:q.jsx(U8,{})}),q.jsx(Ml,{path:"/upload",element:q.jsx(wD,{})}),q.jsx(Ml,{path:"/view/:video",element:q.jsx(N8,{})})]})]})})}Wd.createRoot(document.getElementById("root")).render(q.jsx(Ki.StrictMode,{children:q.jsx(j8,{})})); diff --git a/assets/index-5nUgs8zv.js b/assets/index-5nUgs8zv.js new file mode 100644 index 0000000..6bf634b --- /dev/null +++ b/assets/index-5nUgs8zv.js @@ -0,0 +1,277 @@ +function gC(t,e){for(var i=0;in[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function i(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=i(r);fetch(r.href,s)}})();var ru=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Yv(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var i=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}),i}var Jv={exports:{}},nc={},Zv={exports:{}},ue={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Co=Symbol.for("react.element"),yC=Symbol.for("react.portal"),vC=Symbol.for("react.fragment"),_C=Symbol.for("react.strict_mode"),TC=Symbol.for("react.profiler"),xC=Symbol.for("react.provider"),SC=Symbol.for("react.context"),EC=Symbol.for("react.forward_ref"),bC=Symbol.for("react.suspense"),CC=Symbol.for("react.memo"),wC=Symbol.for("react.lazy"),Xg=Symbol.iterator;function AC(t){return t===null||typeof t!="object"?null:(t=Xg&&t[Xg]||t["@@iterator"],typeof t=="function"?t:null)}var e_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},t_=Object.assign,i_={};function Bs(t,e,i){this.props=t,this.context=e,this.refs=i_,this.updater=i||e_}Bs.prototype.isReactComponent={};Bs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Bs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function n_(){}n_.prototype=Bs.prototype;function Kf(t,e,i){this.props=t,this.context=e,this.refs=i_,this.updater=i||e_}var Qf=Kf.prototype=new n_;Qf.constructor=Kf;t_(Qf,Bs.prototype);Qf.isPureReactComponent=!0;var Kg=Array.isArray,r_=Object.prototype.hasOwnProperty,Yf={current:null},s_={key:!0,ref:!0,__self:!0,__source:!0};function a_(t,e,i){var n,r={},s=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)r_.call(e,n)&&!s_.hasOwnProperty(n)&&(r[n]=e[n]);var o=arguments.length-2;if(o===1)r.children=i;else if(1>>1,Se=q[me];if(0>>1;mer(kr,ie))Sir(Pr,kr)?(q[me]=Pr,q[Si]=ie,me=Si):(q[me]=kr,q[xi]=ie,me=xi);else if(Sir(Pr,ie))q[me]=Pr,q[Si]=ie,me=Si;else break e}}return te}function r(q,te){var ie=q.sortIndex-te.sortIndex;return ie!==0?ie:q.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],p=1,m=null,_=3,E=!1,v=!1,S=!1,D=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(q){for(var te=i(c);te!==null;){if(te.callback===null)n(c);else if(te.startTime<=q)n(c),te.sortIndex=te.expirationTime,e(l,te);else break;te=i(c)}}function P(q){if(S=!1,C(q),!v)if(i(l)!==null)v=!0,ce(O);else{var te=i(c);te!==null&&Ae(P,te.startTime-q)}}function O(q,te){v=!1,S&&(S=!1,x(V),V=-1),E=!0;var ie=_;try{for(C(te),m=i(l);m!==null&&(!(m.expirationTime>te)||q&&!re());){var me=m.callback;if(typeof me=="function"){m.callback=null,_=m.priorityLevel;var Se=me(m.expirationTime<=te);te=t.unstable_now(),typeof Se=="function"?m.callback=Se:m===i(l)&&n(l),C(te)}else n(l);m=i(l)}if(m!==null)var qi=!0;else{var xi=i(c);xi!==null&&Ae(P,xi.startTime-te),qi=!1}return qi}finally{m=null,_=ie,E=!1}}var N=!1,F=null,V=-1,Q=5,J=-1;function re(){return!(t.unstable_now()-Jq||125me?(q.sortIndex=ie,e(c,q),i(l)===null&&q===i(c)&&(S?(x(V),V=-1):S=!0,Ae(P,ie-me))):(q.sortIndex=Se,e(l,q),v||E||(v=!0,ce(O))),q},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(q){var te=_;return function(){var ie=_;_=te;try{return q.apply(this,arguments)}finally{_=ie}}}})(c_);u_.exports=c_;var UC=u_.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var d_=X,Wt=UC;function $(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Th=Object.prototype.hasOwnProperty,jC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Yg={},Jg={};function $C(t){return Th.call(Jg,t)?!0:Th.call(Yg,t)?!1:jC.test(t)?Jg[t]=!0:(Yg[t]=!0,!1)}function VC(t,e,i,n){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function HC(t,e,i,n){if(e===null||typeof e>"u"||VC(t,e,i,n))return!0;if(n)return!1;if(i!==null)switch(i.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ct(t,e,i,n,r,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=r,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var at={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){at[t]=new Ct(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];at[e]=new Ct(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){at[t]=new Ct(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){at[t]=new Ct(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){at[t]=new Ct(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){at[t]=new Ct(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){at[t]=new Ct(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){at[t]=new Ct(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){at[t]=new Ct(t,5,!1,t.toLowerCase(),null,!1,!1)});var Zf=/[\-:]([a-z])/g;function ep(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Zf,ep);at[e]=new Ct(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Zf,ep);at[e]=new Ct(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Zf,ep);at[e]=new Ct(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){at[t]=new Ct(t,1,!1,t.toLowerCase(),null,!1,!1)});at.xlinkHref=new Ct("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){at[t]=new Ct(t,1,!1,t.toLowerCase(),null,!0,!0)});function tp(t,e,i,n){var r=at.hasOwnProperty(e)?at[e]:null;(r!==null?r.type!==0:n||!(2o||r[a]!==s[o]){var l=` +`+r[a].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{bd=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?Ca(t):""}function zC(t){switch(t.tag){case 5:return Ca(t.type);case 16:return Ca("Lazy");case 13:return Ca("Suspense");case 19:return Ca("SuspenseList");case 0:case 2:case 15:return t=Cd(t.type,!1),t;case 11:return t=Cd(t.type.render,!1),t;case 1:return t=Cd(t.type,!0),t;default:return""}}function bh(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case zr:return"Fragment";case Hr:return"Portal";case xh:return"Profiler";case ip:return"StrictMode";case Sh:return"Suspense";case Eh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case p_:return(t.displayName||"Context")+".Consumer";case f_:return(t._context.displayName||"Context")+".Provider";case np:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case rp:return e=t.displayName||null,e!==null?e:bh(t.type)||"Memo";case bn:e=t._payload,t=t._init;try{return bh(t(e))}catch{}}return null}function qC(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return bh(e);case 8:return e===ip?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function $n(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function g_(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function WC(t){var e=g_(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,s=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){n=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ml(t){t._valueTracker||(t._valueTracker=WC(t))}function y_(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=g_(t)?t.checked?"true":"false":t.value),t=n,t!==i?(e.setValue(t),!0):!1}function su(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ch(t,e){var i=e.checked;return Fe({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function e0(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=$n(e.value!=null?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function v_(t,e){e=e.checked,e!=null&&tp(t,"checked",e,!1)}function wh(t,e){v_(t,e);var i=$n(e.value),n=e.type;if(i!=null)n==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ah(t,e.type,i):e.hasOwnProperty("defaultValue")&&Ah(t,e.type,$n(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function t0(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Ah(t,e,i){(e!=="number"||su(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var wa=Array.isArray;function ss(t,e,i,n){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=gl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ja(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var Ra={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},GC=["Webkit","ms","Moz","O"];Object.keys(Ra).forEach(function(t){GC.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ra[e]=Ra[t]})});function S_(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||Ra.hasOwnProperty(t)&&Ra[t]?(""+e).trim():e+"px"}function E_(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,r=S_(i,e[i],n);i==="float"&&(i="cssFloat"),n?t.setProperty(i,r):t[i]=r}}var XC=Fe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ph(t,e){if(e){if(XC[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error($(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error($(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error($(61))}if(e.style!=null&&typeof e.style!="object")throw Error($(62))}}function Ih(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Oh=null;function sp(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Lh=null,as=null,os=null;function r0(t){if(t=Do(t)){if(typeof Lh!="function")throw Error($(280));var e=t.stateNode;e&&(e=lc(e),Lh(t.stateNode,t.type,e))}}function b_(t){as?os?os.push(t):os=[t]:as=t}function C_(){if(as){var t=as,e=os;if(os=as=null,r0(t),e)for(t=0;t>>=0,t===0?32:31-(sw(t)/aw|0)|0}var yl=64,vl=4194304;function Aa(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function uu(t,e){var i=t.pendingLanes;if(i===0)return 0;var n=0,r=t.suspendedLanes,s=t.pingedLanes,a=i&268435455;if(a!==0){var o=a&~r;o!==0?n=Aa(o):(s&=a,s!==0&&(n=Aa(s)))}else a=i&~r,a!==0?n=Aa(a):s!==0&&(n=Aa(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&r)&&(r=n&-n,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(n&4&&(n|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0i;i++)e.push(t);return e}function wo(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-gi(e),t[e]=i}function cw(t,e){var i=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=Ba),f0=" ",p0=!1;function q_(t,e){switch(t){case"keyup":return Fw.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function W_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var qr=!1;function jw(t,e){switch(t){case"compositionend":return W_(e);case"keypress":return e.which!==32?null:(p0=!0,f0);case"textInput":return t=e.data,t===f0&&p0?null:t;default:return null}}function $w(t,e){if(qr)return t==="compositionend"||!fp&&q_(t,e)?(t=H_(),$l=cp=kn=null,qr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:i,offset:e-t};t=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=v0(i)}}function Q_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Q_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Y_(){for(var t=window,e=su();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=su(t.document)}return e}function pp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Qw(t){var e=Y_(),i=t.focusedElem,n=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&Q_(i.ownerDocument.documentElement,i)){if(n!==null&&pp(i)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=i.textContent.length,s=Math.min(n.start,r);n=n.end===void 0?s:Math.min(n.end,r),!t.extend&&s>n&&(r=n,n=s,s=r),r=_0(i,s);var a=_0(i,n);r&&a&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i=document.documentMode,Wr=null,Uh=null,Ua=null,jh=!1;function T0(t,e,i){var n=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;jh||Wr==null||Wr!==su(n)||(n=Wr,"selectionStart"in n&&pp(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ua&&ro(Ua,n)||(Ua=n,n=hu(Uh,"onSelect"),0Kr||(t.current=Wh[Kr],Wh[Kr]=null,Kr--)}function be(t,e){Kr++,Wh[Kr]=t.current,t.current=e}var Vn={},ht=Gn(Vn),Ot=Gn(!1),vr=Vn;function vs(t,e){var i=t.type.contextTypes;if(!i)return Vn;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in i)r[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function Lt(t){return t=t.childContextTypes,t!=null}function pu(){Pe(Ot),Pe(ht)}function A0(t,e,i){if(ht.current!==Vn)throw Error($(168));be(ht,e),be(Ot,i)}function a1(t,e,i){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var r in n)if(!(r in e))throw Error($(108,qC(t)||"Unknown",r));return Fe({},i,n)}function mu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vn,vr=ht.current,be(ht,t),be(Ot,Ot.current),!0}function D0(t,e,i){var n=t.stateNode;if(!n)throw Error($(169));i?(t=a1(t,e,vr),n.__reactInternalMemoizedMergedChildContext=t,Pe(Ot),Pe(ht),be(ht,t)):Pe(Ot),be(Ot,i)}var Qi=null,uc=!1,Ud=!1;function o1(t){Qi===null?Qi=[t]:Qi.push(t)}function lA(t){uc=!0,o1(t)}function Xn(){if(!Ud&&Qi!==null){Ud=!0;var t=0,e=ve;try{var i=Qi;for(ve=1;t>=a,r-=a,Zi=1<<32-gi(e)+r|i<V?(Q=F,F=null):Q=F.sibling;var J=_(x,F,C[V],P);if(J===null){F===null&&(F=Q);break}t&&F&&J.alternate===null&&e(x,F),T=s(J,T,V),N===null?O=J:N.sibling=J,N=J,F=Q}if(V===C.length)return i(x,F),Ne&&rr(x,V),O;if(F===null){for(;VV?(Q=F,F=null):Q=F.sibling;var re=_(x,F,J.value,P);if(re===null){F===null&&(F=Q);break}t&&F&&re.alternate===null&&e(x,F),T=s(re,T,V),N===null?O=re:N.sibling=re,N=re,F=Q}if(J.done)return i(x,F),Ne&&rr(x,V),O;if(F===null){for(;!J.done;V++,J=C.next())J=m(x,J.value,P),J!==null&&(T=s(J,T,V),N===null?O=J:N.sibling=J,N=J);return Ne&&rr(x,V),O}for(F=n(x,F);!J.done;V++,J=C.next())J=E(F,x,V,J.value,P),J!==null&&(t&&J.alternate!==null&&F.delete(J.key===null?V:J.key),T=s(J,T,V),N===null?O=J:N.sibling=J,N=J);return t&&F.forEach(function(pe){return e(x,pe)}),Ne&&rr(x,V),O}function D(x,T,C,P){if(typeof C=="object"&&C!==null&&C.type===zr&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case pl:e:{for(var O=C.key,N=T;N!==null;){if(N.key===O){if(O=C.type,O===zr){if(N.tag===7){i(x,N.sibling),T=r(N,C.props.children),T.return=x,x=T;break e}}else if(N.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===bn&&R0(O)===N.type){i(x,N.sibling),T=r(N,C.props),T.ref=fa(x,N,C),T.return=x,x=T;break e}i(x,N);break}else e(x,N);N=N.sibling}C.type===zr?(T=fr(C.props.children,x.mode,P,C.key),T.return=x,x=T):(P=Kl(C.type,C.key,C.props,null,x.mode,P),P.ref=fa(x,T,C),P.return=x,x=P)}return a(x);case Hr:e:{for(N=C.key;T!==null;){if(T.key===N)if(T.tag===4&&T.stateNode.containerInfo===C.containerInfo&&T.stateNode.implementation===C.implementation){i(x,T.sibling),T=r(T,C.children||[]),T.return=x,x=T;break e}else{i(x,T);break}else e(x,T);T=T.sibling}T=Gd(C,x.mode,P),T.return=x,x=T}return a(x);case bn:return N=C._init,D(x,T,N(C._payload),P)}if(wa(C))return v(x,T,C,P);if(la(C))return S(x,T,C,P);Cl(x,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,T!==null&&T.tag===6?(i(x,T.sibling),T=r(T,C),T.return=x,x=T):(i(x,T),T=Wd(C,x.mode,P),T.return=x,x=T),a(x)):i(x,T)}return D}var Ts=m1(!0),g1=m1(!1),ko={},Ni=Gn(ko),lo=Gn(ko),uo=Gn(ko);function cr(t){if(t===ko)throw Error($(174));return t}function Ep(t,e){switch(be(uo,e),be(lo,t),be(Ni,ko),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:kh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=kh(e,t)}Pe(Ni),be(Ni,e)}function xs(){Pe(Ni),Pe(lo),Pe(uo)}function y1(t){cr(uo.current);var e=cr(Ni.current),i=kh(e,t.type);e!==i&&(be(lo,t),be(Ni,i))}function bp(t){lo.current===t&&(Pe(Ni),Pe(lo))}var Re=Gn(0);function xu(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var jd=[];function Cp(){for(var t=0;ti?i:4,t(!0);var n=$d.transition;$d.transition={};try{t(!1),e()}finally{ve=i,$d.transition=n}}function L1(){return ai().memoizedState}function hA(t,e,i){var n=Fn(t);if(i={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null},N1(t))R1(e,i);else if(i=d1(t,e,i,n),i!==null){var r=St();yi(i,t,n,r),M1(i,e,n)}}function fA(t,e,i){var n=Fn(t),r={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null};if(N1(t))R1(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,i);if(r.hasEagerState=!0,r.eagerState=o,_i(o,a)){var l=e.interleaved;l===null?(r.next=r,xp(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}i=d1(t,e,r,n),i!==null&&(r=St(),yi(i,t,n,r),M1(i,e,n))}}function N1(t){var e=t.alternate;return t===Be||e!==null&&e===Be}function R1(t,e){ja=Su=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function M1(t,e,i){if(i&4194240){var n=e.lanes;n&=t.pendingLanes,i|=n,e.lanes=i,op(t,i)}}var Eu={readContext:si,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useInsertionEffect:ot,useLayoutEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useMutableSource:ot,useSyncExternalStore:ot,useId:ot,unstable_isNewReconciler:!1},pA={readContext:si,useCallback:function(t,e){return Ci().memoizedState=[t,e===void 0?null:e],t},useContext:si,useEffect:B0,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,ql(4194308,4,D1.bind(null,e,t),i)},useLayoutEffect:function(t,e){return ql(4194308,4,t,e)},useInsertionEffect:function(t,e){return ql(4,2,t,e)},useMemo:function(t,e){var i=Ci();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var n=Ci();return e=i!==void 0?i(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=hA.bind(null,Be,t),[n.memoizedState,t]},useRef:function(t){var e=Ci();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:Pp,useDeferredValue:function(t){return Ci().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=dA.bind(null,t[1]),Ci().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var n=Be,r=Ci();if(Ne){if(i===void 0)throw Error($(407));i=i()}else{if(i=e(),tt===null)throw Error($(349));Tr&30||T1(n,e,i)}r.memoizedState=i;var s={value:i,getSnapshot:e};return r.queue=s,B0(S1.bind(null,n,s,t),[t]),n.flags|=2048,fo(9,x1.bind(null,n,s,i,e),void 0,null),i},useId:function(){var t=Ci(),e=tt.identifierPrefix;if(Ne){var i=en,n=Zi;i=(n&~(1<<32-gi(n)-1)).toString(32)+i,e=":"+e+"R"+i,i=co++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(i,{is:n.is}):(t=a.createElement(i),i==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,i),t[Di]=e,t[oo]=n,q1(t,e,!1,!1),e.stateNode=t;e:{switch(a=Ih(i,n),i){case"dialog":ke("cancel",t),ke("close",t),r=n;break;case"iframe":case"object":case"embed":ke("load",t),r=n;break;case"video":case"audio":for(r=0;rEs&&(e.flags|=128,n=!0,pa(s,!1),e.lanes=4194304)}else{if(!n)if(t=xu(a),t!==null){if(e.flags|=128,n=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),pa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Ne)return lt(e),null}else 2*He()-s.renderingStartTime>Es&&i!==1073741824&&(e.flags|=128,n=!0,pa(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(i=s.last,i!==null?i.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=He(),e.sibling=null,i=Re.current,be(Re,n?i&1|2:i&1),e):(lt(e),null);case 22:case 23:return Mp(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?jt&1073741824&&(lt(e),e.subtreeFlags&6&&(e.flags|=8192)):lt(e),null;case 24:return null;case 25:return null}throw Error($(156,e.tag))}function SA(t,e){switch(gp(e),e.tag){case 1:return Lt(e.type)&&pu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xs(),Pe(Ot),Pe(ht),Cp(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return bp(e),null;case 13:if(Pe(Re),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error($(340));_s()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Pe(Re),null;case 4:return xs(),null;case 10:return Tp(e.type._context),null;case 22:case 23:return Mp(),null;case 24:return null;default:return null}}var Al=!1,ut=!1,EA=typeof WeakSet=="function"?WeakSet:Set,K=null;function Zr(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(n){Ue(t,e,n)}else i.current=null}function sf(t,e,i){try{i()}catch(n){Ue(t,e,n)}}var W0=!1;function bA(t,e){if($h=cu,t=Y_(),pp(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var n=i.getSelection&&i.getSelection();if(n&&n.rangeCount!==0){i=n.anchorNode;var r=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{i.nodeType,s.nodeType}catch{i=null;break e}var a=0,o=-1,l=-1,c=0,p=0,m=t,_=null;t:for(;;){for(var E;m!==i||r!==0&&m.nodeType!==3||(o=a+r),m!==s||n!==0&&m.nodeType!==3||(l=a+n),m.nodeType===3&&(a+=m.nodeValue.length),(E=m.firstChild)!==null;)_=m,m=E;for(;;){if(m===t)break t;if(_===i&&++c===r&&(o=a),_===s&&++p===n&&(l=a),(E=m.nextSibling)!==null)break;m=_,_=m.parentNode}m=E}i=o===-1||l===-1?null:{start:o,end:l}}else i=null}i=i||{start:0,end:0}}else i=null;for(Vh={focusedElem:t,selectionRange:i},cu=!1,K=e;K!==null;)if(e=K,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,K=t;else for(;K!==null;){e=K;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var S=v.memoizedProps,D=v.memoizedState,x=e.stateNode,T=x.getSnapshotBeforeUpdate(e.elementType===e.type?S:fi(e.type,S),D);x.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(P){Ue(e,e.return,P)}if(t=e.sibling,t!==null){t.return=e.return,K=t;break}K=e.return}return v=W0,W0=!1,v}function $a(t,e,i){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var r=n=n.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&sf(e,i,s)}r=r.next}while(r!==n)}}function hc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.create;i.destroy=n()}i=i.next}while(i!==e)}}function af(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function X1(t){var e=t.alternate;e!==null&&(t.alternate=null,X1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Di],delete e[oo],delete e[qh],delete e[aA],delete e[oA])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function K1(t){return t.tag===5||t.tag===3||t.tag===4}function G0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||K1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function of(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=fu));else if(n!==4&&(t=t.child,t!==null))for(of(t,e,i),t=t.sibling;t!==null;)of(t,e,i),t=t.sibling}function lf(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(lf(t,e,i),t=t.sibling;t!==null;)lf(t,e,i),t=t.sibling}var nt=null,pi=!1;function xn(t,e,i){for(i=i.child;i!==null;)Q1(t,e,i),i=i.sibling}function Q1(t,e,i){if(Li&&typeof Li.onCommitFiberUnmount=="function")try{Li.onCommitFiberUnmount(rc,i)}catch{}switch(i.tag){case 5:ut||Zr(i,e);case 6:var n=nt,r=pi;nt=null,xn(t,e,i),nt=n,pi=r,nt!==null&&(pi?(t=nt,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nt.removeChild(i.stateNode));break;case 18:nt!==null&&(pi?(t=nt,i=i.stateNode,t.nodeType===8?Fd(t.parentNode,i):t.nodeType===1&&Fd(t,i),io(t)):Fd(nt,i.stateNode));break;case 4:n=nt,r=pi,nt=i.stateNode.containerInfo,pi=!0,xn(t,e,i),nt=n,pi=r;break;case 0:case 11:case 14:case 15:if(!ut&&(n=i.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){r=n=n.next;do{var s=r,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&sf(i,e,a),r=r.next}while(r!==n)}xn(t,e,i);break;case 1:if(!ut&&(Zr(i,e),n=i.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=i.memoizedProps,n.state=i.memoizedState,n.componentWillUnmount()}catch(o){Ue(i,e,o)}xn(t,e,i);break;case 21:xn(t,e,i);break;case 22:i.mode&1?(ut=(n=ut)||i.memoizedState!==null,xn(t,e,i),ut=n):xn(t,e,i);break;default:xn(t,e,i)}}function X0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new EA),e.forEach(function(n){var r=LA.bind(null,t,n);i.has(n)||(i.add(n),n.then(r,r))})}}function hi(t,e){var i=e.deletions;if(i!==null)for(var n=0;nr&&(r=a),n&=~s}if(n=r,n=He()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*wA(n/1960))-n,10t?16:t,Pn===null)var n=!1;else{if(t=Pn,Pn=null,wu=0,fe&6)throw Error($(331));var r=fe;for(fe|=4,K=t.current;K!==null;){var s=K,a=s.child;if(K.flags&16){var o=s.deletions;if(o!==null){for(var l=0;lHe()-Np?hr(t,0):Lp|=i),Nt(t,e)}function r2(t,e){e===0&&(t.mode&1?(e=vl,vl<<=1,!(vl&130023424)&&(vl=4194304)):e=1);var i=St();t=un(t,e),t!==null&&(wo(t,e,i),Nt(t,i))}function OA(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),r2(t,i)}function LA(t,e){var i=0;switch(t.tag){case 13:var n=t.stateNode,r=t.memoizedState;r!==null&&(i=r.retryLane);break;case 19:n=t.stateNode;break;default:throw Error($(314))}n!==null&&n.delete(e),r2(t,i)}var s2;s2=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ot.current)It=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return It=!1,TA(t,e,i);It=!!(t.flags&131072)}else It=!1,Ne&&e.flags&1048576&&l1(e,yu,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Wl(t,e),t=e.pendingProps;var r=vs(e,ht.current);us(e,i),r=Ap(null,e,n,t,r,i);var s=Dp();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Lt(n)?(s=!0,mu(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Sp(e),r.updater=cc,e.stateNode=r,r._reactInternals=e,Yh(e,n,t,i),e=ef(null,e,n,!0,s,i)):(e.tag=0,Ne&&s&&mp(e),yt(null,e,r,i),e=e.child),e;case 16:n=e.elementType;e:{switch(Wl(t,e),t=e.pendingProps,r=n._init,n=r(n._payload),e.type=n,r=e.tag=RA(n),t=fi(n,t),r){case 0:e=Zh(null,e,n,t,i);break e;case 1:e=H0(null,e,n,t,i);break e;case 11:e=$0(null,e,n,t,i);break e;case 14:e=V0(null,e,n,fi(n.type,t),i);break e}throw Error($(306,n,""))}return e;case 0:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:fi(n,r),Zh(t,e,n,r,i);case 1:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:fi(n,r),H0(t,e,n,r,i);case 3:e:{if(V1(e),t===null)throw Error($(387));n=e.pendingProps,s=e.memoizedState,r=s.element,h1(t,e),Tu(e,n,null,i);var a=e.memoizedState;if(n=a.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Ss(Error($(423)),e),e=z0(t,e,n,i,r);break e}else if(n!==r){r=Ss(Error($(424)),e),e=z0(t,e,n,i,r);break e}else for(Ht=Rn(e.stateNode.containerInfo.firstChild),zt=e,Ne=!0,mi=null,i=g1(e,null,n,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(_s(),n===r){e=cn(t,e,i);break e}yt(t,e,n,i)}e=e.child}return e;case 5:return y1(e),t===null&&Xh(e),n=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,a=r.children,Hh(n,r)?a=null:s!==null&&Hh(n,s)&&(e.flags|=32),$1(t,e),yt(t,e,a,i),e.child;case 6:return t===null&&Xh(e),null;case 13:return H1(t,e,i);case 4:return Ep(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Ts(e,null,n,i):yt(t,e,n,i),e.child;case 11:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:fi(n,r),$0(t,e,n,r,i);case 7:return yt(t,e,e.pendingProps,i),e.child;case 8:return yt(t,e,e.pendingProps.children,i),e.child;case 12:return yt(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(n=e.type._context,r=e.pendingProps,s=e.memoizedProps,a=r.value,be(vu,n._currentValue),n._currentValue=a,s!==null)if(_i(s.value,a)){if(s.children===r.children&&!Ot.current){e=cn(t,e,i);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=nn(-1,i&-i),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?l.next=l:(l.next=p.next,p.next=l),c.pending=l}}s.lanes|=i,l=s.alternate,l!==null&&(l.lanes|=i),Kh(s.return,i,e),o.lanes|=i;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error($(341));a.lanes|=i,o=a.alternate,o!==null&&(o.lanes|=i),Kh(a,i,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}yt(t,e,r.children,i),e=e.child}return e;case 9:return r=e.type,n=e.pendingProps.children,us(e,i),r=si(r),n=n(r),e.flags|=1,yt(t,e,n,i),e.child;case 14:return n=e.type,r=fi(n,e.pendingProps),r=fi(n.type,r),V0(t,e,n,r,i);case 15:return U1(t,e,e.type,e.pendingProps,i);case 17:return n=e.type,r=e.pendingProps,r=e.elementType===n?r:fi(n,r),Wl(t,e),e.tag=1,Lt(n)?(t=!0,mu(e)):t=!1,us(e,i),p1(e,n,r),Yh(e,n,r,i),ef(null,e,n,!0,t,i);case 19:return z1(t,e,i);case 22:return j1(t,e,i)}throw Error($(156,e.tag))};function a2(t,e){return O_(t,e)}function NA(t,e,i,n){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(t,e,i,n){return new NA(t,e,i,n)}function Fp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function RA(t){if(typeof t=="function")return Fp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===np)return 11;if(t===rp)return 14}return 2}function Un(t,e){var i=t.alternate;return i===null?(i=ti(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Kl(t,e,i,n,r,s){var a=2;if(n=t,typeof t=="function")Fp(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case zr:return fr(i.children,r,s,e);case ip:a=8,r|=8;break;case xh:return t=ti(12,i,e,r|2),t.elementType=xh,t.lanes=s,t;case Sh:return t=ti(13,i,e,r),t.elementType=Sh,t.lanes=s,t;case Eh:return t=ti(19,i,e,r),t.elementType=Eh,t.lanes=s,t;case m_:return pc(i,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case f_:a=10;break e;case p_:a=9;break e;case np:a=11;break e;case rp:a=14;break e;case bn:a=16,n=null;break e}throw Error($(130,t==null?t:typeof t,""))}return e=ti(a,i,e,r),e.elementType=t,e.type=n,e.lanes=s,e}function fr(t,e,i,n){return t=ti(7,t,n,e),t.lanes=i,t}function pc(t,e,i,n){return t=ti(22,t,n,e),t.elementType=m_,t.lanes=i,t.stateNode={isHidden:!1},t}function Wd(t,e,i){return t=ti(6,t,null,e),t.lanes=i,t}function Gd(t,e,i){return e=ti(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function MA(t,e,i,n,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ad(0),this.expirationTimes=Ad(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ad(0),this.identifierPrefix=n,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Up(t,e,i,n,r,s,a,o,l){return t=new MA(t,e,i,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=ti(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sp(s),t}function BA(t,e,i){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c2)}catch(t){console.error(t)}}c2(),l_.exports=Xt;var VA=l_.exports,iy=VA;_h.createRoot=iy.createRoot,_h.hydrateRoot=iy.hydrateRoot;var d2={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ny=tn.createContext&&tn.createContext(d2),jn=function(){return jn=Object.assign||function(t){for(var e,i=1,n=arguments.length;i"u")throw new Error(e)}function Hp(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function GA(){return Math.random().toString(36).substr(2,8)}function sy(t,e){return{usr:t.state,key:t.key,idx:e}}function ff(t,e,i,n){return i===void 0&&(i=null),mo({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?js(e):e,{state:i,key:e&&e.key||n||GA()})}function p2(t){let{pathname:e="/",search:i="",hash:n=""}=t;return i&&i!=="?"&&(e+=i.charAt(0)==="?"?i:"?"+i),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function js(t){let e={};if(t){let i=t.indexOf("#");i>=0&&(e.hash=t.substr(i),t=t.substr(0,i));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function XA(t,e,i,n){n===void 0&&(n={});let{window:r=document.defaultView,v5Compat:s=!1}=n,a=r.history,o=In.Pop,l=null,c=p();c==null&&(c=0,a.replaceState(mo({},a.state,{idx:c}),""));function p(){return(a.state||{idx:null}).idx}function m(){o=In.Pop;let D=p(),x=D==null?null:D-c;c=D,l&&l({action:o,location:S.location,delta:x})}function _(D,x){o=In.Push;let T=ff(S.location,D,x);i&&i(T,D),c=p()+1;let C=sy(T,c),P=S.createHref(T);try{a.pushState(C,"",P)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;r.location.assign(P)}s&&l&&l({action:o,location:S.location,delta:1})}function E(D,x){o=In.Replace;let T=ff(S.location,D,x);i&&i(T,D),c=p();let C=sy(T,c),P=S.createHref(T);a.replaceState(C,"",P),s&&l&&l({action:o,location:S.location,delta:0})}function v(D){let x=r.location.origin!=="null"?r.location.origin:r.location.href,T=typeof D=="string"?D:p2(D);return Ye(x,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,x)}let S={get action(){return o},get location(){return t(r,a)},listen(D){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(ry,m),l=D,()=>{r.removeEventListener(ry,m),l=null}},createHref(D){return e(r,D)},createURL:v,encodeLocation(D){let x=v(D);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:_,replace:E,go(D){return a.go(D)}};return S}var ay;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(ay||(ay={}));function KA(t,e,i){i===void 0&&(i="/");let n=typeof e=="string"?js(e):e,r=y2(n.pathname||"/",i);if(r==null)return null;let s=m2(t);QA(s);let a=null;for(let o=0;a==null&&o{let l={relativePath:o===void 0?s.path||"":o,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};l.relativePath.startsWith("/")&&(Ye(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=pr([n,l.relativePath]),p=i.concat(l);s.children&&s.children.length>0&&(Ye(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),m2(s.children,e,p,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:nD(c,s.index),routesMeta:p})};return t.forEach((s,a)=>{var o;if(s.path===""||!((o=s.path)!=null&&o.includes("?")))r(s,a);else for(let l of g2(s.path))r(s,a,l)}),e}function g2(t){let e=t.split("/");if(e.length===0)return[];let[i,...n]=e,r=i.endsWith("?"),s=i.replace(/\?$/,"");if(n.length===0)return r?[s,""]:[s];let a=g2(n.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),r&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function QA(t){t.sort((e,i)=>e.score!==i.score?i.score-e.score:rD(e.routesMeta.map(n=>n.childrenIndex),i.routesMeta.map(n=>n.childrenIndex)))}const YA=/^:\w+$/,JA=3,ZA=2,eD=1,tD=10,iD=-2,oy=t=>t==="*";function nD(t,e){let i=t.split("/"),n=i.length;return i.some(oy)&&(n+=iD),e&&(n+=ZA),i.filter(r=>!oy(r)).reduce((r,s)=>r+(YA.test(s)?JA:s===""?eD:tD),n)}function rD(t,e){return t.length===e.length&&t.slice(0,-1).every((n,r)=>n===e[r])?t[t.length-1]-e[e.length-1]:0}function sD(t,e){let{routesMeta:i}=t,n={},r="/",s=[];for(let a=0;a{let{paramName:_,isOptional:E}=p;if(_==="*"){let S=o[m]||"";a=s.slice(0,s.length-S.length).replace(/(.)\/+$/,"$1")}const v=o[m];return E&&!v?c[_]=void 0:c[_]=uD(v||"",_),c},{}),pathname:s,pathnameBase:a,pattern:t}}function oD(t,e,i){e===void 0&&(e=!1),i===void 0&&(i=!0),Hp(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:(\w+)(\?)?/g,(a,o,l)=>(n.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function lD(t){try{return decodeURI(t)}catch(e){return Hp(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function uD(t,e){try{return decodeURIComponent(t)}catch(i){return Hp(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+i+").")),t}}function y2(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let i=e.endsWith("/")?e.length-1:e.length,n=t.charAt(i);return n&&n!=="/"?null:t.slice(i)||"/"}function cD(t,e){e===void 0&&(e="/");let{pathname:i,search:n="",hash:r=""}=typeof t=="string"?js(t):t;return{pathname:i?i.startsWith("/")?i:dD(i,e):e,search:gD(n),hash:yD(r)}}function dD(t,e){let i=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?i.length>1&&i.pop():r!=="."&&i.push(r)}),i.length>1?i.join("/"):"/"}function Xd(t,e,i,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function hD(t){return t.filter((e,i)=>i===0||e.route.path&&e.route.path.length>0)}function fD(t){return hD(t).map((e,i)=>i===t.length-1?e.pathname:e.pathnameBase)}function pD(t,e,i,n){n===void 0&&(n=!1);let r;typeof t=="string"?r=js(t):(r=mo({},t),Ye(!r.pathname||!r.pathname.includes("?"),Xd("?","pathname","search",r)),Ye(!r.pathname||!r.pathname.includes("#"),Xd("#","pathname","hash",r)),Ye(!r.search||!r.search.includes("#"),Xd("#","search","hash",r)));let s=t===""||r.pathname==="",a=s?"/":r.pathname,o;if(a==null)o=i;else if(n){let m=e[e.length-1].replace(/^\//,"").split("/");if(a.startsWith("..")){let _=a.split("/");for(;_[0]==="..";)_.shift(),m.pop();r.pathname=_.join("/")}o="/"+m.join("/")}else{let m=e.length-1;if(a.startsWith("..")){let _=a.split("/");for(;_[0]==="..";)_.shift(),m-=1;r.pathname=_.join("/")}o=m>=0?e[m]:"/"}let l=cD(r,o),c=a&&a!=="/"&&a.endsWith("/"),p=(s||a===".")&&i.endsWith("/");return!l.pathname.endsWith("/")&&(c||p)&&(l.pathname+="/"),l}const pr=t=>t.join("/").replace(/\/\/+/g,"/"),mD=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),gD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,yD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function vD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const v2=["post","put","patch","delete"];new Set(v2);const _D=["get",...v2];new Set(_D);/** + * React Router v6.20.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function ku(){return ku=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),X.useCallback(function(l,c){if(c===void 0&&(c={}),!a.current)return;if(typeof l=="number"){i.go(l);return}let p=pD(l,JSON.parse(s),r,c.relative==="path");t==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:pr([e,p.pathname])),(c.replace?i.replace:i.push)(p,c.state,c)},[e,i,s,r,t])}function SD(){let{matches:t}=X.useContext(Ar),e=t[t.length-1];return e?e.params:{}}function ED(t,e){return bD(t,e)}function bD(t,e,i){xc()||Ye(!1);let{navigator:n}=X.useContext(_c),{matches:r}=X.useContext(Ar),s=r[r.length-1],a=s?s.params:{};s&&s.pathname;let o=s?s.pathnameBase:"/";s&&s.route;let l=T2(),c;if(e){var p;let S=typeof e=="string"?js(e):e;o==="/"||(p=S.pathname)!=null&&p.startsWith(o)||Ye(!1),c=S}else c=l;let m=c.pathname||"/",_=o==="/"?m:m.slice(o.length)||"/",E=KA(t,{pathname:_}),v=kD(E&&E.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:pr([o,n.encodeLocation?n.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?o:pr([o,n.encodeLocation?n.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),r,i);return e&&v?X.createElement(Tc.Provider,{value:{location:ku({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:In.Pop}},v):v}function CD(){let t=LD(),e=vD(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return X.createElement(X.Fragment,null,X.createElement("h2",null,"Unexpected Application Error!"),X.createElement("h3",{style:{fontStyle:"italic"}},e),i?X.createElement("pre",{style:r},i):null,s)}const wD=X.createElement(CD,null);class AD extends X.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,i){return i.location!==e.location||i.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||i.error,location:i.location,revalidation:e.revalidation||i.revalidation}}componentDidCatch(e,i){console.error("React Router caught the following error during render",e,i)}render(){return this.state.error?X.createElement(Ar.Provider,{value:this.props.routeContext},X.createElement(_2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function DD(t){let{routeContext:e,match:i,children:n}=t,r=X.useContext(zp);return r&&r.static&&r.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=i.route.id),X.createElement(Ar.Provider,{value:e},n)}function kD(t,e,i){var n;if(e===void 0&&(e=[]),i===void 0&&(i=null),t==null){var r;if((r=i)!=null&&r.errors)t=i.matches;else return null}let s=t,a=(n=i)==null?void 0:n.errors;if(a!=null){let o=s.findIndex(l=>l.route.id&&(a==null?void 0:a[l.route.id]));o>=0||Ye(!1),s=s.slice(0,Math.min(s.length,o+1))}return s.reduceRight((o,l,c)=>{let p=l.route.id?a==null?void 0:a[l.route.id]:null,m=null;i&&(m=l.route.errorElement||wD);let _=e.concat(s.slice(0,c+1)),E=()=>{let v;return p?v=m:l.route.Component?v=X.createElement(l.route.Component,null):l.route.element?v=l.route.element:v=o,X.createElement(DD,{match:l,routeContext:{outlet:o,matches:_,isDataRoute:i!=null},children:v})};return i&&(l.route.ErrorBoundary||l.route.errorElement||c===0)?X.createElement(AD,{location:i.location,revalidation:i.revalidation,component:m,error:p,children:E(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):E()},null)}var S2=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(S2||{}),Pu=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Pu||{});function PD(t){let e=X.useContext(zp);return e||Ye(!1),e}function ID(t){let e=X.useContext(TD);return e||Ye(!1),e}function OD(t){let e=X.useContext(Ar);return e||Ye(!1),e}function E2(t){let e=OD(),i=e.matches[e.matches.length-1];return i.route.id||Ye(!1),i.route.id}function LD(){var t;let e=X.useContext(_2),i=ID(Pu.UseRouteError),n=E2(Pu.UseRouteError);return e||((t=i.errors)==null?void 0:t[n])}function ND(){let{router:t}=PD(S2.UseNavigateStable),e=E2(Pu.UseNavigateStable),i=X.useRef(!1);return x2(()=>{i.current=!0}),X.useCallback(function(r,s){s===void 0&&(s={}),i.current&&(typeof r=="number"?t.navigate(r):t.navigate(r,ku({fromRouteId:e},s)))},[t,e])}function Ql(t){Ye(!1)}function RD(t){let{basename:e="/",children:i=null,location:n,navigationType:r=In.Pop,navigator:s,static:a=!1}=t;xc()&&Ye(!1);let o=e.replace(/^\/*/,"/"),l=X.useMemo(()=>({basename:o,navigator:s,static:a}),[o,s,a]);typeof n=="string"&&(n=js(n));let{pathname:c="/",search:p="",hash:m="",state:_=null,key:E="default"}=n,v=X.useMemo(()=>{let S=y2(c,o);return S==null?null:{location:{pathname:S,search:p,hash:m,state:_,key:E},navigationType:r}},[o,c,p,m,_,E,r]);return v==null?null:X.createElement(_c.Provider,{value:l},X.createElement(Tc.Provider,{children:i,value:v}))}function MD(t){let{children:e,location:i}=t;return ED(pf(e),i)}new Promise(()=>{});function pf(t,e){e===void 0&&(e=[]);let i=[];return X.Children.forEach(t,(n,r)=>{if(!X.isValidElement(n))return;let s=[...e,r];if(n.type===X.Fragment){i.push.apply(i,pf(n.props.children,s));return}n.type!==Ql&&Ye(!1),!n.props.index||!n.props.children||Ye(!1);let a={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(a.children=pf(n.props.children,s)),i.push(a)}),i}/** + * React Router DOM v6.20.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const BD="startTransition",ly=OC[BD];function FD(t){let{basename:e,children:i,future:n,window:r}=t,s=X.useRef();s.current==null&&(s.current=WA({window:r,v5Compat:!0}));let a=s.current,[o,l]=X.useState({action:a.action,location:a.location}),{v7_startTransition:c}=n||{},p=X.useCallback(m=>{c&&ly?ly(()=>l(m)):l(m)},[l,c]);return X.useLayoutEffect(()=>a.listen(p),[a,p]),X.createElement(RD,{basename:e,children:i,location:o.location,navigationType:o.action,navigator:a})}var uy;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(uy||(uy={}));var cy;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(cy||(cy={}));const UD=({title:t})=>{const e=Sc(),i=()=>{e(-1)};return W.jsxs("div",{className:"fixed top-0 left-0 flex w-full justify-between p-6 gradient z-40",children:[W.jsx("div",{className:"text-red font-bold text-2xl break-keep",children:t}),W.jsx("button",{onClick:i,children:W.jsx(qA,{size:"24"})})]})};function jD(t){return f2({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M403.002 217.001C388.998 148.002 328.998 96 256 96c-57.998 0-107.998 32.998-132.998 81.001C63.002 183.002 16 233.998 16 296c0 65.996 53.999 120 120 120h260c55 0 100-45 100-100 0-52.998-40.996-96.001-92.998-98.999zM288 276v76h-64v-76h-68l100-100 100 100h-68z"}}]})(t)}const $D={video:!0},VD=()=>{const t=X.useRef(null),e=X.useRef(null),[i,n]=X.useState(!1),r=Sc(),s=async()=>{try{const l=await navigator.mediaDevices.getUserMedia($D);t.current&&!t.current.srcObject&&(t.current.srcObject=l,e.current=new MediaRecorder(l),e.current.ondataavailable=c=>{c.data.size>0},e.current.onstop=()=>{console.log("Recording stopped. Sending data to the server...")},e.current.start(1e3))}catch(l){console.error("Error accessing camera:",l)}};X.useEffect(()=>(s(),()=>{e.current&&e.current.state==="recording"&&e.current.stop()}),[]);const a=X.useRef(null),o=()=>{var c,p;const l=(p=(c=a==null?void 0:a.current)==null?void 0:c.files)==null?void 0:p[0];if(console.log(l),l){n(!0);const m=new FormData;m.append("video",l),m.append("file_name",l==null?void 0:l.name),fetch("http://14.35.173.13:38228/api/video/upload",{method:"POST",body:m}).then(_=>_.json()).then(_=>{console.log("Upload success:",_)}).catch(_=>{console.error("Upload error:",_)}).finally(()=>{n(!1),r(`/view/${l==null?void 0:l.name}`)})}};return W.jsxs(W.Fragment,{children:[W.jsx("video",{className:"video",width:"100%",autoPlay:!0,ref:t}),W.jsxs("div",{className:"fixed top-0 left-0 w-full h-full",children:[W.jsx(UD,{title:"AI BLUR 콘텐츠 등록"}),W.jsx("div",{className:"h-full flex flex-col justify-center items-center backdrop-blur",children:i?W.jsxs(W.Fragment,{children:[W.jsx("span",{className:"font-bold",children:"블러를 입히는 중 입니다. 잠시만 기다려주세요."}),W.jsx("br",{}),W.jsx("span",{className:"loader"})]}):W.jsxs(W.Fragment,{children:[W.jsx("label",{htmlFor:"file",className:"font-bold",children:"블러처리 할 파일을 등록해주세요."}),W.jsx("label",{htmlFor:"file",children:W.jsx(jD,{color:"#FFFFFF",size:"72"})}),W.jsx("input",{id:"file",type:"file",className:"hidden",ref:a,onChange:o})]})})]})]})},HD=()=>W.jsx("div",{className:"text-white font-bold w-full h-full fixed top-0 left-0 bg-black flex justify-center items-center z-40",children:W.jsx("span",{className:"splash text-3xl text-[#E21401]",children:"AI Blur"})});var ka;typeof window<"u"?ka=window:typeof ru<"u"?ka=ru:typeof self<"u"?ka=self:ka={};var Ec=ka;const k=gn(Ec),zD={},qD=Object.freeze(Object.defineProperty({__proto__:null,default:zD},Symbol.toStringTag,{value:"Module"})),WD=Yv(qD);var dy=typeof ru<"u"?ru:typeof window<"u"?window:{},GD=WD,Pa;typeof document<"u"?Pa=document:(Pa=dy["__GLOBAL_DOCUMENT_CACHE@4"],Pa||(Pa=dy["__GLOBAL_DOCUMENT_CACHE@4"]=GD));var b2=Pa;const H=gn(b2);var mf={exports:{}};(function(t,e){function i(l){if(l&&typeof l=="object"){var c=l.which||l.keyCode||l.charCode;c&&(l=c)}if(typeof l=="number")return a[l];var p=String(l),m=n[p.toLowerCase()];if(m)return m;var m=r[p.toLowerCase()];if(m)return m;if(p.length===1)return p.charCodeAt(0)}i.isEventKey=function(c,p){if(c&&typeof c=="object"){var m=c.which||c.keyCode||c.charCode;if(m==null)return!1;if(typeof p=="string"){var _=n[p.toLowerCase()];if(_)return _===m;var _=r[p.toLowerCase()];if(_)return _===m}else if(typeof p=="number")return p===m;return!1}},e=t.exports=i;var n=e.code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};/*! + * Programatically add the following + */for(s=97;s<123;s++)n[String.fromCharCode(s)]=s-32;for(var s=48;s<58;s++)n[s-48]=s;for(s=1;s<13;s++)n["f"+s]=s+111;for(s=0;s<10;s++)n["numpad "+s]=s+96;var a=e.names=e.title={};for(s in n)a[n[s]]=s;for(var o in r)n[o]=r[o]})(mf,mf.exports);var XD=mf.exports;const se=gn(XD);var KD=QD;function QD(t,e){var i,n=null;try{i=JSON.parse(t,e)}catch(r){n=r}return[n,i]}const YD=gn(KD);var qp={exports:{}};function dn(){return dn=Object.assign?Object.assign.bind():function(t){for(var e=1;e=400&&r.statusCode<=599){var a=s;if(i)if(nk.TextDecoder){var o=sk(r.headers&&r.headers["content-type"]);try{a=new TextDecoder(o).decode(s)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(s));e({cause:a});return}e(null,s)}};function sk(t){return t===void 0&&(t=""),t.toLowerCase().split(";").reduce(function(e,i){var n=i.split("="),r=n[0],s=n[1];return r.trim()==="charset"?s.trim():e},"utf-8")}var ak=rk,C2=Ec,ok=ZD,lk=ek;Ri.httpHandler=ak;/** + * @license + * slighly modified parse-headers 2.0.2 + * Copyright (c) 2014 David Björklund + * Available under the MIT license + * + */var uk=function(e){var i={};return e&&e.trim().split(` +`).forEach(function(n){var r=n.indexOf(":"),s=n.slice(0,r).trim().toLowerCase(),a=n.slice(r+1).trim();typeof i[s]>"u"?i[s]=a:Array.isArray(i[s])?i[s].push(a):i[s]=[i[s],a]}),i};qp.exports=Ri;qp.exports.default=Ri;Ri.XMLHttpRequest=C2.XMLHttpRequest||fk;Ri.XDomainRequest="withCredentials"in new Ri.XMLHttpRequest?Ri.XMLHttpRequest:C2.XDomainRequest;ck(["get","put","post","patch","head","delete"],function(t){Ri[t==="delete"?"del":t]=function(e,i,n){return i=w2(e,i,n),i.method=t.toUpperCase(),A2(i)}});function ck(t,e){for(var i=0;i"u")throw new Error("callback argument missing");var e=!1,i=function(C,P,O){e||(e=!0,t.callback(C,P,O))};function n(){o.readyState===4&&setTimeout(a,0)}function r(){var T=void 0;if(o.response?T=o.response:T=o.responseText||hk(o),S)try{T=JSON.parse(T)}catch{}return T}function s(T){return clearTimeout(D),T instanceof Error||(T=new Error(""+(T||"Unknown XMLHttpRequest Error"))),T.statusCode=0,i(T,x)}function a(){if(!c){var T;clearTimeout(D),t.useXDR&&o.status===void 0?T=200:T=o.status===1223?204:o.status;var C=x,P=null;return T!==0?(C={body:r(),statusCode:T,method:m,headers:{},url:p,rawRequest:o},o.getAllResponseHeaders&&(C.headers=uk(o.getAllResponseHeaders()))):P=new Error("Internal XMLHttpRequest Error"),i(P,C,C.body)}}var o=t.xhr||null;o||(t.cors||t.useXDR?o=new Ri.XDomainRequest:o=new Ri.XMLHttpRequest);var l,c,p=o.url=t.uri||t.url,m=o.method=t.method||"GET",_=t.body||t.data,E=o.headers=t.headers||{},v=!!t.sync,S=!1,D,x={body:void 0,headers:{},statusCode:0,method:m,url:p,rawRequest:o};if("json"in t&&t.json!==!1&&(S=!0,E.accept||E.Accept||(E.Accept="application/json"),m!=="GET"&&m!=="HEAD"&&(E["content-type"]||E["Content-Type"]||(E["Content-Type"]="application/json"),_=JSON.stringify(t.json===!0?_:t.json))),o.onreadystatechange=n,o.onload=a,o.onerror=s,o.onprogress=function(){},o.onabort=function(){c=!0},o.ontimeout=s,o.open(m,p,!v,t.username,t.password),v||(o.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(D=setTimeout(function(){if(!c){c=!0,o.abort("timeout");var T=new Error("XMLHttpRequest timeout");T.code="ETIMEDOUT",s(T)}},t.timeout)),o.setRequestHeader)for(l in E)E.hasOwnProperty(l)&&o.setRequestHeader(l,E[l]);else if(t.headers&&!dk(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(o.responseType=t.responseType),"beforeSend"in t&&typeof t.beforeSend=="function"&&t.beforeSend(o),o.send(_||null),o}function hk(t){try{if(t.responseType==="document")return t.responseXML;var e=t.responseXML&&t.responseXML.documentElement.nodeName==="parsererror";if(t.responseType===""&&!e)return t.responseXML}catch{}return null}function fk(){}var pk=qp.exports;const D2=gn(pk);var k2={exports:{}},hy=b2,Wp=Object.create||function(){function t(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=e,new t}}();function Vt(t,e){this.name="ParsingError",this.code=t.code,this.message=e||t.message}Vt.prototype=Wp(Error.prototype);Vt.prototype.constructor=Vt;Vt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Gp(t){function e(n,r,s,a){return(n|0)*3600+(r|0)*60+(s|0)+(a|0)/1e3}var i=t.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?e(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?e(i[1],i[2],0,i[4]):e(0,i[1],i[2],i[4]):null}function za(){this.values=Wp(null)}za.prototype={set:function(t,e){!this.get(t)&&e!==""&&(this.values[t]=e)},get:function(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,i){for(var n=0;n=0&&e<=100)?(this.set(t,e),!0):!1}};function Ia(t,e,i,n){var r=n?t.split(n):[t];for(var s in r)if(typeof r[s]=="string"){var a=r[s].split(i);if(a.length===2){var o=a[0].trim(),l=a[1].trim();e(o,l)}}}function mk(t,e,i){var n=t;function r(){var o=Gp(t);if(o===null)throw new Vt(Vt.Errors.BadTimeStamp,"Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,l){var c=new za;Ia(o,function(p,m){switch(p){case"region":for(var _=i.length-1;_>=0;_--)if(i[_].id===m){c.set(p,i[_].region);break}break;case"vertical":c.alt(p,m,["rl","lr"]);break;case"line":var E=m.split(","),v=E[0];c.integer(p,v),c.percent(p,v)&&c.set("snapToLines",!1),c.alt(p,v,["auto"]),E.length===2&&c.alt("lineAlign",E[1],["start","center","end"]);break;case"position":E=m.split(","),c.percent(p,E[0]),E.length===2&&c.alt("positionAlign",E[1],["start","center","end"]);break;case"size":c.percent(p,m);break;case"align":c.alt(p,m,["start","center","end","left","right"]);break}},/:/,/\s/),l.region=c.get("region",null),l.vertical=c.get("vertical","");try{l.line=c.get("line","auto")}catch{}l.lineAlign=c.get("lineAlign","start"),l.snapToLines=c.get("snapToLines",!0),l.size=c.get("size",100);try{l.align=c.get("align","center")}catch{l.align=c.get("align","middle")}try{l.position=c.get("position","auto")}catch{l.position=c.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},l.align)}l.positionAlign=c.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},l.align)}function a(){t=t.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),t.substr(0,3)!=="-->")throw new Vt(Vt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);t=t.substr(3),a(),e.endTime=r(),a(),s(t,e)}var Kd=hy.createElement&&hy.createElement("textarea"),gk={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},fy={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},yk={v:"title",lang:"lang"},py={rt:"ruby"};function P2(t,e){function i(){if(!e)return null;function v(D){return e=e.substr(D.length),D}var S=e.match(/^([^<]*)(<[^>]*>?)?/);return v(S[1]?S[1]:S[2])}function n(v){return Kd.innerHTML=v,v=Kd.textContent,Kd.textContent="",v}function r(v,S){return!py[S.localName]||py[S.localName]===v.localName}function s(v,S){var D=gk[v];if(!D)return null;var x=t.document.createElement(D),T=yk[v];return T&&S&&(x[T]=S.trim()),x}for(var a=t.document.createElement("div"),o=a,l,c=[];(l=i())!==null;){if(l[0]==="<"){if(l[1]==="/"){c.length&&c[c.length-1]===l.substr(2).replace(">","")&&(c.pop(),o=o.parentNode);continue}var p=Gp(l.substr(1,l.length-2)),m;if(p){m=t.document.createProcessingInstruction("timestamp",p),o.appendChild(m);continue}var _=l.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!_||(m=s(_[1],_[3]),!m)||!r(o,m))continue;if(_[2]){var E=_[2].split(".");E.forEach(function(v){var S=/^bg_/.test(v),D=S?v.slice(3):v;if(fy.hasOwnProperty(D)){var x=S?"background-color":"color",T=fy[D];m.style[x]=T}}),m.className=E.join(" ")}c.push(_[1]),o.appendChild(m),o=m;continue}o.appendChild(t.document.createTextNode(n(l)))}return a}var my=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function vk(t){for(var e=0;e=i[0]&&t<=i[1])return!0}return!1}function _k(t){var e=[],i="",n;if(!t||!t.childNodes)return"ltr";function r(o,l){for(var c=l.childNodes.length-1;c>=0;c--)o.push(l.childNodes[c])}function s(o){if(!o||!o.length)return null;var l=o.pop(),c=l.textContent||l.innerText;if(c){var p=c.match(/^.*(\n|\r)/);return p?(o.length=0,p[0]):c}if(l.tagName==="ruby")return s(o);if(l.childNodes)return r(o,l),s(o)}for(r(e,t);i=s(e);)for(var a=0;a=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var e=t.track,i=e.textTrackList,n=0,r=0;rt.left&&this.topt.top};_t.prototype.overlapsAny=function(t){for(var e=0;e=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right};_t.prototype.overlapsOppositeAxis=function(t,e){switch(e){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}};_t.prototype.intersectPercentage=function(t){var e=Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left)),i=Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top)),n=e*i;return n/(this.height*this.width)};_t.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}};_t.getSimpleBoxPosition=function(t){var e=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,i=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,n=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t;var r={left:t.left,right:t.right,top:t.top||n,height:t.height||e,bottom:t.bottom||n+(t.height||e),width:t.width||i};return r};function xk(t,e,i,n){function r(D,x){for(var T,C=new _t(D),P=1,O=0;ON&&(T=new _t(D),P=N),D=new _t(C)}return T||C}var s=new _t(e),a=e.cue,o=Tk(a),l=[];if(a.snapToLines){var c;switch(a.vertical){case"":l=["+y","-y"],c="height";break;case"rl":l=["+x","-x"],c="width";break;case"lr":l=["-x","+x"],c="width";break}var p=s.lineHeight,m=p*Math.round(o),_=i[c]+p,E=l[0];Math.abs(m)>_&&(m=m<0?-1:1,m*=Math.ceil(_/p)*p),o<0&&(m+=a.vertical===""?i.height:i.width,l=l.reverse()),s.move(E,m)}else{var v=s.lineHeight/i.height*100;switch(a.lineAlign){case"center":o-=v/2;break;case"end":o-=v;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}l=["+y","-x","+x","-y"],s=new _t(e)}var S=r(s,l);e.move(S.toCSSCompatValues(i))}function $s(){}$s.StringDecoder=function(){return{decode:function(t){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};$s.convertCueToDOMTree=function(t,e){return!t||!e?null:P2(t,e)};var Sk=.05,Ek="sans-serif",bk="1.5%";$s.processCues=function(t,e,i){if(!t||!e||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=t.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=bk,i.appendChild(n);function r(p){for(var m=0;m")===-1){e.cue.id=a;continue}case"CUE":try{mk(a,e.cue,e.regionList)}catch(p){e.reportOrThrowError(p),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var c=a.indexOf("-->")!==-1;if(!a||c&&(l=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` +`),e.cue.text+=a.replace(/\u2028/g,` +`).replace(/u2029/g,` +`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(p){e.reportOrThrowError(p),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),(t.cue||t.state==="HEADER")&&(t.buffer+=` + +`,t.parse()),t.state==="INITIAL")throw new Vt(Vt.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};var Ck=$s,wk="auto",Ak={"":1,lr:1,rl:1},Dk={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function kk(t){if(typeof t!="string")return!1;var e=Ak[t.toLowerCase()];return e?t.toLowerCase():!1}function Qd(t){if(typeof t!="string")return!1;var e=Dk[t.toLowerCase()];return e?t.toLowerCase():!1}function I2(t,e,i){this.hasBeenReset=!1;var n="",r=!1,s=t,a=e,o=i,l=null,c="",p=!0,m="auto",_="start",E="auto",v="auto",S=100,D="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(x){n=""+x}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(x){r=!!x}},startTime:{enumerable:!0,get:function(){return s},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");s=x,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");a=x,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(x){o=""+x,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(x){l=x,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return c},set:function(x){var T=kk(x);if(T===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");c=T,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(x){p=!!x,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return m},set:function(x){if(typeof x!="number"&&x!==wk)throw new SyntaxError("Line: an invalid number or illegal string was specified.");m=x,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return _},set:function(x){var T=Qd(x);T?(_=T,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return E},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");E=x,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return v},set:function(x){var T=Qd(x);T?(v=T,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return S},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");S=x,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return D},set:function(x){var T=Qd(x);if(!T)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");D=T,this.hasBeenReset=!0}}}),this.displayState=void 0}I2.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Pk=I2,Ik={"":!0,up:!0};function Ok(t){if(typeof t!="string")return!1;var e=Ik[t.toLowerCase()];return e?t.toLowerCase():!1}function ga(t){return typeof t=="number"&&t>=0&&t<=100}function Lk(){var t=100,e=3,i=0,n=100,r=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(o){if(!ga(o))throw new Error("Width must be between 0 and 100.");t=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!ga(o))throw new Error("RegionAnchorX must be between 0 and 100.");n=o}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(o){if(!ga(o))throw new Error("RegionAnchorY must be between 0 and 100.");i=o}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(o){if(!ga(o))throw new Error("ViewportAnchorY must be between 0 and 100.");s=o}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(o){if(!ga(o))throw new Error("ViewportAnchorX must be between 0 and 100.");r=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var l=Ok(o);l===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=l}}})}var Nk=Lk,hn=Ec,Dr=k2.exports={WebVTT:Ck,VTTCue:Pk,VTTRegion:Nk};hn.vttjs=Dr;hn.WebVTT=Dr.WebVTT;var Rk=Dr.VTTCue,Mk=Dr.VTTRegion,Bk=hn.VTTCue,Fk=hn.VTTRegion;Dr.shim=function(){hn.VTTCue=Rk,hn.VTTRegion=Mk};Dr.restore=function(){hn.VTTCue=Bk,hn.VTTRegion=Fk};hn.VTTCue||Dr.shim();var Uk=k2.exports;const gy=gn(Uk);var O2={exports:{}};(function(t,e){(function(i){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,p){if(p=p||{},l=l.trim(),c=c.trim(),!c){if(!p.alwaysNormalize)return l;var m=o.parseURL(l);if(!m)throw new Error("Error trying to parse base URL.");return m.path=o.normalizePath(m.path),o.buildURLFromParts(m)}var _=o.parseURL(c);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return p.alwaysNormalize?(_.path=o.normalizePath(_.path),o.buildURLFromParts(_)):c;var E=o.parseURL(l);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var v=r.exec(E.path);E.netLoc=v[1],E.path=v[2]}E.netLoc&&!E.path&&(E.path="/");var S={scheme:E.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(S.netLoc=E.netLoc,_.path[0]!=="/"))if(!_.path)S.path=E.path,_.params||(S.params=E.params,_.query||(S.query=E.query));else{var D=E.path,x=D.substring(0,D.lastIndexOf("/")+1)+_.path;S.path=o.normalizePath(x)}return S.path===null&&(S.path=p.alwaysNormalize?o.normalizePath(_.path):_.path),o.buildURLFromParts(S)},parseURL:function(l){var c=n.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};t.exports=o})()})(O2);var jk=O2.exports;const Ou=gn(jk);var yy="http://example.com",$k=function(e,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(e)&&(e=k.location&&k.location.href||"");var n=typeof k.URL=="function",r=/^\/\//.test(e),s=!k.location&&!/\/\//i.test(e);if(n?e=new k.URL(e,k.location||yy):/\/\//i.test(e)||(e=Ou.buildAbsoluteURL(k.location&&k.location.href||"",e)),n){var a=new URL(i,e);return s?a.href.slice(yy.length):r?a.href.slice(a.protocol.length):a.href}return Ou.buildAbsoluteURL(e,i)},Xp=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(n,r){this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(r)},e.off=function(n,r){if(!this.listeners[n])return!1;var s=this.listeners[n].indexOf(r);return this.listeners[n]=this.listeners[n].slice(0),this.listeners[n].splice(s,1),s>-1},e.trigger=function(n){var r=this.listeners[n];if(r)if(arguments.length===2)for(var s=r.length,a=0;a-1;i=this.buffer.indexOf(` +`))this.trigger("data",this.buffer.substring(0,i)),this.buffer=this.buffer.substring(i+1)}}const zk=" ",Yd=function(t){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},qk=function(){const t="[^=]*",e='"[^"]*"|[^,]*',i="(?:"+t+")=(?:"+e+")";return new RegExp("(?:^|,)("+i+")")},Yt=function(t){const e={};if(!t)return e;const i=t.split(qk());let n=i.length,r;for(;n--;)i[n]!==""&&(r=/([^=]*)=(.*)/.exec(i[n]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e};class Wk extends Xp{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let i,n;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((s,a)=>{const o=a(e);return o===e?s:s.concat([o])},[e]).forEach(s=>{for(let a=0;as),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:n(s),customType:i,segment:r}),!0})}addTagMapper({expression:e,map:i}){const n=r=>e.test(r)?i(r):r;this.tagMappers.push(n)}}const Gk=t=>t.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),ir=function(t){const e={};return Object.keys(t).forEach(function(i){e[Gk(i)]=t[i]}),e},Jd=function(t){const{serverControl:e,targetDuration:i,partTargetDuration:n}=t;if(!e)return;const r="#EXT-X-SERVER-CONTROL",s="holdBack",a="partHoldBack",o=i&&i*3,l=n&&n*2;i&&!e.hasOwnProperty(s)&&(e[s]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[s]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&r&&(n.map=r),!n.key&&s&&(n.key=s),!n.timeline&&typeof p=="number"&&(n.timeline=p),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(v){let S,D;({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const x={};"length"in v&&(n.byterange=x,x.length=v.length,"offset"in v||(v.offset=m)),"offset"in v&&(n.byterange=x,x.offset=v.offset),m=x.offset+x.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.duration>0&&(n.duration=v.duration),v.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){s=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===c){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:L2(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(s.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,p=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){r={},v.uri&&(r.uri=v.uri),v.byterange&&(r.byterange=v.byterange),s&&(r.key=s)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||l,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),dn(n.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const x=this.manifest.mediaGroups[v.attributes.TYPE];x[v.attributes["GROUP-ID"]]=x[v.attributes["GROUP-ID"]]||{},S=x[v.attributes["GROUP-ID"]],D={default:/yes/i.test(v.attributes.DEFAULT)},D.default?D.autoselect=!0:D.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(D.language=v.attributes.LANGUAGE),v.attributes.URI&&(D.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(D.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(D.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(D.forced=/yes/i.test(v.attributes.FORCED)),S[v.attributes.NAME]=D},discontinuity(){p+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),n.dateTimeString=v.dateTimeString,n.dateTimeObject=v.dateTimeObject},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,Jd.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){n.cueOut=v.data},"cue-out-cont"(){n.cueOutCont=v.data},"cue-in"(){n.cueIn=v.data},skip(){this.manifest.skip=ir(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const x=this.manifest.segments.length,T=ir(v.attributes);n.parts=n.parts||[],n.parts.push(T),T.byterange&&(T.byterange.hasOwnProperty("offset")||(T.byterange.offset=_),_=T.byterange.offset+T.byterange.length);const C=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${C} for segment #${x}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((P,O)=>{P.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${O} lacks required attribute(s): LAST-PART`})})},"server-control"(){const x=this.manifest.serverControl=ir(v.attributes);x.hasOwnProperty("canBlockReload")||(x.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Jd.call(this,this.manifest),x.canSkipDateranges&&!x.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const x=this.manifest.segments.length,T=ir(v.attributes),C=T.type&&T.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(T),T.byterange&&(T.byterange.hasOwnProperty("offset")||(T.byterange.offset=C?_:0,C&&(_=T.byterange.offset+T.byterange.length)));const P=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${P} for segment #${x}`,v.attributes,["TYPE","URI"]),!!T.type)for(let O=0;Om&&(p-=m,p-=m,p-=rt(2))}return Number(p)},s3=function(e,i){var n=i===void 0?{}:i,r=n.le,s=r===void 0?!1:r;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=rt(e);for(var a=i3(e),o=new Uint8Array(new ArrayBuffer(a)),l=0;l=i.length&&c.call(i,function(p,m){var _=l[m]?l[m]&e[a+m]:e[a+m];return p===_})},Ty="http://example.com",Kp=function(e,i){if(/^[a-z]+:/i.test(i))return i;/^data:/.test(e)&&(e=k.location&&k.location.href||"");var n=typeof k.URL=="function",r=/^\/\//.test(e),s=!k.location&&!/\/\//i.test(e);if(n?e=new k.URL(e,k.location||Ty):/\/\//i.test(e)||(e=Ou.buildAbsoluteURL(k.location&&k.location.href||"",e)),n){var a=new URL(i,e);return s?a.href.slice(Ty.length):r?a.href.slice(a.protocol.length):a.href}return Ou.buildAbsoluteURL(e,i)},o3=function(e,i,n){i.forEach(function(r){for(var s in e.mediaGroups[r])for(var a in e.mediaGroups[r][s]){var o=e.mediaGroups[r][s][a];n(o,r,s,a)}})},Kn={},vn={};function l3(t,e,i){if(i===void 0&&(i=Array.prototype),t&&typeof i.find=="function")return i.find.call(t,e);for(var n=0;n=0&&t=0){for(var r=e.length-1;n0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n}e=e.nodeType==bs?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==bs?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Y2(t){return t=="<"&&"<"||t==">"&&">"||t=="&"&&"&"||t=='"'&&"""||"&#"+t.charCodeAt()+";"}Po(Bt,_e);Po(Bt,_e.prototype);function vo(t,e){if(e(t))return!0;if(t=t.firstChild)do if(vo(t,e))return!0;while(t=t.nextSibling)}function Io(){this.ownerDocument=this}function g3(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===yo.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function J2(t,e,i,n){t&&t._inc++;var r=i.namespaceURI;r===yo.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Jp(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var r=e.firstChild,s=0;r;)n[s++]=r,r=r.nextSibling;n.length=s,delete n[n.length]}}}function Z2(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Jp(t.ownerDocument,t),e}function y3(t){return t&&(t.nodeType===_e.DOCUMENT_NODE||t.nodeType===_e.DOCUMENT_FRAGMENT_NODE||t.nodeType===_e.ELEMENT_NODE)}function v3(t){return t&&(Bi(t)||Zp(t)||pn(t)||t.nodeType===_e.DOCUMENT_FRAGMENT_NODE||t.nodeType===_e.COMMENT_NODE||t.nodeType===_e.PROCESSING_INSTRUCTION_NODE)}function pn(t){return t&&t.nodeType===_e.DOCUMENT_TYPE_NODE}function Bi(t){return t&&t.nodeType===_e.ELEMENT_NODE}function Zp(t){return t&&t.nodeType===_e.TEXT_NODE}function Cy(t,e){var i=t.childNodes||[];if(Mi(i,Bi)||pn(e))return!1;var n=Mi(i,pn);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function wy(t,e){var i=t.childNodes||[];function n(s){return Bi(s)&&s!==e}if(Mi(i,n))return!1;var r=Mi(i,pn);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function _3(t,e,i){if(!y3(t))throw new ze(kt,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new ze(X2,"child not in parent");if(!v3(e)||pn(e)&&t.nodeType!==_e.DOCUMENT_NODE)throw new ze(kt,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function T3(t,e,i){var n=t.childNodes||[],r=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Bi);if(s.length>1||Mi(r,Zp))throw new ze(kt,"More than one element or text in fragment");if(s.length===1&&!Cy(t,i))throw new ze(kt,"Element in fragment can not be inserted before doctype")}if(Bi(e)&&!Cy(t,i))throw new ze(kt,"Only one element can be added and only after doctype");if(pn(e)){if(Mi(n,pn))throw new ze(kt,"Only one doctype is allowed");var a=Mi(n,Bi);if(i&&n.indexOf(a)1||Mi(r,Zp))throw new ze(kt,"More than one element or text in fragment");if(s.length===1&&!wy(t,i))throw new ze(kt,"Element in fragment can not be inserted before doctype")}if(Bi(e)&&!wy(t,i))throw new ze(kt,"Only one element can be added and only after doctype");if(pn(e)){let l=function(c){return pn(c)&&c!==i};var o=l;if(Mi(n,l))throw new ze(kt,"Only one doctype is allowed");var a=Mi(n,Bi);if(i&&n.indexOf(a)0&&vo(i.documentElement,function(r){if(r!==i&&r.nodeType===vi){var s=r.getAttribute("class");if(s){var a=t===s;if(!a){var o=xy(s);a=e.every(f3(o))}a&&n.push(r)}}}),n})},createElement:function(t){var e=new Er;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new rn;var i=e.attributes=new Nu;return i._ownerElement=e,e},createDocumentFragment:function(){var t=new wc;return t.ownerDocument=this,t.childNodes=new rn,t},createTextNode:function(t){var e=new em;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new tm;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new im;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new rm;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new Mu;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new nm;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new Er,n=e.split(":"),r=i.attributes=new Nu;return i.childNodes=new rn,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=e,r._ownerElement=i,i},createAttributeNS:function(t,e){var i=new Mu,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,n.length==2?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}};Mt(Io,_e);function Er(){this._nsMap={}}Er.prototype={nodeType:vi,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===fn?this.insertBefore(t,null):x3(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Cs(this,function(e){var i=[];return vo(e,function(n){n!==e&&n.nodeType==vi&&(t==="*"||n.tagName==t)&&i.push(n)}),i})},getElementsByTagNameNS:function(t,e){return new Cs(this,function(i){var n=[];return vo(i,function(r){r!==i&&r.nodeType===vi&&(t==="*"||r.namespaceURI===t)&&(e==="*"||r.localName==e)&&n.push(r)}),n})}};Io.prototype.getElementsByTagName=Er.prototype.getElementsByTagName;Io.prototype.getElementsByTagNameNS=Er.prototype.getElementsByTagNameNS;Mt(Er,_e);function Mu(){}Mu.prototype.nodeType=bs;Mt(Mu,_e);function Oo(){}Oo.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(it[kt])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){var n=this.data.substring(0,t),r=this.data.substring(t+e);i=n+i+r,this.nodeValue=this.data=i,this.length=i.length}};Mt(Oo,_e);function em(){}em.prototype={nodeName:"#text",nodeType:Lu,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};Mt(em,Oo);function tm(){}tm.prototype={nodeName:"#comment",nodeType:q2};Mt(tm,Oo);function im(){}im.prototype={nodeName:"#cdata-section",nodeType:V2};Mt(im,Oo);function Cc(){}Cc.prototype.nodeType=G2;Mt(Cc,_e);function tT(){}tT.prototype.nodeType=m3;Mt(tT,_e);function iT(){}iT.prototype.nodeType=p3;Mt(iT,_e);function nm(){}nm.prototype.nodeType=H2;Mt(nm,_e);function wc(){}wc.prototype.nodeName="#document-fragment";wc.prototype.nodeType=fn;Mt(wc,_e);function rm(){}rm.prototype.nodeType=z2;Mt(rm,_e);function nT(){}nT.prototype.serializeToString=function(t,e,i){return rT.call(t,e,i)};_e.prototype.toString=rT;function rT(t,e){var i=[],n=this.nodeType==9&&this.documentElement||this,r=n.prefix,s=n.namespaceURI;if(s&&r==null){var r=n.lookupPrefix(s);if(r==null)var a=[{namespace:s,prefix:null}]}return ts(this,i,t,e,a),i.join("")}function Ay(t,e,i){var n=t.prefix||"",r=t.namespaceURI;if(!r||n==="xml"&&r===yo.XML||r===yo.XMLNS)return!1;for(var s=i.length;s--;){var a=i[s];if(a.prefix===n)return a.namespace!==r}return!0}function eh(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,Y2),'"')}function ts(t,e,i,n,r){if(r||(r=[]),n)if(t=n(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case vi:var s=t.attributes,a=s.length,x=t.firstChild,o=t.tagName;i=yo.isHTML(t.namespaceURI)||i;var l=o;if(!i&&!t.prefix&&t.namespaceURI){for(var c,p=0;p=0;m--){var _=r[m];if(_.prefix===""&&_.namespace===t.namespaceURI){c=_.namespace;break}}if(c!==t.namespaceURI)for(var m=r.length-1;m>=0;m--){var _=r[m];if(_.namespace===t.namespaceURI){_.prefix&&(l=_.prefix+":"+o);break}}}e.push("<",l);for(var E=0;E"),i&&/^script$/i.test(o))for(;x;)x.data?e.push(x.data):ts(x,e,i,n,r.slice()),x=x.nextSibling;else for(;x;)ts(x,e,i,n,r.slice()),x=x.nextSibling;e.push("")}else e.push("/>");return;case W2:case fn:for(var x=t.firstChild;x;)ts(x,e,i,n,r.slice()),x=x.nextSibling;return;case bs:return eh(e,t.name,t.value);case Lu:return e.push(t.data.replace(/[<&>]/g,Y2));case V2:return e.push("");case q2:return e.push("");case G2:var T=t.publicId,C=t.systemId;if(e.push("");else if(C&&C!=".")e.push(" SYSTEM ",C,">");else{var P=t.internalSubset;P&&e.push(" [",P,"]"),e.push(">")}return;case z2:return e.push("");case H2:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function sT(t,e,i){var n;switch(e.nodeType){case vi:n=e.cloneNode(!1),n.ownerDocument=t;case fn:break;case bs:i=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var r=e.firstChild;r;)n.appendChild(sT(t,r,i)),r=r.nextSibling;return n}function yf(t,e,i){var n=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=e[r];typeof s!="object"&&s!=n[r]&&(n[r]=s)}switch(e.childNodes&&(n.childNodes=new rn),n.ownerDocument=t,n.nodeType){case vi:var a=e.attributes,o=n.attributes=new Nu,l=a.length;o._ownerElement=n;for(var c=0;c",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` +`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(oT);var sm={},_o=vn.NAMESPACE,vf=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Dy=new RegExp("[\\-\\.0-9"+vf.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ky=new RegExp("^"+vf.source+Dy.source+"*(?::"+vf.source+Dy.source+"*)?$"),ya=0,Sn=1,Mr=2,va=3,Br=4,Fr=5,_a=6,Pl=7;function ws(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,ws)}ws.prototype=new Error;ws.prototype.name=ws.name;function lT(){}lT.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),uT(e,e={}),S3(t,e,i,n,this.errorHandler),n.endDocument()}};function S3(t,e,i,n,r){function s(ce){if(ce>65535){ce-=65536;var Ae=55296+(ce>>10),q=56320+(ce&1023);return String.fromCharCode(Ae,q)}else return String.fromCharCode(ce)}function a(ce){var Ae=ce.slice(1,-1);return Object.hasOwnProperty.call(i,Ae)?i[Ae]:Ae.charAt(0)==="#"?s(parseInt(Ae.substr(1).replace("x","0x"))):(r.error("entity not found:"+ce),ce)}function o(ce){if(ce>S){var Ae=t.substring(S,ce).replace(/&#?\w+;/g,a);_&&l(S),n.characters(Ae,0,ce-S),S=ce}}function l(ce,Ae){for(;ce>=p&&(Ae=m.exec(t));)c=Ae.index,p=c+Ae[0].length,_.lineNumber++;_.columnNumber=ce-c+1}for(var c=0,p=0,m=/.*(?:\r\n?|\n)|.*$/g,_=n.locator,E=[{currentNSMap:e}],v={},S=0;;){try{var D=t.indexOf("<",S);if(D<0){if(!t.substr(S).match(/^\s*$/)){var x=n.doc,T=x.createTextNode(t.substr(S));x.appendChild(T),n.currentElement=T}return}switch(D>S&&o(D),t.charAt(D+1)){case"/":var re=t.indexOf(">",D+3),C=t.substring(D+2,re).replace(/[ \t\n\r]+$/g,""),P=E.pop();re<0?(C=t.substring(D+2).replace(/[\s<].*/,""),r.error("end tag name: "+C+" is not complete:"+P.tagName),re=D+1+C.length):C.match(/\sS?S=re:o(Math.max(D,S)+1)}}function Py(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function E3(t,e,i,n,r,s){function a(_,E,v){i.attributeNames.hasOwnProperty(_)&&s.fatalError("Attribute "+_+" redefined"),i.addValue(_,E.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),v)}for(var o,l,c=++e,p=ya;;){var m=t.charAt(c);switch(m){case"=":if(p===Sn)o=t.slice(e,c),p=va;else if(p===Mr)p=va;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===va||p===Sn)if(p===Sn&&(s.warning('attribute value must after "="'),o=t.slice(e,c)),e=c+1,c=t.indexOf(m,e),c>0)l=t.slice(e,c),a(o,l,e-1),p=Fr;else throw new Error("attribute value no end '"+m+"' match");else if(p==Br)l=t.slice(e,c),a(o,l,e),s.warning('attribute "'+o+'" missed start quot('+m+")!!"),e=c+1,p=Fr;else throw new Error('attribute value must after "="');break;case"/":switch(p){case ya:i.setTagName(t.slice(e,c));case Fr:case _a:case Pl:p=Pl,i.closed=!0;case Br:case Sn:break;case Mr:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),p==ya&&i.setTagName(t.slice(e,c)),c;case">":switch(p){case ya:i.setTagName(t.slice(e,c));case Fr:case _a:case Pl:break;case Br:case Sn:l=t.slice(e,c),l.slice(-1)==="/"&&(i.closed=!0,l=l.slice(0,-1));case Mr:p===Mr&&(l=o),p==Br?(s.warning('attribute "'+l+'" missed quot(")!'),a(o,l,e)):((!_o.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case va:throw new Error("attribute value missed!!")}return c;case"€":m=" ";default:if(m<=" ")switch(p){case ya:i.setTagName(t.slice(e,c)),p=_a;break;case Sn:o=t.slice(e,c),p=Mr;break;case Br:var l=t.slice(e,c);s.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case Fr:p=_a;break}else switch(p){case Mr:i.tagName,(!_o.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=c,p=Sn;break;case Fr:s.warning('attribute space is required"'+o+'"!!');case _a:p=Sn,e=c;break;case va:p=Br,e=c;break;case Pl:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function Iy(t,e,i){for(var n=t.tagName,r=null,m=t.length;m--;){var s=t[m],a=s.qName,o=s.value,_=a.indexOf(":");if(_>0)var l=s.prefix=a.slice(0,_),c=a.slice(_+1),p=l==="xmlns"&&c;else c=a,l=null,p=a==="xmlns"&&"";s.localName=c,p!==!1&&(r==null&&(r={},uT(i,i={})),i[p]=r[p]=o,s.uri=_o.XMLNS,e.startPrefixMapping(p,o))}for(var m=t.length;m--;){s=t[m];var l=s.prefix;l&&(l==="xml"&&(s.uri=_o.XML),l!=="xmlns"&&(s.uri=i[l||""]))}var _=n.indexOf(":");_>0?(l=t.prefix=n.slice(0,_),c=t.localName=n.slice(_+1)):(l=null,c=t.localName=n);var E=t.uri=i[l||""];if(e.startElement(E,c,n,t),t.closed){if(e.endElement(E,c,n),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&e.endPrefixMapping(l)}else return t.currentNSMap=i,t.localNSMap=r,!0}function b3(t,e,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var s=t.indexOf("",e),a=t.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(i)?(r.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),s)}return e+1}function C3(t,e,i,n){var r=n[i];return r==null&&(r=t.lastIndexOf(""),r",e+4);return s>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var a=D3(t,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var l=a[1][0],c=!1,p=!1;o>3&&(/^public$/i.test(a[2][0])?(c=a[3][0],p=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var m=a[o-1];return i.startDTD(l,c,p),i.endDTD(),m.index+m[0].length}}return-1}function A3(t,e,i){var n=t.indexOf("?>",e);if(n){var r=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function cT(){this.attributeNames={}}cT.prototype={setTagName:function(t){if(!ky.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!ky.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function D3(t,e){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(t);i=r.exec(t);)if(n.push(i),i[1])return n}sm.XMLReader=lT;sm.ParseError=ws;var k3=vn,P3=Kn,Oy=oT,dT=sm,I3=P3.DOMImplementation,Ly=k3.NAMESPACE,O3=dT.ParseError,L3=dT.XMLReader;function hT(t){return t.replace(/\r[\n\u0085]/g,` +`).replace(/[\r\u0085\u2028]/g,` +`)}function fT(t){this.options=t||{locator:{}}}fT.prototype.parseFromString=function(t,e){var i=this.options,n=new L3,r=i.domBuilder||new Lo,s=i.errorHandler,a=i.locator,o=i.xmlns||{},l=/\/x?html?$/.test(e),c=l?Oy.HTML_ENTITIES:Oy.XML_ENTITIES;a&&r.setDocumentLocator(a),n.errorHandler=N3(s,r,a),n.domBuilder=i.domBuilder||r,l&&(o[""]=Ly.HTML),o.xml=o.xml||Ly.XML;var p=i.normalizeLineEndings||hT;return t&&typeof t=="string"?n.parse(p(t),o,c):n.errorHandler.error("invalid doc source"),r.doc};function N3(t,e,i){if(!t){if(e instanceof Lo)return e;t=e}var n={},r=t instanceof Function;i=i||{};function s(a){var o=t[a];!o&&r&&(o=t.length==2?function(l){t(a,l)}:t),n[a]=o&&function(l){o("[xmldom "+a+"] "+l+_f(i))}||function(){}}return s("warning"),s("error"),s("fatalError"),n}function Lo(){this.cdata=!1}function Ur(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}Lo.prototype={startDocument:function(){this.doc=new I3().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var r=this.doc,s=r.createElementNS(t,i||e),a=n.length;Il(this,s),this.currentElement=s,this.locator&&Ur(this.locator,s);for(var o=0;o=e+i||e?new java.lang.String(t,e,i)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){Lo.prototype[t]=function(){return null}});function Il(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}Ac.__DOMHandler=Lo;Ac.normalizeLineEndings=hT;Ac.DOMParser=fT;var R3=Ac.DOMParser;/*! @name mpd-parser @version 1.2.2 @license Apache-2.0 */const Ry=t=>!!t&&typeof t=="object",et=(...t)=>t.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(n=>{Array.isArray(e[n])&&Array.isArray(i[n])?e[n]=e[n].concat(i[n]):Ry(e[n])&&Ry(i[n])?e[n]=et(e[n],i[n]):e[n]=i[n]}),e),{}),pT=t=>Object.keys(t).map(e=>t[e]),M3=(t,e)=>{const i=[];for(let n=t;nt.reduce((e,i)=>e.concat(i),[]),mT=t=>{if(!t.length)return[];const e=[];for(let i=0;it.reduce((i,n,r)=>(n[e]&&i.push(r),i),[]),F3=(t,e)=>pT(t.reduce((i,n)=>(n.forEach(r=>{i[e(r)]=r}),i),{}));var Ds={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const To=({baseUrl:t="",source:e="",range:i="",indexRange:n=""})=>{const r={uri:e,resolvedUri:Kp(t||"",e)};if(i||n){const a=(i||n).split("-");let o=k.BigInt?k.BigInt(a[0]):parseInt(a[0],10),l=k.BigInt?k.BigInt(a[1]):parseInt(a[1],10);o{let e;return typeof t.offset=="bigint"||typeof t.length=="bigint"?e=k.BigInt(t.offset)+k.BigInt(t.length)-k.BigInt(1):e=t.offset+t.length-1,`${t.offset}-${e}`},My=t=>(t&&typeof t!="number"&&(t=parseInt(t,10)),isNaN(t)?null:t),j3={static(t){const{duration:e,timescale:i=1,sourceDuration:n,periodDuration:r}=t,s=My(t.endNumber),a=e/i;return typeof s=="number"?{start:0,end:s}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:n/a}},dynamic(t){const{NOW:e,clientOffset:i,availabilityStartTime:n,timescale:r=1,duration:s,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=t,c=My(t.endNumber),p=(e+i)/1e3,m=n+a,E=p+o-m,v=Math.ceil(E*r/s),S=Math.floor((p-m-l)*r/s),D=Math.floor((p-m)*r/s);return{start:Math.max(0,S),end:typeof c=="number"?c:Math.min(v,D)}}},$3=t=>e=>{const{duration:i,timescale:n=1,periodStart:r,startNumber:s=1}=t;return{number:s+e,duration:i/n,timeline:r,time:e*i}},am=t=>{const{type:e,duration:i,timescale:n=1,periodDuration:r,sourceDuration:s}=t,{start:a,end:o}=j3[e](t),l=M3(a,o).map($3(t));if(e==="static"){const c=l.length-1,p=typeof r=="number"?r:s;l[c].duration=p-i/n*c}return l},gT=t=>{const{baseUrl:e,initialization:i={},sourceDuration:n,indexRange:r="",periodStart:s,presentationTime:a,number:o=0,duration:l}=t;if(!e)throw new Error(Ds.NO_BASE_URL);const c=To({baseUrl:e,source:i.sourceURL,range:i.range}),p=To({baseUrl:e,source:e,indexRange:r});if(p.map=c,l){const m=am(t);m.length&&(p.duration=m[0].duration,p.timeline=m[0].timeline)}else n&&(p.duration=n,p.timeline=s);return p.presentationTime=a||s,p.number=o,[p]},om=(t,e,i)=>{const n=t.sidx.map?t.sidx.map:null,r=t.sidx.duration,s=t.timeline||0,a=t.sidx.byterange,o=a.offset+a.length,l=e.timescale,c=e.references.filter(D=>D.referenceType!==1),p=[],m=t.endList?"static":"dynamic",_=t.sidx.timeline;let E=_,v=t.mediaSequence||0,S;typeof e.firstOffset=="bigint"?S=k.BigInt(o)+e.firstOffset:S=o+e.firstOffset;for(let D=0;DF3(t,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),z3=(t,e)=>{for(let i=0;i{let e=[];return o3(t,V3,(i,n,r,s)=>{e=e.concat(i.playlists||[])}),e},Fy=({playlist:t,mediaSequence:e})=>{t.mediaSequence=e,t.segments.forEach((i,n)=>{i.number=t.mediaSequence+n})},q3=({oldPlaylists:t,newPlaylists:e,timelineStarts:i})=>{e.forEach(n=>{n.discontinuitySequence=i.findIndex(function({timeline:l}){return l===n.timeline});const r=z3(t,n.attributes.NAME);if(!r||n.sidx)return;const s=n.segments[0],a=r.segments.findIndex(function(l){return Math.abs(l.presentationTime-s.presentationTime)r.timeline||r.segments.length&&n.timeline>r.segments[r.segments.length-1].timeline)&&n.discontinuitySequence--;return}r.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),Fy({playlist:n,mediaSequence:r.segments[a].number})})},W3=({oldManifest:t,newManifest:e})=>{const i=t.playlists.concat(By(t)),n=e.playlists.concat(By(e));return e.timelineStarts=yT([t.timelineStarts,e.timelineStarts]),q3({oldPlaylists:i,newPlaylists:n,timelineStarts:e.timelineStarts}),e},Dc=t=>t&&t.uri+"-"+U3(t.byterange),th=t=>{const e=t.reduce(function(n,r){return n[r.attributes.baseUrl]||(n[r.attributes.baseUrl]=[]),n[r.attributes.baseUrl].push(r),n},{});let i=[];return Object.values(e).forEach(n=>{const r=pT(n.reduce((s,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return s[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),s[o].segments.push(...a.segments)),a.attributes.contentProtection&&(s[o].attributes.contentProtection=a.attributes.contentProtection)):(s[o]=a,s[o].attributes.timelineStarts=[]),s[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),s},{}));i=i.concat(r)}),i.map(n=>(n.discontinuityStarts=B3(n.segments||[],"discontinuity"),n))},lm=(t,e)=>{const i=Dc(t.sidx),n=i&&e[i]&&e[i].sidx;return n&&om(t,n,t.sidx.resolvedUri),t},G3=(t,e={})=>{if(!Object.keys(e).length)return t;for(const i in t)t[i]=lm(t[i],e);return t},X3=({attributes:t,segments:e,sidx:i,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:s},a)=>{const o={attributes:{NAME:t.id,BANDWIDTH:t.bandwidth,CODECS:t.codecs,"PROGRAM-ID":1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuitySequence:r,discontinuityStarts:s,timelineStarts:t.timelineStarts,mediaSequence:n,segments:e};return t.contentProtection&&(o.contentProtection=t.contentProtection),t.serviceLocation&&(o.attributes.serviceLocation=t.serviceLocation),i&&(o.sidx=i),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},K3=({attributes:t,segments:e,mediaSequence:i,discontinuityStarts:n,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);const s={NAME:t.id,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1};t.codecs&&(s.CODECS=t.codecs);const a={attributes:s,uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:n,discontinuitySequence:r,mediaSequence:i,segments:e};return t.serviceLocation&&(a.attributes.serviceLocation=t.serviceLocation),a},Q3=(t,e={},i=!1)=>{let n;const r=t.reduce((s,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let c=a.attributes.label||"main";if(l&&!a.attributes.label){const m=o?` (${o})`:"";c=`${a.attributes.lang}${m}`}s[c]||(s[c]={language:l,autoselect:!0,default:o==="main",playlists:[],uri:""});const p=lm(X3(a,i),e);return s[c].playlists.push(p),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),s},{});if(!n){const s=Object.keys(r)[0];r[s].default=!0}return r},Y3=(t,e={})=>t.reduce((i,n)=>{const r=n.attributes.label||n.attributes.lang||"text";return i[r]||(i[r]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),i[r].playlists.push(lm(K3(n),e)),i},{}),J3=t=>t.reduce((e,i)=>(i&&i.forEach(n=>{const{channel:r,language:s}=n;e[s]={autoselect:!1,default:!1,instreamId:r,language:s},n.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[s].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[s]["3D"]=n["3D"])}),e),{}),Z3=({attributes:t,segments:e,sidx:i,discontinuityStarts:n})=>{const r={attributes:{NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth,"PROGRAM-ID":1},uri:"",endList:t.type==="static",timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:n,timelineStarts:t.timelineStarts,segments:e};return t.frameRate&&(r.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(r.contentProtection=t.contentProtection),t.serviceLocation&&(r.attributes.serviceLocation=t.serviceLocation),i&&(r.sidx=i),r},e4=({attributes:t})=>t.mimeType==="video/mp4"||t.mimeType==="video/webm"||t.contentType==="video",t4=({attributes:t})=>t.mimeType==="audio/mp4"||t.mimeType==="audio/webm"||t.contentType==="audio",i4=({attributes:t})=>t.mimeType==="text/vtt"||t.contentType==="text",n4=(t,e)=>{t.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:n}){return n===i.timeline}),i.segments&&i.segments.forEach((n,r)=>{n.number=r})})},Uy=t=>t?Object.keys(t).reduce((e,i)=>{const n=t[i];return e.concat(n.playlists)},[]):[],r4=({dashPlaylists:t,locations:e,contentSteering:i,sidxMapping:n={},previousManifest:r,eventStream:s})=>{if(!t.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:c}=t[0].attributes,p=th(t.filter(e4)).map(Z3),m=th(t.filter(t4)),_=th(t.filter(i4)),E=t.map(P=>P.attributes.captionServices).filter(Boolean),v={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:G3(p,n)};c>=0&&(v.minimumUpdatePeriod=c*1e3),e&&(v.locations=e),i&&(v.contentSteering=i),o==="dynamic"&&(v.suggestedPresentationDelay=l),s&&s.length>0&&(v.eventStream=s);const S=v.playlists.length===0,D=m.length?Q3(m,n,S):null,x=_.length?Y3(_,n):null,T=p.concat(Uy(D),Uy(x)),C=T.map(({timelineStarts:P})=>P);return v.timelineStarts=yT(C),n4(T,v.timelineStarts),D&&(v.mediaGroups.AUDIO.audio=D),x&&(v.mediaGroups.SUBTITLES.subs=x),E.length&&(v.mediaGroups["CLOSED-CAPTIONS"].cc=J3(E)),r?W3({oldManifest:r,newManifest:v}):v},s4=(t,e,i)=>{const{NOW:n,clientOffset:r,availabilityStartTime:s,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=t,c=(n+r)/1e3,p=s+o,_=c+l-p;return Math.ceil((_*a-e)/i)},vT=(t,e)=>{const{type:i,minimumUpdatePeriod:n=0,media:r="",sourceDuration:s,timescale:a=1,startNumber:o=1,periodStart:l}=t,c=[];let p=-1;for(let m=0;mp&&(p=S);let D;if(v<0){const C=m+1;C===e.length?i==="dynamic"&&n>0&&r.indexOf("$Number$")>0?D=s4(t,p,E):D=(s*a-p)/E:D=(e[C].t-p)/E}else D=v+1;const x=o+c.length+D;let T=o+c.length;for(;T(e,i,n,r)=>{if(e==="$$")return"$";if(typeof t[i]>"u")return e;const s=""+t[i];return i==="RepresentationID"||(n?r=parseInt(r,10):r=1,s.length>=r)?s:`${new Array(r-s.length+1).join("0")}${s}`},jy=(t,e)=>t.replace(a4,o4(e)),l4=(t,e)=>!t.duration&&!e?[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]:t.duration?am(t):vT(t,e),u4=(t,e)=>{const i={RepresentationID:t.id,Bandwidth:t.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=t,r=To({baseUrl:t.baseUrl,source:jy(n.sourceURL,i),range:n.range});return l4(t,e).map(a=>{i.Number=a.number,i.Time=a.time;const o=jy(t.media||"",i),l=t.timescale||1,c=t.presentationTimeOffset||0,p=t.periodStart+(a.time-c)/l;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:Kp(t.baseUrl||"",o),map:r,number:a.number,presentationTime:p}})},c4=(t,e)=>{const{baseUrl:i,initialization:n={}}=t,r=To({baseUrl:i,source:n.sourceURL,range:n.range}),s=To({baseUrl:i,source:e.media,range:e.mediaRange});return s.map=r,s},d4=(t,e)=>{const{duration:i,segmentUrls:n=[],periodStart:r}=t;if(!i&&!e||i&&e)throw new Error(Ds.SEGMENT_TIME_UNSPECIFIED);const s=n.map(l=>c4(t,l));let a;return i&&(a=am(t)),e&&(a=vT(t,e)),a.map((l,c)=>{if(s[c]){const p=s[c],m=t.timescale||1,_=t.presentationTimeOffset||0;return p.timeline=l.timeline,p.duration=l.duration,p.number=l.number,p.presentationTime=r+(l.time-_)/m,p}}).filter(l=>l)},h4=({attributes:t,segmentInfo:e})=>{let i,n;e.template?(n=u4,i=et(t,e.template)):e.base?(n=gT,i=et(t,e.base)):e.list&&(n=d4,i=et(t,e.list));const r={attributes:t};if(!n)return r;const s=n(i,e.segmentTimeline);if(i.duration){const{duration:a,timescale:o=1}=i;i.duration=a/o}else s.length?i.duration=s.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):i.duration=0;return r.attributes=i,r.segments=s,e.base&&i.indexRange&&(r.sidx=s[0],r.segments=[]),r},f4=t=>t.map(h4),Le=(t,e)=>mT(t.childNodes).filter(({tagName:i})=>i===e),No=t=>t.textContent.trim(),p4=t=>parseFloat(t.split("/").reduce((e,i)=>e/i)),jr=t=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!o)return 0;const[l,c,p,m,_,E]=o.slice(1);return parseFloat(l||0)*31536e3+parseFloat(c||0)*2592e3+parseFloat(p||0)*86400+parseFloat(m||0)*3600+parseFloat(_||0)*60+parseFloat(E||0)},m4=t=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),Date.parse(t)),$y={mediaPresentationDuration(t){return jr(t)},availabilityStartTime(t){return m4(t)/1e3},minimumUpdatePeriod(t){return jr(t)},suggestedPresentationDelay(t){return jr(t)},type(t){return t},timeShiftBufferDepth(t){return jr(t)},start(t){return jr(t)},width(t){return parseInt(t,10)},height(t){return parseInt(t,10)},bandwidth(t){return parseInt(t,10)},frameRate(t){return p4(t)},startNumber(t){return parseInt(t,10)},timescale(t){return parseInt(t,10)},presentationTimeOffset(t){return parseInt(t,10)},duration(t){const e=parseInt(t,10);return isNaN(e)?jr(t):e},d(t){return parseInt(t,10)},t(t){return parseInt(t,10)},r(t){return parseInt(t,10)},presentationTime(t){return parseInt(t,10)},DEFAULT(t){return t}},qe=t=>t&&t.attributes?mT(t.attributes).reduce((e,i)=>{const n=$y[i.name]||$y.DEFAULT;return e[i.name]=n(i.value),e},{}):{},g4={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},kc=(t,e)=>e.length?As(t.map(function(i){return e.map(function(n){const r=No(n),s=Kp(i.baseUrl,r),a=et(qe(n),{baseUrl:s});return s!==r&&!a.serviceLocation&&i.serviceLocation&&(a.serviceLocation=i.serviceLocation),a})})):t,um=t=>{const e=Le(t,"SegmentTemplate")[0],i=Le(t,"SegmentList")[0],n=i&&Le(i,"SegmentURL").map(m=>et({tag:"SegmentURL"},qe(m))),r=Le(t,"SegmentBase")[0],s=i||e,a=s&&Le(s,"SegmentTimeline")[0],o=i||r||e,l=o&&Le(o,"Initialization")[0],c=e&&qe(e);c&&l?c.initialization=l&&qe(l):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});const p={template:c,segmentTimeline:a&&Le(a,"S").map(m=>qe(m)),list:i&&et(qe(i),{segmentUrls:n,initialization:qe(l)}),base:r&&et(qe(r),{initialization:qe(l)})};return Object.keys(p).forEach(m=>{p[m]||delete p[m]}),p},y4=(t,e,i)=>n=>{const r=Le(n,"BaseURL"),s=kc(e,r),a=et(t,qe(n)),o=um(n);return s.map(l=>({segmentInfo:et(i,o),attributes:et(a,l)}))},v4=t=>t.reduce((e,i)=>{const n=qe(i);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const r=g4[n.schemeIdUri];if(r){e[r]={attributes:n};const s=Le(i,"cenc:pssh")[0];if(s){const a=No(s);e[r].pssh=a&&L2(a)}}return e},{}),_4=t=>{if(t.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof t.value!="string"?[]:t.value.split(";")).map(i=>{let n,r;return r=i,/^CC\d=/.test(i)?[n,r]=i.split("="):/^CC\d$/.test(i)&&(n=i),{channel:n,language:r}});if(t.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof t.value!="string"?[]:t.value.split(";")).map(i=>{const n={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[r,s=""]=i.split("=");n.channel=r,n.language=i,s.split(",").forEach(a=>{const[o,l]=a.split(":");o==="lang"?n.language=l:o==="er"?n.easyReader=Number(l):o==="war"?n.aspectRatio=Number(l):o==="3D"&&(n["3D"]=Number(l))})}else n.language=i;return n.channel&&(n.channel="SERVICE"+n.channel),n})},T4=t=>As(Le(t.node,"EventStream").map(e=>{const i=qe(e),n=i.schemeIdUri;return Le(e,"Event").map(r=>{const s=qe(r),a=s.presentationTime||0,o=i.timescale||1,l=s.duration||0,c=a/o+t.attributes.start;return{schemeIdUri:n,value:i.value,id:s.id,start:c,end:c+l/o,messageData:No(r)||s.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),x4=(t,e,i)=>n=>{const r=qe(n),s=kc(e,Le(n,"BaseURL")),a=Le(n,"Role")[0],o={role:qe(a)};let l=et(t,r,o);const c=Le(n,"Accessibility")[0],p=_4(qe(c));p&&(l=et(l,{captionServices:p}));const m=Le(n,"Label")[0];if(m&&m.childNodes.length){const D=m.childNodes[0].nodeValue.trim();l=et(l,{label:D})}const _=v4(Le(n,"ContentProtection"));Object.keys(_).length&&(l=et(l,{contentProtection:_}));const E=um(n),v=Le(n,"Representation"),S=et(i,E);return As(v.map(y4(l,s,S)))},S4=(t,e)=>(i,n)=>{const r=kc(e,Le(i.node,"BaseURL")),s=et(t,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(s.periodDuration=i.attributes.duration);const a=Le(i.node,"AdaptationSet"),o=um(i.node);return As(a.map(x4(s,r,o)))},E4=(t,e)=>{if(t.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!t.length)return null;const i=et({serverURL:No(t[0])},qe(t[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},b4=({attributes:t,priorPeriodAttributes:e,mpdType:i})=>typeof t.start=="number"?t.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,C4=(t,e={})=>{const{manifestUri:i="",NOW:n=Date.now(),clientOffset:r=0,eventHandler:s=function(){}}=e,a=Le(t,"Period");if(!a.length)throw new Error(Ds.INVALID_NUMBER_OF_PERIOD);const o=Le(t,"Location"),l=qe(t),c=kc([{baseUrl:i}],Le(t,"BaseURL")),p=Le(t,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=n,l.clientOffset=r,o.length&&(l.locations=o.map(No));const m=[];return a.forEach((_,E)=>{const v=qe(_),S=m[E-1];v.start=b4({attributes:v,priorPeriodAttributes:S?S.attributes:null,mpdType:l.type}),m.push({node:_,attributes:v})}),{locations:l.locations,contentSteeringInfo:E4(p,s),representationInfo:As(m.map(S4(l,c))),eventStream:As(m.map(T4))}},_T=t=>{if(t==="")throw new Error(Ds.DASH_EMPTY_MANIFEST);const e=new R3;let i,n;try{i=e.parseFromString(t,"application/xml"),n=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Ds.DASH_INVALID_XML);return n},w4=t=>{const e=Le(t,"UTCTiming")[0];if(!e)return null;const i=qe(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ds.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},A4=(t,e={})=>{const i=C4(_T(t),e),n=f4(i.representationInfo);return r4({dashPlaylists:n,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},D4=t=>w4(_T(t));var TT=Math.pow(2,32),k4=function(t){var e=new DataView(t.buffer,t.byteOffset,t.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;n+=12,r--)i.references.push({referenceType:(t[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return i},O4=I4;const L4=gn(O4);var N4=Z([73,68,51]),R4=function(e,i){i===void 0&&(i=0),e=Z(e);var n=e[i+5],r=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],s=(n&16)>>4;return s?r+20:r+10},Oa=function t(e,i){return i===void 0&&(i=0),e=Z(e),e.length-i<10||!Oe(e,N4,{offset:i})?i:(i+=R4(e,i),t(e,i))},Hy=function(e){return typeof e=="string"?F2(e):e},M4=function(e){return Array.isArray(e)?e.map(function(i){return Hy(i)}):[Hy(e)]},B4=function t(e,i,n){n===void 0&&(n=!1),i=M4(i),e=Z(e);var r=[];if(!i.length)return r;for(var s=0;s>>0,o=e.subarray(s+4,s+8);if(a===0)break;var l=s+a;if(l>e.length){if(n)break;l=e.length}var c=e.subarray(s+8,l);Oe(o,i[0])&&(i.length===1?r.push(c):r.push.apply(r,t(c,i.slice(1),n))),s=l}return r},Ol={EBML:Z([26,69,223,163]),DocType:Z([66,130]),Segment:Z([24,83,128,103]),SegmentInfo:Z([21,73,169,102]),Tracks:Z([22,84,174,107]),Track:Z([174]),TrackNumber:Z([215]),DefaultDuration:Z([35,227,131]),TrackEntry:Z([174]),TrackType:Z([131]),FlagDefault:Z([136]),CodecID:Z([134]),CodecPrivate:Z([99,162]),VideoTrack:Z([224]),AudioTrack:Z([225]),Cluster:Z([31,67,182,117]),Timestamp:Z([231]),TimestampScale:Z([42,215,177]),BlockGroup:Z([160]),BlockDuration:Z([155]),Block:Z([161]),SimpleBlock:Z([163])},Tf=[128,64,32,16,8,4,2,1],F4=function(e){for(var i=1,n=0;n=i.length)return i.length;var r=Bu(i,n,!1);if(Oe(e.bytes,r.bytes))return n;var s=Bu(i,n+r.length);return t(e,i,n+s.length+s.value+r.length)},qy=function t(e,i){i=U4(i),e=Z(e);var n=[];if(!i.length)return n;for(var r=0;re.length?e.length:o+a.value,c=e.subarray(o,l);Oe(i[0],s.bytes)&&(i.length===1?n.push(c):n=n.concat(t(c,i.slice(1))));var p=s.length+a.length+c.length;r+=p}return n},$4=Z([0,0,0,1]),V4=Z([0,0,1]),H4=Z([0,0,3]),z4=function(e){for(var i=[],n=1;n>1&63),n.indexOf(c)!==-1&&(a=s+l),s+=l+(i==="h264"?1:2)}return e.subarray(0,0)},q4=function(e,i,n){return xT(e,"h264",i,n)},W4=function(e,i,n){return xT(e,"h265",i,n)},gt={webm:Z([119,101,98,109]),matroska:Z([109,97,116,114,111,115,107,97]),flac:Z([102,76,97,67]),ogg:Z([79,103,103,83]),ac3:Z([11,119]),riff:Z([82,73,70,70]),avi:Z([65,86,73]),wav:Z([87,65,86,69]),"3gp":Z([102,116,121,112,51,103]),mp4:Z([102,116,121,112]),fmp4:Z([115,116,121,112]),mov:Z([102,116,121,112,113,116]),moov:Z([109,111,111,118]),moof:Z([109,111,111,102])},ks={aac:function(e){var i=Oa(e);return Oe(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=Oa(e);return Oe(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=qy(e,[Ol.EBML,Ol.DocType])[0];return Oe(i,gt.webm)},mkv:function(e){var i=qy(e,[Ol.EBML,Ol.DocType])[0];return Oe(i,gt.matroska)},mp4:function(e){if(ks["3gp"](e)||ks.mov(e))return!1;if(Oe(e,gt.mp4,{offset:4})||Oe(e,gt.fmp4,{offset:4})||Oe(e,gt.moof,{offset:4})||Oe(e,gt.moov,{offset:4}))return!0},mov:function(e){return Oe(e,gt.mov,{offset:4})},"3gp":function(e){return Oe(e,gt["3gp"],{offset:4})},ac3:function(e){var i=Oa(e);return Oe(e,gt.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},dm=9e4,hm,fm,Pc,pm,ST,ET,bT;hm=function(t){return t*dm};fm=function(t,e){return t*e};Pc=function(t){return t/dm};pm=function(t,e){return t/e};ST=function(t,e){return hm(pm(t,e))};ET=function(t,e){return fm(Pc(t),e)};bT=function(t,e,i){return Pc(i?t:t-e)};var Fu={ONE_SECOND_IN_TS:dm,secondsToVideoTs:hm,secondsToAudioTs:fm,videoTsToSeconds:Pc,audioTsToSeconds:pm,audioTsToVideoTs:ST,videoTsToAudioTs:ET,metadataTsToSeconds:bT};/** + * @license + * Video.js 8.6.1 + * Copyright Brightcove, Inc. + * Available under Apache License Version 2.0 + * + * + * Includes vtt.js + * Available under Apache License Version 2.0 + * + */var CT="8.6.1";const Yi={},Hn=function(t,e){return Yi[t]=Yi[t]||[],e&&(Yi[t]=Yi[t].concat(e)),Yi[t]},K4=function(t,e){Hn(t,e)},wT=function(t,e){const i=Hn(t).indexOf(e);return i<=-1?!1:(Yi[t]=Yi[t].slice(),Yi[t].splice(i,1),!0)},Q4=function(t,e){Hn(t,[].concat(e).map(i=>{const n=(...r)=>(wT(t,n),i(...r));return n}))},Uu={prefixed:!0},Jl=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Wy=Jl[0];let La;for(let t=0;t(n,r,s)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let l=t;if(n!=="log"&&s.unshift(n.toUpperCase()+":"),i&&(l=`%c${t}`,s.unshift(i)),s.unshift(l+":"),At){At.push([].concat(s));const p=At.length-1e3;At.splice(0,p>0?p:0)}if(!k.console)return;let c=k.console[n];!c&&n==="debug"&&(c=k.console.info||k.console.log),!(!c||!a||!o.test(n))&&c[Array.isArray(s)?"apply":"call"](k.console,s)};function Sf(t,e=":",i=""){let n="info",r;const s=function(...a){r("log",n,a)};return r=Y4(t,s,i),s.createLogger=(a,o,l)=>{const c=o!==void 0?o:e,p=l!==void 0?l:i,m=`${t} ${c} ${a}`;return Sf(m,c,p)},s.createNewLogger=(a,o,l)=>Sf(a,o,l),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},s.level=a=>{if(typeof a=="string"){if(!s.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},s.history=()=>At?[].concat(At):[],s.history.filter=a=>(At||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),s.history.clear=()=>{At&&(At.length=0)},s.history.disable=()=>{At!==null&&(At.length=0,At=null)},s.history.enable=()=>{At===null&&(At=[])},s.error=(...a)=>r("error",n,a),s.warn=(...a)=>r("warn",n,a),s.debug=(...a)=>r("debug",n,a),s}const le=Sf("VIDEOJS"),AT=le.createLogger,J4=Object.prototype.toString,DT=function(t){return Ui(t)?Object.keys(t):[]};function ds(t,e){DT(t).forEach(i=>e(t[i],i))}function kT(t,e,i=0){return DT(t).reduce((n,r)=>e(n,t[r],r),i)}function Ui(t){return!!t&&typeof t=="object"}function Ps(t){return Ui(t)&&J4.call(t)==="[object Object]"&&t.constructor===Object}function Ee(...t){const e={};return t.forEach(i=>{i&&ds(i,(n,r)=>{if(!Ps(n)){e[r]=n;return}Ps(e[r])||(e[r]={}),e[r]=Ee(e[r],n)})}),e}function PT(t={}){const e=[];for(const i in t)if(t.hasOwnProperty(i)){const n=t[i];e.push(n)}return e}function Ic(t,e,i,n=!0){const r=a=>Object.defineProperty(t,e,{value:a,enumerable:!0,writable:!0}),s={configurable:!0,enumerable:!0,get(){const a=i();return r(a),a}};return n&&(s.set=r),Object.defineProperty(t,e,s)}var Z4=Object.freeze({__proto__:null,each:ds,reduce:kT,isObject:Ui,isPlain:Ps,merge:Ee,values:PT,defineLazyProperty:Ic});let mm=!1,IT=null,ji=!1,OT,LT=!1,hs=!1,fs=!1,$i=!1,gm=null,Oc=null,NT=null,ju=!1,Lc=!1,$u=!1,Nc=!1;const xo=!!(Vs()&&("ontouchstart"in k||k.navigator.maxTouchPoints||k.DocumentTouch&&k.document instanceof k.DocumentTouch)),$r=k.navigator&&k.navigator.userAgentData;$r&&(ji=$r.platform==="Android",hs=!!$r.brands.find(t=>t.brand==="Microsoft Edge"),fs=!!$r.brands.find(t=>t.brand==="Chromium"),$i=!hs&&fs,gm=Oc=($r.brands.find(t=>t.brand==="Chromium")||{}).version||null,Lc=$r.platform==="Windows");if(!fs){const t=k.navigator&&k.navigator.userAgent||"";mm=/iPod/i.test(t),IT=function(){const e=t.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),ji=/Android/i.test(t),OT=function(){const e=t.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const i=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return i&&n?parseFloat(e[1]+"."+e[2]):i||null}(),LT=/Firefox/i.test(t),hs=/Edg/i.test(t),fs=/Chrome/i.test(t)||/CriOS/i.test(t),$i=!hs&&fs,gm=Oc=function(){const e=t.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),NT=function(){const e=/MSIE\s(\d+)\.\d/.exec(t);let i=e&&parseFloat(e[1]);return!i&&/Trident\/7.0/i.test(t)&&/rv:11.0/.test(t)&&(i=11),i}(),ju=/Safari/i.test(t)&&!$i&&!ji&&!hs,Lc=/Windows/i.test(t),$u=/iPad/i.test(t)||ju&&xo&&!/iPhone/i.test(t),Nc=/iPhone/i.test(t)&&!$u}const Et=Nc||$u||mm,Rc=(ju||Et)&&!$i;var eP=Object.freeze({__proto__:null,get IS_IPOD(){return mm},get IOS_VERSION(){return IT},get IS_ANDROID(){return ji},get ANDROID_VERSION(){return OT},get IS_FIREFOX(){return LT},get IS_EDGE(){return hs},get IS_CHROMIUM(){return fs},get IS_CHROME(){return $i},get CHROMIUM_VERSION(){return gm},get CHROME_VERSION(){return Oc},get IE_VERSION(){return NT},get IS_SAFARI(){return ju},get IS_WINDOWS(){return Lc},get IS_IPAD(){return $u},get IS_IPHONE(){return Nc},TOUCH_ENABLED:xo,IS_IOS:Et,IS_ANY_SAFARI:Rc});function Gy(t){return typeof t=="string"&&!!t.trim()}function tP(t){if(t.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Vs(){return H===k.document}function Hs(t){return Ui(t)&&t.nodeType===1}function RT(){try{return k.parent!==k.self}catch{return!0}}function MT(t){return function(e,i){if(!Gy(e))return H[t](null);Gy(i)&&(i=H.querySelector(i));const n=Hs(i)?i:H;return n[t]&&n[t](e)}}function oe(t="div",e={},i={},n){const r=H.createElement(t);return Object.getOwnPropertyNames(e).forEach(function(s){const a=e[s];s==="textContent"?Qn(r,a):(r[s]!==a||s==="tabIndex")&&(r[s]=a)}),Object.getOwnPropertyNames(i).forEach(function(s){r.setAttribute(s,i[s])}),n&&ym(r,n),r}function Qn(t,e){return typeof t.textContent>"u"?t.innerText=e:t.textContent=e,t}function Ef(t,e){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}function qa(t,e){return tP(e),t.classList.contains(e)}function gr(t,...e){return t.classList.add(...e.reduce((i,n)=>i.concat(n.split(/\s+/)),[])),t}function Mc(t,...e){return t?(t.classList.remove(...e.reduce((i,n)=>i.concat(n.split(/\s+/)),[])),t):(le.warn("removeClass was called with an element that doesn't exist"),null)}function BT(t,e,i){return typeof i=="function"&&(i=i(t,e)),typeof i!="boolean"&&(i=void 0),e.split(/\s+/).forEach(n=>t.classList.toggle(n,i)),t}function FT(t,e){Object.getOwnPropertyNames(e).forEach(function(i){const n=e[i];n===null||typeof n>"u"||n===!1?t.removeAttribute(i):t.setAttribute(i,n===!0?"":n)})}function wn(t){const e={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(t&&t.attributes&&t.attributes.length>0){const n=t.attributes;for(let r=n.length-1;r>=0;r--){const s=n[r].name;let a=n[r].value;i.includes(s)&&(a=a!==null),e[s]=a}}return e}function UT(t,e){return t.getAttribute(e)}function Is(t,e,i){t.setAttribute(e,i)}function Bc(t,e){t.removeAttribute(e)}function jT(){H.body.focus(),H.onselectstart=function(){return!1}}function $T(){H.onselectstart=function(){return!0}}function Os(t){if(t&&t.getBoundingClientRect&&t.parentNode){const e=t.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(i[n]=e[n])}),i.height||(i.height=parseFloat(Ls(t,"height"))),i.width||(i.width=parseFloat(Ls(t,"width"))),i}}function So(t){if(!t||t&&!t.offsetParent)return{left:0,top:0,width:0,height:0};const e=t.offsetWidth,i=t.offsetHeight;let n=0,r=0;for(;t.offsetParent&&t!==H[Uu.fullscreenElement];)n+=t.offsetLeft,r+=t.offsetTop,t=t.offsetParent;return{left:n,top:r,width:e,height:i}}function Fc(t,e){const i={x:0,y:0};if(Et){let p=t;for(;p&&p.nodeName.toLowerCase()!=="html";){const m=Ls(p,"transform");if(/^matrix/.test(m)){const _=m.slice(7,-1).split(/,\s/).map(Number);i.x+=_[4],i.y+=_[5]}else if(/^matrix3d/.test(m)){const _=m.slice(9,-1).split(/,\s/).map(Number);i.x+=_[12],i.y+=_[13]}p=p.parentNode}}const n={},r=So(e.target),s=So(t),a=s.width,o=s.height;let l=e.offsetY-(s.top-r.top),c=e.offsetX-(s.left-r.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-s.left,l=e.changedTouches[0].pageY+s.top,Et&&(c-=i.x,l-=i.y)),n.y=1-Math.max(0,Math.min(1,l/o)),n.x=Math.max(0,Math.min(1,c/a)),n}function VT(t){return Ui(t)&&t.nodeType===3}function Uc(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function HT(t){return typeof t=="function"&&(t=t()),(Array.isArray(t)?t:[t]).map(e=>{if(typeof e=="function"&&(e=e()),Hs(e)||VT(e))return e;if(typeof e=="string"&&/\S/.test(e))return H.createTextNode(e)}).filter(e=>e)}function ym(t,e){return HT(e).forEach(i=>t.appendChild(i)),t}function zT(t,e){return ym(Uc(t),e)}function Eo(t){return t.button===void 0&&t.buttons===void 0||t.button===0&&t.buttons===void 0||t.type==="mouseup"&&t.button===0&&t.buttons===0?!0:!(t.button!==0||t.buttons!==1)}const zn=MT("querySelector"),qT=MT("querySelectorAll");function Ls(t,e){if(!t||!e)return"";if(typeof k.getComputedStyle=="function"){let i;try{i=k.getComputedStyle(t)}catch{return""}return i?i.getPropertyValue(e)||i[e]:""}return""}function WT(t){[...H.styleSheets].forEach(e=>{try{const i=[...e.cssRules].map(r=>r.cssText).join(""),n=H.createElement("style");n.textContent=i,t.document.head.appendChild(n)}catch{const n=H.createElement("link");n.rel="stylesheet",n.type=e.type,n.media=e.media.mediaText,n.href=e.href,t.document.head.appendChild(n)}})}var GT=Object.freeze({__proto__:null,isReal:Vs,isEl:Hs,isInFrame:RT,createEl:oe,textContent:Qn,prependTo:Ef,hasClass:qa,addClass:gr,removeClass:Mc,toggleClass:BT,setAttributes:FT,getAttributes:wn,getAttribute:UT,setAttribute:Is,removeAttribute:Bc,blockTextSelection:jT,unblockTextSelection:$T,getBoundingClientRect:Os,findPosition:So,getPointerPosition:Fc,isTextNode:VT,emptyEl:Uc,normalizeContent:HT,appendContent:ym,insertContent:zT,isSingleLeftClick:Eo,$:zn,$$:qT,computedStyle:Ls,copyStyleSheetsToWindow:WT});let XT=!1,bf;const iP=function(){if(bf.options.autoSetup===!1)return;const t=Array.prototype.slice.call(H.getElementsByTagName("video")),e=Array.prototype.slice.call(H.getElementsByTagName("audio")),i=Array.prototype.slice.call(H.getElementsByTagName("video-js")),n=t.concat(e,i);if(n&&n.length>0)for(let r=0,s=n.length;r-1&&(r={passive:!0}),t.addEventListener(e,n.dispatcher,r)}else t.attachEvent&&t.attachEvent("on"+e,n.dispatcher)}function dt(t,e,i){if(!Tt.has(t))return;const n=Tt.get(t);if(!n.handlers)return;if(Array.isArray(e))return vm(dt,t,e,i);const r=function(a,o){n.handlers[o]=[],Xy(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(t,a);return}const s=n.handlers[e];if(s){if(!i){r(t,e);return}if(i.guid)for(let a=0;a=e&&(t(...r),i=s)}},YT=function(t,e,i,n=k){let r;const s=()=>{n.clearTimeout(r),r=null},a=function(){const o=this,l=arguments;let c=function(){r=null,c=null,i||t.apply(o,l)};!r&&i&&t.apply(o,l),n.clearTimeout(r),r=n.setTimeout(c,e)};return a.cancel=s,a};var lP=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:oi,bind_:Ce,throttle:Hi,debounce:YT});let Ta;class li{on(e,i){const n=this.addEventListener;this.addEventListener=()=>{},Gt(this,e,i),this.addEventListener=n}off(e,i){dt(this,e,i)}one(e,i){const n=this.addEventListener;this.addEventListener=()=>{},$c(this,e,i),this.addEventListener=n}any(e,i){const n=this.addEventListener;this.addEventListener=()=>{},_m(this,e,i),this.addEventListener=n}trigger(e){const i=e.type||e;typeof e=="string"&&(e={type:i}),e=jc(e),this.allowedEvents_[i]&&this["on"+i]&&this["on"+i](e),zs(this,e)}queueTrigger(e){Ta||(Ta=new Map);const i=e.type||e;let n=Ta.get(this);n||(n=new Map,Ta.set(this,n));const r=n.get(i);n.delete(i),k.clearTimeout(r);const s=k.setTimeout(()=>{n.delete(i),n.size===0&&(n=null,Ta.delete(this)),this.trigger(e)},0);n.set(i,s)}}li.prototype.allowedEvents_={};li.prototype.addEventListener=li.prototype.on;li.prototype.removeEventListener=li.prototype.off;li.prototype.dispatchEvent=li.prototype.trigger;const Vc=t=>typeof t.name=="function"?t.name():typeof t.name=="string"?t.name:t.name_?t.name_:t.constructor&&t.constructor.name?t.constructor.name:typeof t,sn=t=>t instanceof li||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof t[e]=="function"),uP=(t,e)=>{sn(t)?e():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(e))},Af=t=>typeof t=="string"&&/\S/.test(t)||Array.isArray(t)&&!!t.length,Vu=(t,e,i)=>{if(!t||!t.nodeName&&!sn(t))throw new Error(`Invalid target for ${Vc(e)}#${i}; must be a DOM node or evented object.`)},JT=(t,e,i)=>{if(!Af(t))throw new Error(`Invalid event type for ${Vc(e)}#${i}; must be a non-empty string or array.`)},ZT=(t,e,i)=>{if(typeof t!="function")throw new Error(`Invalid listener for ${Vc(e)}#${i}; must be a function.`)},ih=(t,e,i)=>{const n=e.length<3||e[0]===t||e[0]===t.eventBusEl_;let r,s,a;return n?(r=t.eventBusEl_,e.length>=3&&e.shift(),[s,a]=e):[r,s,a]=e,Vu(r,t,i),JT(s,t,i),ZT(a,t,i),a=Ce(t,a),{isTargetingSelf:n,target:r,type:s,listener:a}},nr=(t,e,i,n)=>{Vu(t,t,e),t.nodeName?oP[e](t,i,n):t[e](i,n)},cP={on(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=ih(this,t,"on");if(nr(i,"on",n,r),!e){const s=()=>this.off(i,n,r);s.guid=r.guid;const a=()=>this.off("dispose",s);a.guid=r.guid,nr(this,"on","dispose",s),nr(i,"on","dispose",a)}},one(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=ih(this,t,"one");if(e)nr(i,"one",n,r);else{const s=(...a)=>{this.off(i,n,s),r.apply(null,a)};s.guid=r.guid,nr(i,"one",n,s)}},any(...t){const{isTargetingSelf:e,target:i,type:n,listener:r}=ih(this,t,"any");if(e)nr(i,"any",n,r);else{const s=(...a)=>{this.off(i,n,s),r.apply(null,a)};s.guid=r.guid,nr(i,"any",n,s)}},off(t,e,i){if(!t||Af(t))dt(this.eventBusEl_,t,e);else{const n=t,r=e;Vu(n,this,"off"),JT(r,this,"off"),ZT(i,this,"off"),i=Ce(this,i),this.off("dispose",i),n.nodeName?(dt(n,r,i),dt(n,"dispose",i)):sn(n)&&(n.off(r,i),n.off("dispose",i))}},trigger(t,e){Vu(this.eventBusEl_,this,"trigger");const i=t&&typeof t!="string"?t.type:t;if(!Af(i))throw new Error(`Invalid event type for ${Vc(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return zs(this.eventBusEl_,t,e)}};function Tm(t,e={}){const{eventBusKey:i}=e;if(i){if(!t[i].nodeName)throw new Error(`The eventBusKey "${i}" does not refer to an element.`);t.eventBusEl_=t[i]}else t.eventBusEl_=oe("span",{className:"vjs-event-bus"});return Object.assign(t,cP),t.eventedCallbacks&&t.eventedCallbacks.forEach(n=>{n()}),t.on("dispose",()=>{t.off(),[t,t.el_,t.eventBusEl_].forEach(function(n){n&&Tt.has(n)&&Tt.delete(n)}),k.setTimeout(()=>{t.eventBusEl_=null},0)}),t}const dP={state:{},setState(t){typeof t=="function"&&(t=t());let e;return ds(t,(i,n)=>{this.state[n]!==i&&(e=e||{},e[n]={from:this.state[n],to:i}),this.state[n]=i}),e&&sn(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function ex(t,e){return Object.assign(t,dP),t.state=Object.assign({},t.state,e),typeof t.handleStateChanged=="function"&&sn(t)&&t.on("statechanged",t.handleStateChanged),t}const Wa=function(t){return typeof t!="string"?t:t.replace(/./,e=>e.toLowerCase())},je=function(t){return typeof t!="string"?t:t.replace(/./,e=>e.toUpperCase())},tx=function(t,e){return je(t)===je(e)};var hP=Object.freeze({__proto__:null,toLowerCase:Wa,toTitleCase:je,titleCaseEquals:tx});class B{constructor(e,i,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ee({},this.options_),i=this.options_=Ee(this.options_,i),this.id_=i.id||i.el&&i.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Vi()}`}this.name_=i.name||null,i.el?this.el_=i.el:i.createEl!==!1&&(this.el_=this.createEl()),i.className&&this.el_&&i.className.split(" ").forEach(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),i.evented!==!1&&(Tm(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),ex(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,i.initChildren!==!1&&this.initChildren(),this.ready(n),i.reportTouchActivity!==!1&&this.enableTouchActivity()}on(e,i){}off(e,i){}one(e,i){}any(e,i){}trigger(e,i){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let i=this.children_.length-1;i>=0;i--)this.children_[i].dispose&&this.children_[i].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ee(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,i,n){return oe(e,i,n)}localize(e,i,n=e){const r=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),a=s&&s[r],o=r&&r.split("-")[0],l=s&&s[o];let c=n;return a&&a[e]?c=a[e]:l&&l[e]&&(c=l[e]),i&&(c=c.replace(/\{(\d+)\}/g,function(p,m){const _=i[m-1];let E=_;return typeof _>"u"&&(E=p),E})),c}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((n,r)=>n.concat(r),[]);let i=this;for(let n=0;n=0;r--)if(this.children_[r]===e){i=!0,this.children_.splice(r,1);break}if(!i)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[je(e.name())]=null,this.childNameIndex_[Wa(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const i=this.options_,n=a=>{const o=a.name;let l=a.opts;if(i[o]!==void 0&&(l=i[o]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const c=this.addChild(o,l);c&&(this[o]=c)};let r;const s=B.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,l;return typeof a=="string"?(o=a,l=e[o]||this.options_[o]||{}):(o=a.name,l=a),{name:o,opts:l}}).filter(a=>{const o=B.getComponent(a.opts.componentClass||je(a.name));return o&&!s.isTech(o)}).forEach(n)}}buildCSSClass(){return""}ready(e,i=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}i?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(i){i.call(this)},this),this.trigger("ready")},1)}$(e,i){return zn(e,i||this.contentEl())}$$(e,i){return qT(e,i||this.contentEl())}hasClass(e){return qa(this.el_,e)}addClass(...e){gr(this.el_,...e)}removeClass(...e){Mc(this.el_,...e)}toggleClass(e,i){BT(this.el_,e,i)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return UT(this.el_,e)}setAttribute(e,i){Is(this.el_,e,i)}removeAttribute(e){Bc(this.el_,e)}width(e,i){return this.dimension("width",e,i)}height(e,i){return this.dimension("height",e,i)}dimensions(e,i){this.width(e,!0),this.height(i)}dimension(e,i,n){if(i!==void 0){(i===null||i!==i)&&(i=0),(""+i).indexOf("%")!==-1||(""+i).indexOf("px")!==-1?this.el_.style[e]=i:i==="auto"?this.el_.style[e]="":this.el_.style[e]=i+"px",n||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],s=r.indexOf("px");return parseInt(s!==-1?r.slice(0,s):this.el_["offset"+je(e)],10)}currentDimension(e){let i=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(i=Ls(this.el_,e),i=parseFloat(i),i===0||isNaN(i)){const n=`offset${je(e)}`;i=this.el_[n]}return i}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(se.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,i=null;const n=10,r=200;let s;this.on("touchstart",function(o){o.touches.length===1&&(i={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=k.performance.now(),s=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)s=!1;else if(i){const l=o.touches[0].pageX-i.pageX,c=o.touches[0].pageY-i.pageY;Math.sqrt(l*l+c*c)>n&&(s=!1)}});const a=function(){s=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){i=null,s===!0&&k.performance.now()-e{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},i),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),k.clearTimeout(e)),e}setInterval(e,i){e=Ce(this,e),this.clearTimersOnDispose_();const n=k.setInterval(e,i);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),k.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var i;return e=Ce(this,e),i=k.requestAnimationFrame(()=>{this.rafIds_.has(i)&&this.rafIds_.delete(i),e()}),this.rafIds_.add(i),i}requestNamedAnimationFrame(e,i){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),i=Ce(this,i);const n=this.requestAnimationFrame(()=>{i(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),k.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((n,r)=>this[i](r))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(e,i){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const n=B.getComponent("Tech"),r=n&&n.isTech(i),s=B===i||B.prototype.isPrototypeOf(i.prototype);if(r||!s){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=je(e),B.components_||(B.components_={});const a=B.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,l=Object.keys(o);if(o&&l.length>0&&l.map(c=>o[c]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return B.components_[e]=i,B.components_[Wa(e)]=i,i}static getComponent(e){if(!(!e||!B.components_))return B.components_[e]}}B.registerComponent("Component",B);function fP(t,e,i){if(typeof e!="number"||e<0||e>i)throw new Error(`Failed to execute '${t}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${i}).`)}function Ky(t,e,i,n){return fP(t,n,i.length-1),i[n][e]}function nh(t){let e;return t===void 0||t.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:t.length,start:Ky.bind(null,"start",0,t),end:Ky.bind(null,"end",1,t)},k.Symbol&&k.Symbol.iterator&&(e[k.Symbol.iterator]=()=>(t||[]).values()),e}function Fi(t,e){return Array.isArray(t)?nh(t):t===void 0||e===void 0?nh():nh([[t,e]])}const ix=function(t,e){t=t<0?0:t;let i=Math.floor(t%60),n=Math.floor(t/60%60),r=Math.floor(t/3600);const s=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(t)||t===1/0)&&(r=n=i="-"),r=r>0||a>0?r+":":"",n=((r||s>=10)&&n<10?"0"+n:n)+":",i=i<10?"0"+i:i,r+n+i};let xm=ix;function nx(t){xm=t}function rx(){xm=ix}function br(t,e=t){return xm(t,e)}var pP=Object.freeze({__proto__:null,createTimeRanges:Fi,createTimeRange:Fi,setFormatTime:nx,resetFormatTime:rx,formatTime:br});function sx(t,e){let i=0,n,r;if(!e)return 0;(!t||!t.length)&&(t=Fi(0,0));for(let s=0;se&&(r=e),i+=r-n;return i/e}function xt(t){if(t instanceof xt)return t;typeof t=="number"?this.code=t:typeof t=="string"?this.message=t:Ui(t)&&(typeof t.code=="number"&&(this.code=t.code),Object.assign(this,t)),this.message||(this.message=xt.defaultMessages[this.code]||"")}xt.prototype.code=0;xt.prototype.message="";xt.prototype.status=null;xt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];xt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let t=0;t{})}const Df=function(t){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((i,n,r)=>(t[n]&&(i[n]=t[n]),i),{cues:t.cues&&Array.prototype.map.call(t.cues,function(i){return{startTime:i.startTime,endTime:i.endTime,text:i.text,id:i.id}})})},mP=function(t){const e=t.$$("track"),i=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const s=Df(r.track);return r.src&&(s.src=r.src),s}).concat(Array.prototype.filter.call(t.textTracks(),function(r){return i.indexOf(r)===-1}).map(Df))},gP=function(t,e){return t.forEach(function(i){const n=e.addRemoteTextTrack(i).track;!i.src&&i.cues&&i.cues.forEach(r=>n.addCue(r))}),e.textTracks()};var Qy={textTracksToJson:mP,jsonToTextTracks:gP,trackToJson_:Df};const rh="vjs-modal-dialog";class qs extends B{constructor(e,i){super(e,i),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=oe("div",{className:`${rh}-content`},{role:"document"}),this.descEl_=oe("p",{className:`${rh}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Qn(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${rh} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(!this.opened_){const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const i=this.closeable_=!!e;let n=this.getChild("closeButton");if(i&&!n){const r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close_)}!i&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const i=this.contentEl(),n=i.parentNode,r=i.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(i),this.empty(),zT(i,e),this.trigger("modalfill"),r?n.insertBefore(i,r):n.appendChild(i);const s=this.getChild("closeButton");s&&n.appendChild(s.el_)}empty(){this.trigger("beforemodalempty"),Uc(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=H.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null,(i.contains(e)||i===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),se.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault(),this.close();return}if(!se.isEventKey(e,"Tab"))return;const i=this.focusableEls_(),n=this.el_.querySelector(":focus");let r;for(let s=0;s(i instanceof k.HTMLAnchorElement||i instanceof k.HTMLAreaElement)&&i.hasAttribute("href")||(i instanceof k.HTMLInputElement||i instanceof k.HTMLSelectElement||i instanceof k.HTMLTextAreaElement||i instanceof k.HTMLButtonElement)&&!i.hasAttribute("disabled")||i instanceof k.HTMLIFrameElement||i instanceof k.HTMLObjectElement||i instanceof k.HTMLEmbedElement||i.hasAttribute("tabindex")&&i.getAttribute("tabindex")!==-1||i.hasAttribute("contenteditable"))}}qs.prototype.options_={pauseOnOpen:!0,temporary:!0};B.registerComponent("ModalDialog",qs);class Ns extends li{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let i=0;i{this.trigger({track:e,type:"labelchange",target:this})},sn(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let i;for(let n=0,r=this.length;n=0;i--)if(e[i].enabled){sh(e,e[i]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&sh(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,sh(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const ah=function(t,e){for(let i=0;i=0;i--)if(e[i].selected){ah(e,e[i]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let i=0;i{this.changing_||(this.changing_=!0,ah(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class ax extends Ns{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class _P{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let i=0,n=e.length;i0&&(k.console&&k.console.groupCollapsed&&k.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(r=>le.error(r)),k.console&&k.console.groupEnd&&k.console.groupEnd()),i.flush()},Zy=function(t,e){const i={uri:t},n=Hc(t);n&&(i.cors=n);const r=e.tech_.crossOrigin()==="use-credentials";r&&(i.withCredentials=r),D2(i,Ce(this,function(s,a,o){if(s)return le.error(s,a);e.loaded_=!0,typeof k.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){le.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Jy(o,e)}):Jy(o,e)}))};class Ro extends Sm{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const i=Ee(e,{kind:SP[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=Yy[i.mode]||"disabled";const r=i.default;(i.kind==="metadata"||i.kind==="chapters")&&(n="hidden"),super(i),this.tech_=i.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const s=new Hu(this.cues_),a=new Hu(this.activeCues_);let o=!1;this.timeupdateHandler=Ce(this,function(c={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return n},set(c){Yy[c]&&n!==c&&(n=c,!this.preload_&&n!=="disabled"&&this.cues.length===0&&Zy(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const c=this.tech_.currentTime(),p=[];for(let m=0,_=this.cues.length;m<_;m++){const E=this.cues[m];E.startTime<=c&&E.endTime>=c&&p.push(E)}if(o=!1,p.length!==this.activeCues_.length)o=!0;else for(let m=0;m{i=mn.LOADED,this.trigger({type:"load",target:this})})}}mn.prototype.allowedEvents_={load:"load"};mn.NONE=0;mn.LOADING=1;mn.LOADED=2;mn.ERROR=3;const ni={audio:{ListClass:yP,TrackClass:lx,capitalName:"Audio"},video:{ListClass:vP,TrackClass:ux,capitalName:"Video"},text:{ListClass:ax,TrackClass:Ro,capitalName:"Text"}};Object.keys(ni).forEach(function(t){ni[t].getterName=`${t}Tracks`,ni[t].privateName=`${t}Tracks_`});const Rs={remoteText:{ListClass:ax,TrackClass:Ro,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:_P,TrackClass:mn,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},vt=Object.assign({},ni,Rs);Rs.names=Object.keys(Rs);ni.names=Object.keys(ni);vt.names=[].concat(Rs.names).concat(ni.names);function bP(t,e,i,n,r={}){const s=t.textTracks();r.kind=e,i&&(r.label=i),n&&(r.language=n),r.tech=t;const a=new vt.text.TrackClass(r);return s.addTrack(a),a}class ae extends B{constructor(e={},i=function(){}){e.reportTouchActivity=!1,super(null,e,i),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),vt.names.forEach(n=>{const r=vt[n];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new vt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ce(this,function(){const i=this.bufferedPercent();this.bufferedPercent_!==i&&this.trigger("progress"),this.bufferedPercent_=i,i===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Fi(0,0)}bufferedPercent(){return sx(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(ni.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(i=>{const n=this[`${i}Tracks`]()||[];let r=n.length;for(;r--;){const s=n[r];i==="text"&&this.removeRemoteTextTrack(s),n.removeTrack(s)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let i=e.length;for(;i--;){const n=e[i];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new xt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Fi(0,0):Fi()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){ni.names.forEach(e=>{const i=ni[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!k.WebVTT)if(H.body.contains(this.el())){if(!this.options_["vtt.js"]&&Ps(gy)&&Object.keys(gy).length>0){this.trigger("vttjsloaded");return}const e=H.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),k.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),i=this.remoteTextTracks(),n=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();const s=()=>this.trigger("texttrackchange"),a=()=>{s();for(let o=0;othis.autoRemoteTextTracks_.addTrack(n.track)),n}removeRemoteTextTrack(e){const i=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(i),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const i=Vi();return!this.isReady_||this.paused()?(this.queuedHanders_.add(i),this.one("playing",()=>{this.queuedHanders_.has(i)&&(this.queuedHanders_.delete(i),e())})):this.requestNamedAnimationFrame(i,e),i}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,i){return ae.canPlayType(e.type)}static isTech(e){return e.prototype instanceof ae||e instanceof ae||e===ae}static registerTech(e,i){if(ae.techs_||(ae.techs_={}),!ae.isTech(i))throw new Error(`Tech ${e} must be a Tech`);if(!ae.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!ae.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=je(e),ae.techs_[e]=i,ae.techs_[Wa(e)]=i,e!=="Tech"&&ae.defaultTechOrder_.push(e),i}static getTech(e){if(e){if(ae.techs_&&ae.techs_[e])return ae.techs_[e];if(e=je(e),k&&k.videojs&&k.videojs[e])return le.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),k.videojs[e]}}}vt.names.forEach(function(t){const e=vt[t];ae.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ae.prototype.featuresVolumeControl=!0;ae.prototype.featuresMuteControl=!0;ae.prototype.featuresFullscreenResize=!1;ae.prototype.featuresPlaybackRate=!1;ae.prototype.featuresProgressEvents=!1;ae.prototype.featuresSourceset=!1;ae.prototype.featuresTimeupdateEvents=!1;ae.prototype.featuresNativeTextTracks=!1;ae.prototype.featuresVideoFrameCallback=!1;ae.withSourceHandlers=function(t){t.registerSourceHandler=function(i,n){let r=t.sourceHandlers;r||(r=t.sourceHandlers=[]),n===void 0&&(n=r.length),r.splice(n,0,i)},t.canPlayType=function(i){const n=t.sourceHandlers||[];let r;for(let s=0;sar(e,yr[e.type],i,t),1)}function AP(t,e){t.forEach(i=>i.setTech&&i.setTech(e))}function DP(t,e,i){return t.reduceRight(Cm(i),e[i]())}function kP(t,e,i,n){return e[i](t.reduce(Cm(i),n))}function ev(t,e,i,n=null){const r="call"+je(i),s=t.reduce(Cm(r),n),a=s===zu,o=a?null:e[i](s);return OP(t,i,o,a),o}const PP={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},IP={setCurrentTime:1,setMuted:1,setVolume:1},tv={play:1,pause:1};function Cm(t){return(e,i)=>e===zu?zu:i[t]?i[t](e):e}function OP(t,e,i,n){for(let r=t.length-1;r>=0;r--){const s=t[r];s[e]&&s[e](n,i)}}function LP(t){kf[t.id()]=null}function NP(t,e){const i=kf[t.id()];let n=null;if(i==null)return n=e(t),kf[t.id()]=[[e,n]],n;for(let r=0;r{if(!e)return"";if(t.cache_.source.src===e&&t.cache_.source.type)return t.cache_.source.type;const i=t.cache_.sources.filter(r=>r.src===e);if(i.length)return i[0].type;const n=t.$$("source");for(let r=0;r + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`;class FP extends B{constructor(e,i,n){const r=Ee({createEl:!1},i);if(super(e,r,n),!i.playerOptions.sources||i.playerOptions.sources.length===0)for(let s=0,a=i.playerOptions.techOrder;sthis.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",i={},n={}){i=Object.assign({className:this.buildCSSClass(),tabIndex:0},i),e==="button"&&le.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=i.tabIndex;const r=oe(e,i,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=oe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,i=this.el()){if(e===void 0)return this.controlText_||"Need Text";const n=this.localize(e);this.controlText_=e,Qn(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&i.setAttribute("title",n)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){se.isEventKey(e,"Space")||se.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("ClickableComponent",zc);class Pf extends zc{constructor(e,i){super(e,i),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return oe("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const i=this.player().poster();this.setSrc(i),i?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(oe("picture",{className:"vjs-poster",tabIndex:-1},{},oe("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?ki(this.player_.play()):this.player_.pause())}}Pf.prototype.crossorigin=Pf.prototype.crossOrigin;B.registerComponent("PosterImage",Pf);const Jt="#222",nv="#ccc",UP={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function oh(t,e){let i;if(t.length===4)i=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else if(t.length===7)i=t.slice(1);else throw new Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+e+")"}function xa(t,e,i){try{t.style[e]=i}catch{return}}function rv(t){return t?`${t}px`:""}class jP extends B{constructor(e,i,n){super(e,i,n);const r=a=>this.updateDisplay(a),s=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Ce(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);const a=k.screen.orientation||k,o=k.screen.orientation?"change":"orientationchange";a.addEventListener(o,s),e.on("dispose",()=>a.removeEventListener(o,s));const l=this.options_.playerOptions.tracks||[];for(let c=0;c.1&&(n>r?s=Math.round((e-i*r)/2):a=Math.round((i-e/r)/2)),xa(this.el_,"insetInline",rv(s)),xa(this.el_,"insetBlock",rv(a))}updateDisplayState(e){const i=this.player_.textTrackSettings.getValues(),n=e.activeCues;let r=n.length;for(;r--;){const s=n[r];if(!s)continue;const a=s.displayState;if(i.color&&(a.firstChild.style.color=i.color),i.textOpacity&&xa(a.firstChild,"color",oh(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(a.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&xa(a.firstChild,"backgroundColor",oh(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?xa(a,"backgroundColor",oh(i.windowColor,i.windowOpacity)):a.style.backgroundColor=i.windowColor),i.edgeStyle&&(i.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Jt}, 2px 2px 4px ${Jt}, 2px 2px 5px ${Jt}`:i.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Jt}, 2px 2px ${Jt}, 3px 3px ${Jt}`:i.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${nv}, 0 1px ${nv}, -1px -1px ${Jt}, 0 -1px ${Jt}`:i.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Jt}, 0 0 4px ${Jt}, 0 0 4px ${Jt}, 0 0 4px ${Jt}`)),i.fontPercent&&i.fontPercent!==1){const o=k.parseFloat(a.style.fontSize);a.style.fontSize=o*i.fontPercent+"px",a.style.height="auto",a.style.top="auto"}i.fontFamily&&i.fontFamily!=="default"&&(i.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=UP[i.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof k.WebVTT!="function"||e.every(n=>!n.activeCues))return;const i=[];for(let n=0;nthis.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const i=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){ki(i),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const s=()=>r.focus();Ga(i)?i.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}dx.prototype.controlText_="Play Video";B.registerComponent("BigPlayButton",dx);class VP extends qt{constructor(e,i){super(e,i),this.setIcon("cancel"),this.controlText(i&&i.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){se.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("CloseButton",VP);class hx extends qt{constructor(e,i={}){super(e,i),i.replay=i.replay===void 0||i.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),i.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ki(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",i=>this.handleSeeked(i))}}hx.prototype.controlText_="Play";B.registerComponent("PlayToggle",hx);class Ws extends B{constructor(e,i){super(e,i),this.on(e,["timeupdate","ended"],n=>this.updateContent(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),i=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=oe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return i.appendChild(n),this.contentEl_=oe("span",{className:`${e}-display`},{role:"presentation"}),i.appendChild(this.contentEl_),i}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=br(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let i=this.textNode_;i&&this.contentEl_.firstChild!==i&&(i=null,le.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=H.createTextNode(this.formattedTime_),this.textNode_&&(i?this.contentEl_.replaceChild(this.textNode_,i):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Ws.prototype.labelText_="Time";Ws.prototype.controlText_="Time";B.registerComponent("TimeDisplay",Ws);class wm extends Ws{buildCSSClass(){return"vjs-current-time"}updateContent(e){let i;this.player_.ended()?i=this.player_.duration():i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(i)}}wm.prototype.labelText_="Current Time";wm.prototype.controlText_="Current Time";B.registerComponent("CurrentTimeDisplay",wm);class Am extends Ws{constructor(e,i){super(e,i);const n=r=>this.updateContent(r);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const i=this.player_.duration();this.updateTextNode_(i)}}Am.prototype.labelText_="Duration";Am.prototype.controlText_="Duration";B.registerComponent("DurationDisplay",Am);class HP extends B{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return i.appendChild(n),e.appendChild(i),e}}B.registerComponent("TimeDivider",HP);class Dm extends Ws{constructor(e,i){super(e,i),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(oe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let i;this.player_.ended()?i=0:this.player_.remainingTimeDisplay?i=this.player_.remainingTimeDisplay():i=this.player_.remainingTime(),this.updateTextNode_(i)}}Dm.prototype.labelText_="Remaining Time";Dm.prototype.controlText_="Remaining Time";B.registerComponent("RemainingTimeDisplay",Dm);class zP extends B{constructor(e,i){super(e,i),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=oe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(oe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(H.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}B.registerComponent("LiveDisplay",zP);class fx extends qt{constructor(e,i){super(e,i),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=oe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}fx.prototype.controlText_="Seek to live, currently playing live";B.registerComponent("SeekToLive",fx);function Mo(t,e,i){return t=Number(t),Math.min(i,Math.max(e,isNaN(t)?e:t))}var qP=Object.freeze({__proto__:null,clamp:Mo});class km extends B{constructor(e,i){super(e,i),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,i={},n={}){return i.className=i.className+" vjs-slider",i=Object.assign({tabIndex:0},i),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,i,n)}handleMouseDown(e){const i=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!$i&&e.preventDefault(),jT(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(i,"mousemove",this.handleMouseMove_),this.on(i,"mouseup",this.handleMouseUp_),this.on(i,"touchmove",this.handleMouseMove_),this.on(i,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const i=this.bar.el_.ownerDocument;$T(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(i,"mousemove",this.handleMouseMove_),this.off(i,"mouseup",this.handleMouseUp_),this.off(i,"touchmove",this.handleMouseMove_),this.off(i,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const i=this.vertical()?"height":"width";this.bar.el().style[i]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Mo(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const i=Fc(this.el_,e);return this.vertical()?i.y:i.x}handleKeyDown(e){se.isEventKey(e,"Left")||se.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):se.isEventKey(e,"Right")||se.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}B.registerComponent("Slider",km);const lh=(t,e)=>Mo(t/e*100,0,100).toFixed(2)+"%";class WP extends B{constructor(e,i){super(e,i),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),i=oe("span",{className:"vjs-control-text"}),n=oe("span",{textContent:this.localize("Loaded")}),r=H.createTextNode(": ");return this.percentageEl_=oe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const i=this.player_.liveTracker,n=this.player_.buffered(),r=i&&i.isLive()?i.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),a=this.partEls_,o=lh(s,r);this.percent_!==o&&(this.el_.style.width=o,Qn(this.percentageEl_,o),this.percent_=o);for(let l=0;ln.length;l--)this.el_.removeChild(a[l-1]);a.length=n.length})}}B.registerComponent("LoadProgressBar",WP);class GP extends B{constructor(e,i){super(e,i),this.update=Hi(Ce(this,this.update),oi)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,i,n){const r=So(this.el_),s=Os(this.player_.el()),a=e.width*i;if(!s||!r)return;const o=e.left-s.left+a,l=e.width-a+(s.right-e.right);let c=r.width/2;or.width&&(c=r.width),c=Math.round(c),this.el_.style.right=`-${c}px`,this.write(n)}write(e){Qn(this.el_,e)}updateTime(e,i,n,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),l=o-i*o;s=(l<1?"":"-")+br(l,o)}else s=br(n,a);this.update(e,i,s),r&&r()})}}B.registerComponent("TimeTooltip",GP);class Pm extends B{constructor(e,i){super(e,i),this.setIcon("circle"),this.update=Hi(Ce(this,this.update),oi)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,i){const n=this.getChild("timeTooltip");if(!n)return;const r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,i,r)}}Pm.prototype.options_={children:[]};!Et&&!ji&&Pm.prototype.options_.children.push("timeTooltip");B.registerComponent("PlayProgressBar",Pm);class px extends B{constructor(e,i){super(e,i),this.update=Hi(Ce(this,this.update),oi)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,i){const n=i*this.player_.duration();this.getChild("timeTooltip").updateTime(e,i,n,()=>{this.el_.style.left=`${e.width*i}px`})}}px.prototype.options_={children:["timeTooltip"]};B.registerComponent("MouseTimeDisplay",px);const Nl=5,sv=12;class Im extends km{constructor(e,i){super(e,i),this.setEventHandlers_()}setEventHandlers_(){this.update_=Ce(this,this.update),this.update=Hi(this.update_,oi),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in H&&"visibilityState"in H&&this.on(H,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){H.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,oi))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(H.visibilityState==="hidden")return;const i=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let s=this.player_.duration();r&&r.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==i&&(this.el_.setAttribute("aria-valuenow",(i*100).toFixed(2)),this.percent_=i),(this.currentTime_!==n||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[br(n,s),br(s,s)],"{1} of {2}")),this.currentTime_=n,this.duration_=s),this.bar&&this.bar.update(Os(this.el()),this.getProgress())}),i}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let i;const n=this.player_.liveTracker;return n&&n.isLive()?(i=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(i=1)):i=e/this.player_.duration(),i}handleMouseDown(e){Eo(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,i=!1){if(!Eo(e)||isNaN(this.player_.duration()))return;!i&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const r=this.calculateDistance(e),s=this.player_.liveTracker;if(!s||!s.isLive())n=r*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(r>=.99){s.seekToLiveEdge();return}const a=s.seekableStart(),o=s.liveCurrentTime();if(n=a+r*s.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.userSeek_(n)}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?ki(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+Nl)}stepBack(){this.userSeek_(this.player_.currentTime()-Nl)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const i=this.player_.liveTracker;if(se.isEventKey(e,"Space")||se.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(se.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(se.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(se(e))){e.preventDefault(),e.stopPropagation();const n=(se.codes[se(e)]-se.codes[0])*10/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else se.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-Nl*sv)):se.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+Nl*sv)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in H&&"visibilityState"in H&&this.off(H,"visibilitychange",this.toggleVisibility_),super.dispose()}}Im.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};!Et&&!ji&&Im.prototype.options_.children.splice(1,0,"mouseTimeDisplay");B.registerComponent("SeekBar",Im);class mx extends B{constructor(e,i){super(e,i),this.handleMouseMove=Hi(Ce(this,this.handleMouseMove),oi),this.throttledHandleMouseSeek=Hi(Ce(this,this.handleMouseSeek),oi),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const i=this.getChild("seekBar");if(!i)return;const n=i.getChild("playProgressBar"),r=i.getChild("mouseTimeDisplay");if(!n&&!r)return;const s=i.el(),a=So(s);let o=Fc(s,e).x;o=Mo(o,0,1),r&&r.update(a,o),n&&n.update(a,i.getProgress())}handleMouseSeek(e){const i=this.getChild("seekBar");i&&i.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&ki(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const i=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(i,"mousemove",this.throttledHandleMouseSeek),this.on(i,"touchmove",this.throttledHandleMouseSeek),this.on(i,"mouseup",this.handleMouseUpHandler_),this.on(i,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const i=this.getChild("seekBar");i&&i.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}mx.prototype.options_={children:["seekBar"]};B.registerComponent("ProgressControl",mx);class gx extends qt{constructor(e,i){super(e,i),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){H.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in k?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof H.exitPictureInPicture=="function"&&super.show()}}gx.prototype.controlText_="Picture-in-Picture";B.registerComponent("PictureInPictureToggle",gx);class yx extends qt{constructor(e,i){super(e,i),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),H[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}yx.prototype.controlText_="Fullscreen";B.registerComponent("FullscreenToggle",yx);const XP=function(t,e){e.tech_&&!e.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})};class KP extends B{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}B.registerComponent("VolumeLevel",KP);class QP extends B{constructor(e,i){super(e,i),this.update=Hi(Ce(this,this.update),oi)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,i,n,r){if(!n){const s=Os(this.el_),a=Os(this.player_.el()),o=e.width*i;if(!a||!s)return;const l=e.left-a.left+o,c=e.width-o+(a.right-e.right);let p=s.width/2;ls.width&&(p=s.width),this.el_.style.right=`-${p}px`}this.write(`${r}%`)}write(e){Qn(this.el_,e)}updateVolume(e,i,n,r,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,i,n,r.toFixed(0)),s&&s()})}}B.registerComponent("VolumeLevelTooltip",QP);class vx extends B{constructor(e,i){super(e,i),this.update=Hi(Ce(this,this.update),oi)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,i,n){const r=100*i;this.getChild("volumeLevelTooltip").updateVolume(e,i,n,r,()=>{n?this.el_.style.bottom=`${e.height*i}px`:this.el_.style.left=`${e.width*i}px`})}}vx.prototype.options_={children:["volumeLevelTooltip"]};B.registerComponent("MouseVolumeLevelDisplay",vx);class qc extends km{constructor(e,i){super(e,i),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Eo(e)&&super.handleMouseDown(e)}handleMouseMove(e){const i=this.getChild("mouseVolumeLevelDisplay");if(i){const n=this.el(),r=Os(n),s=this.vertical();let a=Fc(n,e);a=s?a.y:a.x,a=Mo(a,0,1),i.update(r,a,s)}Eo(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const i=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",i),this.el_.setAttribute("aria-valuetext",i+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}qc.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Et&&!ji&&qc.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");qc.prototype.playerEvent="volumechange";B.registerComponent("VolumeBar",qc);class _x extends B{constructor(e,i={}){i.vertical=i.vertical||!1,(typeof i.volumeBar>"u"||Ps(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),super(e,i),XP(this,e),this.throttledHandleMouseMove=Hi(Ce(this,this.handleMouseMove),oi),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const i=this.el_.ownerDocument;this.on(i,"mousemove",this.throttledHandleMouseMove),this.on(i,"touchmove",this.throttledHandleMouseMove),this.on(i,"mouseup",this.handleMouseUpHandler_),this.on(i,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const i=this.el_.ownerDocument;this.off(i,"mousemove",this.throttledHandleMouseMove),this.off(i,"touchmove",this.throttledHandleMouseMove),this.off(i,"mouseup",this.handleMouseUpHandler_),this.off(i,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}_x.prototype.options_={children:["volumeBar"]};B.registerComponent("VolumeControl",_x);const YP=function(t,e){e.tech_&&!e.tech_.featuresMuteControl&&t.addClass("vjs-hidden"),t.on(e,"loadstart",function(){e.tech_.featuresMuteControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})};class Tx extends qt{constructor(e,i){super(e,i),YP(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const i=this.player_.volume(),n=this.player_.lastVolume_();if(i===0){const r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let i=3;this.setIcon("volume-high"),Et&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),i=0):e<.33?(this.setIcon("volume-low"),i=1):e<.67&&(this.setIcon("volume-medium"),i=2),Mc(this.el_,[0,1,2,3].reduce((n,r)=>n+`${r?" ":""}vjs-vol-${r}`,"")),gr(this.el_,`vjs-vol-${i}`)}updateControlText_(){const i=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==i&&this.controlText(i)}}Tx.prototype.controlText_="Mute";B.registerComponent("MuteToggle",Tx);class xx extends B{constructor(e,i={}){typeof i.inline<"u"?i.inline=i.inline:i.inline=!0,(typeof i.volumeControl>"u"||Ps(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),super(e,i),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){se.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Gt(H,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),dt(H,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){se.isEventKey(e,"Esc")&&this.handleMouseOut()}}xx.prototype.options_={children:["muteToggle","volumeControl"]};B.registerComponent("VolumePanel",xx);class JP extends qt{constructor(e,i){super(e,i),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const i=this.player_.currentTime(),n=this.player_.liveTracker,r=n&&n.isLive()?n.seekableEnd():this.player_.duration();let s;i+this.skipTime<=r?s=i+this.skipTime:s=r,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}B.registerComponent("SkipForward",JP);class Sx extends qt{constructor(e,i){super(e,i),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const i=this.player_.currentTime(),n=this.player_.liveTracker,r=n&&n.isLive()&&n.seekableStart();let s;r&&i-this.skipTime<=r?s=r:i>=this.skipTime?s=i-this.skipTime:s=0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Sx.prototype.controlText_="Skip Backward";B.registerComponent("SkipBackward",Sx);class Ex extends B{constructor(e,i){super(e,i),i&&(this.menuButton_=i.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}addEventListenerForItem(e){e instanceof B&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof B&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const i=this.addChild(e);i&&this.addEventListenerForItem(i)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=oe(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const i=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),Gt(i,"click",function(n){n.preventDefault(),n.stopImmediatePropagation()}),i}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const i=e.relatedTarget||H.activeElement;if(!this.children().some(n=>n.el()===i)){const n=this.menuButton_;n&&n.buttonPressed_&&i!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const i=this.children();if(!Array.isArray(i))return;const n=i.filter(r=>r.el()===e.target)[0];if(!n)return;n.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){se.isEventKey(e,"Left")||se.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(se.isEventKey(e,"Right")||se.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const i=this.children().slice();i.length&&i[0].hasClass("vjs-menu-title")&&i.shift(),i.length>0&&(e<0?e=0:e>=i.length&&(e=i.length-1),this.focusedChild_=e,i[e].el_.focus())}}B.registerComponent("Menu",Ex);class Om extends B{constructor(e,i={}){super(e,i),this.menuButton_=new qt(e,i),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const n=qt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=s=>this.handleClick(s);this.handleMenuKeyUp_=s=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",s=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Gt(H,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",s=>this.handleMouseLeave(s)),this.on("keydown",s=>this.handleSubmenuKeyDown(s))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Ex(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const i=oe("li",{className:"vjs-menu-title",textContent:je(this.options_.title),tabIndex:-1}),n=new B(this.player_,{el:i});e.addItem(n)}if(this.items=this.createItems(),this.items)for(let i=0;ise.isEventKey(e,i))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}B.registerComponent("MenuItem",Bo);class Fo extends Bo{constructor(e,i){const n=i.track,r=e.textTracks();i.label=n.label||n.language||"Unknown",i.selected=n.mode==="showing",super(e,i),this.track=n,this.kinds=(i.kinds||[i.kind||this.track.kind]).filter(Boolean);const s=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],s),r.addEventListener("change",s),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),r.removeEventListener("change",s),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof k.Event!="object")try{o=new k.Event("change")}catch{}o||(o=H.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const i=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let r=0;r-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const i=this.player().textTracks();let n=!0;for(let r=0,s=i.length;r-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}B.registerComponent("OffTextTrackMenuItem",bx);class Gs extends Lm{constructor(e,i={}){i.tracks=e.textTracks(),super(e,i)}createItems(e=[],i=Fo){let n;this.label_&&(n=`${this.label_} off`),e.push(new bx(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let s=0;s-1){const o=new i(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}B.registerComponent("TextTrackButton",Gs);class Cx extends Bo{constructor(e,i){const n=i.track,r=i.cue,s=e.currentTime();i.selectable=!0,i.multiSelectable=!1,i.label=r.text,i.selected=r.startTime<=s&&s{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),super.update()):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.kind===this.kind_)return n}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(je(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const i=this.track_.cues;if(!i)return e;for(let n=0,r=i.length;n-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(je(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Bm(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,wx),e}}Um.prototype.kinds_=["captions","subtitles"];Um.prototype.controlText_="Subtitles";B.registerComponent("SubsCapsButton",Um);class Ax extends Bo{constructor(e,i){const n=i.track,r=e.audioTracks();i.label=n.label||n.language||"Unknown",i.selected=n.enabled,super(e,i),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const s=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",s),this.on("dispose",()=>{r.removeEventListener("change",s)})}createEl(e,i,n){const r=super.createEl(e,i,n),s=r.querySelector(".vjs-menu-item-text");return["main-desc","description"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(oe("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const i=this.player_.audioTracks();for(let n=0;nthis.update(s))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}jm.prototype.contentElType="button";B.registerComponent("PlaybackRateMenuItem",jm);class kx extends Om{constructor(e,i){super(e,i),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=oe("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),i=[];for(let n=e.length-1;n>=0;n--)i.push(new jm(this.player(),{rate:e[n]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}kx.prototype.controlText_="Playback Rate";B.registerComponent("PlaybackRateMenuButton",kx);class Px extends B{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",i={},n={}){return i.className||(i.className=this.buildCSSClass()),super.createEl(e,i,n)}}B.registerComponent("Spacer",Px);class eI extends Px{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}B.registerComponent("CustomControlSpacer",eI);class Ix extends B{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Ix.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};B.registerComponent("ControlBar",Ix);class Ox extends qs{constructor(e,i){super(e,i),this.on(e,"error",n=>this.open(n))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Ox.prototype.options_=Object.assign({},qs.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});B.registerComponent("ErrorDisplay",Ox);const uh="vjs-text-track-settings",av=["#000","Black"],ov=["#00F","Blue"],lv=["#0FF","Cyan"],uv=["#0F0","Green"],cv=["#F0F","Magenta"],dv=["#F00","Red"],hv=["#FFF","White"],fv=["#FF0","Yellow"],ch=["1","Opaque"],dh=["0.5","Semi-Transparent"],pv=["0","Transparent"],or={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[av,hv,dv,uv,ov,fv,cv,lv]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ch,dh,pv]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[hv,av,dv,uv,ov,fv,cv,lv]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:t=>t==="1.00"?null:Number(t)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ch,dh]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[pv,dh,ch]}};or.windowColor.options=or.backgroundColor.options;function Lx(t,e){if(e&&(t=e(t)),t&&t!=="none")return t}function tI(t,e){const i=t.options[t.options.selectedIndex].value;return Lx(i,e)}function iI(t,e,i){if(e){for(let n=0;n{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),ds(or,n=>{this.on(this.$(n.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,i="",n="label"){const r=or[e],s=r.id.replace("%s",this.id_),a=[i,s].join(" ").trim();return[`<${n} id="${s}" class="${n==="label"?"vjs-label":""}">`,this.localize(r.label),``,`").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return oe("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return oe("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return oe("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return kT(or,(e,i,n)=>{const r=tI(this.$(i.selector),i.parser);return r!==void 0&&(e[n]=r),e},{})}setValues(e){ds(or,(i,n)=>{iI(this.$(i.selector),e[n],i.parser)})}setDefaults(){ds(or,e=>{const i=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=i})}restoreSettings(){let e;try{e=JSON.parse(k.localStorage.getItem(uh))}catch(i){le.warn(i)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?k.localStorage.setItem(uh,JSON.stringify(e)):k.localStorage.removeItem(uh)}catch(i){le.warn(i)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,i=e&&e.subsCapsButton,n=e&&e.captionsButton;i?i.focus():n&&n.focus()}handleLanguagechange(){this.fill()}}B.registerComponent("TextTrackSettings",nI);class rI extends B{constructor(e,i){let n=i.ResizeObserver||k.ResizeObserver;i.ResizeObserver===null&&(n=!1);const r=Ee({createEl:!n,reportTouchActivity:!1},i);super(e,r),this.ResizeObserver=i.ResizeObserver||k.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=YT(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const s=this.debouncedHandler_;let a=this.unloadListener_=function(){dt(this,"resize",s),dt(this,"unload",a),a=null};Gt(this.el_.contentWindow,"unload",a),Gt(this.el_.contentWindow,"resize",s)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}B.registerComponent("ResizeManager",rI);const sI={trackingThreshold:20,liveTolerance:15};class aI extends B{constructor(e,i){const n=Ee(sI,i,{createEl:!1});super(e,n),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const i=Number(k.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(i-this.lastTime_)/1e3;this.lastTime_=i,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),s=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-s)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,oi),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),i=[];let n=e?e.length:0;for(;n--;)i.push(e.end(n));return i.length?i.sort()[i.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),i=[];let n=e?e.length:0;for(;n--;)i.push(e.start(n));return i.length?i.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}B.registerComponent("LiveTracker",aI);class oI extends B{constructor(e,i){super(e,i),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:oe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Vi()}`}),description:oe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Vi()}`})},oe("div",{className:"vjs-title-bar"},{},PT(this.els))}updateDom_(){const e=this.player_.tech_,i=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const s=this.state[r],a=this.els[r],o=n[r];Uc(a),s&&Qn(a,s),i&&(i.removeAttribute(o),s&&i.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,i=e&&e.el_;i&&(i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}B.registerComponent("TitleBar",oI);const If=t=>{const e=t.el();if(e.hasAttribute("src"))return t.triggerSourceset(e.src),!0;const i=t.$$("source"),n=[];let r="";if(!i.length)return!1;for(let s=0;s{let i={};for(let n=0;nNx([t.el(),k.HTMLMediaElement.prototype,k.Element.prototype,lI],"innerHTML"),mv=function(t){const e=t.el();if(e.resetSourceWatch_)return;const i={},n=uI(t),r=s=>(...a)=>{const o=s.apply(e,a);return If(t),o};["append","appendChild","insertAdjacentHTML"].forEach(s=>{e[s]&&(i[s]=e[s],e[s]=r(i[s]))}),Object.defineProperty(e,"innerHTML",Ee(n,{set:r(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(i).forEach(s=>{e[s]=i[s]}),Object.defineProperty(e,"innerHTML",n)},t.one("sourceset",e.resetSourceWatch_)},cI=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?ox(k.Element.prototype.getAttribute.call(this,"src")):""},set(t){return k.Element.prototype.setAttribute.call(this,"src",t),t}}),dI=t=>Nx([t.el(),k.HTMLMediaElement.prototype,cI],"src"),hI=function(t){if(!t.featuresSourceset)return;const e=t.el();if(e.resetSourceset_)return;const i=dI(t),n=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Ee(i,{set:s=>{const a=i.set.call(e,s);return t.triggerSourceset(e.src),a}})),e.setAttribute=(s,a)=>{const o=n.call(e,s,a);return/src/i.test(s)&&t.triggerSourceset(e.src),o},e.load=()=>{const s=r.call(e);return If(t)||(t.triggerSourceset(""),mv(t)),s},e.currentSrc?t.triggerSourceset(e.currentSrc):If(t)||mv(t),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=n,Object.defineProperty(e,"src",i),e.resetSourceWatch_&&e.resetSourceWatch_()}};class G extends ae{constructor(e,i){super(e,i);const n=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const s=this.el_.childNodes;let a=s.length;const o=[];for(;a--;){const l=s[a];l.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(l),this.remoteTextTracks().addTrack(l.track),this.textTracks().addTrack(l.track),!r&&!this.el_.hasAttribute("crossorigin")&&Hc(l.src)&&(r=!0)):o.push(l))}for(let l=0;l{i=[];for(let s=0;se.removeEventListener("change",n));const r=()=>{for(let s=0;s{e.removeEventListener("change",n),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",r)})}overrideNative_(e,i){if(i!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(r=>{this.el()[`${n}Tracks`].removeEventListener(r,this[`${n}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!i,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const i=ni[e],n=this.el()[i.getterName],r=this[i.getterName]();if(!this[`featuresNative${i.capitalName}Tracks`]||!n||!n.addEventListener)return;const s={change:o=>{const l={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(l),e==="text"&&this[Rs.remoteText.getterName]().trigger(l)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let l=0;l{const l=s[o];n.addEventListener(o,l),this.on("dispose",c=>n.removeEventListener(o,l))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){ni.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),G.disposeMediaElement(e),e=n}else{e=H.createElement("video");const n=this.options_.tag&&wn(this.options_.tag),r=Ee({},n);(!xo||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,FT(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Is(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const i=["loop","muted","playsinline","autoplay"];for(let n=0;n=2&&i.push("loadeddata"),e.readyState>=3&&i.push("canplay"),e.readyState>=4&&i.push("canplaythrough"),this.ready(function(){i.forEach(function(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Rc?this.el_.fastSeek(e):this.el_.currentTime=e}catch(i){le(i,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ji&&$i&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",()=>{this.off("webkitbeginfullscreen",i),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)ki(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(i){this.trigger("fullscreenerror",i)}},0);else try{e.webkitEnterFullScreen()}catch(i){this.trigger("fullscreenerror",i)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}reset(){G.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,i,n):super.addTextTrack(e,i,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const i=H.createElement("track");return e.kind&&(i.kind=e.kind),e.label&&(i.label=e.label),(e.language||e.srclang)&&(i.srclang=e.language||e.srclang),e.default&&(i.default=e.default),e.id&&(i.id=e.id),e.src&&(i.src=e.src),i}addRemoteTextTrack(e,i){const n=super.addRemoteTextTrack(e,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const i=this.$$("track");let n=i.length;for(;n--;)(e===i[n]||e===i[n].track)&&this.el().removeChild(i[n])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),k.performance&&(e.creationTime=k.performance.now()),e}}Ic(G,"TEST_VID",function(){if(!Vs())return;const t=H.createElement("video"),e=H.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",t.appendChild(e),t});G.isSupported=function(){try{G.TEST_VID.volume=.5}catch{return!1}return!!(G.TEST_VID&&G.TEST_VID.canPlayType)};G.canPlayType=function(t){return G.TEST_VID.canPlayType(t)};G.canPlaySource=function(t,e){return G.canPlayType(t.type)};G.canControlVolume=function(){try{const t=G.TEST_VID.volume;G.TEST_VID.volume=t/2+.1;const e=t!==G.TEST_VID.volume;return e&&Et?(k.setTimeout(()=>{G&&G.prototype&&(G.prototype.featuresVolumeControl=t!==G.TEST_VID.volume)}),!1):e}catch{return!1}};G.canMuteVolume=function(){try{const t=G.TEST_VID.muted;return G.TEST_VID.muted=!t,G.TEST_VID.muted?Is(G.TEST_VID,"muted","muted"):Bc(G.TEST_VID,"muted","muted"),t!==G.TEST_VID.muted}catch{return!1}};G.canControlPlaybackRate=function(){if(ji&&$i&&Oc<58)return!1;try{const t=G.TEST_VID.playbackRate;return G.TEST_VID.playbackRate=t/2+.1,t!==G.TEST_VID.playbackRate}catch{return!1}};G.canOverrideAttributes=function(){try{const t=()=>{};Object.defineProperty(H.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(H.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(H.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(H.createElement("audio"),"innerHTML",{get:t,set:t})}catch{return!1}return!0};G.supportsNativeTextTracks=function(){return Rc||Et&&$i};G.supportsNativeVideoTracks=function(){return!!(G.TEST_VID&&G.TEST_VID.videoTracks)};G.supportsNativeAudioTracks=function(){return!!(G.TEST_VID&&G.TEST_VID.audioTracks)};G.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([t,e]){Ic(G.prototype,t,()=>G[e](),!0)});G.prototype.featuresVolumeControl=G.canControlVolume();G.prototype.movingMediaElementInDOM=!Et;G.prototype.featuresFullscreenResize=!0;G.prototype.featuresProgressEvents=!0;G.prototype.featuresTimeupdateEvents=!0;G.prototype.featuresVideoFrameCallback=!!(G.TEST_VID&&G.TEST_VID.requestVideoFrameCallback);G.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),typeof t.load=="function"&&function(){try{t.load()}catch{}}()}};G.resetMediaElement=function(t){if(!t)return;const e=t.querySelectorAll("source");let i=e.length;for(;i--;)t.removeChild(e[i]);t.removeAttribute("src"),typeof t.load=="function"&&function(){try{t.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(t){G.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){G.prototype["set"+je(t)]=function(e){this.el_[t]=e,e?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(t){G.prototype[t]=function(){return this.el_[t]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){G.prototype["set"+je(t)]=function(e){this.el_[t]=e}});["pause","load","play"].forEach(function(t){G.prototype[t]=function(){return this.el_[t]()}});ae.withSourceHandlers(G);G.nativeSourceHandler={};G.nativeSourceHandler.canPlayType=function(t){try{return G.TEST_VID.canPlayType(t)}catch{return""}};G.nativeSourceHandler.canHandleSource=function(t,e){if(t.type)return G.nativeSourceHandler.canPlayType(t.type);if(t.src){const i=bm(t.src);return G.nativeSourceHandler.canPlayType(`video/${i}`)}return""};G.nativeSourceHandler.handleSource=function(t,e,i){e.setSrc(t.src)};G.nativeSourceHandler.dispose=function(){};G.registerSourceHandler(G.nativeSourceHandler);ae.registerTech("Html5",G);const Rx=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],hh={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Of=["tiny","xsmall","small","medium","large","xlarge","huge"],Zl={};Of.forEach(t=>{const e=t.charAt(0)==="x"?`x-${t.substring(1)}`:t;Zl[t]=`vjs-layout-${e}`});const fI={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class we extends B{constructor(e,i,n){if(e.id=e.id||i.id||`vjs_video_${Vi()}`,i=Object.assign(we.getTagSettings(e),i),i.initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,!i.language){const a=e.closest("[lang]");a&&(i.language=a.getAttribute("lang"))}if(super(null,i,n),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.isFullscreen_=!1,this.log=AT(this.id_),this.fsApi_=Uu,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&wn(e),this.language(this.options_.language),i.languages){const a={};Object.getOwnPropertyNames(i.languages).forEach(function(o){a[o.toLowerCase()]=i.languages[o]}),this.languages_=a}else this.languages_=we.prototype.options_.languages;this.resetCache_(),this.poster_=i.poster||"",this.controls_=!!i.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),i.plugins&&Object.keys(i.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Tm(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Gt(H,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Ee(this.options_);if(i.plugins&&Object.keys(i.plugins).forEach(a=>{this[a](i.plugins[a])}),i.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(i.playbackRates),i.experimentalSvgIcons){const o=new k.DOMParser().parseFromString(BP,"image/svg+xml");if(o.querySelector("parsererror"))le.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const c=o.documentElement;c.style.display="none",this.el_.appendChild(c),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),xo&&this.addClass("vjs-touch-enabled"),Et||this.addClass("vjs-workinghover"),we.players[this.id_]=this;const s=CT.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),dt(H,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),dt(H,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),we.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),LP(this),vt.names.forEach(e=>{const i=vt[e],n=this[i.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,i,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";n?i=this.el_=e.parentNode:r||(i=this.el_=super.createEl("div"));const s=wn(e);if(r){for(i=this.el_=e,e=this.tag=H.createElement("video");i.children.length;)e.appendChild(i.firstChild);qa(i,"video-js")||gr(i,"video-js"),i.appendChild(e),n=this.playerElIngest_=i,Object.keys(i).forEach(o=>{try{e[o]=i[o]}catch{}})}if(e.setAttribute("tabindex","-1"),s.tabindex="-1",$i&&Lc&&(e.setAttribute("role","application"),s.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(o){r&&o==="class"||i.setAttribute(o,s[o]),r&&e.setAttribute(o,s[o])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=i.player=this,this.addClass("vjs-paused"),k.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=KT("vjs-styles-dimensions");const o=zn(".vjs-styles-defaults"),l=zn("head");l.insertBefore(this.styleEl_,o?o.nextSibling:l.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const a=e.getElementsByTagName("a");for(let o=0;o"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){le.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,i){const n=e+"_";if(i===void 0)return this[n]||0;if(i===""||i==="auto"){this[n]=void 0,this.updateStyleEl_();return}const r=parseFloat(i);if(isNaN(r)){le.error(`Improper value "${i}" supplied for for ${e}`);return}this[n]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,sn(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),uP(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(k.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,c=this.tech_&&this.tech_.el();c&&(o>=0&&(c.width=o),l>=0&&(c.height=l));return}let e,i,n,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const s=n.split(":"),a=s[1]/s[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?i=this.height_:i=e*a,/^[^a-zA-Z]/.test(this.id())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),QT(this.styleEl_,` + .${r} { + width: ${e}px; + height: ${i}px; + } + + .${r}.vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: ${a*100}%; + } + `)}loadTech_(e,i){this.tech_&&this.unloadTech_();const n=je(e),r=e.charAt(0).toLowerCase()+e.slice(1);n!=="Html5"&&this.tag&&(ae.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;let s=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(s=!1);const a={source:i,autoplay:s,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${r}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};vt.names.forEach(l=>{const c=vt[l];a[c.getterName]=this[c.privateName]}),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),i&&i.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=ae.getTech(e);if(!o)throw new Error(`No Tech named '${n}' exists! '${n}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Ce(this,this.handleTechReady_),!0),Qy.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Rx.forEach(l=>{this.on(this.tech_,l,c=>this[`handleTech${je(l)}_`](c))}),Object.keys(hh).forEach(l=>{this.on(this.tech_,l,c=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${hh[l]}_`].bind(this),event:c});return}this[`handleTech${hh[l]}_`](c)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,c)=>this.handleTechFullscreenChange_(l,c)),this.on(this.tech_,"fullscreenerror",(l,c)=>this.handleTechFullscreenError_(l,c)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(n!=="Html5"||!this.tag)&&Ef(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){vt.names.forEach(e=>{const i=vt[e];this[i.privateName]=this[i.getterName]()}),this.textTracksJson_=Qy.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&le.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. +See https://github.com/videojs/video.js/issues/2617 for more info. +`),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const i=()=>{const r=this.muted();this.muted(!0);const s=()=>{this.muted(r)};this.playTerminatedQueue_.push(s);const a=this.play();if(Ga(a))return a.catch(o=>{throw s(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),Ga(n)&&(n=n.catch(i))):e==="muted"&&!this.muted()?n=i():n=this.play(),!!Ga(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,n="";typeof i!="string"&&(i=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!n&&(n=MP(this,i)),this.cache_.source=Ee({},e,{src:i,type:n});const r=this.cache_.sources.filter(l=>l.src&&l.src===i),s=[],a=this.$$("source"),o=[];for(let l=0;lthis.updateSourceCaches_(s);const n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=()=>{}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],s=>{if(s.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?ki(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),n=>n.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const i=e.target.player;if(i&&i!==this)return;const n=this.el();let r=H[this.fsApi_.fullscreenElement]===n;!r&&n.matches&&(r=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,i){this.ready(function(){if(e in IP)return kP(this.middleware_,this.tech_,e,i);if(e in tv)return ev(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(n){throw le(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in PP)return DP(this.middleware_,this.tech_,e);if(e in tv)return ev(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(le(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(le(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(le(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=ki){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),n=!!(Rc||Et);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&n&&this.load();return}const r=this.techGet_("play");n&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Fi(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Fi(0,0)),e}bufferedPercent(){return sx(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let n=e.end(e.length-1);return n>i&&(n=i),n}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((n,r)=>{function s(){i.off("fullscreenerror",o),i.off("fullscreenchange",a)}function a(){s(),n()}function o(c,p){s(),r(p)}i.one("fullscreenchange",a),i.one("fullscreenerror",o);const l=i.requestFullscreenHelper_(e);l&&(l.then(s,s),l.then(n,r))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const n=this.el_[this.fsApi_.requestFullscreen](i);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,n)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",s)}function s(){r(),i()}function a(l,c){r(),n(c)}e.one("fullscreenchange",s),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(i,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=H[this.fsApi_.exitFullscreen]();return e&&ki(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=H.documentElement.style.overflow,Gt(H,"keydown",this.boundFullWindowOnEscKey_),H.documentElement.style.overflow="hidden",gr(H.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){se.isEventKey(e,"Esc")&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,dt(H,"keydown",this.boundFullWindowOnEscKey_),H.documentElement.style.overflow=this.docOrigOverflow,Mc(H.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&k.documentPictureInPicture){const e=H.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(oe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),k.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(WT(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),i.addEventListener("pagehide",n=>{const r=n.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in H&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(k.documentPictureInPicture&&k.documentPictureInPicture.window)return k.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in H)return H.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(r=>{const s=r.tagName.toLowerCase();if(r.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return s==="input"?a.indexOf(r.type)===-1:["textarea"].indexOf(s)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:n=a=>se.isEventKey(a,"f"),muteKey:r=a=>se.isEventKey(a,"m"),playPauseKey:s=a=>se.isEventKey(a,"k")||se.isEventKey(a,"Space")}=i;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=B.getComponent("FullscreenToggle");H[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),B.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),B.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let n=0,r=this.options_.techOrder;n[o,ae.getTech(o)]).filter(([o,l])=>l?l.isSupported():(le.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,l,c){let p;return o.some(m=>l.some(_=>{if(p=c(m,_),p)return!0})),p};let r;const s=o=>(l,c)=>o(c,l),a=([o,l],c)=>{if(l.canPlaySource(c,this.options_[o.toLowerCase()]))return{source:c,tech:o}};return this.options_.sourceOrder?r=n(e,i,s(a)):r=n(i,e,a),r||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=cx(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),wP(this,n[0],(r,s)=>{if(this.middleware_=s,i||(this.cache_.sources=n),this.updateSourceCaches_(r),this.src_(r)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}AP(s,this.tech_)}),n.length>1){const r=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},s=()=>{this.off("error",r)};this.one("error",r),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",s)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?tx(i.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();ki(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),sn(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:n,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:s}=n||{};e&&e.updateContent(),i&&i.updateContent(),r&&r.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Hn("beforeerror").forEach(i=>{const n=i(this,e);if(!(Ui(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new xt(e),this.addClass("vjs-error"),le.error(`(CODE:${this.error_.code} ${xt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Hn("error").forEach(i=>i(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,n;const r=Ce(this,this.reportUserActivity),s=function(m){(m.screenX!==i||m.screenY!==n)&&(i=m.screenX,n=m.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(m){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",s),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");l&&!Et&&!ji&&(l.on("mouseenter",function(m){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(m){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let c;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(c);const m=this.options_.inactivityTimeout;m<=0||(c=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},m))};this.setInterval(p,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();e.forEach(r=>{r!==i&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,i,n){if(this.tech_)return this.tech_.addTextTrack(e,i,n)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),sn(this)&&this.trigger("languagechange"))}languages(){return Ee(we.prototype.options_.languages,this.languages_)}toJSON(){const e=Ee(this.options_),i=e.tracks;e.tracks=[];for(let n=0;n{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let n=0;nthis.addRemoteTextTrack(m,!1)),this.titleBar&&this.titleBar.update({title:p,description:a||r||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),n=Array.prototype.map.call(this.remoteTextTracks(),s=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),r={src:i,textTracks:n};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:qu(r.poster)}]),r}return Ee(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},n=wn(e),r=n["data-setup"];if(qa(e,"vjs-fill")&&(n.fill=!0),qa(e,"vjs-fluid")&&(n.fluid=!0),r!==null){const[s,a]=YD(r||"{}");s&&le.error(s),Object.assign(n,a)}if(Object.assign(i,n),e.hasChildNodes()){const s=e.childNodes;for(let a=0,o=s.length;atypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}vt.names.forEach(function(t){const e=vt[t];we.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});we.prototype.crossorigin=we.prototype.crossOrigin;we.players={};const Sa=k.navigator;we.prototype.options_={techOrder:ae.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Sa&&(Sa.languages&&Sa.languages[0]||Sa.userLanguage||Sa.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1};["ended","seeking","seekable","networkState","readyState"].forEach(function(t){we.prototype[t]=function(){return this.techGet_(t)}});Rx.forEach(function(t){we.prototype[`handleTech${je(t)}_`]=function(){return this.trigger(t)}});B.registerComponent("Player",we);const Wu="plugin",ps="activePlugins_",is={},Gu=t=>is.hasOwnProperty(t),eu=t=>Gu(t)?is[t]:void 0,Mx=(t,e)=>{t[ps]=t[ps]||{},t[ps][e]=!0},Xu=(t,e,i)=>{const n=(i?"before":"")+"pluginsetup";t.trigger(n,e),t.trigger(n+":"+e.name,e)},pI=function(t,e){const i=function(){Xu(this,{name:t,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return Mx(this,t),Xu(this,{name:t,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){i[n]=e[n]}),i},gv=(t,e)=>(e.prototype.name=t,function(...i){Xu(this,{name:t,plugin:e,instance:null},!0);const n=new e(this,...i);return this[t]=()=>n,Xu(this,n.getEventHash()),n});class Rt{constructor(e){if(this.constructor===Rt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Tm(this),delete this.trigger,ex(this,this.constructor.defaultState),Mx(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,i={}){return zs(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[ps][e]=!1,this.player=this.state=null,i[e]=gv(e,is[e])}static isBasic(e){const i=typeof e=="string"?eu(e):e;return typeof i=="function"&&!Rt.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Gu(e))le.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(we.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return is[e]=i,e!==Wu&&(Rt.isBasic(i)?we.prototype[e]=pI(e,i):we.prototype[e]=gv(e,i)),i}static deregisterPlugin(e){if(e===Wu)throw new Error("Cannot de-register base plugin.");Gu(e)&&(delete is[e],delete we.prototype[e])}static getPlugins(e=Object.keys(is)){let i;return e.forEach(n=>{const r=eu(n);r&&(i=i||{},i[n]=r)}),i}static getPluginVersion(e){const i=eu(e);return i&&i.VERSION||""}}Rt.getPlugin=eu;Rt.BASE_PLUGIN_NAME=Wu;Rt.registerPlugin(Wu,Rt);we.prototype.usingPlugin=function(t){return!!this[ps]&&this[ps][t]===!0};we.prototype.hasPlugin=function(t){return!!Gu(t)};function mI(t,e){let i=!1;return function(...n){return i||le.warn(t),i=!0,e.apply(this,n)}}function Ti(t,e,i,n){return mI(`${e} is deprecated and will be removed in ${t}.0; please use ${i} instead.`,n)}const Bx=t=>t.indexOf("#")===0?t.slice(1):t;function M(t,e,i){let n=M.getPlayer(t);if(n)return e&&le.warn(`Player "${t}" is already initialised. Options will not be applied.`),i&&n.ready(i),n;const r=typeof t=="string"?zn("#"+Bx(t)):t;if(!Hs(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof k.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&le.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Hn("beforesetup").forEach(l=>{const c=l(r,Ee(e));if(!Ui(c)||Array.isArray(c)){le.error("please return an object in beforesetup hooks");return}e=Ee(e,c)});const o=B.getComponent("Player");return n=new o(r,e,i),Hn("setup").forEach(l=>l(n)),n}M.hooks_=Yi;M.hooks=Hn;M.hook=K4;M.hookOnce=Q4;M.removeHook=wT;if(k.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Vs()){let t=zn(".vjs-styles-defaults");if(!t){t=KT("vjs-styles-defaults");const e=zn("head");e&&e.insertBefore(t,e.firstChild),QT(t,` + .video-js { + width: 300px; + height: 150px; + } + + .vjs-fluid:not(.vjs-audio-only-mode) { + padding-top: 56.25% + } + `)}}Cf(1,M);M.VERSION=CT;M.options=we.prototype.options_;M.getPlayers=()=>we.players;M.getPlayer=t=>{const e=we.players;let i;if(typeof t=="string"){const n=Bx(t),r=e[n];if(r)return r;i=zn("#"+n)}else i=t;if(Hs(i)){const{player:n,playerId:r}=i;if(n||e[r])return n||e[r]}};M.getAllPlayers=()=>Object.keys(we.players).map(t=>we.players[t]).filter(Boolean);M.players=we.players;M.getComponent=B.getComponent;M.registerComponent=(t,e)=>(ae.isTech(e)&&le.warn(`The ${t} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),B.registerComponent.call(B,t,e));M.getTech=ae.getTech;M.registerTech=ae.registerTech;M.use=CP;Object.defineProperty(M,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(M.middleware,"TERMINATOR",{value:zu,writeable:!1,enumerable:!0});M.browser=eP;M.obj=Z4;M.mergeOptions=Ti(9,"videojs.mergeOptions","videojs.obj.merge",Ee);M.defineLazyProperty=Ti(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Ic);M.bind=Ti(9,"videojs.bind","native Function.prototype.bind",Ce);M.registerPlugin=Rt.registerPlugin;M.deregisterPlugin=Rt.deregisterPlugin;M.plugin=(t,e)=>(le.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Rt.registerPlugin(t,e));M.getPlugins=Rt.getPlugins;M.getPlugin=Rt.getPlugin;M.getPluginVersion=Rt.getPluginVersion;M.addLanguage=function(t,e){return t=(""+t).toLowerCase(),M.options.languages=Ee(M.options.languages,{[t]:e}),M.options.languages[t]};M.log=le;M.createLogger=AT;M.time=pP;M.createTimeRange=Ti(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Fi);M.createTimeRanges=Ti(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Fi);M.formatTime=Ti(9,"videojs.formatTime","videojs.time.formatTime",br);M.setFormatTime=Ti(9,"videojs.setFormatTime","videojs.time.setFormatTime",nx);M.resetFormatTime=Ti(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",rx);M.parseUrl=Ti(9,"videojs.parseUrl","videojs.url.parseUrl",Em);M.isCrossOrigin=Ti(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Hc);M.EventTarget=li;M.any=_m;M.on=Gt;M.one=$c;M.off=dt;M.trigger=zs;M.xhr=D2;M.TextTrack=Ro;M.AudioTrack=lx;M.VideoTrack=ux;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(t=>{M[t]=function(){return le.warn(`videojs.${t}() is deprecated; use videojs.dom.${t}() instead`),GT[t].apply(null,arguments)}});M.computedStyle=Ti(9,"videojs.computedStyle","videojs.dom.computedStyle",Ls);M.dom=GT;M.fn=lP;M.num=qP;M.str=hP;M.url=EP;/*! @name videojs-contrib-quality-levels @version 4.0.0 @license Apache-2.0 */class gI{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(n){i.enabled_(n)}}),i}}class Ku extends M.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let i=this.getQualityLevelById(e.id);if(i)return i;const n=this.levels_.length;return i=new gI(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let n=0,r=this.length;nn&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,n=this.length;in,t.qualityLevels.VERSION=Fx,n},Ux=function(t){return yI(this,M.obj.merge({},t))};M.registerPlugin("qualityLevels",Ux);Ux.VERSION=Fx;/*! @name @videojs/http-streaming @version 3.7.0 @license Apache-2.0 */const $t=$k,Qu=(t,e)=>e&&e.responseURL&&t!==e.responseURL?e.responseURL:t,ui=t=>M.log.debug?M.log.debug.bind(M,"VHS:",`${t} >`):function(){};function Te(...t){const e=M.obj||M;return(e.merge||e.mergeOptions).apply(e,t)}function ct(...t){const e=M.time||M;return(e.createTimeRanges||e.createTimeRanges).apply(e,t)}function vI(t){let e="";for(let i=0;i ${r})`}return e||"empty"}const qn=1/30,Pi=qn*3,jx=function(t,e){const i=[];let n;if(t&&t.length)for(n=0;n=e})},Rl=function(t,e){return jx(t,function(i){return i-qn>=e})},_I=function(t){if(t.length<2)return ct();const e=[];for(let i=1;i{const e=[];if(!t||!t.length)return"";for(let i=0;i "+t.end(i));return e.join(", ")},xI=function(t,e,i=1){return((t.length?t.end(t.length-1):0)-e)/i},dr=t=>{const e=[];for(let i=0;is)){if(e>r&&e<=s){i+=s-e;continue}i+=s-r}}return i},Vm=(t,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(n){i+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(i+=t.partTargetDuration)}),i},Lf=t=>(t.segments||[]).reduce((e,i,n)=>(i.parts?i.parts.forEach(function(r,s){e.push({duration:r.duration,segmentIndex:n,partIndex:s,part:r,segment:i})}):e.push({duration:i.duration,segmentIndex:n,partIndex:null,segment:i,part:null}),e),[]),Vx=t=>{const e=t.segments&&t.segments.length&&t.segments[t.segments.length-1];return e&&e.parts||[]},Hx=({preloadSegment:t})=>{if(!t)return;const{parts:e,preloadHints:i}=t;let n=(i||[]).reduce((r,s)=>r+(s.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},zx=(t,e)=>{if(e.endList)return 0;if(t&&t.suggestedPresentationDelay)return t.suggestedPresentationDelay;const i=Vx(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},EI=function(t,e){let i=0,n=e-t.mediaSequence,r=t.segments[n];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;n--;){if(r=t.segments[n],typeof r.end<"u")return{result:i+r.end,precise:!0};if(i+=Vm(t,r),typeof r.start<"u")return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},bI=function(t,e){let i=0,n,r=e-t.mediaSequence;for(;r"u"&&(e=t.mediaSequence+t.segments.length),e"u"){if(t.totalDuration)return t.totalDuration;if(!t.endList)return k.Infinity}return qx(t,e,i)},Xa=function({defaultDuration:t,durationList:e,startIndex:i,endIndex:n}){let r=0;if(i>n&&([i,n]=[n,i]),i<0){for(let s=i;s0)for(let c=l-1;c>=0;c--){const p=o[c];if(a+=p.duration,s){if(a<0)continue}else if(a+qn<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r-Xa({defaultDuration:t.targetDuration,durationList:o,startIndex:l,endIndex:c})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(l<0){for(let c=l;c<0;c++)if(a-=t.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};l=0}for(let c=l;c0)continue}else if(a-qn>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r+Xa({defaultDuration:t.targetDuration,durationList:o,startIndex:l,endIndex:c})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Xx=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},Hm=function(t){return t.excludeUntil&&t.excludeUntil===1/0},Wc=function(t){const e=Xx(t);return!t.disabled&&!e},AI=function(t){return t.disabled},DI=function(t){for(let e=0;e{if(t.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return t.playlists.filter(n=>Wc(n)?(n.attributes.BANDWIDTH||0)!t&&!e||!t&&e||t&&!e?!1:!!(t===e||t.id&&e.id&&t.id===e.id||t.resolvedUri&&e.resolvedUri&&t.resolvedUri===e.resolvedUri||t.uri&&e.uri&&t.uri===e.uri),vv=function(t,e){const i=t&&t.mediaGroups&&t.mediaGroups.AUDIO||{};let n=!1;for(const r in i){for(const s in i[r])if(n=e(i[r][s]),n)break;if(n)break}return!!n},Uo=t=>{if(!t||!t.playlists||!t.playlists.length)return vv(t,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;eR2(s))||vv(t,s=>zm(i,s))))return!1}return!0};var Pt={liveEdgeDelay:zx,duration:Wx,seekable:CI,getMediaInfoForTime:wI,isEnabled:Wc,isDisabled:AI,isExcluded:Xx,isIncompatible:Hm,playlistEnd:Gx,isAes:DI,hasAttribute:Kx,estimateSegmentRequestTime:kI,isLowestEnabledRendition:Nf,isAudioOnly:Uo,playlistMatch:zm,segmentDurationWithParts:Vm};const{log:Qx}=M,qm=(t,e)=>`${t}-${e}`,PI=(t,e,i)=>`placeholder-uri-${t}-${e}-${i}`,II=({onwarn:t,oninfo:e,manifestString:i,customTagParsers:n=[],customTagMappers:r=[],llhls:s})=>{const a=new Xk;t&&a.on("warn",t),e&&a.on("info",e),n.forEach(c=>a.addParser(c)),r.forEach(c=>a.addTagMapper(c)),a.push(i),a.end();const o=a.manifest;if(s||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(c){o.hasOwnProperty(c)&&delete o[c]}),o.segments&&o.segments.forEach(function(c){["parts","preloadHints"].forEach(function(p){c.hasOwnProperty(p)&&delete c[p]})})),!o.targetDuration){let c=10;o.segments&&o.segments.length&&(c=o.segments.reduce((p,m)=>Math.max(p,m.duration),0)),t&&t(`manifest has no targetDuration defaulting to ${c}`),o.targetDuration=c}const l=Vx(o);if(l.length&&!o.partTargetDuration){const c=l.reduce((p,m)=>Math.max(p,m.duration),0);t&&(t(`manifest has no partTargetDuration defaulting to ${c}`),Qx.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=c}return o},Xs=(t,e)=>{t.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(t.mediaGroups[i])for(const n in t.mediaGroups[i])for(const r in t.mediaGroups[i][n]){const s=t.mediaGroups[i][n][r];e(s,i,n,r)}})},Yx=({playlist:t,uri:e,id:i})=>{t.id=i,t.playlistErrors_=0,e&&(t.uri=e),t.attributes=t.attributes||{}},OI=t=>{let e=t.playlists.length;for(;e--;){const i=t.playlists[e];Yx({playlist:i,id:qm(e,i.uri)}),i.resolvedUri=$t(t.uri,i.uri),t.playlists[i.id]=i,t.playlists[i.uri]=i,i.attributes.BANDWIDTH||Qx.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},LI=t=>{Xs(t,e=>{e.uri&&(e.resolvedUri=$t(t.uri,e.uri))})},NI=(t,e)=>{const i=qm(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:k.location.href,resolvedUri:k.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[e]=n.playlists[0],n},Jx=(t,e,i=PI)=>{t.uri=e;for(let r=0;r{if(!r.playlists||!r.playlists.length){if(n&&s==="AUDIO"&&!r.uri)for(let l=0;l(r.set(s.id,s),r),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((n,r)=>{if(!this.processedDateRanges_.has(r)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),i.push(n),!!n.class))if(e[n.class]){const s=e[n.class].push(n);n.classListIndex=s-1}else e[n.class]=[n],n.classListIndex=0});for(const n of i){const r=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&r[n.classListIndex+1]?n.endTime=r[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((n,r)=>{n.startDate.getTime(){if(e.endList||!e.serverControl)return t;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let r=e.mediaSequence+e.segments.length;if(n){const s=n.parts||[],a=Hx(e)-1;a>-1&&a!==s.length-1&&(i._HLS_part=a),(a>-1||s.length)&&r--}i._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const n=new k.URL(t);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){i.hasOwnProperty(r)&&n.searchParams.set(r,i[r])}),t=n.toString()}return t},BI=(t,e)=>{if(!t)return e;const i=Te(t,e);if(t.preloadHints&&!e.preloadHints&&delete i.preloadHints,t.parts&&!e.parts)delete i.parts;else if(t.parts&&e.parts)for(let n=0;n{const n=t.slice(),r=e.slice();i=i||0;const s=[];let a;for(let o=0;o{!t.resolvedUri&&t.uri&&(t.resolvedUri=$t(e,t.uri)),t.key&&!t.key.resolvedUri&&(t.key.resolvedUri=$t(e,t.key.uri)),t.map&&!t.map.resolvedUri&&(t.map.resolvedUri=$t(e,t.map.uri)),t.map&&t.map.key&&!t.map.key.resolvedUri&&(t.map.key.resolvedUri=$t(e,t.map.key.uri)),t.parts&&t.parts.length&&t.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=$t(e,i.uri))}),t.preloadHints&&t.preloadHints.length&&t.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=$t(e,i.uri))})},eS=function(t){const e=t.segments||[],i=t.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let n=0;nt===e||t.segments&&e.segments&&t.segments.length===e.segments.length&&t.endList===e.endList&&t.mediaSequence===e.mediaSequence&&t.preloadSegment===e.preloadSegment,Rf=(t,e,i=tS)=>{const n=Te(t,{}),r=n.playlists[e.id];if(!r||i(r,e))return null;e.segments=eS(e);const s=Te(r,e);if(s.preloadSegment&&!e.preloadSegment&&delete s.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{Zx(a,s.resolvedUri)});for(let a=0;a{if(a.playlists)for(let p=0;p{const i=t.segments||[],n=i[i.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],s=r&&r.duration||n&&n.duration;return e&&s?s*1e3:(t.partTargetDuration||t.targetDuration||10)*500};class rs extends RI{constructor(e,i,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=ui("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=i,this.withCredentials=r,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const s=i.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new _v,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=$t(this.main.uri,e.uri);this.llhls&&(i=MI(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(n,r)=>{if(this.request){if(n)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,i,n){const{uri:r,id:s}=i;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:i}){return II({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:i,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const s=i||this.parseManifest_({url:n,manifestString:e});s.lastRequest=Date.now(),Yx({playlist:s,uri:n,id:r});const a=Rf(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Mf(this.media(),!!a)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),k.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new _v,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(k.clearTimeout(this.finalRenditionTimeout),i){const a=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=k.setTimeout(this.media.bind(this,e,!1),a);return}const n=this.state,r=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(Mf(e,!0)),!!r){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(a,o)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Qu(e.resolvedUri,o),a)return this.playlistRequestError(this.request,e,n);this.haveMetadata({playlistString:o.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}pause(){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=k.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,i)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.src=Qu(this.src,i);const n=this.parseManifest_({manifestString:i.responseText,url:this.src});this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Jx(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=eS(n),n.segments.forEach(r=>{Zx(r,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||k.location.href;this.main=NI(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:UI}=M,Bf=function(t,e,i,n){const r=t.responseType==="arraybuffer"?t.response:t.responseText;!e&&r&&(t.responseTime=Date.now(),t.roundTripTime=t.responseTime-t.requestTime,t.bytesReceived=r.byteLength||r.length,t.bandwidth||(t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3))),i.headers&&(t.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(t.timedout=!0),!e&&!t.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(t&&(r||t.responseText)))),n(e,t)},jI=(t,e)=>{if(!t||!t.size)return;let i=e;return t.forEach(n=>{i=n(i)}),i},$I=(t,e,i,n)=>{!t||!t.size||t.forEach(r=>{r(e,i,n)})},iS=function(){const t=function e(i,n){i=Te({timeout:45e3},i);const r=e.beforeRequest||M.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||M.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||M.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(M.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(r));const o=M.Vhs.xhr.original===!0?UI:M.Vhs.xhr,l=jI(s,i);s.delete(r);const c=o(l||i,function(m,_){return $I(a,c,m,_),Bf(c,m,_,n)}),p=c.abort;return c.abort=function(){return c.aborted=!0,p.apply(c,arguments)},c.uri=i.uri,c.requestTime=Date.now(),c};return t.original=!0,t},VI=function(t){let e;const i=t.offset;return typeof t.offset=="bigint"||typeof t.length=="bigint"?e=k.BigInt(t.offset)+k.BigInt(t.length)-k.BigInt(1):e=t.offset+t.length-1,"bytes="+i+"-"+e},Ff=function(t){const e={};return t.byterange&&(e.Range=VI(t.byterange)),e},HI=function(t,e){return t.start(e)+"-"+t.end(e)},zI=function(t,e){const i=t.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},qI=function(t){return t>=32&&t<126?String.fromCharCode(t):"."},nS=function(t){const e={};return Object.keys(t).forEach(i=>{const n=t[i];B2(n)?e[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[i]=n}),e},Yu=function(t){const e=t.byterange||{length:1/0,offset:0};return[e.length,e.offset,t.resolvedUri].join(",")},rS=function(t){return t.resolvedUri},sS=t=>{const e=Array.prototype.slice.call(t),i=16;let n="",r,s;for(let a=0;asS(t),GI=t=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+i,s=t-r;return new Date(e.dateTimeObject.getTime()+s*1e3)},QI=t=>t.transmuxedPresentationEnd-t.transmuxedPresentationStart-t.transmuxerPrependedSeconds,YI=(t,e)=>{let i;try{i=new Date(t)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(io?null:(i>new Date(s)&&(n=r),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Pt.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},JI=(t,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,n;for(let s=0;si){if(t>i+r.duration*aS)return null;n=r}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},ZI=(t,e)=>{let i,n;try{i=new Date(t),n=new Date(e)}catch{}const r=i.getTime();return(n.getTime()-r)/1e3},eO=t=>{if(!t.segments||t.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!t||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const n=JI(e,t);if(!n)return i({message:"valid programTime was not found"});if(n.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:e},s=KI(e,n.segment);return s&&(r.programDateTime=s.toISOString()),i(null,r)},oS=({programTime:t,playlist:e,retryCount:i=2,seekTo:n,pauseAfterSeek:r=!0,tech:s,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof t>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!s.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!eO(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=YI(t,e);if(!o)return a({message:`${t} was not found in the stream`});const l=o.segment,c=ZI(l.dateTimeObject,t);if(o.type==="estimate"){if(i===0)return a({message:`${t} is not buffered yet. Try again`});n(o.estimatedStart+c),s.one("seeked",()=>{oS({programTime:t,playlist:e,retryCount:i-1,seekTo:n,pauseAfterSeek:r,tech:s,callback:a})});return}const p=l.start+c,m=()=>a(null,s.currentTime());s.one("seeked",m),r&&s.pause(),n(p)},fh=(t,e)=>{if(t.readyState===4)return e()},iO=(t,e,i)=>{let n=[],r,s=!1;const a=function(p,m,_,E){return m.abort(),s=!0,i(p,m,_,E)},o=function(p,m){if(s)return;if(p)return a(p,m,"",n);const _=m.responseText.substring(n&&n.byteLength||0,m.responseText.length);if(n=a3(n,F2(_,!0)),r=r||Oa(n),n.length<10||r&&n.lengtha(p,m,"",n));const E=cm(n);return E==="ts"&&n.length<188?fh(m,()=>a(p,m,"",n)):!E&&n.length<376?fh(m,()=>a(p,m,"",n)):a(null,m,E,n)},c=e({uri:t,beforeSend(p){p.overrideMimeType("text/plain; charset=x-user-defined"),p.addEventListener("progress",function({total:m,loaded:_}){return Bf(p,null,{statusCode:p.status},o)})}},function(p,m){return Bf(c,p,m,o)});return c},{EventTarget:nO}=M,Tv=function(t,e){if(!tS(t,e)||t.sidx&&e.sidx&&(t.sidx.offset!==e.sidx.offset||t.sidx.length!==e.sidx.length))return!1;if(!t.sidx&&e.sidx||t.sidx&&!e.sidx||t.segments&&!e.segments||!t.segments&&e.segments)return!1;if(!t.segments&&!e.segments)return!0;for(let i=0;i{const r=n.attributes.NAME||i;return`placeholder-uri-${t}-${e}-${r}`},sO=({mainXml:t,srcUrl:e,clientOffset:i,sidxMapping:n,previousManifest:r})=>{const s=A4(t,{manifestUri:e,clientOffset:i,sidxMapping:n,previousManifest:r});return Jx(s,e,rO),s},aO=(t,e)=>{Xs(t,(i,n,r,s)=>{s in e.mediaGroups[n][r]||delete t.mediaGroups[n][r][s]})},oO=(t,e,i)=>{let n=!0,r=Te(t,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let s=0;s{if(s.playlists&&s.playlists.length){const c=s.playlists[0].id,p=Rf(r,s.playlists[0],Tv);p&&(r=p,l in r.mediaGroups[a][o]||(r.mediaGroups[a][o][l]=s),r.mediaGroups[a][o][l].playlists[0]=r.playlists[c],n=!1)}}),aO(r,e),e.minimumUpdatePeriod!==t.minimumUpdatePeriod&&(n=!1),n?null:r},lO=(t,e)=>(!t.map&&!e.map||!!(t.map&&e.map&&t.map.byterange.offset===e.map.byterange.offset&&t.map.byterange.length===e.map.byterange.length))&&t.uri===e.uri&&t.byterange.offset===e.byterange.offset&&t.byterange.length===e.byterange.length,xv=(t,e)=>{const i={};for(const n in t){const s=t[n].sidx;if(s){const a=Dc(s);if(!e[a])break;const o=e[a].sidxInfo;lO(o,s)&&(i[a]=e[a])}}return i},uO=(t,e)=>{let n=xv(t.playlists,e);return Xs(t,(r,s,a,o)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;n=Te(n,xv(l,e))}}),n};class Uf extends nO{constructor(e,i,n={},r){super(),this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:s=!1}=n;if(this.vhs_=i,this.withCredentials=s,this.addMetadataToTextTrack=n.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.media().attributes.serviceLocation||this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=ui("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,i,n){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,i,n){const r=e.sidx&&Dc(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){this.mediaRequest_=k.setTimeout(()=>n(!1),0);return}const s=Qu(e.sidx.resolvedUri),a=(o,l)=>{if(this.requestErrored_(o,l,i))return;const c=this.mainPlaylistLoader_.sidxMapping_;let p;try{p=L4(Z(l.response).subarray(8))}catch(m){this.requestErrored_(m,l,i);return}return c[r]={sidxInfo:e.sidx,sidx:p},om(e,p,e.sidx.resolvedUri),n(!0)};this.request=iO(s,this.vhs_.xhr,(o,l,c,p)=>{if(o)return a(o,l);if(!c||c!=="mp4")return a({status:l.status,message:`Unsupported ${c||"unknown"} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},l);const{offset:m,length:_}=e.sidx.byterange;if(p.length>=_+m)return a(o,{response:p.subarray(m,m+_),status:l.status,uri:l.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:Ff({byterange:e.sidx.byterange})},a)})}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},k.clearTimeout(this.minimumUpdatePeriodTimeout_),k.clearTimeout(this.mediaRequest_),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,r=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(k.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>this.load(),n);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){this.mediaRequest_=k.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(i,n)=>{if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Qu(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const i=D4(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:$t(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(n,r)=>{if(!this.request)return;if(n)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let s;i.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?s=this.mainLoaded_:s=Date.parse(r.responseHeaders.date):s=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let i=sO({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(i=oO(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(k.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=k.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=uO(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const i=this.mainPlaylistLoader_.main.playlists,n=!this.media_||this.media_!==i[e];if(n?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=k.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},Mf(this.media(),!!n)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}}var Ze={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const cO=t=>{const e=new Uint8Array(new ArrayBuffer(t.length));for(let i=0;i-1):!1},this.trigger=function(d){var f,h,g,y;if(f=u[d],!!f)if(arguments.length===2)for(g=f.length,h=0;h"u")){for(u in Y)Y.hasOwnProperty(u)&&(Y[u]=[u.charCodeAt(0),u.charCodeAt(1),u.charCodeAt(2),u.charCodeAt(3)]);de=new Uint8Array([105,115,111,109]),ce=new Uint8Array([97,118,99,49]),pt=new Uint8Array([0,0,0,1]),Ae=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),q=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),te={video:Ae,audio:q},Se=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),me=new Uint8Array([0,0,0,0,0,0,0,0]),qi=new Uint8Array([0,0,0,0,0,0,0,0]),xi=qi,kr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Si=qi,ie=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(u){var d=[],f=0,h,g,y;for(h=1;h>>1,u.samplingfrequencyindex<<7|u.channelcount<<3,6,1,2]))},p=function(){return o(Y.ftyp,de,pt,de,ce)},N=function(u){return o(Y.hdlr,te[u])},m=function(u){return o(Y.mdat,u)},O=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,u.duration>>>24&255,u.duration>>>16&255,u.duration>>>8&255,u.duration&255,85,196,0,0]);return u.samplerate&&(d[12]=u.samplerate>>>24&255,d[13]=u.samplerate>>>16&255,d[14]=u.samplerate>>>8&255,d[15]=u.samplerate&255),o(Y.mdhd,d)},P=function(u){return o(Y.mdia,O(u),N(u.type),E(u))},_=function(u){return o(Y.mfhd,new Uint8Array([0,0,0,0,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255]))},E=function(u){return o(Y.minf,u.type==="video"?o(Y.vmhd,ie):o(Y.smhd,me),l(),V(u))},v=function(u,d){for(var f=[],h=d.length;h--;)f[h]=J(d[h]);return o.apply(null,[Y.moof,_(u)].concat(f))},S=function(u){for(var d=u.length,f=[];d--;)f[d]=T(u[d]);return o.apply(null,[Y.moov,x(4294967295)].concat(f).concat(D(u)))},D=function(u){for(var d=u.length,f=[];d--;)f[d]=re(u[d]);return o.apply(null,[Y.mvex].concat(f))},x=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(Y.mvhd,d)},F=function(u){var d=u.samples||[],f=new Uint8Array(4+d.length),h,g;for(g=0;g>>8),y.push(h[w].byteLength&255),y=y.concat(Array.prototype.slice.call(h[w]));for(w=0;w>>8),b.push(g[w].byteLength&255),b=b.concat(Array.prototype.slice.call(g[w]));if(A=[Y.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(Y.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([h.length],y,[g.length],b))),o(Y.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var I=f.sarRatio[0],L=f.sarRatio[1];A.push(o(Y.pasp,new Uint8Array([(I&4278190080)>>24,(I&16711680)>>16,(I&65280)>>8,I&255,(L&4278190080)>>24,(L&16711680)>>16,(L&65280)>>8,L&255])))}return o.apply(null,A)},d=function(f){return o(Y.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),c(f))}}(),C=function(u){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,0,(u.duration&4278190080)>>24,(u.duration&16711680)>>16,(u.duration&65280)>>8,u.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(u.width&65280)>>8,u.width&255,0,0,(u.height&65280)>>8,u.height&255,0,0]);return o(Y.tkhd,d)},J=function(u){var d,f,h,g,y,b,w;return d=o(Y.tfhd,new Uint8Array([0,0,0,58,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),b=Math.floor(u.baseMediaDecodeTime/a),w=Math.floor(u.baseMediaDecodeTime%a),f=o(Y.tfdt,new Uint8Array([1,0,0,0,b>>>24&255,b>>>16&255,b>>>8&255,b&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255])),y=92,u.type==="audio"?(h=pe(u,y),o(Y.traf,d,f,h)):(g=F(u),h=pe(u,g.length+y),o(Y.traf,d,f,h,g))},T=function(u){return u.duration=u.duration||4294967295,o(Y.trak,C(u),P(u))},re=function(u){var d=new Uint8Array([0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return u.type!=="video"&&(d[d.length-1]=0),o(Y.trex,d)},function(){var u,d,f;f=function(h,g){var y=0,b=0,w=0,A=0;return h.length&&(h[0].duration!==void 0&&(y=1),h[0].size!==void 0&&(b=2),h[0].flags!==void 0&&(w=4),h[0].compositionTimeOffset!==void 0&&(A=8)),[0,0,y|b|w|A,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(g&4278190080)>>>24,(g&16711680)>>>16,(g&65280)>>>8,g&255]},d=function(h,g){var y,b,w,A,I,L;for(A=h.samples||[],g+=20+16*A.length,w=f(A,g),b=new Uint8Array(w.length+A.length*16),b.set(w),y=w.length,L=0;L>>24,b[y++]=(I.duration&16711680)>>>16,b[y++]=(I.duration&65280)>>>8,b[y++]=I.duration&255,b[y++]=(I.size&4278190080)>>>24,b[y++]=(I.size&16711680)>>>16,b[y++]=(I.size&65280)>>>8,b[y++]=I.size&255,b[y++]=I.flags.isLeading<<2|I.flags.dependsOn,b[y++]=I.flags.isDependedOn<<6|I.flags.hasRedundancy<<4|I.flags.paddingValue<<1|I.flags.isNonSyncSample,b[y++]=I.flags.degradationPriority&61440,b[y++]=I.flags.degradationPriority&15,b[y++]=(I.compositionTimeOffset&4278190080)>>>24,b[y++]=(I.compositionTimeOffset&16711680)>>>16,b[y++]=(I.compositionTimeOffset&65280)>>>8,b[y++]=I.compositionTimeOffset&255;return o(Y.trun,b)},u=function(h,g){var y,b,w,A,I,L;for(A=h.samples||[],g+=20+8*A.length,w=f(A,g),y=new Uint8Array(w.length+A.length*8),y.set(w),b=w.length,L=0;L>>24,y[b++]=(I.duration&16711680)>>>16,y[b++]=(I.duration&65280)>>>8,y[b++]=I.duration&255,y[b++]=(I.size&4278190080)>>>24,y[b++]=(I.size&16711680)>>>16,y[b++]=(I.size&65280)>>>8,y[b++]=I.size&255;return o(Y.trun,y)},pe=function(h,g){return h.type==="audio"?u(h,g):d(h,g)}}();var Pr={ftyp:p,mdat:m,moof:v,moov:S,initSegment:function(u){var d=p(),f=S(u),h;return h=new Uint8Array(d.byteLength+f.byteLength),h.set(d),h.set(f,d.byteLength),h}},rE=function(u){var d,f,h=[],g=[];for(g.byteLength=0,g.nalCount=0,g.duration=0,h.byteLength=0,d=0;d1&&(d=u.shift(),u.byteLength-=d.byteLength,u.nalCount-=d.nalCount,u[0][0].dts=d.dts,u[0][0].pts=d.pts,u[0][0].duration+=d.duration),u},oE=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},eg=function(u,d){var f=oE();return f.dataOffset=d,f.compositionTimeOffset=u.pts-u.dts,f.duration=u.duration,f.size=4*u.length,f.size+=u.byteLength,u.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},lE=function(u,d){var f,h,g,y,b,w=d||0,A=[];for(f=0;fHo.ONE_SECOND_IN_TS/2))){for(I=mE()[u.samplerate],I||(I=d[0].data),L=0;L=f?u:(d.minSegmentDts=1/0,u.filter(function(h){return h.dts>=f?(d.minSegmentDts=Math.min(d.minSegmentDts,h.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},_E=function(u){var d,f,h=[];for(d=0;d=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(u),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Wi.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Wi.prototype.addText=function(u){this.rows[this.rowIdx]+=u},Wi.prototype.backspace=function(){if(!this.isEmpty()){var u=this.rows[this.rowIdx];this.rows[this.rowIdx]=u.substr(0,u.length-1)}};var Wo=function(u,d,f){this.serviceNum=u,this.text="",this.currentWindow=new Wi(-1),this.windows=[],this.stream=f,typeof d=="string"&&this.createTextDecoder(d)};Wo.prototype.init=function(u,d){this.startPts=u;for(var f=0;f<8;f++)this.windows[f]=new Wi(f),typeof d=="function"&&(this.windows[f].beforeRowOverflow=d)},Wo.prototype.setCurrentWindow=function(u){this.currentWindow=this.windows[u]},Wo.prototype.createTextDecoder=function(u){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(u)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+u+" encoding. "+d})}};var xe=function(u){u=u||{},xe.prototype.init.call(this);var d=this,f=u.captionServices||{},h={},g;Object.keys(f).forEach(y=>{g=f[y],/^SERVICE/.test(y)&&(h[y]=g.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(y){y.type===3?(d.new708Packet(),d.add708Bytes(y)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(y))}};xe.prototype=new rd,xe.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},xe.prototype.add708Bytes=function(u){var d=u.ccData,f=d>>>8,h=d&255;this.current708Packet.ptsVals.push(u.pts),this.current708Packet.data.push(f),this.current708Packet.data.push(h)},xe.prototype.push708Packet=function(){var u=this.current708Packet,d=u.data,f=null,h=null,g=0,y=d[g++];for(u.seq=y>>6,u.sizeCode=y&63;g>5,h=y&31,f===7&&h>0&&(y=d[g++],f=y),this.pushServiceBlock(f,g,h),h>0&&(g+=h-1)},xe.prototype.pushServiceBlock=function(u,d,f){var h,g=d,y=this.current708Packet.data,b=this.services[u];for(b||(b=this.initService(u,g));g("0"+(ee&255).toString(16)).slice(-2)).join("")}if(g?(R=[w,A],u++):R=[w],d.textDecoder_&&!h)L=d.textDecoder_.decode(new Uint8Array(R));else if(g){const j=z(R);L=String.fromCharCode(parseInt(j,16))}else L=LE(b|w);return I.pendingNewLine&&!I.isEmpty()&&I.newLine(this.getPts(u)),I.pendingNewLine=!1,I.addText(L),u},xe.prototype.multiByteCharacter=function(u,d){var f=this.current708Packet.data,h=f[u+1],g=f[u+2];return qo(h)&&qo(g)&&(u=this.handleText(++u,d,{isMultiByte:!0})),u},xe.prototype.setCurrentWindow=function(u,d){var f=this.current708Packet.data,h=f[u],g=h&7;return d.setCurrentWindow(g),u},xe.prototype.defineWindow=function(u,d){var f=this.current708Packet.data,h=f[u],g=h&7;d.setCurrentWindow(g);var y=d.currentWindow;return h=f[++u],y.visible=(h&32)>>5,y.rowLock=(h&16)>>4,y.columnLock=(h&8)>>3,y.priority=h&7,h=f[++u],y.relativePositioning=(h&128)>>7,y.anchorVertical=h&127,h=f[++u],y.anchorHorizontal=h,h=f[++u],y.anchorPoint=(h&240)>>4,y.rowCount=h&15,h=f[++u],y.columnCount=h&63,h=f[++u],y.windowStyle=(h&56)>>3,y.penStyle=h&7,y.virtualRowCount=y.rowCount+1,u},xe.prototype.setWindowAttributes=function(u,d){var f=this.current708Packet.data,h=f[u],g=d.currentWindow.winAttr;return h=f[++u],g.fillOpacity=(h&192)>>6,g.fillRed=(h&48)>>4,g.fillGreen=(h&12)>>2,g.fillBlue=h&3,h=f[++u],g.borderType=(h&192)>>6,g.borderRed=(h&48)>>4,g.borderGreen=(h&12)>>2,g.borderBlue=h&3,h=f[++u],g.borderType+=(h&128)>>5,g.wordWrap=(h&64)>>6,g.printDirection=(h&48)>>4,g.scrollDirection=(h&12)>>2,g.justify=h&3,h=f[++u],g.effectSpeed=(h&240)>>4,g.effectDirection=(h&12)>>2,g.displayEffect=h&3,u},xe.prototype.flushDisplayed=function(u,d){for(var f=[],h=0;h<8;h++)d.windows[h].visible&&!d.windows[h].isEmpty()&&f.push(d.windows[h].getText());d.endPts=u,d.text=f.join(` + +`),this.pushCaption(d),d.startPts=u},xe.prototype.pushCaption=function(u){u.text!==""&&(this.trigger("data",{startPts:u.startPts,endPts:u.endPts,text:u.text,stream:"cc708_"+u.serviceNum}),u.text="",u.startPts=u.endPts)},xe.prototype.displayWindows=function(u,d){var f=this.current708Packet.data,h=f[++u],g=this.getPts(u);this.flushDisplayed(g,d);for(var y=0;y<8;y++)h&1<>4,g.offset=(h&12)>>2,g.penSize=h&3,h=f[++u],g.italics=(h&128)>>7,g.underline=(h&64)>>6,g.edgeType=(h&56)>>3,g.fontStyle=h&7,u},xe.prototype.setPenColor=function(u,d){var f=this.current708Packet.data,h=f[u],g=d.currentWindow.penColor;return h=f[++u],g.fgOpacity=(h&192)>>6,g.fgRed=(h&48)>>4,g.fgGreen=(h&12)>>2,g.fgBlue=h&3,h=f[++u],g.bgOpacity=(h&192)>>6,g.bgRed=(h&48)>>4,g.bgGreen=(h&12)>>2,g.bgBlue=h&3,h=f[++u],g.edgeRed=(h&48)>>4,g.edgeGreen=(h&12)>>2,g.edgeBlue=h&3,u},xe.prototype.setPenLocation=function(u,d){var f=this.current708Packet.data,h=f[u],g=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,h=f[++u],g.row=h&15,h=f[++u],g.column=h&63,u},xe.prototype.reset=function(u,d){var f=this.getPts(u);return this.flushDisplayed(f,d),this.initService(d.serviceNum,u)};var NE={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Go=function(u){return u===null?"":(u=NE[u]||u,String.fromCharCode(u))},Xo=14,RE=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Yn=function(){for(var u=[],d=Xo+1;d--;)u.push({text:"",indent:0,offset:0});return u},Ie=function(u,d){Ie.prototype.init.call(this),this.field_=u||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var h,g,y,b,w;if(h=f.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),y=h>>>8,b=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(f.pts),this.flushDisplayed(f.pts),g=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=g,this.startPts_=f.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(f.pts),this.displayed_=Yn();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Yn();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=Yn()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(y,b))y=(y&3)<<8,w=Go(y|b),this[this.mode_](f.pts,w),this.column_++;else if(this.isExtCharacter(y,b))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),y=(y&3)<<8,w=Go(y|b),this[this.mode_](f.pts,w),this.column_++;else if(this.isMidRowCode(y,b))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(b&14)===14&&this.addFormatting(f.pts,["i"]),(b&1)===1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(y,b)){const I=b&3;this.nonDisplayed_[this.row_].offset=I,this.column_+=I}else if(this.isPAC(y,b)){var A=RE.indexOf(h&7968);if(this.mode_==="rollUp"&&(A-this.rollUpRows_+1<0&&(A=this.rollUpRows_-1),this.setRollUp(f.pts,A)),A!==this.row_&&(this.clearFormatting(f.pts),this.row_=A),b&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(h&16)===16){const I=(h&14)>>1;this.column_=I*4,this.nonDisplayed_[this.row_].indent+=I}this.isColorPAC(b)&&(b&14)===14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(y)&&(b===0&&(b=null),w=Go(y),w+=Go(b),this[this.mode_](f.pts,w),this.column_+=w.length)}};Ie.prototype=new rd,Ie.prototype.flushDisplayed=function(u){const d=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},f=[];this.displayed_.forEach((h,g)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{d(g)}h.text.length&&f.push({text:h.text,line:g+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&d(g)}),f.length&&this.trigger("data",{startPts:this.startPts_,endPts:u,content:f,stream:this.name_})},Ie.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Yn(),this.nonDisplayed_=Yn(),this.lastControlCode_=null,this.column_=0,this.row_=Xo,this.rollUpRows_=2,this.formatting_=[]},Ie.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Ie.prototype.isSpecialCharacter=function(u,d){return u===this.EXT_&&d>=48&&d<=63},Ie.prototype.isExtCharacter=function(u,d){return(u===this.EXT_+1||u===this.EXT_+2)&&d>=32&&d<=63},Ie.prototype.isMidRowCode=function(u,d){return u===this.EXT_&&d>=32&&d<=47},Ie.prototype.isOffsetControlCode=function(u,d){return u===this.OFFSET_&&d>=33&&d<=35},Ie.prototype.isPAC=function(u,d){return u>=this.BASE_&&u=64&&d<=127},Ie.prototype.isColorPAC=function(u){return u>=64&&u<=79||u>=96&&u<=127},Ie.prototype.isNormalChar=function(u){return u>=32&&u<=127},Ie.prototype.setRollUp=function(u,d){if(this.mode_!=="rollUp"&&(this.row_=Xo,this.mode_="rollUp",this.flushDisplayed(u),this.nonDisplayed_=Yn(),this.displayed_=Yn()),d!==void 0&&d!==this.row_)for(var f=0;f"},"");this[this.mode_](u,f)},Ie.prototype.clearFormatting=function(u){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(f,h){return f+""},"");this.formatting_=[],this[this.mode_](u,d)}},Ie.prototype.popOn=function(u,d){var f=this.nonDisplayed_[this.row_].text;f+=d,this.nonDisplayed_[this.row_].text=f},Ie.prototype.rollUp=function(u,d){var f=this.displayed_[this.row_].text;f+=d,this.displayed_[this.row_].text=f},Ie.prototype.shiftRowsUp_=function(){var u;for(u=0;ud&&(f=-1);Math.abs(d-u)>FE;)u+=f*BE;return u},ad=function(u){var d,f;ad.prototype.init.call(this),this.type_=u||og,this.push=function(h){this.type_!==og&&h.type!==this.type_||(f===void 0&&(f=h.dts),h.dts=sd(h.dts,f),h.pts=sd(h.pts,f),d=h.dts,this.trigger("data",h))},this.flush=function(){f=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ad.prototype=new ME;var lg={TimestampRolloverStream:ad,handleRollover:sd},UE=(u,d,f)=>{if(!u)return-1;for(var h=f;h";u.data[0]===Yo.Utf8&&(f=Qo(u.data,0,d),!(f<0)&&(u.mimeType=Ys(u.data,d,f),d=f+1,u.pictureType=u.data[d],d++,h=Qo(u.data,0,d),!(h<0)&&(u.description=Qs(u.data,d,h),d=h+1,u.mimeType===g?u.url=Ys(u.data,d,u.data.length):u.pictureData=u.data.subarray(d,u.data.length))))},"T*":function(u){u.data[0]===Yo.Utf8&&(u.value=Qs(u.data,1,u.data.length).replace(/\0*$/,""),u.values=u.value.split("\0"))},TXXX:function(u){var d;u.data[0]===Yo.Utf8&&(d=Qo(u.data,0,1),d!==-1&&(u.description=Qs(u.data,1,d),u.value=Qs(u.data,d+1,u.data.length).replace(/\0*$/,""),u.data=u.value))},"W*":function(u){u.url=Ys(u.data,0,u.data.length).replace(/\0.*$/,"")},WXXX:function(u){var d;u.data[0]===Yo.Utf8&&(d=Qo(u.data,0,1),d!==-1&&(u.description=Qs(u.data,1,d),u.url=Ys(u.data,d+1,u.data.length).replace(/\0.*$/,"")))},PRIV:function(u){var d;for(d=0;d>>2;ee*=4,ee+=j[7]&3,L.timeStamp=ee,w.pts===void 0&&w.dts===void 0&&(w.pts=L.timeStamp,w.dts=L.timeStamp),this.trigger("timestamp",L)}w.frames.push(L),A+=10,A+=I}while(A>>4>1&&(b+=g[b]+1),y.pid===0)y.type="pat",u(g.subarray(b),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",u(g.subarray(b),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([g,b,y]):this.processPes_(g,b,y)},this.processPes_=function(g,y,b){b.pid===this.programMapTable.video?b.streamType=ci.H264_STREAM_TYPE:b.pid===this.programMapTable.audio?b.streamType=ci.ADTS_STREAM_TYPE:b.streamType=this.programMapTable["timed-metadata"][b.pid],b.type="pes",b.data=g.subarray(y),this.trigger("data",b)}},ea.prototype=new od,ea.STREAM_TYPES={h264:27,adts:15},el=function(){var u=this,d=!1,f={data:[],size:0},h={data:[],size:0},g={data:[],size:0},y,b=function(A,I){var L;const R=A[0]<<16|A[1]<<8|A[2];I.data=new Uint8Array,R===1&&(I.packetLength=6+(A[4]<<8|A[5]),I.dataAlignmentIndicator=(A[6]&4)!==0,L=A[7],L&192&&(I.pts=(A[9]&14)<<27|(A[10]&255)<<20|(A[11]&254)<<12|(A[12]&255)<<5|(A[13]&254)>>>3,I.pts*=4,I.pts+=(A[13]&6)>>>1,I.dts=I.pts,L&64&&(I.dts=(A[14]&14)<<27|(A[15]&255)<<20|(A[16]&254)<<12|(A[17]&255)<<5|(A[18]&254)>>>3,I.dts*=4,I.dts+=(A[18]&6)>>>1)),I.data=A.subarray(9+A[8]))},w=function(A,I,L){var R=new Uint8Array(A.size),z={type:I},j=0,ee=0,ne=!1,Xe;if(!(!A.data.length||A.size<9)){for(z.trackId=A.data[0].pid,j=0;j>5,A=((d[g+6]&3)+1)*1024,I=A*XE/hg[(d[g+2]&60)>>>2],d.byteLength-g>>6&3)+1,channelcount:(d[g+2]&1)<<2|(d[g+3]&192)>>>6,samplerate:hg[(d[g+2]&60)>>>2],samplingfrequencyindex:(d[g+2]&60)>>>2,samplesize:16,data:d.subarray(g+7+b,g+y)}),f++,g+=y}typeof L=="number"&&(this.skipWarn_(L,g),L=null),d=d.subarray(g)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},tl.prototype=new GE;var KE=tl,fg;fg=function(u){var d=u.byteLength,f=0,h=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+h},this.loadWord=function(){var g=u.byteLength-d,y=new Uint8Array(4),b=Math.min(4,d);if(b===0)throw new Error("no bytes available");y.set(u.subarray(g,g+b)),f=new DataView(y.buffer).getUint32(0),h=b*8,d-=b},this.skipBits=function(g){var y;h>g?(f<<=g,h-=g):(g-=h,y=Math.floor(g/8),g-=y*8,d-=y,this.loadWord(),f<<=g,h-=g)},this.readBits=function(g){var y=Math.min(h,g),b=f>>>32-y;return h-=y,h>0?f<<=y:d>0&&this.loadWord(),y=g-y,y>0?b<>>g)return f<<=g,h-=g,g;return this.loadWord(),g+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var g=this.skipLeadingZeros();return this.readBits(g+1)-1},this.readExpGolomb=function(){var g=this.readUnsignedExpGolomb();return 1&g?1+g>>>1:-1*(g>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var QE=fg,pg=i,YE=QE,il,ta,mg;ta=function(){var u=0,d,f;ta.prototype.init.call(this),this.push=function(h){var g;f?(g=new Uint8Array(f.byteLength+h.data.byteLength),g.set(f),g.set(h.data,f.byteLength),f=g):f=h.data;for(var y=f.byteLength;u3&&this.trigger("data",f.subarray(u+3)),f=null,u=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},ta.prototype=new pg,mg={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},il=function(){var u=new ta,d,f,h,g,y,b,w;il.prototype.init.call(this),d=this,this.push=function(A){A.type==="video"&&(f=A.trackId,h=A.pts,g=A.dts,u.push(A))},u.on("data",function(A){var I={trackId:f,pts:h,dts:g,data:A,nalUnitTypeCode:A[0]&31};switch(I.nalUnitTypeCode){case 5:I.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:I.nalUnitType="sei_rbsp",I.escapedRBSP=y(A.subarray(1));break;case 7:I.nalUnitType="seq_parameter_set_rbsp",I.escapedRBSP=y(A.subarray(1)),I.config=b(I.escapedRBSP);break;case 8:I.nalUnitType="pic_parameter_set_rbsp";break;case 9:I.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",I)}),u.on("done",function(){d.trigger("done")}),u.on("partialdone",function(){d.trigger("partialdone")}),u.on("reset",function(){d.trigger("reset")}),u.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){u.flush()},this.partialFlush=function(){u.partialFlush()},this.reset=function(){u.reset()},this.endTimeline=function(){u.endTimeline()},w=function(A,I){var L=8,R=8,z,j;for(z=0;z>4;return f=f>=0?f:0,g?f+20:f+10},yg=function(u,d){return u.length-d<10||u[d]!==73||u[d+1]!==68||u[d+2]!==51?d:(d+=gg(u,d),yg(u,d))},eb=function(u){var d=yg(u,0);return u.length>=d+2&&(u[d]&255)===255&&(u[d+1]&240)===240&&(u[d+1]&22)===16},vg=function(u){return u[0]<<21|u[1]<<14|u[2]<<7|u[3]},tb=function(u,d,f){var h,g="";for(h=d;h>5,h=u[d+4]<<3,g=u[d+3]&6144;return g|h|f},rb=function(u,d){return u[d]===73&&u[d+1]===68&&u[d+2]===51?"timed-metadata":u[d]&!0&&(u[d+1]&240)===240?"audio":null},sb=function(u){for(var d=0;d+5>>2]}return null},ab=function(u){var d,f,h,g;d=10,u[5]&64&&(d+=4,d+=vg(u.subarray(10,14)));do{if(f=vg(u.subarray(d+4,d+8)),f<1)return null;if(g=String.fromCharCode(u[d],u[d+1],u[d+2],u[d+3]),g==="PRIV"){h=u.subarray(d+10,d+f+10);for(var y=0;y>>2;return A*=4,A+=w[7]&3,A}break}}d+=10,d+=f}while(d=3;){if(u[g]===73&&u[g+1]===68&&u[g+2]===51){if(u.length-g<10||(h=_g.parseId3TagSize(u,g),g+h>u.length))break;b={type:"timed-metadata",data:u.subarray(g,g+h)},this.trigger("data",b),g+=h;continue}else if((u[g]&255)===255&&(u[g+1]&240)===240){if(u.length-g<7||(h=_g.parseAdtsSize(u,g),g+h>u.length))break;w={type:"audio",data:u.subarray(g,g+h),pts:d,dts:d},this.trigger("data",w),g+=h;continue}g++}y=u.length-g,y>0?u=u.subarray(g):u=new Uint8Array},this.reset=function(){u=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){u=new Uint8Array,this.trigger("endedtimeline")}},nl.prototype=new ob;var lb=nl,ub=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],cb=ub,db=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],hb=db,rl=i,ia=Pr,na=hE,sl=xE,di=wE,Gi=WE,al=De,Tg=KE,fb=JE.H264Stream,pb=lb,mb=dd.isLikelyAacData,gb=De.ONE_SECOND_IN_TS,hd=cb,fd=hb,ra,Or,ol,Jn,yb=function(u,d){d.stream=u,this.trigger("log",d)},xg=function(u,d){for(var f=Object.keys(d),h=0;h=-I&&R<=A&&(!z||L>R)&&(z=ee,L=R)));return z?z.gop:null},this.alignGopsAtStart_=function(w){var A,I,L,R,z,j,ee,ne;for(z=w.byteLength,j=w.nalCount,ee=w.duration,A=I=0;AL.pts){A++;continue}I++,z-=R.byteLength,j-=R.nalCount,ee-=R.duration}return I===0?w:I===w.length?null:(ne=w.slice(I),ne.byteLength=z,ne.duration=ee,ne.nalCount=j,ne.pts=ne[0].pts,ne.dts=ne[0].dts,ne)},this.alignGopsAtEnd_=function(w){var A,I,L,R,z,j;for(A=g.length-1,I=w.length-1,z=null,j=!1;A>=0&&I>=0;){if(L=g[A],R=w[I],L.pts===R.pts){j=!0;break}if(L.pts>R.pts){A--;continue}A===g.length-1&&(z=I),I--}if(!j&&z===null)return null;var ee;if(j?ee=I:ee=z,ee===0)return w;var ne=w.slice(ee),Xe=ne.reduce(function(Qt,er){return Qt.byteLength+=er.byteLength,Qt.duration+=er.duration,Qt.nalCount+=er.nalCount,Qt},{byteLength:0,duration:0,nalCount:0});return ne.byteLength=Xe.byteLength,ne.duration=Xe.duration,ne.nalCount=Xe.nalCount,ne.pts=ne[0].pts,ne.dts=ne[0].dts,ne},this.alignGopsWith=function(w){g=w}},ra.prototype=new rl,Jn=function(u,d){this.numberOfTracks=0,this.metadataStream=d,u=u||{},typeof u.remux<"u"?this.remuxTracks=!!u.remux:this.remuxTracks=!0,typeof u.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=u.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Jn.prototype.init.call(this),this.push=function(f){if(f.content||f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},Jn.prototype=new rl,Jn.prototype.flush=function(u){var d=0,f={captions:[],captionStreams:{},metadata:[],info:{}},h,g,y,b=0,w;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(b=this.videoTrack.timelineStartInfo.pts,fd.forEach(function(A){f.info[A]=this.videoTrack[A]},this)):this.audioTrack&&(b=this.audioTrack.timelineStartInfo.pts,hd.forEach(function(A){f.info[A]=this.audioTrack[A]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?f.type=this.pendingTracks[0].type:f.type="combined",this.emittedTracks+=this.pendingTracks.length,y=ia.initSegment(this.pendingTracks),f.initSegment=new Uint8Array(y.byteLength),f.initSegment.set(y),f.data=new Uint8Array(this.pendingBytes),w=0;w=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Jn.prototype.setRemux=function(u){this.remuxTracks=u},ol=function(u){var d=this,f=!0,h,g;ol.prototype.init.call(this),u=u||{},this.baseMediaDecodeTime=u.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new Gi.MetadataStream,y.aacStream=new pb,y.audioTimestampRolloverStream=new Gi.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new Gi.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Tg,y.coalesceStream=new Jn(u,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(b){y.aacStream.setTimestamp(b.timeStamp)}),y.aacStream.on("data",function(b){b.type!=="timed-metadata"&&b.type!=="audio"||y.audioSegmentStream||(g=g||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new Or(g,u),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!h}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xg(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new Gi.MetadataStream,y.packetStream=new Gi.TransportPacketStream,y.parseStream=new Gi.TransportParseStream,y.elementaryStream=new Gi.ElementaryStream,y.timestampRolloverStream=new Gi.TimestampRolloverStream,y.adtsStream=new Tg,y.h264Stream=new fb,y.captionStream=new Gi.CaptionStream(u),y.coalesceStream=new Jn(u,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(b){var w;if(b.type==="metadata"){for(w=b.tracks.length;w--;)!h&&b.tracks[w].type==="video"?(h=b.tracks[w],h.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!g&&b.tracks[w].type==="audio"&&(g=b.tracks[w],g.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);h&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new ra(h,u),y.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(A){g&&!u.keepOriginalTimestamps&&(g.timelineStartInfo=A,y.audioSegmentStream.setEarliestDts(A.dts-d.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(A){g&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(A)}),y.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),g&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new Or(g,u),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!h})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(b){b.dispatchType=y.metadataStream.dispatchType,d.trigger("id3Frame",b)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xg(this,y)},this.setBaseMediaDecodeTime=function(y){var b=this.transmuxPipeline_;u.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),g&&(g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,di.clearDtsInfo(g),b.audioTimestampRolloverStream&&b.audioTimestampRolloverStream.discontinuity()),h&&(b.videoSegmentStream&&(b.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,di.clearDtsInfo(h),b.captionStream.reset()),b.timestampRolloverStream&&b.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){g&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var b=this.transmuxPipeline_;u.remux=y,b&&b.coalesceStream&&b.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var b=this;return function(w){w.stream=y,b.trigger("log",w)}},this.push=function(y){if(f){var b=mb(y);b&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!b&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){f=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},ol.prototype=new rl;var vb={Transmuxer:ol,VideoSegmentStream:ra,AudioSegmentStream:Or,AUDIO_PROPERTIES:hd,VIDEO_PROPERTIES:fd,generateSegmentTimingInfo:pd},_b=function(u){return u>>>0},Tb=function(u){return("00"+u.toString(16)).slice(-2)},ll={toUnsigned:_b,toHexString:Tb},xb=function(u){var d="";return d+=String.fromCharCode(u[0]),d+=String.fromCharCode(u[1]),d+=String.fromCharCode(u[2]),d+=String.fromCharCode(u[3]),d},Eg=xb,Sb=ll.toUnsigned,Eb=Eg,bg=function(u,d){var f=[],h,g,y,b,w;if(!d.length)return null;for(h=0;h1?h+g:u.byteLength,y===d[0]&&(d.length===1?f.push(u.subarray(h+8,b)):(w=bg(u.subarray(h+8,b),d.slice(1)),w.length&&(f=f.concat(w)))),h=b;return f},Cg=bg,bb=ll.toUnsigned,Cb=s.getUint64,wb=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=Cb(u.subarray(4)):d.baseMediaDecodeTime=bb(u[4]<<24|u[5]<<16|u[6]<<8|u[7]),d},wg=wb,Ab=function(u){return{isLeading:(u[0]&12)>>>2,dependsOn:u[0]&3,isDependedOn:(u[1]&192)>>>6,hasRedundancy:(u[1]&48)>>>4,paddingValue:(u[1]&14)>>>1,isNonSyncSample:u[1]&1,degradationPriority:u[2]<<8|u[3]}},Db=Ab,Ag=Db,kb=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4)),samples:[]},f=new DataView(u.buffer,u.byteOffset,u.byteLength),h=d.flags[2]&1,g=d.flags[2]&4,y=d.flags[1]&1,b=d.flags[1]&2,w=d.flags[1]&4,A=d.flags[1]&8,I=f.getUint32(4),L=8,R;for(h&&(d.dataOffset=f.getInt32(L),L+=4),g&&I&&(R={flags:Ag(u.subarray(L,L+4))},L+=4,y&&(R.duration=f.getUint32(L),L+=4),b&&(R.size=f.getUint32(L),L+=4),A&&(d.version===1?R.compositionTimeOffset=f.getInt32(L):R.compositionTimeOffset=f.getUint32(L),L+=4),d.samples.push(R),I--);I--;)R={},y&&(R.duration=f.getUint32(L),L+=4),b&&(R.size=f.getUint32(L),L+=4),w&&(R.flags=Ag(u.subarray(L,L+4)),L+=4),A&&(d.version===1?R.compositionTimeOffset=f.getInt32(L):R.compositionTimeOffset=f.getUint32(L),L+=4),d.samples.push(R);return d},Dg=kb,Pb=function(u){var d=new DataView(u.buffer,u.byteOffset,u.byteLength),f={version:u[0],flags:new Uint8Array(u.subarray(1,4)),trackId:d.getUint32(4)},h=f.flags[2]&1,g=f.flags[2]&2,y=f.flags[2]&8,b=f.flags[2]&16,w=f.flags[2]&32,A=f.flags[0]&65536,I=f.flags[0]&131072,L;return L=8,h&&(L+=4,f.baseDataOffset=d.getUint32(12),L+=4),g&&(f.sampleDescriptionIndex=d.getUint32(L),L+=4),y&&(f.defaultSampleDuration=d.getUint32(L),L+=4),b&&(f.defaultSampleSize=d.getUint32(L),L+=4),w&&(f.defaultSampleFlags=d.getUint32(L)),A&&(f.durationIsEmpty=!0),!h&&I&&(f.baseDataOffsetIsMoof=!0),f},kg=Pb,sa;typeof window<"u"?sa=window:typeof t<"u"?sa=t:typeof self<"u"?sa=self:sa={};var Pg=sa,Ib=sg.discardEmulationPreventionBytes,Ob=ag.CaptionStream,aa=Cg,Lb=wg,Nb=Dg,Rb=kg,Ig=Pg,Mb=function(u,d){for(var f=u,h=0;h0?Lb(z[0]).baseMediaDecodeTime:0,ee=aa(A,["trun"]),ne,Xe;d===R&&ee.length>0&&(ne=Fb(ee,j,L),Xe=Bb(w,ne,R),g[R]||(g[R]={seiNals:[],logs:[]}),g[R].seiNals=g[R].seiNals.concat(Xe.seiNals),g[R].logs=g[R].logs.concat(Xe.logs))}),g},jb=function(u,d,f){var h;if(d===null)return null;h=Ub(u,d);var g=h[d]||{};return{seiNals:g.seiNals,logs:g.logs,timescale:f}},$b=function(){var u=!1,d,f,h,g,y,b;this.isInitialized=function(){return u},this.init=function(w){d=new Ob,u=!0,b=w?w.isPartial:!1,d.on("data",function(A){A.startTime=A.startPts/g,A.endTime=A.endPts/g,y.captions.push(A),y.captionStreams[A.stream]=!0}),d.on("log",function(A){y.logs.push(A)})},this.isNewInit=function(w,A){return w&&w.length===0||A&&typeof A=="object"&&Object.keys(A).length===0?!1:h!==w[0]||g!==A[h]},this.parse=function(w,A,I){var L;if(this.isInitialized()){if(!A||!I)return null;if(this.isNewInit(A,I))h=A[0],g=I[h];else if(h===null||!g)return f.push(w),null}else return null;for(;f.length>0;){var R=f.shift();this.parse(R,A,I)}return L=jb(w,h,g),L&&L.logs&&(y.logs=y.logs.concat(L.logs)),L===null||!L.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(L.seiNals),this.flushStream(),y)},this.pushNals=function(w){if(!this.isInitialized()||!w||w.length===0)return null;w.forEach(function(A){d.push(A)})},this.flushStream=function(){if(!this.isInitialized())return null;b?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){f=[],h=null,g=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Vb=$b,Hb=function(u){for(var d=0,f=String.fromCharCode(u[d]),h="";f!=="\0";)h+=f,d++,f=String.fromCharCode(u[d]);return h+=f,h},zb={uint8ToCString:Hb},ul=zb.uint8ToCString,qb=s.getUint64,Wb=function(u){var d=4,f=u[0],h,g,y,b,w,A,I,L;if(f===0){h=ul(u.subarray(d)),d+=h.length,g=ul(u.subarray(d)),d+=g.length;var R=new DataView(u.buffer);y=R.getUint32(d),d+=4,w=R.getUint32(d),d+=4,A=R.getUint32(d),d+=4,I=R.getUint32(d),d+=4}else if(f===1){var R=new DataView(u.buffer);y=R.getUint32(d),d+=4,b=qb(u.subarray(d)),d+=8,A=R.getUint32(d),d+=4,I=R.getUint32(d),d+=4,h=ul(u.subarray(d)),d+=h.length,g=ul(u.subarray(d)),d+=g.length}L=new Uint8Array(u.subarray(d,u.byteLength));var z={scheme_id_uri:h,value:g,timescale:y||1,presentation_time:b,presentation_time_delta:w,event_duration:A,id:I,message_data:L};return Xb(f,z)?z:void 0},Gb=function(u,d,f,h){return u||u===0?u/d:h+f/d},Xb=function(u,d){var f=d.scheme_id_uri!=="\0",h=u===0&&Og(d.presentation_time_delta)&&f,g=u===1&&Og(d.presentation_time)&&f;return!(u>1)&&h||g},Og=function(u){return u!==void 0||u!==null},Kb={parseEmsgBox:Wb,scaleTime:Gb},cl=ll.toUnsigned,oa=ll.toHexString,$e=Cg,Lr=Eg,md=Kb,Qb=kg,Yb=Dg,Jb=wg,Zb=s.getUint64,Lg,Ng,Rg,Mg,Bg,gd,Fg,yd=Pg,eC=cg.parseId3Frames;Lg=function(u){var d={},f=$e(u,["moov","trak"]);return f.reduce(function(h,g){var y,b,w,A,I;return y=$e(g,["tkhd"])[0],!y||(b=y[0],w=b===0?12:20,A=cl(y[w]<<24|y[w+1]<<16|y[w+2]<<8|y[w+3]),I=$e(g,["mdia","mdhd"])[0],!I)?null:(b=I[0],w=b===0?12:20,h[A]=cl(I[w]<<24|I[w+1]<<16|I[w+2]<<8|I[w+3]),h)},d)},Ng=function(u,d){var f;f=$e(d,["moof","traf"]);var h=f.reduce(function(g,y){var b=$e(y,["tfhd"])[0],w=cl(b[4]<<24|b[5]<<16|b[6]<<8|b[7]),A=u[w]||9e4,I=$e(y,["tfdt"])[0],L=new DataView(I.buffer,I.byteOffset,I.byteLength),R;I[0]===1?R=Zb(I.subarray(4,12)):R=L.getUint32(4);let z;return typeof R=="bigint"?z=R/yd.BigInt(A):typeof R=="number"&&!isNaN(R)&&(z=R/A),z11?(g.codec+=".",g.codec+=oa(j[9]),g.codec+=oa(j[10]),g.codec+=oa(j[11])):g.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(g.codec)?(j=z.subarray(28),ee=Lr(j.subarray(4,8)),ee==="esds"&&j.length>20&&j[19]!==0?(g.codec+="."+oa(j[19]),g.codec+="."+oa(j[20]>>>2&63).replace(/^0/,"")):g.codec="mp4a.40.2"):g.codec=g.codec.toLowerCase())}var ne=$e(h,["mdia","mdhd"])[0];ne&&(g.timescale=gd(ne)),f.push(g)}),f},Fg=function(u,d=0){var f=$e(u,["emsg"]);return f.map(h=>{var g=md.parseEmsgBox(new Uint8Array(h)),y=eC(g.message_data);return{cueTime:md.scaleTime(g.presentation_time,g.timescale,g.presentation_time_delta,d),duration:md.scaleTime(g.event_duration,g.timescale),frames:y}})};var vd={findBox:$e,parseType:Lr,timescale:Lg,startTime:Ng,compositionStartTime:Rg,videoTrackIds:Mg,tracks:Bg,getTimescaleFromMediaHeader:gd,getEmsgID3:Fg},_d=Ko,Ug=function(u){var d=u[1]&31;return d<<=8,d|=u[2],d},dl=function(u){return!!(u[1]&64)},hl=function(u){var d=0;return(u[3]&48)>>>4>1&&(d+=u[4]+1),d},tC=function(u,d){var f=Ug(u);return f===0?"pat":f===d?"pmt":d?"pes":null},iC=function(u){var d=dl(u),f=4+hl(u);return d&&(f+=u[f]+1),(u[f+10]&31)<<8|u[f+11]},nC=function(u){var d={},f=dl(u),h=4+hl(u);if(f&&(h+=u[h]+1),!!(u[h+5]&1)){var g,y,b;g=(u[h+1]&15)<<8|u[h+2],y=3+g-4,b=(u[h+10]&15)<<8|u[h+11];for(var w=12+b;w=u.byteLength)return null;var h=null,g;return g=u[f+7],g&192&&(h={},h.pts=(u[f+9]&14)<<27|(u[f+10]&255)<<20|(u[f+11]&254)<<12|(u[f+12]&255)<<5|(u[f+13]&254)>>>3,h.pts*=4,h.pts+=(u[f+13]&6)>>>1,h.dts=h.pts,g&64&&(h.dts=(u[f+14]&14)<<27|(u[f+15]&255)<<20|(u[f+16]&254)<<12|(u[f+17]&255)<<5|(u[f+18]&254)>>>3,h.dts*=4,h.dts+=(u[f+18]&6)>>>1)),h},Td=function(u){switch(u){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},aC=function(u){for(var d=4+hl(u),f=u.subarray(d),h=0,g=0,y=!1,b;g3&&(b=Td(f[g+3]&31),b==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},oC={parseType:tC,parsePat:iC,parsePmt:nC,parsePayloadUnitStartIndicator:dl,parsePesType:rC,parsePesTime:sC,videoPacketContainsKeyFrame:aC},jg=Ko,Nr=lg.handleRollover,ye={};ye.ts=oC,ye.aac=dd;var Zn=De.ONE_SECOND_IN_TS,mt=188,Ei=71,lC=function(u,d){for(var f=0,h=mt,g,y;h=0;){if(u[h]===Ei&&(u[g]===Ei||g===u.byteLength)){switch(y=u.subarray(h,g),b=ye.ts.parseType(y,d.pid),b){case"pes":w=ye.ts.parsePesType(y,d.table),A=ye.ts.parsePayloadUnitStartIndicator(y),w==="audio"&&A&&(I=ye.ts.parsePesTime(y),I&&(I.type="audio",f.audio.push(I),L=!0));break}if(L)break;h-=mt,g-=mt;continue}h--,g--}},uC=function(u,d,f){for(var h=0,g=mt,y,b,w,A,I,L,R,z,j=!1,ee={data:[],size:0};g=0;){if(u[h]===Ei&&u[g]===Ei){switch(y=u.subarray(h,g),b=ye.ts.parseType(y,d.pid),b){case"pes":w=ye.ts.parsePesType(y,d.table),A=ye.ts.parsePayloadUnitStartIndicator(y),w==="video"&&A&&(I=ye.ts.parsePesTime(y),I&&(I.type="video",f.video.push(I),j=!0));break}if(j)break;h-=mt,g-=mt;continue}h--,g--}},cC=function(u,d){if(u.audio&&u.audio.length){var f=d;(typeof f>"u"||isNaN(f))&&(f=u.audio[0].dts),u.audio.forEach(function(y){y.dts=Nr(y.dts,f),y.pts=Nr(y.pts,f),y.dtsTime=y.dts/Zn,y.ptsTime=y.pts/Zn})}if(u.video&&u.video.length){var h=d;if((typeof h>"u"||isNaN(h))&&(h=u.video[0].dts),u.video.forEach(function(y){y.dts=Nr(y.dts,h),y.pts=Nr(y.pts,h),y.dtsTime=y.dts/Zn,y.ptsTime=y.pts/Zn}),u.firstKeyFrame){var g=u.firstKeyFrame;g.dts=Nr(g.dts,h),g.pts=Nr(g.pts,h),g.dtsTime=g.dts/Zn,g.ptsTime=g.pts/Zn}}},dC=function(u){for(var d=!1,f=0,h=null,g=null,y=0,b=0,w;u.length-b>=3;){var A=ye.aac.parseType(u,b);switch(A){case"timed-metadata":if(u.length-b<10){d=!0;break}if(y=ye.aac.parseId3TagSize(u,b),y>u.length){d=!0;break}g===null&&(w=u.subarray(b,b+y),g=ye.aac.parseAacTimestamp(w)),b+=y;break;case"audio":if(u.length-b<7){d=!0;break}if(y=ye.aac.parseAdtsSize(u,b),y>u.length){d=!0;break}h===null&&(w=u.subarray(b,b+y),h=ye.aac.parseSampleRate(w)),f++,b+=y;break;default:b++;break}if(d)return null}if(h===null||g===null)return null;var I=Zn/h,L={audio:[{type:"audio",dts:g,pts:g},{type:"audio",dts:g+f*1024*I,pts:g+f*1024*I}]};return L},hC=function(u){var d={pid:null,table:null},f={};lC(u,d);for(var h in d.table)if(d.table.hasOwnProperty(h)){var g=d.table[h];switch(g){case jg.H264_STREAM_TYPE:f.video=[],uC(u,d,f),f.video.length===0&&delete f.video;break;case jg.ADTS_STREAM_TYPE:f.audio=[],$g(u,d,f),f.audio.length===0&&delete f.audio;break}}return f},fC=function(u,d){var f=ye.aac.isLikelyAacData(u),h;return f?h=dC(u):h=hC(u),!h||!h.audio&&!h.video?null:(cC(h,d),h)},pC={inspect:fC,parseAudioPes_:$g};const mC=function(u,d){d.on("data",function(f){const h=f.initSegment;f.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const g=f.data;f.data=g.buffer,u.postMessage({action:"data",segment:f,byteOffset:g.byteOffset,byteLength:g.byteLength},[f.data])}),d.on("done",function(f){u.postMessage({action:"done"})}),d.on("gopInfo",function(f){u.postMessage({action:"gopInfo",gopInfo:f})}),d.on("videoSegmentTimingInfo",function(f){const h={start:{decode:De.videoTsToSeconds(f.start.dts),presentation:De.videoTsToSeconds(f.start.pts)},end:{decode:De.videoTsToSeconds(f.end.dts),presentation:De.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:De.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=De.videoTsToSeconds(f.prependedContentDuration)),u.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),d.on("audioSegmentTimingInfo",function(f){const h={start:{decode:De.videoTsToSeconds(f.start.dts),presentation:De.videoTsToSeconds(f.start.pts)},end:{decode:De.videoTsToSeconds(f.end.dts),presentation:De.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:De.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=De.videoTsToSeconds(f.prependedContentDuration)),u.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),d.on("id3Frame",function(f){u.postMessage({action:"id3Frame",id3Frame:f})}),d.on("caption",function(f){u.postMessage({action:"caption",caption:f})}),d.on("trackinfo",function(f){u.postMessage({action:"trackinfo",trackInfo:f})}),d.on("audioTimingInfo",function(f){u.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:De.videoTsToSeconds(f.start),end:De.videoTsToSeconds(f.end)}})}),d.on("videoTimingInfo",function(f){u.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:De.videoTsToSeconds(f.start),end:De.videoTsToSeconds(f.end)}})}),d.on("log",function(f){u.postMessage({action:"log",log:f})})};class Vg{constructor(d,f){this.options=f||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new vb.Transmuxer(this.options),mC(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new Vb,this.captionParser.init());const f=new Uint8Array(d.data,d.byteOffset,d.byteLength),h=this.captionParser.parse(f,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:f.buffer},[f.buffer])}probeMp4StartTime({timescales:d,data:f}){const h=vd.startTime(d,f);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:f},[f.buffer])}probeMp4Tracks({data:d}){const f=vd.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:f,data:d},[d.buffer])}probeEmsgID3({data:d,offset:f}){const h=vd.getEmsgID3(d,f);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:f}){const h=typeof f=="number"&&!isNaN(f)?f*De.ONE_SECOND_IN_TS:void 0,g=pC.inspect(d,h);let y=null;g&&(y={hasVideo:g.video&&g.video.length===2||!1,hasAudio:g.audio&&g.audio.length===2||!1},y.hasVideo&&(y.videoStart=g.video[0].ptsTime),y.hasAudio&&(y.audioStart=g.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const f=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(f)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const f=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(De.secondsToVideoTs(f)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(De.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(u){if(u.data.action==="init"&&u.data.options){this.messageHandlers=new Vg(self,u.data.options);return}this.messageHandlers||(this.messageHandlers=new Vg(self)),u.data&&u.data.action&&u.data.action!=="init"&&this.messageHandlers[u.data.action]&&this.messageHandlers[u.data.action](u.data)}}));var fO=uS(hO);const pO=(t,e,i)=>{const{type:n,initSegment:r,captions:s,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:c}=t.data.segment;e.buffer.push({captions:s,captionStreams:a,metadata:o});const p=t.data.segment.boxes||{data:t.data.segment.data},m={type:n,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof l<"u"&&(m.videoFrameDtsTime=l),typeof c<"u"&&(m.videoFramePtsTime=c),i(m)},mO=({transmuxedData:t,callback:e})=>{t.buffer=[],e(t)},gO=(t,e)=>{e.gopInfo=t.data.gopInfo},hS=t=>{const{transmuxer:e,bytes:i,audioAppendStart:n,gopsToAlignWith:r,remux:s,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:c,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:m,onId3:_,onCaptions:E,onDone:v,onEndedTimeline:S,onTransmuxerLog:D,isEndOfTimeline:x}=t,T={buffer:[]};let C=x;const P=O=>{e.currentTransmux===t&&(O.data.action==="data"&&pO(O,T,a),O.data.action==="trackinfo"&&o(O.data.trackInfo),O.data.action==="gopInfo"&&gO(O,T),O.data.action==="audioTimingInfo"&&l(O.data.audioTimingInfo),O.data.action==="videoTimingInfo"&&c(O.data.videoTimingInfo),O.data.action==="videoSegmentTimingInfo"&&p(O.data.videoSegmentTimingInfo),O.data.action==="audioSegmentTimingInfo"&&m(O.data.audioSegmentTimingInfo),O.data.action==="id3Frame"&&_([O.data.id3Frame],O.data.id3Frame.dispatchType),O.data.action==="caption"&&E(O.data.caption),O.data.action==="endedtimeline"&&(C=!1,S()),O.data.action==="log"&&D(O.data.log),O.data.type==="transmuxed"&&(C||(e.onmessage=null,mO({transmuxedData:T,callback:v}),fS(e))))};if(e.onmessage=P,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof s<"u"&&e.postMessage({action:"setRemux",remux:s}),i.byteLength){const O=i instanceof ArrayBuffer?i:i.buffer,N=i instanceof ArrayBuffer?0:i.byteOffset;e.postMessage({action:"push",data:O,byteOffset:N,byteLength:i.byteLength},[O])}x&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},fS=t=>{t.currentTransmux=null,t.transmuxQueue.length&&(t.currentTransmux=t.transmuxQueue.shift(),typeof t.currentTransmux=="function"?t.currentTransmux():hS(t.currentTransmux))},Sv=(t,e)=>{t.postMessage({action:e}),fS(t)},pS=(t,e)=>{if(!e.currentTransmux){e.currentTransmux=t,Sv(e,t);return}e.transmuxQueue.push(Sv.bind(null,e,t))},yO=t=>{pS("reset",t)},vO=t=>{pS("endTimeline",t)},mS=t=>{if(!t.transmuxer.currentTransmux){t.transmuxer.currentTransmux=t,hS(t);return}t.transmuxer.transmuxQueue.push(t)},_O=t=>{const e=new fO;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:t}),e};var ph={reset:yO,endTimeline:vO,transmux:mS,createTransmuxer:_O};const Ka=function(t){const e=t.transmuxer,i=t.endAction||t.action,n=t.callback,r=dn({},t,{endAction:null,transmuxer:null,callback:null}),s=a=>{a.data.action===i&&(e.removeEventListener("message",s),a.data.data&&(a.data.data=new Uint8Array(a.data.data,t.byteOffset||0,t.byteLength||a.data.data.byteLength),t.data&&(t.data=a.data.data)),n(a.data))};if(e.addEventListener("message",s),t.data){const a=t.data instanceof ArrayBuffer;r.byteOffset=a?0:t.data.byteOffset,r.byteLength=t.data.byteLength;const o=[a?t.data:t.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},Ii={FAILURE:2,TIMEOUT:-101,ABORTED:-102},jf=t=>{t.forEach(e=>{e.abort()})},TO=t=>({bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}),xO=t=>{const e=t.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return n.bytesReceived=t.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n},Wm=(t,e)=>e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Ii.TIMEOUT,xhr:e}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Ii.ABORTED,xhr:e}:t?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Ii.FAILURE,xhr:e}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Ii.FAILURE,xhr:e}:null,Ev=(t,e,i)=>(n,r)=>{const s=r.response,a=Wm(n,r);if(a)return i(a,t);if(s.byteLength!==16)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Ii.FAILURE,xhr:r},t);const o=new DataView(s),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let c=0;c{const i=cm(t.map.bytes);if(i!=="mp4"){const n=t.map.resolvedUri||t.map.uri;return e({internal:!0,message:`Found unsupported ${i||"unknown"} container for initialization segment at URL: ${n}`,code:Ii.FAILURE})}Ka({action:"probeMp4Tracks",data:t.map.bytes,transmuxer:t.transmuxer,callback:({tracks:n,data:r})=>(t.map.bytes=r,n.forEach(function(s){t.map.tracks=t.map.tracks||{},!t.map.tracks[s.type]&&(t.map.tracks[s.type]=s,typeof s.id=="number"&&s.timescale&&(t.map.timescales=t.map.timescales||{},t.map.timescales[s.id]=s.timescale))}),e(null))})},SO=({segment:t,finishProcessingFn:e})=>(i,n)=>{const r=Wm(i,n);if(r)return e(r,t);const s=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=s,e(null,t);t.map.bytes=s,gS(t,function(a){if(a)return a.xhr=n,a.status=n.status,e(a,t);e(null,t)})},EO=({segment:t,finishProcessingFn:e,responseType:i})=>(n,r)=>{const s=Wm(n,r);if(s)return e(s,t);const a=i==="arraybuffer"||!r.responseText?r.response:cO(r.responseText.substring(t.lastReachedChar||0));return t.stats=TO(r),t.key?t.encryptedBytes=new Uint8Array(a):t.bytes=new Uint8Array(a),e(null,t)},bO=({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})=>{const E=t.map&&t.map.tracks||{},v=!!(E.audio&&E.video);let S=n.bind(null,t,"audio","start");const D=n.bind(null,t,"audio","end");let x=n.bind(null,t,"video","start");const T=n.bind(null,t,"video","end"),C=()=>mS({bytes:e,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:v,onData:P=>{P.type=P.type==="combined"?"video":P.type,p(t,P)},onTrackInfo:P=>{i&&(v&&(P.isMuxed=!0),i(t,P))},onAudioTimingInfo:P=>{S&&typeof P.start<"u"&&(S(P.start),S=null),D&&typeof P.end<"u"&&D(P.end)},onVideoTimingInfo:P=>{x&&typeof P.start<"u"&&(x(P.start),x=null),T&&typeof P.end<"u"&&T(P.end)},onVideoSegmentTimingInfo:P=>{r(P)},onAudioSegmentTimingInfo:P=>{s(P)},onId3:(P,O)=>{a(t,P,O)},onCaptions:P=>{o(t,[P])},isEndOfTimeline:l,onEndedTimeline:()=>{c()},onTransmuxerLog:_,onDone:P=>{m&&(P.type=P.type==="combined"?"video":P.type,m(null,t,P))}});Ka({action:"probeTs",transmuxer:t.transmuxer,data:e,baseStartTime:t.baseStartTime,callback:P=>{t.bytes=e=P.data;const O=P.result;O&&(i(t,{hasAudio:O.hasAudio,hasVideo:O.hasVideo,isMuxed:v}),i=null),C()}})},yS=({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})=>{let E=new Uint8Array(e);if(X4(E)){t.isFmp4=!0;const{tracks:v}=t.map,S={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(S.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(S.videoCodec=v.video.codec),v.video&&v.audio&&(S.isMuxed=!0),i(t,S);const D=(x,T)=>{p(t,{data:E,type:S.hasAudio&&!S.isMuxed?"audio":"video"}),T&&T.length&&a(t,T),x&&x.length&&o(t,x),m(null,t,{})};Ka({action:"probeMp4StartTime",timescales:t.map.timescales,data:E,transmuxer:t.transmuxer,callback:({data:x,startTime:T})=>{e=x.buffer,t.bytes=E=x,S.hasAudio&&!S.isMuxed&&n(t,"audio","start",T),S.hasVideo&&n(t,"video","start",T),Ka({action:"probeEmsgID3",data:E,transmuxer:t.transmuxer,offset:T,callback:({emsgData:C,id3Frames:P})=>{if(e=C.buffer,t.bytes=E=C,!v.video||!C.byteLength||!t.transmuxer){D(void 0,P);return}Ka({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:E,timescales:t.map.timescales,trackIds:[v.video.id],callback:O=>{e=O.data.buffer,t.bytes=E=O.data,O.logs.forEach(function(N){_(Te(N,{stream:"mp4CaptionParser"}))}),D(O.captions,P)}})}})}});return}if(!t.transmuxer){m(null,t,{});return}if(typeof t.container>"u"&&(t.container=cm(E)),t.container!=="ts"&&t.container!=="aac"){i(t,{hasAudio:!1,hasVideo:!1}),m(null,t,{});return}bO({segment:t,bytes:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})},vS=function({id:t,key:e,encryptedBytes:i,decryptionWorker:n},r){const s=o=>{if(o.data.source===t){n.removeEventListener("message",s);const l=o.data.decrypted;r(new Uint8Array(l.bytes,l.byteOffset,l.byteLength))}};n.addEventListener("message",s);let a;e.bytes.slice?a=e.bytes.slice():a=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(nS({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},CO=({decryptionWorker:t,segment:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})=>{vS({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:t},E=>{e.bytes=E,yS({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})})},wO=({activeXhrs:t,decryptionWorker:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})=>{let E=0,v=!1;return(S,D)=>{if(!v){if(S)return v=!0,jf(t),m(S,D);if(E+=1,E===t.length){const x=function(){if(D.encryptedBytes)return CO({decryptionWorker:e,segment:D,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_});yS({segment:D,bytes:D.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:_})};if(D.endOfAllRequests=Date.now(),D.map&&D.map.encryptedBytes&&!D.map.bytes)return vS({decryptionWorker:e,id:D.requestId+"-init",encryptedBytes:D.map.encryptedBytes,key:D.map.key},T=>{D.map.bytes=T,gS(D,C=>{if(C)return jf(t),m(C,D);x()})});x()}}}},AO=({loadendState:t,abortFn:e})=>i=>{i.target.aborted&&e&&!t.calledAbortFn&&(e(),t.calledAbortFn=!0)},DO=({segment:t,progressFn:e,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:c,dataFn:p})=>m=>{if(!m.target.aborted)return t.stats=Te(t.stats,xO(m)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),e(m,t)},kO=({xhr:t,xhrOptions:e,decryptionWorker:i,segment:n,abortFn:r,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:m,isEndOfTimeline:_,endedTimelineFn:E,dataFn:v,doneFn:S,onTransmuxerLog:D})=>{const x=[],T=wO({activeXhrs:x,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:m,isEndOfTimeline:_,endedTimelineFn:E,dataFn:v,doneFn:S,onTransmuxerLog:D});if(n.key&&!n.key.bytes){const F=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&F.push(n.map.key);const V=Te(e,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),Q=Ev(n,F,T),J=t(V,Q);x.push(J)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const re=Te(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer"}),pe=Ev(n,[n.map.key],T),Y=t(re,pe);x.push(Y)}const V=Te(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Ff(n.map)}),Q=SO({segment:n,finishProcessingFn:T}),J=t(V,Q);x.push(J)}const C=Te(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Ff(n)}),P=EO({segment:n,finishProcessingFn:T,responseType:C.responseType}),O=t(C,P);O.addEventListener("progress",DO({segment:n,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:m,isEndOfTimeline:_,endedTimelineFn:E,dataFn:v})),x.push(O);const N={};return x.forEach(F=>{F.addEventListener("loadend",AO({loadendState:N,abortFn:r}))}),()=>jf(x)},PO=ui("CodecUtils"),IO=function(t){const e=t.attributes||{};if(e.CODECS)return wi(e.CODECS)},_S=(t,e)=>{const i=e.attributes||{};return t&&t.mediaGroups&&t.mediaGroups.AUDIO&&i.AUDIO&&t.mediaGroups.AUDIO[i.AUDIO]},OO=(t,e)=>{if(!_S(t,e))return!0;const i=e.attributes||{},n=t.mediaGroups.AUDIO[i.AUDIO];for(const r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1},Ju=function(t){const e={};return t.forEach(({mediaType:i,type:n,details:r})=>{e[i]=e[i]||[],e[i].push(N2(`${n}${r}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){PO(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},bv=function(t){let e=0;return t.audio&&e++,t.video&&e++,e},Qa=function(t,e){const i=e.attributes||{},n=Ju(IO(e)||[]);if(_S(t,e)&&!n.audio&&!OO(t,e)){const r=Ju(Qk(t,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Ml=ui("PlaylistSelector"),Cv=function(t){if(!t||!t.playlist)return;const e=t.playlist;return JSON.stringify({id:e.id,bandwidth:t.bandwidth,width:t.width,height:t.height,codecs:e.attributes&&e.attributes.CODECS||""})},Zu=function(t,e){if(!t)return"";const i=k.getComputedStyle(t);return i?i[e]:""},ms=function(t,e){const i=t.slice();t.sort(function(n,r){const s=e(n,r);return s===0?i.indexOf(n)-i.indexOf(r):s})},Gm=function(t,e){let i,n;return t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),i=i||k.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||k.Number.MAX_VALUE,i-n},LO=function(t,e){let i,n;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),i=i||k.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||k.Number.MAX_VALUE,i===n&&t.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?t.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-n};let TS=function(t,e,i,n,r,s){if(!t)return;const a={bandwidth:e,width:i,height:n,limitRenditionByPlayerDimensions:r};let o=t.playlists;Pt.isAudioOnly(t)&&(o=s.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map(O=>{let N;const F=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,V=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return N=O.attributes&&O.attributes.BANDWIDTH,N=N||k.Number.MAX_VALUE,{bandwidth:N,width:F,height:V,playlist:O}});ms(l,(O,N)=>O.bandwidth-N.bandwidth),l=l.filter(O=>!Pt.isIncompatible(O.playlist));let c=l.filter(O=>Pt.isEnabled(O.playlist));c.length||(c=l.filter(O=>!Pt.isDisabled(O.playlist)));const p=c.filter(O=>O.bandwidth*Ze.BANDWIDTH_VARIANCEO.bandwidth===m.bandwidth)[0];if(r===!1){const O=_||c[0]||l[0];if(O&&O.playlist){let N="sortedPlaylistReps";return _&&(N="bandwidthBestRep"),c[0]&&(N="enabledPlaylistReps"),Ml(`choosing ${Cv(O)} using ${N} with options`,a),O.playlist}return Ml("could not choose a playlist with options",a),null}const E=p.filter(O=>O.width&&O.height);ms(E,(O,N)=>O.width-N.width);const v=E.filter(O=>O.width===i&&O.height===n);m=v[v.length-1];const S=v.filter(O=>O.bandwidth===m.bandwidth)[0];let D,x,T;S||(D=E.filter(O=>O.width>i||O.height>n),x=D.filter(O=>O.width===D[0].width&&O.height===D[0].height),m=x[x.length-1],T=x.filter(O=>O.bandwidth===m.bandwidth)[0]);let C;if(s.leastPixelDiffSelector){const O=E.map(N=>(N.pixelDiff=Math.abs(N.width-i)+Math.abs(N.height-n),N));ms(O,(N,F)=>N.pixelDiff===F.pixelDiff?F.bandwidth-N.bandwidth:N.pixelDiff-F.pixelDiff),C=O[0]}const P=C||T||S||_||c[0]||l[0];if(P&&P.playlist){let O="sortedPlaylistReps";return C?O="leastPixelDiffRep":T?O="resolutionPlusOneRep":S?O="resolutionBestRep":_?O="bandwidthBestRep":c[0]&&(O="enabledPlaylistReps"),Ml(`choosing ${Cv(P)} using ${O} with options`,a),P.playlist}return Ml("could not choose a playlist with options",a),null};const wv=function(){const t=this.useDevicePixelRatio&&k.devicePixelRatio||1;return TS(this.playlists.main,this.systemBandwidth,parseInt(Zu(this.tech_.el(),"width"),10)*t,parseInt(Zu(this.tech_.el(),"height"),10)*t,this.limitRenditionByPlayerDimensions,this.playlistController_)},NO=function(t){let e=-1,i=-1;if(t<0||t>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const n=this.useDevicePixelRatio&&k.devicePixelRatio||1;return e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=t*this.systemBandwidth+(1-t)*e,i=this.systemBandwidth),TS(this.playlists.main,e,parseInt(Zu(this.tech_.el(),"width"),10)*n,parseInt(Zu(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},RO=function(t){const{main:e,currentTime:i,bandwidth:n,duration:r,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=t,c=e.playlists.filter(v=>!Pt.isIncompatible(v));let p=c.filter(Pt.isEnabled);p.length||(p=c.filter(v=>!Pt.isDisabled(v)));const _=p.filter(Pt.hasAttribute.bind(null,"BANDWIDTH")).map(v=>{const D=l.getSyncPoint(v,r,o,i)?1:2,T=Pt.estimateSegmentRequestTime(s,n,v)*D-a;return{playlist:v,rebufferingImpact:T}}),E=_.filter(v=>v.rebufferingImpact<=0);return ms(E,(v,S)=>Gm(S.playlist,v.playlist)),E.length?E[0]:(ms(_,(v,S)=>v.rebufferingImpact-S.rebufferingImpact),_[0]||null)},MO=function(){const t=this.playlists.main.playlists.filter(Pt.isEnabled);return ms(t,(i,n)=>Gm(i,n)),t.filter(i=>!!Qa(this.playlists.main,i).video)[0]||null},BO=t=>{let e=0,i;return t.bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach(n=>{i.set(n,e),e+=n.byteLength})),i},FO=function(t,e,i){if(!t[i]){e.trigger({type:"usage",name:"vhs-608"});let n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);const r=e.textTracks().getTrackById(n);if(r)t[i]=r;else{const s=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=i,o=i,l=!1;const c=s[n];c&&(a=c.label,o=c.language,l=c.default),t[i]=e.addRemoteTextTrack({kind:"captions",id:n,default:l,label:a,language:o},!1).track}}},UO=function({inbandTextTracks:t,captionArray:e,timestampOffset:i}){if(!e)return;const n=k.WebKitDataCue||k.VTTCue;e.forEach(r=>{const s=r.stream;r.content?r.content.forEach(a=>{const o=new n(r.startTime+i,r.endTime+i,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",t[s].addCue(o)}):t[s].addCue(new n(r.startTime+i,r.endTime+i,r.text))})},jO=function(t){Object.defineProperties(t.frame,{id:{get(){return M.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return M.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return M.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})},$O=({inbandTextTracks:t,metadataArray:e,timestampOffset:i,videoDuration:n})=>{if(!e)return;const r=k.WebKitDataCue||k.VTTCue,s=t.metadataTrack_;if(!s||(e.forEach(p=>{const m=p.cueTime+i;typeof m!="number"||k.isNaN(m)||m<0||!(m<1/0)||!p.frames||!p.frames.length||p.frames.forEach(_=>{const E=new r(m,m,_.value||_.url||_.data||"");E.frame=_,E.value=_,jO(E),s.addCue(E)})}),!s.cues||!s.cues.length))return;const a=s.cues,o=[];for(let p=0;p{const _=p[m.startTime]||[];return _.push(m),p[m.startTime]=_,p},{}),c=Object.keys(l).sort((p,m)=>Number(p)-Number(m));c.forEach((p,m)=>{const _=l[p],E=isFinite(n)?n:0,v=Number(c[m+1])||E;_.forEach(S=>{S.endTime=v})})},VO={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},HO=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),zO=({inbandTextTracks:t,dateRanges:e})=>{const i=t.metadataTrack_;if(!i)return;const n=k.WebKitDataCue||k.VTTCue;e.forEach(r=>{for(const s of Object.keys(r)){if(HO.has(s))continue;const a=new n(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:VO[s],data:r[s]},(s==="scte35Out"||s==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(a)}r.processDateRange()})},Av=(t,e,i)=>{t.metadataTrack_||(t.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,M.browser.IS_ANY_SAFARI||(t.metadataTrack_.inBandMetadataTrackDispatchType=e))},Na=function(t,e,i){let n,r;if(i&&i.cues)for(n=i.cues.length;n--;)r=i.cues[n],r.startTime>=t&&r.endTime<=e&&i.removeCue(r)},qO=function(t){const e=t.cues;if(!e)return;const i={};for(let n=e.length-1;n>=0;n--){const r=e[n],s=`${r.startTime}-${r.endTime}-${r.text}`;i[s]?t.removeCue(r):i[s]=r}},WO=(t,e,i)=>{if(typeof e>"u"||e===null||!t.length)return[];const n=Math.ceil((e-i+3)*Fu.ONE_SECOND_IN_TS);let r;for(r=0;rn);r++);return t.slice(r)},GO=(t,e,i)=>{if(!e.length)return t;if(i)return e.slice();const n=e[0].pts;let r=0;for(r;r=n);r++);return t.slice(0,r).concat(e)},XO=(t,e,i,n)=>{const r=Math.ceil((e-n)*Fu.ONE_SECOND_IN_TS),s=Math.ceil((i-n)*Fu.ONE_SECOND_IN_TS),a=t.slice();let o=t.length;for(;o--&&!(t[o].pts<=s););if(o===-1)return a;let l=o+1;for(;l--&&!(t[l].pts<=r););return l=Math.max(l,0),a.splice(l,o-l+1),a},KO=function(t,e){if(!t&&!e||!t&&e||t&&!e)return!1;if(t===e)return!0;const i=Object.keys(t).sort(),n=Object.keys(e).sort();if(i.length!==n.length)return!1;for(let r=0;ri))return s}return n.length===0?0:n[n.length-1]},Ea=1,YO=500,Dv=t=>typeof t=="number"&&isFinite(t),Bl=1/60,JO=(t,e,i)=>t!=="main"||!e||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,ZO=(t,e,i)=>{let n=e-Ze.BACK_BUFFER_LENGTH;t.length&&(n=Math.max(n,t.start(0)));const r=e-i;return Math.min(r,n)},Vr=t=>{const{startOfSegment:e,duration:i,segment:n,part:r,playlist:{mediaSequence:s,id:a,segments:o=[]},mediaIndex:l,partIndex:c,timeline:p}=t,m=o.length-1;let _="mediaIndex/partIndex increment";t.getMediaInfoForTime?_=`getMediaInfoForTime (${t.getMediaInfoForTime})`:t.isSyncRequest&&(_="getSyncSegmentCandidate (isSyncRequest)"),t.independent&&(_+=` with independent ${t.independent}`);const E=typeof c=="number",v=t.segment.uri?"segment":"pre-segment",S=E?Hx({preloadSegment:n})-1:0;return`${v} [${s+l}/${s+m}]`+(E?` part [${c}/${S}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(E?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${i}] timeline [${p}] selected by [${_}] playlist [${a}]`},kv=t=>`${t}TimingInfo`,Pv=(t,e)=>t.length?t.end(t.length-1):e,eL=({segmentTimeline:t,currentTimeline:e,startOfSegment:i,buffered:n,calculateTimestampOffsetForEachSegment:r,overrideCheck:s})=>r?Pv(n,i):!s&&t===e?null:t{if(e===i)return!1;if(n==="audio"){const s=t.lastTimelineChange({type:"main"});return!s||s.to!==i}if(n==="main"&&r){const s=t.pendingTimelineChange({type:"audio"});return!(s&&s.to===i)}return!1},tL=t=>{let e=0;return["video","audio"].forEach(function(i){const n=t[`${i}TimingInfo`];if(!n)return;const{start:r,end:s}=n;let a;typeof r=="bigint"||typeof s=="bigint"?a=k.BigInt(s)-k.BigInt(r):typeof r=="number"&&typeof s=="number"&&(a=s-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&et?Math.round(t)>e+qn:!1,iL=(t,e)=>{if(e!=="hls")return null;const i=tL({audioTimingInfo:t.audioTimingInfo,videoTimingInfo:t.videoTimingInfo});if(!i)return null;const n=t.playlist.targetDuration,r=Ov({segmentDuration:i,maxDuration:n*2}),s=Ov({segmentDuration:i,maxDuration:n}),a=`Segment with index ${t.mediaIndex} from playlist ${t.playlist.id} has a duration of ${i} when the reported duration is ${t.duration} and the target duration is ${n}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return r||s?{severity:r?"warn":"info",message:a}:null};class $f extends M.EventTarget{constructor(e,i={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.calculateTimestampOffsetForEachSegment_=e.calculateTimestampOffsetForEachSegment,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=ui(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return ph.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,k.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&ph.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ct();if(this.loaderType_==="main"){const{hasAudio:i,hasVideo:n,isMuxed:r}=e;if(n&&i&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,i=!1){if(!e)return null;const n=Yu(e);let r=this.initSegments_[n];return i&&!r&&e.bytes&&(this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,i=!1){if(!e)return null;const n=rS(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&i&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(r||e).resolvedUri};return r&&(s.bytes=r.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,i={}){if(!e)return;const n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(n&&(n.id?s=n.id:n.uri&&(s=n.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-n.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}r&&(r.mediaIndex-=a,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}pause(){this.checkBufferTimeout_&&(k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&ph.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,i,n=()=>{},r=!1){if(i===1/0&&(i=this.duration_()),i<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let s=1;const a=()=>{s--,s===0&&n()};(r||!this.audioDisabled_)&&(s++,this.sourceUpdater_.removeAudio(e,i,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=XO(this.gopBuffer_,e,i,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,i,a));for(const o in this.inbandTextTracks_)Na(e,i,this.inbandTextTracks_[o]);Na(e,i,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),YO)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&(typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,i=this.playlist_,n=this.partIndex){if(!i||!this.mediaSource_)return!1;const r=typeof e=="number"&&i.segments[e],s=e+1===i.segments.length,a=!r||!r.parts||n+1===r.parts.length;return i.endList&&this.mediaSource_.readyState==="open"&&s&&a}chooseNextRequest_(){const e=this.buffered_(),i=yv(e)||0,n=$m(e,this.currentTime_()),r=!this.hasPlayed_()&&n>=1,s=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||r||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=QO(this.currentTimeline_,a,i);else if(this.mediaIndex!==null){const _=a[this.mediaIndex],E=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=_.end?_.end:i,_.parts&&_.parts[E+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=E+1):o.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:_,startTime:E,partIndex:v}=Pt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?i:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${i}`:`currentTime ${this.currentTime_()}`,o.mediaIndex=_,o.startOfSegment=E,o.partIndex=v}const l=a[o.mediaIndex];let c=l&&typeof o.partIndex=="number"&&l.parts&&l.parts[o.partIndex];if(!l||typeof o.partIndex=="number"&&!c)return null;typeof o.partIndex!="number"&&l.parts&&(o.partIndex=0,c=l.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&c&&!p&&!c.independent)if(o.partIndex===0){const _=a[o.mediaIndex-1],E=_.parts&&_.parts.length&&_.parts[_.parts.length-1];E&&E.independent&&(o.mediaIndex-=1,o.partIndex=_.parts.length-1,o.independent="previous segment")}else l.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const m=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&m&&!this.seeking_()?null:this.generateSegmentInfo_(o)}generateSegmentInfo_(e){const{independent:i,playlist:n,mediaIndex:r,startOfSegment:s,isSyncRequest:a,partIndex:o,forceTimestampOffset:l,getMediaInfoForTime:c}=e,p=n.segments[r],m=typeof o=="number"&&p.parts[o],_={requestId:"segment-loader-"+Math.random(),uri:m&&m.resolvedUri||p.resolvedUri,mediaIndex:r,partIndex:m?o:null,isSyncRequest:a,startOfSegment:s,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:p.timeline,duration:m&&m.duration||p.duration,segment:p,part:m,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:c,independent:i},E=typeof l<"u"?l:this.isPendingTimestampOffset_;_.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:E});const v=yv(this.sourceUpdater_.audioBuffered());return typeof v=="number"&&(_.audioAppendStart=v-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(_.gopsToAlignWith=WO(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),_}timestampOffsetForSegment_(e){return eL(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const i=this.currentTime_(),n=e.bandwidth,r=this.pendingSegment_.duration,s=Pt.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),a=xI(this.buffered_(),i,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const o=RO({main:this.vhs_.playlists.main,currentTime:i,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=s-a-o.rebufferingImpact;let p=.5;a<=qn&&(p=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c{s[a.stream]=s[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=s[a.stream];o.startTime=Math.min(o.startTime,a.startTime+r),o.endTime=Math.max(o.endTime,a.endTime+r),o.captions.push(a)}),Object.keys(s).forEach(a=>{const{startTime:o,endTime:l,captions:c}=s[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${l} for ${a}`),FO(p,this.vhs_.tech_,a),Na(o,l,p[a]),UO({captionArray:c,inbandTextTracks:p,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,i,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,i,n));return}this.addMetadataToTextTrack(n,i,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(i=>i())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(i=>i())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Iv({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,i=this.getCurrentMediaInfo_();if(!e||!i)return!1;const{hasAudio:n,hasVideo:r,isMuxed:s}=i;return!(r&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||Iv({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,i));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[kv(i.type)].start;else{const r=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&r&&r.hasVideo;let a;s&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,i.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,i)}}updateAppendInitSegmentStatus(e,i){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[i]!==e.playlist&&(this.appendInitSegment_[i]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:i,map:n,playlist:r}){if(n){const s=Yu(n);if(this.activeInitSegmentId_===s)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=s}return i&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,i):null}handleQuotaExceededError_({segmentInfo:e,type:i,bytes:n},r){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+dr(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+dr(a).join(", "));const o=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(l-o<=Ea&&p-c<=Ea){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${dr(s).join(", ")}, video buffer: ${dr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:i,bytes:n}));const _=this.currentTime_()-Ea;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Ea}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=k.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Ea*1e3)},!0)}handleAppendError_({segmentInfo:e,type:i,bytes:n},r){if(r){if(r.code===xS){this.handleQuotaExceededError_({segmentInfo:e,type:i,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error(`${i} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data:r,bytes:s}){if(!s){const a=[r];let o=r.byteLength;n&&(a.unshift(n),o+=n.byteLength),s=BO({bytes:o,segments:a})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:i,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:i,bytes:s}))}handleSegmentTimingInfo_(e,i,n){if(!this.pendingSegment_||i!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,s=`${e}TimingInfo`;r[s]||(r[s]={}),r[s].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[s].transmuxedPresentationStart=n.start.presentation,r[s].transmuxedDecodeStart=n.start.decode,r[s].transmuxedPresentationEnd=n.end.presentation,r[s].transmuxedDecodeEnd=n.end.decode,r[s].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,i){const{type:n,data:r}=i;if(!r||!r.byteLength||n==="audio"&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:n,initSegment:i.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:s,data:r})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(()=>{const i=dn({},e,{forceTimestampOffset:!0});dn(e,this.generateSegmentInfo_(i)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||r&&s;this.logger_(`Requesting ${Vr(e)}`),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=kO({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:l,stream:c})=>{this.logger_(`${Vr(e)} logged from transmuxer stream ${c} as a ${l}: ${o}`)}})}trimBackBuffer_(e){const i=ZO(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);i>0&&this.remove(0,i)}createSimplifiedSegmentObj_(e){const i=e.segment,n=e.part,r={resolvedUri:n?n.resolvedUri:i.resolvedUri,byterange:n?n.byterange:i.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===i.timeline&&(s.videoTimingInfo?r.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(r.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),i.key){const a=i.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(i.key),r.key.iv=a}return i.map&&(r.map=this.initSegmentForMap(i.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,i){if(this.pendingSegment_.byteLength=i.bytesReceived,e"u"||c.end!==r+s?r:o.start}waitForAppendsToComplete_(e){const i=this.getCurrentMediaInfo_(e);if(!i){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:n,hasVideo:r,isMuxed:s}=i,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&n&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const i=JO(this.loaderType_,this.getCurrentMediaInfo_(),e);return i?(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let i=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),i=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),i=!0),i&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:i,timingInfo:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:i&&typeof i.transmuxedDecodeStart=="number"?i.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const i=this.getMediaInfo_(),r=this.loaderType_==="main"&&i&&i.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const i=iL(e,this.sourceType_);if(i&&(i.severity==="warn"?M.log.warn(i.message):this.logger_(i.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Vr(e)}`);return}this.logger_(`Appended ${Vr(e)}`),this.addSegmentMetadataCue_(e),this.currentTime_()>=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const n=e.segment,r=e.part,s=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(s||a){this.logger_(`bad ${s?"segment":"part"} ${Vr(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},nL=["video","audio"],Vf=(t,e)=>{const i=e[`${t}Buffer`];return i&&i.updating||e.queuePending[t]},rL=(t,e)=>{for(let i=0;i{if(e.queue.length===0)return;let i=0,n=e.queue[i];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),gs("audio",e),gs("video",e));return}if(t!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Vf(t,e))){if(n.type!==t){if(i=rL(t,e.queue),i===null)return;n=e.queue[i]}if(e.queue.splice(i,1),e.queuePending[t]=n,n.action(t,e),!n.doneFn){e.queuePending[t]=null,gs(t,e);return}}},ES=(t,e)=>{const i=e[`${t}Buffer`],n=SS(t);i&&(i.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),i.removeEventListener("error",e[`on${n}Error_`]),e.codecs[t]=null,e[`${t}Buffer`]=null)},Ai=(t,e)=>t&&e&&Array.prototype.indexOf.call(t.sourceBuffers,e)!==-1,Ft={appendBuffer:(t,e,i)=>(n,r)=>{const s=r[`${n}Buffer`];if(Ai(r.mediaSource,s)){r.logger_(`Appending segment ${e.mediaIndex}'s ${t.length} bytes to ${n}Buffer`);try{s.appendBuffer(t)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===xS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,i(a)}}},remove:(t,e)=>(i,n)=>{const r=n[`${i}Buffer`];if(Ai(n.mediaSource,r)){n.logger_(`Removing ${t} to ${e} from ${i}Buffer`);try{r.remove(t,e)}catch{n.logger_(`Remove ${t} to ${e} from ${i}Buffer failed`)}}},timestampOffset:t=>(e,i)=>{const n=i[`${e}Buffer`];Ai(i.mediaSource,n)&&(i.logger_(`Setting ${e}timestampOffset to ${t}`),n.timestampOffset=t)},callback:t=>(e,i)=>{t()},endOfStream:t=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(i){M.log.warn("Failed to call media source endOfStream",i)}}},duration:t=>e=>{e.logger_(`Setting mediaSource duration to ${t}`);try{e.mediaSource.duration=t}catch(i){M.log.warn("Failed to set media source duration",i)}},abort:()=>(t,e)=>{if(e.mediaSource.readyState!=="open")return;const i=e[`${t}Buffer`];if(Ai(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(n){M.log.warn(`Failed to abort on ${t}Buffer`,n)}}},addSourceBuffer:(t,e)=>i=>{const n=SS(t),r=go(e);i.logger_(`Adding ${t}Buffer with codec ${e} to mediaSource`);const s=i.mediaSource.addSourceBuffer(r);s.addEventListener("updateend",i[`on${n}UpdateEnd_`]),s.addEventListener("error",i[`on${n}Error_`]),i.codecs[t]=e,i[`${t}Buffer`]=s},removeSourceBuffer:t=>e=>{const i=e[`${t}Buffer`];if(ES(t,e),!!Ai(e.mediaSource,i)){e.logger_(`Removing ${t}Buffer with codec ${e.codecs[t]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(i)}catch(n){M.log.warn(`Failed to removeSourceBuffer ${t}Buffer`,n)}}},changeType:t=>(e,i)=>{const n=i[`${e}Buffer`],r=go(t);Ai(i.mediaSource,n)&&i.codecs[e]!==t&&(i.logger_(`changing ${e}Buffer codec from ${i.codecs[e]} to ${t}`),n.changeType(r),i.codecs[e]=t)}},Ut=({type:t,sourceUpdater:e,action:i,doneFn:n,name:r})=>{e.queue.push({type:t,action:i,doneFn:n,name:r}),gs(t,e)},Lv=(t,e)=>i=>{const n=e[`${t}Buffered`](),r=vI(n);if(e.logger_(`${t} source buffer update end. Buffered: +`,r),e.queuePending[t]){const s=e.queuePending[t].doneFn;e.queuePending[t]=null,s&&s(e[`${t}Error_`])}gs(t,e)};class bS extends M.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gs("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=ui("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Lv("video",this),this.onAudioUpdateEnd_=Lv("audio",this),this.onVideoError_=i=>{this.videoError_=i},this.onAudioError_=i=>{this.audioError_=i},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,i){Ut({type:"mediaSource",sourceUpdater:this,action:Ft.addSourceBuffer(e,i),name:"addSourceBuffer"})}abort(e){Ut({type:e,sourceUpdater:this,action:Ft.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){M.log.error("removeSourceBuffer is not supported!");return}Ut({type:"mediaSource",sourceUpdater:this,action:Ft.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!M.browser.IS_FIREFOX&&k.MediaSource&&k.MediaSource.prototype&&typeof k.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return k.SourceBuffer&&k.SourceBuffer.prototype&&typeof k.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,i){if(!this.canChangeType()){M.log.error("changeType is not supported!");return}Ut({type:e,sourceUpdater:this,action:Ft.changeType(i),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(i=>{const n=e[i];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(i,n);this.canChangeType()&&this.changeType(i,n)})}appendBuffer(e,i){const{segmentInfo:n,type:r,bytes:s}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,i]),this.logger_(`delayed audio append of ${s.length} until video append`);return}const a=i;if(Ut({type:r,sourceUpdater:this,action:Ft.appendBuffer(s,n||{mediaIndex:-1},a),doneFn:i,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return Ai(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ct()}videoBuffered(){return Ai(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ct()}buffered(){const e=Ai(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,i=Ai(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return i&&!e?this.audioBuffered():e&&!i?this.videoBuffered():TI(this.audioBuffered(),this.videoBuffered())}setDuration(e,i=Ji){Ut({type:"mediaSource",sourceUpdater:this,action:Ft.duration(e),name:"duration",doneFn:i})}endOfStream(e=null,i=Ji){typeof e!="string"&&(e=void 0),Ut({type:"mediaSource",sourceUpdater:this,action:Ft.endOfStream(e),name:"endOfStream",doneFn:i})}removeAudio(e,i,n=Ji){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}Ut({type:"audio",sourceUpdater:this,action:Ft.remove(e,i),doneFn:n,name:"remove"})}removeVideo(e,i,n=Ji){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}Ut({type:"video",sourceUpdater:this,action:Ft.remove(e,i),doneFn:n,name:"remove"})}updating(){return!!(Vf("audio",this)||Vf("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Ut({type:"audio",sourceUpdater:this,action:Ft.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Ut({type:"video",sourceUpdater:this,action:Ft.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Ut({type:"audio",sourceUpdater:this,action:Ft.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Ut({type:"video",sourceUpdater:this,action:Ft.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),nL.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>ES(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Nv=t=>decodeURIComponent(escape(String.fromCharCode.apply(null,t))),Rv=new Uint8Array(` + +`.split("").map(t=>t.charCodeAt(0)));class sL extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class aL extends $f{constructor(e,i={}){super(e,i),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return ct();const e=this.subtitlesTrack_.cues,i=e[0].startTime,n=e[e.length-1].startTime;return ct([[i,n]])}initSegmentForMap(e,i=!1){if(!e)return null;const n=Yu(e);let r=this.initSegments_[n];if(i&&!r&&e.bytes){const s=Rv.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(Rv,e.bytes.byteLength),this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,i){Na(e,i,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const i=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",i),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,i,n){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(i.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Ii.TIMEOUT&&this.handleTimeout_(),e.code===Ii.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,i.stats),i.key&&this.segmentKey(i.key,!0),this.state="APPENDING",this.trigger("appending");const s=r.segment;if(s.map&&(s.map.bytes=i.map.bytes),r.bytes=i.bytes,typeof k.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,i,n),()=>this.stopForError({message:"Error loading vtt.js"}));return}s.requested=!0;try{this.parseVTTCues_(r)}catch(a){this.stopForError({message:a.message});return}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(a=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new k.VTTCue(a.startTime,a.endTime,a.text):a)}),qO(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let i,n=!1;if(typeof k.WebVTT!="function")throw new sL;typeof k.TextDecoder=="function"?i=new k.TextDecoder("utf8"):(i=k.WebVTT.StringDecoder(),n=!0);const r=new k.WebVTT.Parser(k,k.vttjs,i);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=a=>{e.timestampmap=a},r.onparsingerror=a=>{M.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;n&&(a=Nv(a)),r.parse(a)}let s=e.bytes;n&&(s=Nv(s)),r.parse(s),r.flush()}updateTimeMapping_(e,i,n){const r=e.segment;if(!i)return;if(!e.cues.length){r.empty=!0;return}const s=e.timestampmap,a=s.MPEGTS/Fu.ONE_SECOND_IN_TS-s.LOCAL+i.mapping;if(e.cues.forEach(o=>{o.startTime+=a,o.endTime+=a}),!n.syncInfo){const o=e.cues[0].startTime,l=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(o,l-r.duration)}}}}const oL=function(t,e){const i=t.cues;for(let n=0;n=r.adStartTime&&e<=r.adEndTime)return r}return null},lL=function(t,e,i=0){if(!t.segments)return;let n=i,r;for(let s=0;si!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(t,e,i,n,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let s=null,a=null;const o=Lf(e);r=r||0;for(let l=0;l{let s=null,a=null;r=r||0;const o=Lf(e);for(let l=0;l=E)&&(a=E,s={time:_,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return s}},{name:"Discontinuity",run:(t,e,i,n,r)=>{let s=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o=m)&&(a=m,s={time:p.time,segmentIndex:l,partIndex:null})}}}return s}},{name:"Playlist",run:(t,e,i,n,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class cL extends M.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=ui("SyncController")}getSyncPoint(e,i,n,r){const s=this.runStrategies_(e,i,n,r);return s.length?this.selectSyncPoint_(s,{key:"time",value:r}):null}getExpiredTime(e,i){if(!e||!e.segments)return null;const n=this.runStrategies_(e,i,e.discontinuitySequence,0);if(!n.length)return null;const r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+Xa({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,i,n,r){const s=[];for(let a=0;auL){M.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let r=n-1;r>=0;r--){const s=e.segments[r];if(s&&typeof s.start<"u"){i.syncInfo={mediaSequence:e.mediaSequence+r,time:s.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time}, mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const i=e.segments[0],n=i.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[i.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:i}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,i),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const s=r.dateTimeObject;r.discontinuity&&i&&s&&(this.timelineToDatetimeMappings[r.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,i,n){const r=e.segment,s=e.part;let a=this.timelines[e.timeline],o,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-i.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,l=i.end+a.mapping;else if(a)o=i.start+a.mapping,l=i.end+a.mapping;else return!1;return s&&(s.start=o,s.end=l),(!r.start||ol){let c;o<0?c=n.start-Xa({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex,endIndex:s}):c=n.end+Xa({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:c,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class dL extends M.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:i,to:n}){return typeof i=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:i,to:n}){return typeof i=="number"&&typeof n=="number"&&(this.lastTimelineChanges_[e]={type:e,from:i,to:n},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const hL=cS(dS(function(){var t=function(){function S(){this.listeners={}}var D=S.prototype;return D.on=function(T,C){this.listeners[T]||(this.listeners[T]=[]),this.listeners[T].push(C)},D.off=function(T,C){if(!this.listeners[T])return!1;var P=this.listeners[T].indexOf(C);return this.listeners[T]=this.listeners[T].slice(0),this.listeners[T].splice(P,1),P>-1},D.trigger=function(T){var C=this.listeners[T];if(C)if(arguments.length===2)for(var P=C.length,O=0;O>7)*283)^P]=P;for(O=N=0;!T[O];O^=Q||1,N=V[N]||1)for(pe=N^N<<1^N<<2^N<<3^N<<4,pe=pe>>8^pe&255^99,T[O]=pe,C[pe]=O,re=F[J=F[Q=F[O]]],de=re*16843009^J*65537^Q*257^O*16843008,Y=F[pe]*257^pe*16843008,P=0;P<4;P++)D[P][O]=Y=Y<<24^Y>>>8,x[P][pe]=de=de<<24^de>>>8;for(P=0;P<5;P++)D[P]=D[P].slice(0),x[P]=x[P].slice(0);return S};let n=null;class r{constructor(D){n||(n=i()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let x,T,C;const P=this._tables[0][4],O=this._tables[1],N=D.length;let F=1;if(N!==4&&N!==6&&N!==8)throw new Error("Invalid aes key size");const V=D.slice(0),Q=[];for(this._key=[V,Q],x=N;x<4*N+28;x++)C=V[x-1],(x%N===0||N===8&&x%N===4)&&(C=P[C>>>24]<<24^P[C>>16&255]<<16^P[C>>8&255]<<8^P[C&255],x%N===0&&(C=C<<8^C>>>24^F<<24,F=F<<1^(F>>7)*283)),V[x]=V[x-N]^C;for(T=0;x;T++,x--)C=V[T&3?x:x-4],x<=4||T<4?Q[T]=C:Q[T]=O[0][P[C>>>24]]^O[1][P[C>>16&255]]^O[2][P[C>>8&255]]^O[3][P[C&255]]}decrypt(D,x,T,C,P,O){const N=this._key[1];let F=D^N[0],V=C^N[1],Q=T^N[2],J=x^N[3],re,pe,Y;const de=N.length/4-2;let pt,ce=4;const Ae=this._tables[1],q=Ae[0],te=Ae[1],ie=Ae[2],me=Ae[3],Se=Ae[4];for(pt=0;pt>>24]^te[V>>16&255]^ie[Q>>8&255]^me[J&255]^N[ce],pe=q[V>>>24]^te[Q>>16&255]^ie[J>>8&255]^me[F&255]^N[ce+1],Y=q[Q>>>24]^te[J>>16&255]^ie[F>>8&255]^me[V&255]^N[ce+2],J=q[J>>>24]^te[F>>16&255]^ie[V>>8&255]^me[Q&255]^N[ce+3],ce+=4,F=re,V=pe,Q=Y;for(pt=0;pt<4;pt++)P[(3&-pt)+O]=Se[F>>>24]<<24^Se[V>>16&255]<<16^Se[Q>>8&255]<<8^Se[J&255]^N[ce++],re=F,F=V,V=Q,Q=J,J=re}}class s extends t{constructor(){super(t),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(D){this.jobs.push(D),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(S){return S<<24|(S&65280)<<8|(S&16711680)>>8|S>>>24},o=function(S,D,x){const T=new Int32Array(S.buffer,S.byteOffset,S.byteLength>>2),C=new r(Array.prototype.slice.call(D)),P=new Uint8Array(S.byteLength),O=new Int32Array(P.buffer);let N,F,V,Q,J,re,pe,Y,de;for(N=x[0],F=x[1],V=x[2],Q=x[3],de=0;de{const T=S[x];_(T)?D[x]={bytes:T.buffer,byteOffset:T.byteOffset,byteLength:T.byteLength}:D[x]=T}),D};self.onmessage=function(S){const D=S.data,x=new Uint8Array(D.encrypted.bytes,D.encrypted.byteOffset,D.encrypted.byteLength),T=new Uint32Array(D.key.bytes,D.key.byteOffset,D.key.byteLength/4),C=new Uint32Array(D.iv.bytes,D.iv.byteOffset,D.iv.byteLength/4);new l(x,T,C,function(P,O){self.postMessage(v({source:D.source,decrypted:O}),[O.buffer])})}}));var fL=uS(hL);const pL=t=>{let e=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},CS=(t,e)=>{t.abort(),t.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Hf=(t,e)=>{e.activePlaylistLoader=t,t.load()},mL=(t,e)=>()=>{const{segmentLoaders:{[t]:i,main:n},mediaTypes:{[t]:r}}=e,s=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,l=r.lastGroup_;if(!(a&&l&&a.id===l.id)&&(r.lastGroup_=a,r.lastTrack_=s,CS(i,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}i.resyncLoader(),Hf(a.playlistLoader,r)}},gL=(t,e)=>()=>{const{segmentLoaders:{[t]:i},mediaTypes:{[t]:n}}=e;n.lastGroup_=null,i.abort(),i.pause()},yL=(t,e)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[t]:n,main:r},mediaTypes:{[t]:s}}=e,a=s.activeTrack(),o=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_;if(!(c&&a&&c.id===a.id)&&(s.lastGroup_=o,s.lastTrack_=a,CS(n,s),!!o)){if(o.isMainPlaylist){if(!a||!c||a.id===c.id)return;const p=e.vhs.playlistController_,m=p.selectPlaylist();if(p.media()===m)return;s.logger_(`track change. Switching main audio from ${c.id} to ${a.id}`),i.pause(),r.resetEverything(),p.fastQualityChange_(m);return}if(t==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}n.setAudio(!0),r.setAudio(!1)}if(l===o.playlistLoader){Hf(o.playlistLoader,s);return}n.track&&n.track(a),n.resetEverything(),Hf(o.playlistLoader,s)}},ec={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:i},excludePlaylist:n}=e,r=i.activeTrack(),s=i.activeGroup(),a=(s.filter(l=>l.default)[0]||s[0]).id,o=i.tracks[a];if(r===o){n({error:{message:"Problem encountered loading the default audio track."}});return}M.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in i.tracks)i.tracks[l].enabled=i.tracks[l]===o;i.onTrackChanged()},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:i}}=e;M.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=i.activeTrack();n&&(n.mode="disabled"),i.onTrackChanged()}},Bv={AUDIO:(t,e,i)=>{if(!e)return;const{tech:n,requestOptions:r,segmentLoaders:{[t]:s}}=i;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,r),(!n.paused()||a.endList&&n.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),r),n.paused()||s.load()}),e.on("error",ec[t](t,i))},SUBTITLES:(t,e,i)=>{const{tech:n,requestOptions:r,segmentLoaders:{[t]:s},mediaTypes:{[t]:a}}=i;e.on("loadedmetadata",()=>{const o=e.media();s.playlist(o,r),s.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),r),n.paused()||s.load()}),e.on("error",ec[t](t,i))}},vL={AUDIO:(t,e)=>{const{vhs:i,sourceType:n,segmentLoaders:{[t]:r},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[t]:{groups:o,tracks:l,logger_:c}},mainPlaylistLoader:p}=e,m=Uo(p.main);(!a[t]||Object.keys(a[t]).length===0)&&(a[t]={main:{default:{default:!0}}},m&&(a[t].main.default.playlists=p.main.playlists));for(const _ in a[t]){o[_]||(o[_]=[]);for(const E in a[t][_]){let v=a[t][_][E],S;if(m?(c(`AUDIO group '${_}' label '${E}' is a main playlist`),v.isMainPlaylist=!0,S=null):n==="vhs-json"&&v.playlists?S=new rs(v.playlists[0],i,s):v.resolvedUri?S=new rs(v.resolvedUri,i,s):v.playlists&&n==="dash"?S=new Uf(v.playlists[0],i,s,p):S=null,v=Te({id:E,playlistLoader:S},v),Bv[t](t,v.playlistLoader,e),o[_].push(v),typeof l[E]>"u"){const D=new M.AudioTrack({id:E,kind:pL(v),enabled:!1,language:v.language,default:v.default,label:E});l[E]=D}}}r.on("error",ec[t](t,e))},SUBTITLES:(t,e)=>{const{tech:i,vhs:n,sourceType:r,segmentLoaders:{[t]:s},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[t]:{groups:l,tracks:c}},mainPlaylistLoader:p}=e;for(const m in o[t]){l[m]||(l[m]=[]);for(const _ in o[t][m]){if(!n.options_.useForcedSubtitles&&o[t][m][_].forced)continue;let E=o[t][m][_],v;if(r==="hls")v=new rs(E.resolvedUri,n,a);else if(r==="dash"){if(!E.playlists.filter(D=>D.excludeUntil!==1/0).length)return;v=new Uf(E.playlists[0],n,a,p)}else r==="vhs-json"&&(v=new rs(E.playlists?E.playlists[0]:E.resolvedUri,n,a));if(E=Te({id:_,playlistLoader:v},E),Bv[t](t,E.playlistLoader,e),l[m].push(E),typeof c[_]>"u"){const S=i.addRemoteTextTrack({id:_,kind:"subtitles",default:E.default&&E.autoselect,language:E.language,label:_},!1).track;c[_]=S}}}s.on("error",ec[t](t,e))},"CLOSED-CAPTIONS":(t,e)=>{const{tech:i,main:{mediaGroups:n},mediaTypes:{[t]:{groups:r,tracks:s}}}=e;for(const a in n[t]){r[a]||(r[a]=[]);for(const o in n[t][a]){const l=n[t][a][o];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const c=i.options_.vhs&&i.options_.vhs.captionServices||{};let p={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[p.instreamId]&&(p=Te(p,c[p.instreamId])),p.default===void 0&&delete p.default,r[a].push(Te({id:o},l)),typeof s[o]>"u"){const m=i.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;s[o]=m}}}}},wS=(t,e)=>{for(let i=0;ii=>{const{mainPlaylistLoader:n,mediaTypes:{[t]:{groups:r}}}=e,s=n.media();if(!s)return null;let a=null;s.attributes[t]&&(a=r[s.attributes[t]]);const o=Object.keys(r);if(!a)if(t==="AUDIO"&&o.length>1&&Uo(e.main))for(let l=0;l"u"?a:i===null||!a?null:a.filter(l=>l.id===i.id)[0]||null},TL={AUDIO:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:i}}}=e;for(const n in i)if(i[n].enabled)return i[n];return null},SUBTITLES:(t,e)=>()=>{const{mediaTypes:{[t]:{tracks:i}}}=e;for(const n in i)if(i[n].mode==="showing"||i[n].mode==="hidden")return i[n];return null}},xL=(t,{mediaTypes:e})=>()=>{const i=e[t].activeTrack();return i?e[t].activeGroup(i):null},SL=t=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(c=>{vL[c](c,t)});const{mediaTypes:e,mainPlaylistLoader:i,tech:n,vhs:r,segmentLoaders:{["AUDIO"]:s,main:a}}=t;["AUDIO","SUBTITLES"].forEach(c=>{e[c].activeGroup=_L(c,t),e[c].activeTrack=TL[c](c,t),e[c].onGroupChanged=mL(c,t),e[c].onGroupChanging=gL(c,t),e[c].onTrackChanged=yL(c,t),e[c].getActiveGroup=xL(c,t)});const o=e.AUDIO.activeGroup();if(o){const c=(o.filter(m=>m.default)[0]||o[0]).id;e.AUDIO.tracks[c].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",l),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{n.audioTracks().removeEventListener("change",l),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const c in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[c])},EL=()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ji,activeTrack:Ji,getActiveGroup:Ji,onGroupChanged:Ji,onTrackChanged:Ji,lastTrack_:null,logger_:ui(`MediaGroups[${e}]`)}}),t};class Fv{constructor(){this.priority_=[]}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=$t(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}}class bL extends M.EventTarget{constructor(e,i){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.availablePathways_=new Set,this.excludedPathways_=new Set,this.steeringManifest=new Fv,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.logger_=ui("Content Steering"),this.xhr_=e,this.getBandwidth_=i}assignTagProperties(e,i){this.manifestType_=i.serverUri?"HLS":"DASH";const n=i.serverUri||i.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=this.queryBeforeStart?n:$t(e,n),this.defaultPathway=i.pathwayId||i.defaultServiceLocation,this.queryBeforeStart=i.queryBeforeStart||!1,this.proxyServerUrl_=i.proxyServerURL||null,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"),this.queryBeforeStart&&this.requestSteeringManifest(this.steeringManifest.reloadUri)}requestSteeringManifest(e){const i=this.steeringManifest.reloadUri;if(!e&&!i)return;const n=e||this.getRequestURI(i);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:n},(r,s)=>{if(r){if(s.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(s.status===429){const o=s.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${o} seconds.`),this.startTTLTimeout_(parseInt(o,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}const a=JSON.parse(this.request_.responseText);this.startTTLTimeout_(),this.assignSteeringProperties_(a)})}setProxyServerUrl_(e){const i=new k.URL(e),n=new k.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(i.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const i=JSON.parse(k.atob(e));this.assignSteeringProperties_(i)}setSteeringParams_(e){const i=new k.URL(e),n=this.getPathway(),r=this.getBandwidth_();if(n){const s=`_${this.manifestType_}_pathway`;i.searchParams.set(s,n)}if(r){const s=`_${this.manifestType_}_throughput`;i.searchParams.set(s,r)}return i.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const n=(r=>{for(const s of r)if(this.availablePathways_.has(s))return s;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==n&&(this.currentPathway=n,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const i=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!i(r))return r}const n=this.setSteeringParams_(e);return i(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const i=e*1e3;this.ttlTimeout_=k.setTimeout(()=>{this.requestSteeringManifest()},i)}clearTTLTimeout_(){k.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.excludedPathways_=new Set,this.steeringManifest=new Fv}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}}const CL=10;let Xi;const wL=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],AL=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},DL=function({currentPlaylist:t,buffered:e,currentTime:i,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:a,bufferBasedABR:o,log:l}){if(!n)return M.log.warn("We received no playlist to switch to. Please check your stream."),!1;const c=`allowing switch ${t&&t.id||"null"} -> ${n.id}`;if(!t)return l(`${c} as current playlist is not set`),!0;if(n.id===t.id)return!1;const p=!!ns(e,i).length;if(!t.endList)return!p&&typeof t.partTargetDuration=="number"?(l(`not ${c} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${c} as current playlist is live`),!0);const m=$m(e,i),_=o?Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ze.MAX_BUFFER_LOW_WATER_LINE;if(a<_)return l(`${c} as duration < max low water line (${a} < ${_})`),!0;const E=n.attributes.BANDWIDTH,v=t.attributes.BANDWIDTH;if(Ev)&&m>=r){let S=`${c} as forwardBuffer >= bufferLowWaterLine (${m} >= ${r})`;return o&&(S+=` and next bandwidth > current bandwidth (${E} > ${v})`),l(S),!0}return l(`not ${c} as no switching criteria met`),!1};class kL extends M.EventTarget{constructor(e){super();const{src:i,withCredentials:n,tech:r,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:c,sourceType:p,cacheEncryptionKeys:m,bufferBasedABR:_,leastPixelDiffSelector:E,captionServices:v}=e;if(!i)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:S}=e;(S===null||typeof S>"u")&&(S=1/0),Xi=a,this.bufferBasedABR=!!_,this.leastPixelDiffSelector=!!E,this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=p,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=S,this.enableLowInitialPlaylist=c,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:S,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=EL(),this.mediaSource=new k.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=ct(),this.hasPlayed_=!1,this.syncController_=new cL(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new fL,this.sourceUpdater_=new bS(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new dL;const D={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:v,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:m,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Uf(i,this.vhs_,Te(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new rs(i,this.vhs_,Te(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new $f(Te(D,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new $f(Te(D,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new aL(Te(D,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((C,P)=>{function O(){r.off("vttjserror",N),C()}function N(){r.off("vttjsloaded",O),P()}r.one("vttjsloaded",O),r.one("vttjserror",N),r.addWebVttScript_()})}),e);const x=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new bL(this.vhs_.xhr,x),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),wL.forEach(C=>{this[C+"_"]=AL.bind(this,C)}),this.logger_=ui("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 T=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(T,()=>{const C=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-C,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),i=this.audioAppendsToLoadedData_();return e===-1||i===-1?-1:e+i}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const i=this.selectPlaylist();i&&this.shouldSwitchToMedia_(i)&&this.switchMedia_(i,e)}switchMedia_(e,i,n){const r=this.media(),s=r&&(r.id||r.uri),a=e.id||e.uri;s&&s!==a&&(this.logger_(`switch media ${s} -> ${a} from ${i}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${i}`})),this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const i=this.mediaTypes_[e],n=i?i.activeGroup():null,r=this.contentSteeringController_.getPathway();if(n&&r){const a=(n.length?n[0].playlists:n.playlists).filter(o=>o.attributes.serviceLocation===r);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=k.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(k.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),i=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return i;const n=e.mediaGroups.AUDIO,r=Object.keys(n);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||r.length&&n[r[0]];for(const l in o)if(o[l].default){s={label:l};break}}if(!s)return i;const a=[];for(const o in n)if(n[o][s.label]){const l=n[o][s.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(e.playlists.length)for(let c=0;c{const e=this.mainPlaylistLoader_.media(),i=e.targetDuration*1.5*1e3;Nf(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),SL({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(),e),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 e=this.mainPlaylistLoader_.media();if(!e){this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),i=e.targetDuration*1.5*1e3;Nf(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(e)&&(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"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,i){const n=e.mediaGroups||{};let r=!0;const s=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Xi.Playlist.isAes(i)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(n.AUDIO[s[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_(e){const i=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return DL({buffered:a,currentTime:n,currentPlaylist:i,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:s,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 i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),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.mainSegmentLoader_.on("earlyabort",i=>{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:CL}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),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()})}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()}fastQualityChange_(e=this.selectPlaylist()){if(e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments()}resetMainLoaderReplaceSegments(){const e=this.tech_.buffered(),i=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=i,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const i=this.duration();e[e.length-1].endTime=isNaN(i)||Math.abs(i)===1/0?Number.MAX_VALUE:i}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const i=this.mainSegmentLoader_.getCurrentMediaInfo_();!i||i.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const n=this.syncController_.getExpiredTime(e,this.duration());if(n===null)return!1;const r=Xi.Playlist.playlistEnd(e,n),s=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-s<=Pi;const o=a.end(a.length-1);return o-s<=Pi&&r-o<=Pi}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:i={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||i.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=i,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,s=r.filter(Wc),a=s.length===1&&s[0]===e;if(r.length===1&&n!==1/0)return M.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const v=this.pathwayAttribute_(e),S=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(v),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(v)},S);return}let E=!1;r.forEach(v=>{if(v===e)return;const S=v.excludeUntil;typeof S<"u"&&S!==1/0&&(E=!0,delete v.excludeUntil)}),E&&(M.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,i.reason&&(e.lastExcludeReason_=i.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 c=i.internal?this.logger_:M.log.warn,p=i.message?" "+i.message:"";c(`${i.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const m=l.targetDuration/2*1e3||5*1e3,_=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=m;return this.switchMedia_(l,"exclude",a||_)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,i){const n=[],r=e==="all";(r||e==="main")&&n.push(this.mainPlaylistLoader_);const s=[];(r||e==="audio")&&s.push("AUDIO"),(r||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>i.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const i=ns(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(i&&i.length)return e;this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Xi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let i=this.mainPlaylistLoader_.media();if(!i)return;let n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return;const r=this.mainPlaylistLoader_.main,s=Xi.Playlist.seekable(i,n,Xi.Playlist.liveEdgeDelay(r,i));if(s.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(i=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),n=this.syncController_.getExpiredTime(i,this.duration()),n===null||(e=Xi.Playlist.seekable(i,n,Xi.Playlist.liveEdgeDelay(r,i)),e.length===0)))return;let a,o;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),o=this.seekable_.start(0)),e?e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=ct([[e.start(0)>s.start(0)?e.start(0):s.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const i=this.mediaTypes_[e].groups;for(const n in i)i[n].forEach(r=>{r.playlistLoader&&r.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 e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,i=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!i||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=Qa(this.main(),i),r={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=n.video||e.main.videoCodec||Jk),e.main.isMuxed&&(r.video+=`,${n.audio||e.main.audioCodec||_y}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(r.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||_y,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(c,p)=>c?Yl(p):Zd(p),o={};let l;if(["video","audio"].forEach(function(c){if(r.hasOwnProperty(c)&&!a(e[c].isFmp4,r[c])){const p=e[c].isFmp4?"browser":"muxer";o[p]=o[p]||[],o[p].push(r[c]),c==="audio"&&(l=p)}}),s&&l&&i.attributes.AUDIO){const c=i.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===c&&p!==i&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${c} as ${l} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const c=Object.keys(o).reduce((p,m)=>(p&&(p+=", "),p+=`${m} does not support codec(s): "${o[m].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:c},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const c=[];if(["video","audio"].forEach(p=>{const m=(wi(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,_=(wi(r[p]||"")[0]||{}).type;m&&_&&m.toLowerCase()!==_.toLowerCase()&&c.push(`"${this.sourceUpdater_.codecs[p]}" -> "${r[p]}"`)}),c.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${c.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const i=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(i)}excludeUnsupportedVariants_(){const e=this.main().playlists,i=[];Object.keys(e).forEach(n=>{const r=e[n];if(i.indexOf(r.id)!==-1)return;i.push(r.id);const s=Qa(this.main,r),a=[];s.audio&&!Zd(s.audio)&&!Yl(s.audio)&&a.push(`audio codec ${s.audio}`),s.video&&!Zd(s.video)&&!Yl(s.video)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const i=[],n=this.main().playlists,r=Ju(wi(e)),s=bv(r),a=r.video&&wi(r.video)[0]||null,o=r.audio&&wi(r.audio)[0]||null;Object.keys(n).forEach(l=>{const c=n[l];if(i.indexOf(c.id)!==-1||c.excludeUntil===1/0)return;i.push(c.id);const p=[],m=Qa(this.mainPlaylistLoader_.main,c),_=bv(m);if(!(!m.audio&&!m.video)){if(_!==s&&p.push(`codec count "${_}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const E=m.video&&wi(m.video)[0]||null,v=m.audio&&wi(m.audio)[0]||null;E&&a&&E.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${E.type}" !== "${a.type}"`),v&&o&&v.type.toLowerCase()!==o.type.toLowerCase()&&p.push(`audio codec "${v.type}" !== "${o.type}"`)}p.length&&(c.excludeUntil=1/0,this.logger_(`excluding ${c.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let i=0;const n=this.seekable();n.length&&(i=n.start(0)),lL(e,this.cueTagsTrack_,i)}goalBufferLength(){const e=this.tech_.currentTime(),i=Ze.GOAL_BUFFER_LENGTH,n=Ze.GOAL_BUFFER_LENGTH_RATE,r=Math.max(i,Ze.MAX_GOAL_BUFFER_LENGTH);return Math.min(i+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),i=Ze.BUFFER_LOW_WATER_LINE,n=Ze.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(i,Ze.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(i,Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(i+e*n,this.bufferBasedABR?s:r)}bufferHighWaterLine(){return Ze.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Av(this.inbandTextTracks_,"com.apple.streaming",this.tech_),zO({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,i,n){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Av(this.inbandTextTracks_,e,this.tech_),$O({inbandTextTracks:this.inbandTextTracks_,metadataArray:i,timestampOffset:r,videoDuration:n})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(!e.contentSteering)return;const i=n=>{for(const r of n.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(r));this.contentSteeringController_.assignTagProperties(n.uri,n.contentSteering)};i(e),this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("mediaupdatetimeout",()=>{this.mainPlaylistLoader_.refreshMedia_(this.mainPlaylistLoader_.media().id),this.contentSteeringController_.abort(),this.contentSteeringController_.clearTTLTimeout_(),this.contentSteeringController_.clearAvailablePathways(),i(this.main())}),this.contentSteeringController_.queryBeforeStart||this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;const n=this.main().playlists,r=new Set;let s=!1;Object.keys(n).forEach(a=>{const o=n[a],l=this.pathwayAttribute_(o),c=l&&e!==l;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!c&&(delete o.excludeUntil,delete o.lastExcludeReason_,s=!0);const m=!o.excludeUntil&&o.excludeUntil!==1/0;!r.has(o.id)&&c&&m&&(r.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const l=o.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(s=!0)}}),s&&this.changeSegmentPathway_()}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}}const PL=(t,e,i)=>n=>{const r=t.main.playlists[e],s=Hm(r),a=Wc(r);return typeof n>"u"?a:(n?delete r.disabled:r.disabled=!0,n!==a&&!s&&(i(),n?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),n)};class IL{constructor(e,i,n){const{playlistController_:r}=e,s=r.fastQualityChange_.bind(r);if(i.attributes){const a=i.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=i.attributes.BANDWIDTH,this.frameRate=i.attributes["FRAME-RATE"]}this.codecs=Qa(r.main(),i),this.playlist=i,this.id=n,this.enabled=PL(e.playlists,i.id,s)}}const OL=function(t){t.representations=()=>{const e=t.playlistController_.main(),i=Uo(e)?t.playlistController_.getAudioTrackPlaylists_():e.playlists;return i?i.filter(n=>!Hm(n)).map((n,r)=>new IL(t,n,n.id)):[]}},Uv=["seeking","seeked","pause","playing","error"];class LL{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=ui("PlaybackWatcher"),this.logger_("initialize");const i=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach(p=>{l[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",l[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",l[p].reset),this.tech_.on(["seeked","seeking"],l[p].reset)});const c=p=>{["main","audio"].forEach(m=>{a[`${m}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),c("off"))},this.clearSeekingAppendCheck_=()=>c("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),c("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Uv,s),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Uv,s),this.tech_.off("canplay",n),this.tech_.off("play",i),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",l[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",l[p].reset),this.tech_.off(["seeked","seeking"],l[p].reset)}),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=k.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const i=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=i.buffered_()}checkSegmentDownloads_(e){const i=this.playlistController_,n=i[`${e}SegmentLoader_`],r=n.buffered_(),s=SI(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,s){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:n.playlist_&&n.playlist_.id,buffered:dr(r)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&i.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),i=this.tech_.buffered();if(this.lastRecordedTime===e&&(!i.length||e+Pi>=i.end(i.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const i=this.seekable(),n=this.tech_.currentTime(),r=this.afterSeekableWindow_(i,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let s;if(r&&(s=i.end(i.length-1)),this.beforeSeekableWindow_(i,n)){const v=i.start(0);s=v+(v===i.end(0)?0:Pi)}if(typeof s<"u")return this.logger_(`Trying to seek outside of seekable at time ${n} with seekable range ${$x(i)}. Seeking to ${s}.`),this.tech_.setCurrentTime(s),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,c=a.videoBuffer?a.videoBuffered():null,p=this.media(),m=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-qn)*2,_=[l,c];for(let v=0;v<_.length;v++){if(!_[v])continue;if($m(_[v],n) ${n.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),i=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,i)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${i}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const n=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:i}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=Rl(r,i);return a.length>0?(this.logger_(`Stopped at ${i} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(i),!0):!1}afterSeekableWindow_(e,i,n,r=!1){if(!e.length)return!1;let s=e.end(e.length-1)+Pi;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||r)&&(s=e.end(e.length-1)+n.targetDuration*3),i>s}beforeSeekableWindow_(e,i){return!!(e.length&&e.start(0)>0&&i2)return{start:s,end:a}}return null}}const NL={errorInterval:30,getSource(t){const i=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return t(i)}},AS=function(t,e){let i=0,n=0;const r=Te(NL,e);t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){n&&t.currentTime(n)},a=function(p){p!=null&&(n=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(p),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())},o=function(){if(Date.now()-i{Object.defineProperty(Me,t,{get(){return M.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),Ze[t]},set(e){if(M.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){M.log.warn(`value of Vhs.${t} must be greater than or equal to 0`);return}Ze[t]=e}})});const kS="videojs-vhs",PS=function(t,e){const i=e.media();let n=-1;for(let r=0;r{t.addQualityLevel(i)}),PS(t,e.playlists)};Me.canPlaySource=function(){return M.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const $L=(t,e,i)=>{if(!t)return t;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=Ju(wi(e.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);const r=go(n.video),s=go(n.audio),a={};for(const o in t)a[o]={},s&&(a[o].audioContentType=s),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof t[o]=="string"&&(a[o].url=t[o]);return Te(t,a)},VL=(t,e)=>t.reduce((i,n)=>{if(!n.contentProtection)return i;const r=e.reduce((s,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(s[a]={pssh:o.pssh}),s},{});return Object.keys(r).length&&i.push(r),i},[]),HL=({player:t,sourceKeySystems:e,audioMedia:i,mainPlaylists:n})=>{if(!t.eme.initializeMediaKeys)return Promise.resolve();const r=i?n.concat([i]):n,s=VL(r,Object.keys(e)),a=[],o=[];return s.forEach(l=>{o.push(new Promise((c,p)=>{t.tech_.one("keysessioncreated",c)})),a.push(new Promise((c,p)=>{t.eme.initializeMediaKeys({keySystems:l},m=>{if(m){p(m);return}c()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},zL=({player:t,sourceKeySystems:e,media:i,audioMedia:n})=>{const r=$L(e,i,n);return r?(t.currentSource().keySystems=r,r&&!t.eme?(M.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},IS=()=>{if(!k.localStorage)return null;const t=k.localStorage.getItem(kS);if(!t)return null;try{return JSON.parse(t)}catch{return null}},qL=t=>{if(!k.localStorage)return!1;let e=IS();e=e?Te(e,t):t;try{k.localStorage.setItem(kS,JSON.stringify(e))}catch{return!1}return e},WL=t=>t.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(t.substring(t.indexOf(",")+1)):t,OS=(t,e)=>{t._requestCallbackSet||(t._requestCallbackSet=new Set),t._requestCallbackSet.add(e)},LS=(t,e)=>{t._responseCallbackSet||(t._responseCallbackSet=new Set),t._responseCallbackSet.add(e)},NS=(t,e)=>{t._requestCallbackSet&&(t._requestCallbackSet.delete(e),t._requestCallbackSet.size||delete t._requestCallbackSet)},RS=(t,e)=>{t._responseCallbackSet&&(t._responseCallbackSet.delete(e),t._responseCallbackSet.size||delete t._responseCallbackSet)};Me.supportsNativeHls=function(){if(!H||!H.createElement)return!1;const t=H.createElement("video");return M.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(i){return/maybe|probably/i.test(t.canPlayType(i))}):!1}();Me.supportsNativeDash=function(){return!H||!H.createElement||!M.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(H.createElement("video").canPlayType("application/dash+xml"))}();Me.supportsTypeNatively=t=>t==="hls"?Me.supportsNativeHls:t==="dash"?Me.supportsNativeDash:!1;Me.isSupported=function(){return M.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Me.xhr.onRequest=function(t){OS(Me.xhr,t)};Me.xhr.onResponse=function(t){LS(Me.xhr,t)};Me.xhr.offRequest=function(t){NS(Me.xhr,t)};Me.xhr.offResponse=function(t){RS(Me.xhr,t)};const GL=M.getComponent("Component");class MS extends GL{constructor(e,i,n){if(super(i,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=ui("VhsHandler"),i.options_&&i.options_.playerId){const r=M.getPlayer(i.options_.playerId);this.player_=r}if(this.tech_=i,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(H,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const s=H.fullscreenElement||H.webkitFullscreenElement||H.mozFullScreenElement||H.msFullscreenElement;s&&s.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_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!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=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!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 e=IS();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ze.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ze.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{typeof this.source_[e]<"u"&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,i){if(!e)return;this.setOptions_(),this.options_.src=WL(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Me,this.options_.sourceType=M2(i),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.playlistController_=new kL(this.options_);const n=Te({liveRangeSafeTimeDelta:Pi},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new LL(n),this.playlistController_.on("error",()=>{const s=M.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}),s.error(a)});const r=this.options_.bufferBasedABR?Me.movingAverageBandwidthSelector(.55):Me.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Me.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(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=k.navigator.connection||k.navigator.mozConnection||k.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=o&&s>=o?s=Math.max(s,l):s=l}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){M.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:()=>dr(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:()=>dr(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&&qL({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{OL(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_=k.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),HL({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(i=>{this.logger_("error while creating EME key session",i),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 e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=zL({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{if(n.status!=="output-restricted")return;const r=this.playlistController_.main();if(!r||!r.playlists)return;const s=[];r.playlists.forEach(a=>{a&&a.attributes&&a.attributes.RESOLUTION&&a.attributes.RESOLUTION.height>=720&&(!a.excludeUntil||a.excludeUntil<1/0)&&(a.excludeUntil=1/0,s.push(a))}),s.length&&(M.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...s),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!i){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=M.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{jL(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{PS(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":DS,"mux.js":ML,"mpd-parser":BL,"m3u8-parser":FL,"aes-decrypter":UL}}version(){return this.constructor.version()}canChangeType(){return bS.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}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_&&k.URL.revokeObjectURL&&(k.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,i){return tO({playlist:this.playlistController_.media(),time:e,callback:i})}seekToProgramTime(e,i,n=!0,r=2){return oS({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:i})}setupXhrHooks_(){this.xhr.onRequest=e=>{OS(this.xhr,e)},this.xhr.onResponse=e=>{LS(this.xhr,e)},this.xhr.offRequest=e=>{NS(this.xhr,e)},this.xhr.offResponse=e=>{RS(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const tc={name:"videojs-http-streaming",VERSION:DS,canHandleSource(t,e={}){const i=Te(M.options,e);return tc.canPlayType(t.type,i)},handleSource(t,e,i={}){const n=Te(M.options,i);return e.vhs=new MS(t,e,n),e.vhs.xhr=iS(),e.vhs.setupXhrHooks_(),e.vhs.src(t.src,t.type),e.vhs},canPlayType(t,e){const i=M2(t);if(!i)return"";const n=tc.getOverrideNative(e);return!Me.supportsTypeNatively(i)||n?"maybe":""},getOverrideNative(t={}){const{vhs:e={}}=t,i=!(M.browser.IS_ANY_SAFARI||M.browser.IS_IOS),{overrideNative:n=i}=e;return n}},XL=()=>Yl("avc1.4d400d,mp4a.40.2");XL()&&M.getTech("Html5").registerSourceHandler(tc,0);M.VhsHandler=MS;M.VhsSourceHandler=tc;M.Vhs=Me;M.use||M.registerComponent("Vhs",Me);M.options.vhs=M.options.vhs||{};(!M.getPlugin||!M.getPlugin("reloadSourceOnError"))&&M.registerPlugin("reloadSourceOnError",RL);const KL=({video:t})=>{var l;const[e,i]=X.useState(""),n="http://43.202.196.35:5002/api/chat/create",[r,s]=X.useState(void 0),a=async()=>{try{const c=await fetch(`http://13.209.86.34:5002/api/chat/list?video_name=${t}`);if(!c.ok)throw new Error("Network response was not ok");const m=(await c.json()).chats.slice(0,7).reverse();s({chats:m})}catch(c){console.error("Error fetching chat list:",c)}},o=async()=>{try{if(!(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({video_name:t,content:e})})).ok)throw new Error("Network response was not ok");console.log("Message sent successfully"),i("")}catch(c){console.error("Error sending message:",c)}};return X.useEffect(()=>{a();const c=setInterval(a,1e3);return()=>clearInterval(c)},[t]),W.jsxs("div",{className:"fixed bottom-0 left-0 w-full px-6",children:[W.jsx("div",{children:(l=r==null?void 0:r.chats)==null?void 0:l.map((c,p)=>W.jsxs("div",{className:"flex flex-row gap-4 w-full overflow-x-scroll mb-4",children:[W.jsx("div",{children:"익명"}),W.jsx("div",{className:"font-bold",children:c.content}),W.jsx("div",{className:"text-[12px]",children:c.created_at})]},p))}),W.jsxs("div",{className:"flex flex-row mb-4",children:[W.jsx("input",{className:"w-full px-4 py-2 input-style rounded-l",type:"text",placeholder:"내용을 입력하세요.",value:e,onChange:c=>i(c.target.value)}),W.jsx("button",{className:"bg-white px-4 py-2 text-black min-w-fit",onClick:o,children:"전송"})]})]})},QL=()=>{const t=X.useRef(null),{video:e}=SD();return X.useEffect(()=>{if(!t.current)return;const i={controls:!0,fluid:!0,sources:[{src:`https://furiosa-video.s3.ap-northeast-2.amazonaws.com/convert/${e}`,type:"video/mp4"}]},n=M(t.current,i,function(){console.log("Player is ready")});return()=>{n&&n.dispose()}},[e]),W.jsxs(W.Fragment,{children:[W.jsx("div",{"data-vjs-player":!0,children:W.jsx("video",{ref:t,className:"video-js vjs-big-play-centered"})}),W.jsx(KL,{video:e})]})},YL="/noc-client/assets/thumbnail-U4Odmowz.png",JL=({title:t,date:e})=>{const i=Sc(),n=()=>{i(`/view/${t}`)};return W.jsx("button",{onClick:n,children:W.jsxs("div",{className:"rounded-xl w-[12rem] overflow-hidden text-left",children:[W.jsx("img",{src:YL,alt:"thumbnail"}),W.jsx("div",{className:"font-bold truncate",children:t}),W.jsx("span",{className:"text-[14px]",children:e})]})})},ZL=({title:t,videoList:e})=>{var i;return W.jsxs("div",{className:"p-6",children:[W.jsx("span",{className:"text-2xl font-bold mb-2",children:t}),W.jsx("div",{className:"flex flex-row gap-4 w-full overflow-x-scroll mb-4",children:(i=e==null?void 0:e.list)==null?void 0:i.map((n,r)=>W.jsx(JL,{title:n.name,date:n.created_at},r))})]})},e8=()=>W.jsx("div",{className:"w-full h-30 bottom-0 p-6 pb-16 bg-[#232020]",children:W.jsx("span",{className:"opacity-25",children:"Sponsored by FURIOSA, elise"})});function BS(t,e){return function(){return t.apply(e,arguments)}}const{toString:t8}=Object.prototype,{getPrototypeOf:Xm}=Object,Gc=(t=>e=>{const i=t8.call(e);return t[i]||(t[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),zi=t=>(t=t.toLowerCase(),e=>Gc(e)===t),Xc=t=>e=>typeof e===t,{isArray:Ks}=Array,bo=Xc("undefined");function i8(t){return t!==null&&!bo(t)&&t.constructor!==null&&!bo(t.constructor)&&ri(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const FS=zi("ArrayBuffer");function n8(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&FS(t.buffer),e}const r8=Xc("string"),ri=Xc("function"),US=Xc("number"),Kc=t=>t!==null&&typeof t=="object",s8=t=>t===!0||t===!1,tu=t=>{if(Gc(t)!=="object")return!1;const e=Xm(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},a8=zi("Date"),o8=zi("File"),l8=zi("Blob"),u8=zi("FileList"),c8=t=>Kc(t)&&ri(t.pipe),d8=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ri(t.append)&&((e=Gc(t))==="formdata"||e==="object"&&ri(t.toString)&&t.toString()==="[object FormData]"))},h8=zi("URLSearchParams"),f8=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jo(t,e,{allOwnKeys:i=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),Ks(t))for(n=0,r=t.length;n0;)if(r=i[n],e===r.toLowerCase())return r;return null}const $S=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,VS=t=>!bo(t)&&t!==$S;function zf(){const{caseless:t}=VS(this)&&this||{},e={},i=(n,r)=>{const s=t&&jS(e,r)||r;tu(e[s])&&tu(n)?e[s]=zf(e[s],n):tu(n)?e[s]=zf({},n):Ks(n)?e[s]=n.slice():e[s]=n};for(let n=0,r=arguments.length;n(jo(e,(r,s)=>{i&&ri(r)?t[s]=BS(r,i):t[s]=r},{allOwnKeys:n}),t),m8=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),g8=(t,e,i,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),i&&Object.assign(t.prototype,i)},y8=(t,e,i,n)=>{let r,s,a;const o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)a=r[s],(!n||n(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=i!==!1&&Xm(t)}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},v8=(t,e,i)=>{t=String(t),(i===void 0||i>t.length)&&(i=t.length),i-=e.length;const n=t.indexOf(e,i);return n!==-1&&n===i},_8=t=>{if(!t)return null;if(Ks(t))return t;let e=t.length;if(!US(e))return null;const i=new Array(e);for(;e-- >0;)i[e]=t[e];return i},T8=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Xm(Uint8Array)),x8=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const s=r.value;e.call(t,s[0],s[1])}},S8=(t,e)=>{let i;const n=[];for(;(i=t.exec(e))!==null;)n.push(i);return n},E8=zi("HTMLFormElement"),b8=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,n,r){return n.toUpperCase()+r}),jv=(({hasOwnProperty:t})=>(e,i)=>t.call(e,i))(Object.prototype),C8=zi("RegExp"),HS=(t,e)=>{const i=Object.getOwnPropertyDescriptors(t),n={};jo(i,(r,s)=>{let a;(a=e(r,s,t))!==!1&&(n[s]=a||r)}),Object.defineProperties(t,n)},w8=t=>{HS(t,(e,i)=>{if(ri(t)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const n=t[i];if(ri(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},A8=(t,e)=>{const i={},n=r=>{r.forEach(s=>{i[s]=!0})};return Ks(t)?n(t):n(String(t).split(e)),i},D8=()=>{},k8=(t,e)=>(t=+t,Number.isFinite(t)?t:e),mh="abcdefghijklmnopqrstuvwxyz",$v="0123456789",zS={DIGIT:$v,ALPHA:mh,ALPHA_DIGIT:mh+mh.toUpperCase()+$v},P8=(t=16,e=zS.ALPHA_DIGIT)=>{let i="";const{length:n}=e;for(;t--;)i+=e[Math.random()*n|0];return i};function I8(t){return!!(t&&ri(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const O8=t=>{const e=new Array(10),i=(n,r)=>{if(Kc(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[r]=n;const s=Ks(n)?[]:{};return jo(n,(a,o)=>{const l=i(a,r+1);!bo(l)&&(s[o]=l)}),e[r]=void 0,s}}return n};return i(t,0)},L8=zi("AsyncFunction"),N8=t=>t&&(Kc(t)||ri(t))&&ri(t.then)&&ri(t.catch),U={isArray:Ks,isArrayBuffer:FS,isBuffer:i8,isFormData:d8,isArrayBufferView:n8,isString:r8,isNumber:US,isBoolean:s8,isObject:Kc,isPlainObject:tu,isUndefined:bo,isDate:a8,isFile:o8,isBlob:l8,isRegExp:C8,isFunction:ri,isStream:c8,isURLSearchParams:h8,isTypedArray:T8,isFileList:u8,forEach:jo,merge:zf,extend:p8,trim:f8,stripBOM:m8,inherits:g8,toFlatObject:y8,kindOf:Gc,kindOfTest:zi,endsWith:v8,toArray:_8,forEachEntry:x8,matchAll:S8,isHTMLForm:E8,hasOwnProperty:jv,hasOwnProp:jv,reduceDescriptors:HS,freezeMethods:w8,toObjectSet:A8,toCamelCase:b8,noop:D8,toFiniteNumber:k8,findKey:jS,global:$S,isContextDefined:VS,ALPHABET:zS,generateString:P8,isSpecCompliantForm:I8,toJSONObject:O8,isAsyncFn:L8,isThenable:N8};function he(t,e,i,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),n&&(this.request=n),r&&(this.response=r)}U.inherits(he,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:U.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const qS=he.prototype,WS={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{WS[t]={value:t}});Object.defineProperties(he,WS);Object.defineProperty(qS,"isAxiosError",{value:!0});he.from=(t,e,i,n,r,s)=>{const a=Object.create(qS);return U.toFlatObject(t,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),he.call(a,t.message,e,i,n,r),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const R8=null;function qf(t){return U.isPlainObject(t)||U.isArray(t)}function GS(t){return U.endsWith(t,"[]")?t.slice(0,-2):t}function Vv(t,e,i){return t?t.concat(e).map(function(r,s){return r=GS(r),!i&&s?"["+r+"]":r}).join(i?".":""):e}function M8(t){return U.isArray(t)&&!t.some(qf)}const B8=U.toFlatObject(U,{},null,function(e){return/^is[A-Z]/.test(e)});function Qc(t,e,i){if(!U.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,i=U.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,D){return!U.isUndefined(D[S])});const n=i.metaTokens,r=i.visitor||p,s=i.dots,a=i.indexes,l=(i.Blob||typeof Blob<"u"&&Blob)&&U.isSpecCompliantForm(e);if(!U.isFunction(r))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(U.isDate(v))return v.toISOString();if(!l&&U.isBlob(v))throw new he("Blob is not supported. Use a Buffer instead.");return U.isArrayBuffer(v)||U.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function p(v,S,D){let x=v;if(v&&!D&&typeof v=="object"){if(U.endsWith(S,"{}"))S=n?S:S.slice(0,-2),v=JSON.stringify(v);else if(U.isArray(v)&&M8(v)||(U.isFileList(v)||U.endsWith(S,"[]"))&&(x=U.toArray(v)))return S=GS(S),x.forEach(function(C,P){!(U.isUndefined(C)||C===null)&&e.append(a===!0?Vv([S],P,s):a===null?S:S+"[]",c(C))}),!1}return qf(v)?!0:(e.append(Vv(D,S,s),c(v)),!1)}const m=[],_=Object.assign(B8,{defaultVisitor:p,convertValue:c,isVisitable:qf});function E(v,S){if(!U.isUndefined(v)){if(m.indexOf(v)!==-1)throw Error("Circular reference detected in "+S.join("."));m.push(v),U.forEach(v,function(x,T){(!(U.isUndefined(x)||x===null)&&r.call(e,x,U.isString(T)?T.trim():T,S,_))===!0&&E(x,S?S.concat(T):[T])}),m.pop()}}if(!U.isObject(t))throw new TypeError("data must be an object");return E(t),e}function Hv(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Km(t,e){this._pairs=[],t&&Qc(t,this,e)}const XS=Km.prototype;XS.append=function(e,i){this._pairs.push([e,i])};XS.toString=function(e){const i=e?function(n){return e.call(this,n,Hv)}:Hv;return this._pairs.map(function(r){return i(r[0])+"="+i(r[1])},"").join("&")};function F8(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function KS(t,e,i){if(!e)return t;const n=i&&i.encode||F8,r=i&&i.serialize;let s;if(r?s=r(e,i):s=U.isURLSearchParams(e)?e.toString():new Km(e,i).toString(n),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class U8{constructor(){this.handlers=[]}use(e,i,n){return this.handlers.push({fulfilled:e,rejected:i,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){U.forEach(this.handlers,function(n){n!==null&&e(n)})}}const zv=U8,QS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},j8=typeof URLSearchParams<"u"?URLSearchParams:Km,$8=typeof FormData<"u"?FormData:null,V8=typeof Blob<"u"?Blob:null,H8={isBrowser:!0,classes:{URLSearchParams:j8,FormData:$8,Blob:V8},protocols:["http","https","file","blob","url","data"]},YS=typeof window<"u"&&typeof document<"u",z8=(t=>YS&&["ReactNative","NativeScript","NS"].indexOf(t)<0)(typeof navigator<"u"&&navigator.product),q8=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",W8=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:YS,hasStandardBrowserEnv:z8,hasStandardBrowserWebWorkerEnv:q8},Symbol.toStringTag,{value:"Module"})),Oi={...W8,...H8};function G8(t,e){return Qc(t,new Oi.classes.URLSearchParams,Object.assign({visitor:function(i,n,r,s){return Oi.isNode&&U.isBuffer(i)?(this.append(n,i.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function X8(t){return U.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function K8(t){const e={},i=Object.keys(t);let n;const r=i.length;let s;for(n=0;n=i.length;return a=!a&&U.isArray(r)?r.length:a,l?(U.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!U.isObject(r[a]))&&(r[a]=[]),e(i,n,r[a],s)&&U.isArray(r[a])&&(r[a]=K8(r[a])),!o)}if(U.isFormData(t)&&U.isFunction(t.entries)){const i={};return U.forEachEntry(t,(n,r)=>{e(X8(n),r,i,0)}),i}return null}function Q8(t,e,i){if(U.isString(t))try{return(e||JSON.parse)(t),U.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(i||JSON.stringify)(t)}const Qm={transitional:QS,adapter:["xhr","http"],transformRequest:[function(e,i){const n=i.getContentType()||"",r=n.indexOf("application/json")>-1,s=U.isObject(e);if(s&&U.isHTMLForm(e)&&(e=new FormData(e)),U.isFormData(e))return r&&r?JSON.stringify(JS(e)):e;if(U.isArrayBuffer(e)||U.isBuffer(e)||U.isStream(e)||U.isFile(e)||U.isBlob(e))return e;if(U.isArrayBufferView(e))return e.buffer;if(U.isURLSearchParams(e))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return G8(e,this.formSerializer).toString();if((o=U.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qc(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(i.setContentType("application/json",!1),Q8(e)):e}],transformResponse:[function(e){const i=this.transitional||Qm.transitional,n=i&&i.forcedJSONParsing,r=this.responseType==="json";if(e&&U.isString(e)&&(n&&!this.responseType||r)){const a=!(i&&i.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?he.from(o,he.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Oi.classes.FormData,Blob:Oi.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};U.forEach(["delete","get","head","post","put","patch"],t=>{Qm.headers[t]={}});const Ym=Qm,Y8=U.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),J8=t=>{const e={};let i,n,r;return t&&t.split(` +`).forEach(function(a){r=a.indexOf(":"),i=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!i||e[i]&&Y8[i])&&(i==="set-cookie"?e[i]?e[i].push(n):e[i]=[n]:e[i]=e[i]?e[i]+", "+n:n)}),e},qv=Symbol("internals");function ba(t){return t&&String(t).trim().toLowerCase()}function iu(t){return t===!1||t==null?t:U.isArray(t)?t.map(iu):String(t)}function Z8(t){const e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(t);)e[n[1]]=n[2];return e}const e5=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function gh(t,e,i,n,r){if(U.isFunction(n))return n.call(this,e,i);if(r&&(e=i),!!U.isString(e)){if(U.isString(n))return e.indexOf(n)!==-1;if(U.isRegExp(n))return n.test(e)}}function t5(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,i,n)=>i.toUpperCase()+n)}function i5(t,e){const i=U.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+i,{value:function(r,s,a){return this[n].call(this,e,r,s,a)},configurable:!0})})}class Yc{constructor(e){e&&this.set(e)}set(e,i,n){const r=this;function s(o,l,c){const p=ba(l);if(!p)throw new Error("header name must be a non-empty string");const m=U.findKey(r,p);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=iu(o))}const a=(o,l)=>U.forEach(o,(c,p)=>s(c,p,l));return U.isPlainObject(e)||e instanceof this.constructor?a(e,i):U.isString(e)&&(e=e.trim())&&!e5(e)?a(J8(e),i):e!=null&&s(i,e,n),this}get(e,i){if(e=ba(e),e){const n=U.findKey(this,e);if(n){const r=this[n];if(!i)return r;if(i===!0)return Z8(r);if(U.isFunction(i))return i.call(this,r,n);if(U.isRegExp(i))return i.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,i){if(e=ba(e),e){const n=U.findKey(this,e);return!!(n&&this[n]!==void 0&&(!i||gh(this,this[n],n,i)))}return!1}delete(e,i){const n=this;let r=!1;function s(a){if(a=ba(a),a){const o=U.findKey(n,a);o&&(!i||gh(n,n[o],o,i))&&(delete n[o],r=!0)}}return U.isArray(e)?e.forEach(s):s(e),r}clear(e){const i=Object.keys(this);let n=i.length,r=!1;for(;n--;){const s=i[n];(!e||gh(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const i=this,n={};return U.forEach(this,(r,s)=>{const a=U.findKey(n,s);if(a){i[a]=iu(r),delete i[s];return}const o=e?t5(s):String(s).trim();o!==s&&delete i[s],i[o]=iu(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const i=Object.create(null);return U.forEach(this,(n,r)=>{n!=null&&n!==!1&&(i[r]=e&&U.isArray(n)?n.join(", "):n)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,i])=>e+": "+i).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...i){const n=new this(e);return i.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[qv]=this[qv]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=ba(a);n[o]||(i5(r,a),n[o]=!0)}return U.isArray(e)?e.forEach(s):s(e),this}}Yc.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);U.reduceDescriptors(Yc.prototype,({value:t},e)=>{let i=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[i]=n}}});U.freezeMethods(Yc);const an=Yc;function yh(t,e){const i=this||Ym,n=e||i,r=an.from(n.headers);let s=n.data;return U.forEach(t,function(o){s=o.call(i,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function ZS(t){return!!(t&&t.__CANCEL__)}function $o(t,e,i){he.call(this,t??"canceled",he.ERR_CANCELED,e,i),this.name="CanceledError"}U.inherits($o,he,{__CANCEL__:!0});function n5(t,e,i){const n=i.config.validateStatus;!i.status||!n||n(i.status)?t(i):e(new he("Request failed with status code "+i.status,[he.ERR_BAD_REQUEST,he.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}const r5=Oi.hasStandardBrowserEnv?{write(t,e,i,n,r,s){const a=[t+"="+encodeURIComponent(e)];U.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),U.isString(n)&&a.push("path="+n),U.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function s5(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function a5(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function eE(t,e){return t&&!s5(e)?a5(t,e):e}const o5=Oi.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");let n;function r(s){let a=s;return e&&(i.setAttribute("href",a),a=i.href),i.setAttribute("href",a),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return n=r(window.location.href),function(a){const o=U.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}();function l5(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function u5(t,e){t=t||10;const i=new Array(t),n=new Array(t);let r=0,s=0,a;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),p=n[s];a||(a=c),i[r]=l,n[r]=c;let m=s,_=0;for(;m!==r;)_+=i[m++],m=m%t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),c-a{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-i,l=n(o),c=s<=a;i=s;const p={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:r};p[e?"download":"upload"]=!0,t(p)}}const c5=typeof XMLHttpRequest<"u",d5=c5&&function(t){return new Promise(function(i,n){let r=t.data;const s=an.from(t.headers).normalize();let{responseType:a,withXSRFToken:o}=t,l;function c(){t.cancelToken&&t.cancelToken.unsubscribe(l),t.signal&&t.signal.removeEventListener("abort",l)}let p;if(U.isFormData(r)){if(Oi.hasStandardBrowserEnv||Oi.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((p=s.getContentType())!==!1){const[S,...D]=p?p.split(";").map(x=>x.trim()).filter(Boolean):[];s.setContentType([S||"multipart/form-data",...D].join("; "))}}let m=new XMLHttpRequest;if(t.auth){const S=t.auth.username||"",D=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(S+":"+D))}const _=eE(t.baseURL,t.url);m.open(t.method.toUpperCase(),KS(_,t.params,t.paramsSerializer),!0),m.timeout=t.timeout;function E(){if(!m)return;const S=an.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:S,config:t,request:m};n5(function(C){i(C),c()},function(C){n(C),c()},x),m=null}if("onloadend"in m?m.onloadend=E:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(E)},m.onabort=function(){m&&(n(new he("Request aborted",he.ECONNABORTED,t,m)),m=null)},m.onerror=function(){n(new he("Network Error",he.ERR_NETWORK,t,m)),m=null},m.ontimeout=function(){let D=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const x=t.transitional||QS;t.timeoutErrorMessage&&(D=t.timeoutErrorMessage),n(new he(D,x.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,t,m)),m=null},Oi.hasStandardBrowserEnv&&(o&&U.isFunction(o)&&(o=o(t)),o||o!==!1&&o5(_))){const S=t.xsrfHeaderName&&t.xsrfCookieName&&r5.read(t.xsrfCookieName);S&&s.set(t.xsrfHeaderName,S)}r===void 0&&s.setContentType(null),"setRequestHeader"in m&&U.forEach(s.toJSON(),function(D,x){m.setRequestHeader(x,D)}),U.isUndefined(t.withCredentials)||(m.withCredentials=!!t.withCredentials),a&&a!=="json"&&(m.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&m.addEventListener("progress",Wv(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&m.upload&&m.upload.addEventListener("progress",Wv(t.onUploadProgress)),(t.cancelToken||t.signal)&&(l=S=>{m&&(n(!S||S.type?new $o(null,t,m):S),m.abort(),m=null)},t.cancelToken&&t.cancelToken.subscribe(l),t.signal&&(t.signal.aborted?l():t.signal.addEventListener("abort",l)));const v=l5(_);if(v&&Oi.protocols.indexOf(v)===-1){n(new he("Unsupported protocol "+v+":",he.ERR_BAD_REQUEST,t));return}m.send(r||null)})},Wf={http:R8,xhr:d5};U.forEach(Wf,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Gv=t=>`- ${t}`,h5=t=>U.isFunction(t)||t===null||t===!1,tE={getAdapter:t=>{t=U.isArray(t)?t:[t];const{length:e}=t;let i,n;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : +`+s.map(Gv).join(` +`):" "+Gv(s[0]):"as no adapter specified";throw new he("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:Wf};function vh(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new $o(null,t)}function Xv(t){return vh(t),t.headers=an.from(t.headers),t.data=yh.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),tE.getAdapter(t.adapter||Ym.adapter)(t).then(function(n){return vh(t),n.data=yh.call(t,t.transformResponse,n),n.headers=an.from(n.headers),n},function(n){return ZS(n)||(vh(t),n&&n.response&&(n.response.data=yh.call(t,t.transformResponse,n.response),n.response.headers=an.from(n.response.headers))),Promise.reject(n)})}const Kv=t=>t instanceof an?t.toJSON():t;function Ms(t,e){e=e||{};const i={};function n(c,p,m){return U.isPlainObject(c)&&U.isPlainObject(p)?U.merge.call({caseless:m},c,p):U.isPlainObject(p)?U.merge({},p):U.isArray(p)?p.slice():p}function r(c,p,m){if(U.isUndefined(p)){if(!U.isUndefined(c))return n(void 0,c,m)}else return n(c,p,m)}function s(c,p){if(!U.isUndefined(p))return n(void 0,p)}function a(c,p){if(U.isUndefined(p)){if(!U.isUndefined(c))return n(void 0,c)}else return n(void 0,p)}function o(c,p,m){if(m in e)return n(c,p);if(m in t)return n(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,p)=>r(Kv(c),Kv(p),!0)};return U.forEach(Object.keys(Object.assign({},t,e)),function(p){const m=l[p]||r,_=m(t[p],e[p],p);U.isUndefined(_)&&m!==o||(i[p]=_)}),i}const iE="1.6.2",Jm={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Jm[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Qv={};Jm.transitional=function(e,i,n){function r(s,a){return"[Axios v"+iE+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(e===!1)throw new he(r(a," has been removed"+(i?" in "+i:"")),he.ERR_DEPRECATED);return i&&!Qv[a]&&(Qv[a]=!0,console.warn(r(a," has been deprecated since v"+i+" and will be removed in the near future"))),e?e(s,a,o):!0}};function f5(t,e,i){if(typeof t!="object")throw new he("options must be an object",he.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const s=n[r],a=e[s];if(a){const o=t[s],l=o===void 0||a(o,s,t);if(l!==!0)throw new he("option "+s+" must be "+l,he.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new he("Unknown option "+s,he.ERR_BAD_OPTION)}}const Gf={assertOptions:f5,validators:Jm},En=Gf.validators;class ic{constructor(e){this.defaults=e,this.interceptors={request:new zv,response:new zv}}request(e,i){typeof e=="string"?(i=i||{},i.url=e):i=e||{},i=Ms(this.defaults,i);const{transitional:n,paramsSerializer:r,headers:s}=i;n!==void 0&&Gf.assertOptions(n,{silentJSONParsing:En.transitional(En.boolean),forcedJSONParsing:En.transitional(En.boolean),clarifyTimeoutError:En.transitional(En.boolean)},!1),r!=null&&(U.isFunction(r)?i.paramsSerializer={serialize:r}:Gf.assertOptions(r,{encode:En.function,serialize:En.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let a=s&&U.merge(s.common,s[i.method]);s&&U.forEach(["delete","get","head","post","put","patch","common"],v=>{delete s[v]}),i.headers=an.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(i)===!1||(l=l&&S.synchronous,o.unshift(S.fulfilled,S.rejected))});const c=[];this.interceptors.response.forEach(function(S){c.push(S.fulfilled,S.rejected)});let p,m=0,_;if(!l){const v=[Xv.bind(this),void 0];for(v.unshift.apply(v,o),v.push.apply(v,c),_=v.length,p=Promise.resolve(i);m<_;)p=p.then(v[m++],v[m++]);return p}_=o.length;let E=i;for(m=0;m<_;){const v=o[m++],S=o[m++];try{E=v(E)}catch(D){S.call(this,D);break}}try{p=Xv.call(this,E)}catch(v){return Promise.reject(v)}for(m=0,_=c.length;m<_;)p=p.then(c[m++],c[m++]);return p}getUri(e){e=Ms(this.defaults,e);const i=eE(e.baseURL,e.url);return KS(i,e.params,e.paramsSerializer)}}U.forEach(["delete","get","head","options"],function(e){ic.prototype[e]=function(i,n){return this.request(Ms(n||{},{method:e,url:i,data:(n||{}).data}))}});U.forEach(["post","put","patch"],function(e){function i(n){return function(s,a,o){return this.request(Ms(o||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}ic.prototype[e]=i(),ic.prototype[e+"Form"]=i(!0)});const nu=ic;class Zm{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(s){i=s});const n=this;this.promise.then(r=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},e(function(s,a,o){n.reason||(n.reason=new $o(s,a,o),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const i=this._listeners.indexOf(e);i!==-1&&this._listeners.splice(i,1)}static source(){let e;return{token:new Zm(function(r){e=r}),cancel:e}}}const p5=Zm;function m5(t){return function(i){return t.apply(null,i)}}function g5(t){return U.isObject(t)&&t.isAxiosError===!0}const Xf={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xf).forEach(([t,e])=>{Xf[e]=t});const y5=Xf;function nE(t){const e=new nu(t),i=BS(nu.prototype.request,e);return U.extend(i,nu.prototype,e,{allOwnKeys:!0}),U.extend(i,e,null,{allOwnKeys:!0}),i.create=function(r){return nE(Ms(t,r))},i}const Ge=nE(Ym);Ge.Axios=nu;Ge.CanceledError=$o;Ge.CancelToken=p5;Ge.isCancel=ZS;Ge.VERSION=iE;Ge.toFormData=Qc;Ge.AxiosError=he;Ge.Cancel=Ge.CanceledError;Ge.all=function(e){return Promise.all(e)};Ge.spread=m5;Ge.isAxiosError=g5;Ge.mergeConfig=Ms;Ge.AxiosHeaders=an;Ge.formToJSON=t=>JS(U.isHTMLForm(t)?new FormData(t):t);Ge.getAdapter=tE.getAdapter;Ge.HttpStatusCode=y5;Ge.default=Ge;const v5=Ge,_5=()=>{const t=Sc(),[e,i]=X.useState(void 0),n="http://43.202.196.35:5002/api/video_list",r=v5.create({baseURL:"http://43.202.196.35:5002"});X.useEffect(()=>{(async()=>{try{const o=await r.get("/api/video_list");if(o.status!==200)throw new Error("Network response was not ok");const l=o.data;i(l)}catch(o){console.error("Error fetching data:",o)}})()},[n]);const s=()=>{t("/upload")};return W.jsx(W.Fragment,{children:W.jsxs("div",{className:"flex flex-col justify-between h-full w-full bg-black",children:[W.jsxs("div",{children:[W.jsx("div",{className:"mb-[1rem] p-6",children:W.jsx("span",{className:"text-[#E21401] text-3xl font-bold ",children:"AI Blur"})}),W.jsx(ZL,{title:"HOT 10",videoList:e})]}),W.jsxs("div",{className:"flex items-center flex-col w-full",children:[W.jsx("div",{className:"flex w-full px-6 my-2",children:W.jsx("button",{onClick:s,className:"bg-[#E21401] py-2 px-4 w-full text-center rounded-l",children:"영상 업로드하기"})}),W.jsx(e8,{})]})]})})};function T5(){const[t,e]=X.useState(!0);return X.useEffect(()=>{const i=setTimeout(()=>{e(!1)},3e3);return()=>clearTimeout(i)},[]),W.jsx(W.Fragment,{children:W.jsxs(FD,{basename:"/noc-client",children:[t&&W.jsx(HD,{}),W.jsxs(MD,{children:[W.jsx(Ql,{path:"/",element:W.jsx(_5,{})}),W.jsx(Ql,{path:"/upload",element:W.jsx(VD,{})}),W.jsx(Ql,{path:"/view/:video",element:W.jsx(QL,{})})]})]})})}_h.createRoot(document.getElementById("root")).render(W.jsx(tn.StrictMode,{children:W.jsx(T5,{})})); diff --git a/index.html b/index.html index ad33f95..f10b8f6 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,10 @@ - - + Vite + React + TS - +