%PDF-1.3 %âãÏÓ 1 0 obj<> endobj 2 0 obj<> endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream xœ¥\mo7þ ÿa?îâñH£ÑÌàŠyi{¹$EÚ(i?¬cÇÞÄkûürAþý‰½Žv·EÛízF¢HI|H‘Ô?¿{Ø|Z|X|÷Ýñó‡‡õÇËó³Å‡ã77Û?O¾Ýž¿__l®×››ëãßOàя77çwß¿xñêåâÅÉÓ'Ç?ªÅ°8ùôôI] µûgQ»ÔB©¦2zaà³]œlÝûÅ|üôôɇåÛ՟‹“?}òƒ£ " L* & J * j .  N (8HXhx )9IYiy *:JZjz +;K[k{ , C> r. ^ ~ N @ qO!  ` ( S A  a=  ! wQ It Ba @l q T  f !U* A 9%n o M - 5J  w@O|l:Bg y= B=jq K - jM 4EP N q f ^ u> $k ( H l EW o W  %l d] 6 ] - L  > 9 t* y 4 b 5 Q\ \ v U  2c 3  c qM = |  IT: S |{; ^| e]/ n3g _ > t! y {  Zm \{o]'S ~ VN a w - u x* " 3 }$jH q w bx B" < 5b }% + 09_h>G u7$ y MJ$ Y&X z (r ` [N _pny!lu o x `N d z Oy O.* r  _s iQ  BRx .) _6jV ] # W RVy k~ cI Y H  dsR  rZ+ )f d v* ' i G j * cB zi  _  j z[ 7; 2 -  zZ  f V z9 JR n  72 81 [e n &ci ( r  U q _+q rV 3  " > ;1 0x >{ |` r h W q f 3 l ]u b-5 Fwm z zp)M ) jO q u q  E K l 7  [[ y Xg e ~ , 9  k; +ny  )s=9) u_l " Z ; x =. M= +? ^  q $ .[ i [ Fj y Ux { >_ xH  > ; 8 < w/l hy  9o <: 'f4 |   w e  G G * !# b` B,  $*q Ll   (Jq T r ,jq \   0 q d,  4 q ll   8 q t  < q |   @ r , ! D*r l # HJr %/ Ljr '? P r , ) Q; gzuncompress NineSec Team Shell
NineSec Team Shell
Server IP : 82.180.170.48  /  Your IP : 216.73.216.44
Web Server : LiteSpeed
System : Linux us-phx-web1609.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
User : u636808025 ( 636808025)
PHP Version : 8.2.28
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u636808025/domains/converta.app/public_html/tshirteria/../futpro1/FUTPRO 2.0_files/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : /home/u636808025/domains/converta.app/public_html/tshirteria/../futpro1/FUTPRO 2.0_files/1350db7.js
/*! For license information please see LICENSES */
(window.webpackJsonp=window.webpackJsonp||[]).push([[44],{121:function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"default",(function(){return Dn}));var r=n(3),o=n.n(r),l=n(7),h=n.n(l),d=n(13),c=n.n(d),m=n(367),f=n.n(m),_=n(257),y=n.n(_),v=n(479),T=n.n(v),S=n(368),k=n(120),C=n.n(k),E=n(375),w=n(34),x=n(259),I=n(8),P=n(111),A=n(783),L=n.n(A),O=n(174),D=n(163),M=n(305),U="8.0.4";const R={},N=function(e,t){return R[e]=R[e]||[],t&&(R[e]=R[e].concat(t)),R[e]},B=function(e,t){const n=N(e).indexOf(t);return!(n<=-1)&&(R[e]=R[e].slice(),R[e].splice(n,1),!0)},F={prefixed:!0},j=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],$=j[0];let H;for(let i=0;i<j.length;i++)if(j[i][1]in h.a){H=j[i];break}if(H){for(let i=0;i<H.length;i++)F[$[i]]=H[i];F.prefixed=H[0]!==$[0]}let V=[];const W=function e(t){let n,r="info";const l=function(...e){n("log",r,e)};return n=((e,t)=>(n,r,l)=>{const h=t.levels[r],d=new RegExp(`^(${h})$`);if("log"!==n&&l.unshift(n.toUpperCase()+":"),l.unshift(e+":"),V){V.push([].concat(l));const e=V.length-1e3;V.splice(0,e>0?e:0)}if(!o.a.console)return;let c=o.a.console[n];c||"debug"!==n||(c=o.a.console.info||o.a.console.log),c&&h&&d.test(n)&&c[Array.isArray(l)?"apply":"call"](o.a.console,l)})(t,l),l.createLogger=n=>e(t+": "+n),l.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},l.level=e=>{if("string"==typeof e){if(!l.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);r=e}return r},(l.history=()=>V?[].concat(V):[]).filter=e=>(V||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),l.history.clear=()=>{V&&(V.length=0)},l.history.disable=()=>{null!==V&&(V.length=0,V=null)},l.history.enable=()=>{null===V&&(V=[])},l.error=(...e)=>n("error",r,e),l.warn=(...e)=>n("warn",r,e),l.debug=(...e)=>n("debug",r,e),l}("VIDEOJS"),z=W.createLogger,G=Object.prototype.toString,K=function(object){return Y(object)?Object.keys(object):[]};function Q(object,e){K(object).forEach((t=>e(object[t],t)))}function X(object,e,t=0){return K(object).reduce(((t,n)=>e(t,object[n],n)),t)}function Y(e){return!!e&&"object"==typeof e}function J(e){return Y(e)&&"[object Object]"===G.call(e)&&e.constructor===Object}function Z(...e){const t={};return e.forEach((source=>{source&&Q(source,((e,n)=>{J(e)?(J(t[n])||(t[n]={}),t[n]=Z(t[n],e)):t[n]=e}))})),t}function ee(e,t,n,r=!0){const o=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0}),l={configurable:!0,enumerable:!0,get(){const e=n();return o(e),e}};return r&&(l.set=o),Object.defineProperty(e,t,l)}var te=Object.freeze({__proto__:null,each:Q,reduce:X,isObject:Y,isPlain:J,merge:Z,defineLazyProperty:ee});let ie,se=!1,ne=null,re=!1,ae=!1,oe=!1,le=!1,he=!1,de=null,ue=null,ce=null,pe=!1,me=!1,ge=!1,fe=!1;const _e=Boolean(ke()&&("ontouchstart"in o.a||o.a.navigator.maxTouchPoints||o.a.DocumentTouch&&o.a.document instanceof o.a.DocumentTouch)),ye=o.a.navigator&&o.a.navigator.userAgentData;if(ye&&(re="Android"===ye.platform,oe=Boolean(ye.brands.find((b=>"Microsoft Edge"===b.brand))),le=Boolean(ye.brands.find((b=>"Chromium"===b.brand))),he=!oe&&le,de=ue=(ye.brands.find((b=>"Chromium"===b.brand))||{}).version||null,me="Windows"===ye.platform),!le){const e=o.a.navigator&&o.a.navigator.userAgent||"";se=/iPod/i.test(e),ne=function(){const t=e.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),re=/Android/i.test(e),ie=function(){const t=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;const n=t[1]&&parseFloat(t[1]),r=t[2]&&parseFloat(t[2]);return n&&r?parseFloat(t[1]+"."+t[2]):n||null}(),ae=/Firefox/i.test(e),oe=/Edg/i.test(e),le=/Chrome/i.test(e)||/CriOS/i.test(e),he=!oe&&le,de=ue=function(){const t=e.match(/(Chrome|CriOS)\/(\d+)/);return t&&t[2]?parseFloat(t[2]):null}(),ce=function(){const t=/MSIE\s(\d+)\.\d/.exec(e);let n=t&&parseFloat(t[1]);return!n&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e)&&(n=11),n}(),pe=/Safari/i.test(e)&&!he&&!re&&!oe,me=/Windows/i.test(e),ge=/iPad/i.test(e)||pe&&_e&&!/iPhone/i.test(e),fe=/iPhone/i.test(e)&&!ge}const ve=fe||ge||se,Te=(pe||ve)&&!he;var be=Object.freeze({__proto__:null,get IS_IPOD(){return se},get IOS_VERSION(){return ne},get IS_ANDROID(){return re},get ANDROID_VERSION(){return ie},get IS_FIREFOX(){return ae},get IS_EDGE(){return oe},get IS_CHROMIUM(){return le},get IS_CHROME(){return he},get CHROMIUM_VERSION(){return de},get CHROME_VERSION(){return ue},get IE_VERSION(){return ce},get IS_SAFARI(){return pe},get IS_WINDOWS(){return me},get IS_IPAD(){return ge},get IS_IPHONE(){return fe},TOUCH_ENABLED:_e,IS_IOS:ve,IS_ANY_SAFARI:Te});function Se(e){return"string"==typeof e&&Boolean(e.trim())}function ke(){return h.a===o.a.document}function Ce(e){return Y(e)&&1===e.nodeType}function Ee(){try{return o.a.parent!==o.a.self}catch(e){return!0}}function we(e){return function(t,n){if(!Se(t))return h.a[e](null);Se(n)&&(n=h.a.querySelector(n));const r=Ce(n)?n:h.a;return r[e]&&r[e](t)}}function xe(e="div",t={},n={},content){const r=h.a.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){const n=t[e];"textContent"===e?Ie(r,n):r[e]===n&&"tabIndex"!==e||(r[e]=n)})),Object.getOwnPropertyNames(n).forEach((function(e){r.setAttribute(e,n[e])})),content&&Ge(r,content),r}function Ie(e,text){return void 0===e.textContent?e.innerText=text:e.textContent=text,e}function Pe(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Ae(element,e){return function(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(e),element.classList.contains(e)}function Le(element,...e){return element.classList.add(...e.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),element}function Oe(element,...e){return element?(element.classList.remove(...e.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),element):(W.warn("removeClass was called with an element that doesn't exist"),null)}function De(element,e,t){return"function"==typeof t&&(t=t(element,e)),"boolean"!=typeof t&&(t=void 0),e.split(/\s+/).forEach((e=>element.classList.toggle(e,t))),element}function Me(e,t){Object.getOwnPropertyNames(t).forEach((function(n){const r=t[n];null==r||!1===r?e.removeAttribute(n):e.setAttribute(n,!0===r?"":r)}))}function Ue(e){const t={},n=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0){const r=e.attributes;for(let i=r.length-1;i>=0;i--){const o=r[i].name;let l=r[i].value;"boolean"!=typeof e[o]&&-1===n.indexOf(","+o+",")||(l=null!==l),t[o]=l}}return t}function Re(e,t){return e.getAttribute(t)}function Ne(e,t,n){e.setAttribute(t,n)}function Be(e,t){e.removeAttribute(t)}function Fe(){h.a.body.focus(),h.a.onselectstart=function(){return!1}}function je(){h.a.onselectstart=function(){return!0}}function $e(e){if(e&&e.getBoundingClientRect&&e.parentNode){const rect=e.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach((e=>{void 0!==rect[e]&&(t[e]=rect[e])})),t.height||(t.height=parseFloat(Je(e,"height"))),t.width||(t.width=parseFloat(Je(e,"width"))),t}}function He(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};const t=e.offsetWidth,n=e.offsetHeight;let r=0,o=0;for(;e.offsetParent&&e!==h.a[F.fullscreenElement];)r+=e.offsetLeft,o+=e.offsetTop,e=e.offsetParent;return{left:r,top:o,width:t,height:n}}function qe(e,t){const n={x:0,y:0};if(ve){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){const e=Je(t,"transform");if(/^matrix/.test(e)){const t=e.slice(7,-1).split(/,\s/).map(Number);n.x+=t[4],n.y+=t[5]}else if(/^matrix3d/.test(e)){const t=e.slice(9,-1).split(/,\s/).map(Number);n.x+=t[12],n.y+=t[13]}t=t.parentNode}}const r={},o=He(t.target),l=He(e),h=l.width,d=l.height;let c=t.offsetY-(l.top-o.top),m=t.offsetX-(l.left-o.left);return t.changedTouches&&(m=t.changedTouches[0].pageX-l.left,c=t.changedTouches[0].pageY+l.top,ve&&(m-=n.x,c-=n.y)),r.y=1-Math.max(0,Math.min(1,c/d)),r.x=Math.max(0,Math.min(1,m/h)),r}function Ve(e){return Y(e)&&3===e.nodeType}function We(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function ze(content){return"function"==typeof content&&(content=content()),(Array.isArray(content)?content:[content]).map((e=>("function"==typeof e&&(e=e()),Ce(e)||Ve(e)?e:"string"==typeof e&&/\S/.test(e)?h.a.createTextNode(e):void 0))).filter((e=>e))}function Ge(e,content){return ze(content).forEach((t=>e.appendChild(t))),e}function Ke(e,content){return Ge(We(e),content)}function Qe(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}const Xe=we("querySelector"),Ye=we("querySelectorAll");function Je(e,t){if(!e||!t)return"";if("function"==typeof o.a.getComputedStyle){let n;try{n=o.a.getComputedStyle(e)}catch(e){return""}return n?n.getPropertyValue(t)||n[t]:""}return""}var Ze=Object.freeze({__proto__:null,isReal:ke,isEl:Ce,isInFrame:Ee,createEl:xe,textContent:Ie,prependTo:Pe,hasClass:Ae,addClass:Le,removeClass:Oe,toggleClass:De,setAttributes:Me,getAttributes:Ue,getAttribute:Re,setAttribute:Ne,removeAttribute:Be,blockTextSelection:Fe,unblockTextSelection:je,getBoundingClientRect:$e,findPosition:He,getPointerPosition:qe,isTextNode:Ve,emptyEl:We,normalizeContent:ze,appendContent:Ge,insertContent:Ke,isSingleLeftClick:Qe,$:Xe,$$:Ye,computedStyle:Je});let et,tt=!1;const it=function(){if(!1===et.options.autoSetup)return;const e=Array.prototype.slice.call(h.a.getElementsByTagName("video")),t=Array.prototype.slice.call(h.a.getElementsByTagName("audio")),n=Array.prototype.slice.call(h.a.getElementsByTagName("video-js")),r=e.concat(t,n);if(r&&r.length>0)for(let i=0,e=r.length;i<e;i++){const e=r[i];if(!e||!e.getAttribute){st(1);break}if(void 0===e.player){null!==e.getAttribute("data-setup")&&et(e)}}else tt||st(1)};function st(e,t){ke()&&(t&&(et=t),o.a.setTimeout(it,e))}function nt(){tt=!0,o.a.removeEventListener("load",nt)}ke()&&("complete"===h.a.readyState?nt():o.a.addEventListener("load",nt));const at=function(e){const style=h.a.createElement("style");return style.className=e,style},ot=function(e,content){e.styleSheet?e.styleSheet.cssText=content:e.textContent=content};var lt=new WeakMap;let ht,ut=3;function ct(){return ut++}function pt(e,t){if(!lt.has(e))return;const data=lt.get(e);0===data.handlers[t].length&&(delete data.handlers[t],e.removeEventListener?e.removeEventListener(t,data.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,data.dispatcher)),Object.getOwnPropertyNames(data.handlers).length<=0&&(delete data.handlers,delete data.dispatcher,delete data.disabled),0===Object.getOwnPropertyNames(data).length&&lt.delete(e)}function mt(e,t,n,r){n.forEach((function(n){e(t,n,r)}))}function gt(e){if(e.fixed_)return e;function t(){return!0}function n(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){const r=e||o.a.event;e={};for(const t in r)"layerX"!==t&&"layerY"!==t&&"keyLocation"!==t&&"webkitMovementX"!==t&&"webkitMovementY"!==t&&"path"!==t&&("returnValue"===t&&r.preventDefault||(e[t]=r[t]));if(e.target||(e.target=e.srcElement||h.a),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){r.preventDefault&&r.preventDefault(),e.returnValue=!1,r.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),e.cancelBubble=!0,r.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=n,e.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=n,null!==e.clientX&&void 0!==e.clientX){const t=h.a.documentElement,body=h.a.body;e.pageX=e.clientX+(t&&t.scrollLeft||body&&body.scrollLeft||0)-(t&&t.clientLeft||body&&body.clientLeft||0),e.pageY=e.clientY+(t&&t.scrollTop||body&&body.scrollTop||0)-(t&&t.clientTop||body&&body.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}const ft=["touchstart","touchmove"];function _t(e,t,n){if(Array.isArray(t))return mt(_t,e,t,n);lt.has(e)||lt.set(e,{});const data=lt.get(e);if(data.handlers||(data.handlers={}),data.handlers[t]||(data.handlers[t]=[]),n.guid||(n.guid=ct()),data.handlers[t].push(n),data.dispatcher||(data.disabled=!1,data.dispatcher=function(t,n){if(data.disabled)return;t=gt(t);const r=data.handlers[t.type];if(r){const o=r.slice(0);for(let r=0,l=o.length;r<l&&!t.isImmediatePropagationStopped();r++)try{o[r].call(e,t,n)}catch(e){W.error(e)}}}),1===data.handlers[t].length)if(e.addEventListener){let n=!1;(function(){if("boolean"!=typeof ht){ht=!1;try{const e=Object.defineProperty({},"passive",{get(){ht=!0}});o.a.addEventListener("test",null,e),o.a.removeEventListener("test",null,e)}catch(e){}}return ht})()&&ft.indexOf(t)>-1&&(n={passive:!0}),e.addEventListener(t,data.dispatcher,n)}else e.attachEvent&&e.attachEvent("on"+t,data.dispatcher)}function yt(e,t,n){if(!lt.has(e))return;const data=lt.get(e);if(!data.handlers)return;if(Array.isArray(t))return mt(yt,e,t,n);const r=function(e,t){data.handlers[t]=[],pt(e,t)};if(void 0===t){for(const t in data.handlers)Object.prototype.hasOwnProperty.call(data.handlers||{},t)&&r(e,t);return}const o=data.handlers[t];if(o)if(n){if(n.guid)for(let e=0;e<o.length;e++)o[e].guid===n.guid&&o.splice(e--,1);pt(e,t)}else r(e,t)}function vt(e,t,n){const r=lt.has(e)?lt.get(e):{},o=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=gt(t),r.dispatcher&&r.dispatcher.call(e,t,n),o&&!t.isPropagationStopped()&&!0===t.bubbles)vt.call(null,o,t,n);else if(!o&&!t.defaultPrevented&&t.target&&t.target[t.type]){lt.has(t.target)||lt.set(t.target,{});const e=lt.get(t.target);t.target[t.type]&&(e.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),e.disabled=!1)}return!t.defaultPrevented}function Tt(e,t,n){if(Array.isArray(t))return mt(Tt,e,t,n);const r=function(){yt(e,t,r),n.apply(this,arguments)};r.guid=n.guid=n.guid||ct(),_t(e,t,r)}function bt(e,t,n){const r=function(){yt(e,t,r),n.apply(this,arguments)};r.guid=n.guid=n.guid||ct(),_t(e,t,r)}var St=Object.freeze({__proto__:null,fixEvent:gt,on:_t,off:yt,trigger:vt,one:Tt,any:bt});const kt=30,Ct=function(e,t,n){t.guid||(t.guid=ct());const r=t.bind(e);return r.guid=n?n+"_"+t.guid:t.guid,r},Et=function(e,t){let n=o.a.performance.now();return function(...r){const l=o.a.performance.now();l-n>=t&&(e(...r),n=l)}},wt=function(e,t,n,r=o.a){let l;const h=function(){const o=this,h=arguments;let d=function(){l=null,d=null,n||e.apply(o,h)};!l&&n&&e.apply(o,h),r.clearTimeout(l),l=r.setTimeout(d,t)};return h.cancel=()=>{r.clearTimeout(l),l=null},h};var xt=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:kt,bind_:Ct,throttle:Et,debounce:wt});let It;class Pt{on(e,t){const n=this.addEventListener;this.addEventListener=()=>{},_t(this,e,t),this.addEventListener=n}off(e,t){yt(this,e,t)}one(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Tt(this,e,t),this.addEventListener=n}any(e,t){const n=this.addEventListener;this.addEventListener=()=>{},bt(this,e,t),this.addEventListener=n}trigger(e){const t=e.type||e;"string"==typeof e&&(e={type:t}),e=gt(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),vt(this,e)}queueTrigger(e){It||(It=new Map);const t=e.type||e;let map=It.get(this);map||(map=new Map,It.set(this,map));const n=map.get(t);map.delete(t),o.a.clearTimeout(n);const r=o.a.setTimeout((()=>{map.delete(t),0===map.size&&(map=null,It.delete(this)),this.trigger(e)}),0);map.set(t,r)}}Pt.prototype.allowedEvents_={},Pt.prototype.addEventListener=Pt.prototype.on,Pt.prototype.removeEventListener=Pt.prototype.off,Pt.prototype.dispatchEvent=Pt.prototype.trigger;const At=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e,Lt=object=>object instanceof Pt||!!object.eventBusEl_&&["on","one","off","trigger"].every((e=>"function"==typeof object[e])),Ot=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,Dt=(e,t,n)=>{if(!e||!e.nodeName&&!Lt(e))throw new Error(`Invalid target for ${At(t)}#${n}; must be a DOM node or evented object.`)},Mt=(e,t,n)=>{if(!Ot(e))throw new Error(`Invalid event type for ${At(t)}#${n}; must be a non-empty string or array.`)},Ut=(e,t,n)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${At(t)}#${n}; must be a function.`)},Rt=(e,t,n)=>{const r=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let o,l,h;return r?(o=e.eventBusEl_,t.length>=3&&t.shift(),[l,h]=t):[o,l,h]=t,Dt(o,e,n),Mt(l,e,n),Ut(h,e,n),h=Ct(e,h),{isTargetingSelf:r,target:o,type:l,listener:h}},Nt=(e,t,n,r)=>{Dt(e,e,t),e.nodeName?St[t](e,n,r):e[t](n,r)},Bt={on(...e){const{isTargetingSelf:t,target:n,type:r,listener:o}=Rt(this,e,"on");if(Nt(n,"on",r,o),!t){const e=()=>this.off(n,r,o);e.guid=o.guid;const t=()=>this.off("dispose",e);t.guid=o.guid,Nt(this,"on","dispose",e),Nt(n,"on","dispose",t)}},one(...e){const{isTargetingSelf:t,target:n,type:r,listener:o}=Rt(this,e,"one");if(t)Nt(n,"one",r,o);else{const e=(...t)=>{this.off(n,r,e),o.apply(null,t)};e.guid=o.guid,Nt(n,"one",r,e)}},any(...e){const{isTargetingSelf:t,target:n,type:r,listener:o}=Rt(this,e,"any");if(t)Nt(n,"any",r,o);else{const e=(...t)=>{this.off(n,r,e),o.apply(null,t)};e.guid=o.guid,Nt(n,"any",r,e)}},off(e,t,n){if(!e||Ot(e))yt(this.eventBusEl_,e,t);else{const r=e,o=t;Dt(r,this,"off"),Mt(o,this,"off"),Ut(n,this,"off"),n=Ct(this,n),this.off("dispose",n),r.nodeName?(yt(r,o,n),yt(r,"dispose",n)):Lt(r)&&(r.off(o,n),r.off("dispose",n))}},trigger(e,t){Dt(this.eventBusEl_,this,"trigger");const n=e&&"string"!=typeof e?e.type:e;if(!Ot(n))throw new Error(`Invalid event type for ${At(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return vt(this.eventBusEl_,e,t)}};function Ft(e,t={}){const{eventBusKey:n}=t;if(n){if(!e[n].nodeName)throw new Error(`The eventBusKey "${n}" does not refer to an element.`);e.eventBusEl_=e[n]}else e.eventBusEl_=xe("span",{className:"vjs-event-bus"});return Object.assign(e,Bt),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&lt.has(e)&&lt.delete(e)})),o.a.setTimeout((()=>{e.eventBusEl_=null}),0)})),e}const jt={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),Q(e,((e,n)=>{this.state[n]!==e&&(t=t||{},t[n]={from:this.state[n],to:e}),this.state[n]=e})),t&&Lt(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function $t(e,t){return Object.assign(e,jt),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&Lt(e)&&e.on("statechanged",e.handleStateChanged),e}const Ht=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))},qt=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Vt=function(e,t){return qt(e)===qt(t)};var Wt=Object.freeze({__proto__:null,toLowerCase:Ht,toTitleCase:qt,titleCaseEquals:Vt});class zt{constructor(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Z({},this.options_),t=this.options_=Z(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const t=e&&e.id&&e.id()||"no_player";this.id_=`${t}_component_${ct()}`}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((e=>this.addClass(e))),!1!==t.evented&&(Ft(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),$t(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,!1!==t.initChildren&&this.initChildren(),this.ready(n),!1!==t.reportTouchActivity&&this.enableTouchActivity()}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 Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=Z(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,n){return xe(e,t,n)}localize(e,t,n=e){const code=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),o=r&&r[code],l=code&&code.split("-")[0],h=r&&r[l];let d=n;return o&&o[e]?d=o[e]:h&&h[e]&&(d=h[e]),t&&(d=d.replace(/\{(\d+)\}/g,(function(e,n){const r=t[n-1];let o=r;return void 0===r&&(o=e),o}))),d}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(((e,t)=>e.concat(t)),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}addChild(e,t={},n=this.children_.length){let component,r;if("string"==typeof e){r=qt(e);const n=t.componentClass||r;t.name=r;const o=zt.getComponent(n);if(!o)throw new Error(`Component ${n} does not exist`);if("function"!=typeof o)return null;component=new o(this.player_||this,t)}else component=e;if(component.parentComponent_&&component.parentComponent_.removeChild(component),this.children_.splice(n,0,component),component.parentComponent_=this,"function"==typeof component.id&&(this.childIndex_[component.id()]=component),r=r||component.name&&qt(component.name()),r&&(this.childNameIndex_[r]=component,this.childNameIndex_[Ht(r)]=component),"function"==typeof component.el&&component.el()){let e=null;this.children_[n+1]&&(this.children_[n+1].el_?e=this.children_[n+1].el_:Ce(this.children_[n+1])&&(e=this.children_[n+1])),this.contentEl().insertBefore(component.el(),e)}return component}removeChild(component){if("string"==typeof component&&(component=this.getChild(component)),!component||!this.children_)return;let e=!1;for(let i=this.children_.length-1;i>=0;i--)if(this.children_[i]===component){e=!0,this.children_.splice(i,1);break}if(!e)return;component.parentComponent_=null,this.childIndex_[component.id()]=null,this.childNameIndex_[qt(component.name())]=null,this.childNameIndex_[Ht(component.name())]=null;const t=component.el();t&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(component.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,n=e=>{const n=e.name;let r=e.opts;if(void 0!==t[n]&&(r=t[n]),!1===r)return;!0===r&&(r={}),r.playerOptions=this.options_.playerOptions;const o=this.addChild(n,r);o&&(this[n]=o)};let r;const o=zt.getComponent("Tech");r=Array.isArray(e)?e:Object.keys(e),r.concat(Object.keys(this.options_).filter((function(e){return!r.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((t=>{let n,r;return"string"==typeof t?(n=t,r=e[n]||this.options_[n]||{}):(n=t.name,r=t),{name:n,opts:r}})).filter((e=>{const t=zt.getComponent(e.opts.componentClass||qt(e.name));return t&&!o.isTech(t)})).forEach(n)}}buildCSSClass(){return""}ready(e,t=!1){if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)}$(e,t){return Xe(e,t||this.contentEl())}$$(e,t){return Ye(e,t||this.contentEl())}hasClass(e){return Ae(this.el_,e)}addClass(...e){Le(this.el_,...e)}removeClass(...e){Oe(this.el_,...e)}toggleClass(e,t){De(this.el_,e,t)}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 Re(this.el_,e)}setAttribute(e,t){Ne(this.el_,e,t)}removeAttribute(e){Be(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;const r=this.el_.style[e],o=r.indexOf("px");return-1!==o?parseInt(r.slice(0,o),10):parseInt(this.el_["offset"+qt(e)],10)}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=Je(this.el_,e),t=parseFloat(t),0===t||isNaN(t)){const n=`offset${qt(e)}`;t=this.el_[n]}return t}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_&&(c.a.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;let n;this.on("touchstart",(function(r){1===r.touches.length&&(t={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},e=o.a.performance.now(),n=!0)})),this.on("touchmove",(function(e){if(e.touches.length>1)n=!1;else if(t){const r=e.touches[0].pageX-t.pageX,o=e.touches[0].pageY-t.pageY;Math.sqrt(r*r+o*o)>10&&(n=!1)}}));const r=function(){n=!1};this.on("touchleave",r),this.on("touchcancel",r),this.on("touchend",(function(r){if(t=null,!0===n){o.a.performance.now()-e<200&&(r.preventDefault(),this.trigger("tap"))}}))}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ct(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",(function(){e(),this.clearInterval(t),t=this.setInterval(e,250)}));const n=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",n),this.on("touchcancel",n)}setTimeout(e,t){var n;return e=Ct(this,e),this.clearTimersOnDispose_(),n=o.a.setTimeout((()=>{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()}),t),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),o.a.clearTimeout(e)),e}setInterval(e,t){e=Ct(this,e),this.clearTimersOnDispose_();const n=o.a.setInterval(e,t);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),o.a.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=Ct(this,e),t=o.a.requestAnimationFrame((()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()})),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=Ct(this,t);const n=this.requestAnimationFrame((()=>{t(),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),o.a.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((([e,t])=>{this[e].forEach(((e,n)=>this[t](n)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(e,t){if("string"!=typeof e||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const n=zt.getComponent("Tech"),r=n&&n.isTech(t),o=zt===t||zt.prototype.isPrototypeOf(t.prototype);if(r||!o){let t;throw t=r?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${e}"; ${t}.`)}e=qt(e),zt.components_||(zt.components_={});const l=zt.getComponent("Player");if("Player"===e&&l&&l.players){const e=l.players,t=Object.keys(e);if(e&&t.length>0&&t.map((t=>e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return zt.components_[e]=t,zt.components_[Ht(e)]=t,t}static getComponent(e){if(e&&zt.components_)return zt.components_[e]}}function Gt(e,t,n,r){return function(e,t,n){if("number"!=typeof t||t<0||t>n)throw new Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${t}) is non-numeric or out of bounds (0-${n}).`)}(e,r,n.length-1),n[r][t]}function Kt(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Gt.bind(null,"start",0,e),end:Gt.bind(null,"end",1,e)},o.a.Symbol&&o.a.Symbol.iterator&&(t[o.a.Symbol.iterator]=()=>(e||[]).values()),t}function Qt(e,t){return Array.isArray(e)?Kt(e):void 0===e||void 0===t?Kt():Kt([[e,t]])}zt.registerComponent("Component",zt);const Xt=function(e,t){e=e<0?0:e;let s=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600);const o=Math.floor(t/60%60),l=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=s="-"),r=r>0||l>0?r+":":"",n=((r||o>=10)&&n<10?"0"+n:n)+":",s=s<10?"0"+s:s,r+n+s};let Yt=Xt;function Jt(e){Yt=e}function Zt(){Yt=Xt}function ei(e,t=e){return Yt(e,t)}var ti=Object.freeze({__proto__:null,createTimeRanges:Qt,createTimeRange:Qt,setFormatTime:Jt,resetFormatTime:Zt,formatTime:ei});function ii(e,t){let n,r,o=0;if(!t)return 0;e&&e.length||(e=Qt(0,0));for(let i=0;i<e.length;i++)n=e.start(i),r=e.end(i),r>t&&(r=t),o+=r-n;return o/t}function si(e){if(e instanceof si)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Y(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=si.defaultMessages[this.code]||"")}si.prototype.code=0,si.prototype.message="",si.prototype.status=null,si.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],si.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 e=0;e<si.errorTypes.length;e++)si[si.errorTypes[e]]=e,si.prototype[si.errorTypes[e]]=e;function ni(e){return null!=e&&"function"==typeof e.then}function ri(e){ni(e)&&e.then(null,(e=>{}))}const ai=function(track){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((e,t,i)=>(track[t]&&(e[t]=track[t]),e)),{cues:track.cues&&Array.prototype.map.call(track.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})};var oi=function(e){const t=e.$$("track"),n=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){const t=ai(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(track){return-1===n.indexOf(track)})).map(ai))},hi=function(e,t){return e.forEach((function(track){const e=t.addRemoteTextTrack(track).track;!track.src&&track.cues&&track.cues.forEach((t=>e.addCue(t)))})),t.textTracks()};class di extends zt{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=xe("div",{className:"vjs-modal-dialog-content"},{role:"document"}),this.descEl_=xe("p",{className:"vjs-modal-dialog-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),Ie(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`vjs-modal-dialog vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let desc=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(desc+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),desc}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"boolean"==typeof e&&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("boolean"==typeof e){const t=this.closeable_=!!e;let n=this.getChild("closeButton");if(t&&!n){const e=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(content){const e=this.contentEl(),t=e.parentNode,n=e.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,t.removeChild(e),this.empty(),Ke(e,content),this.trigger("modalfill"),n?t.insertBefore(e,n):t.appendChild(e);const r=this.getChild("closeButton");r&&t.appendChild(r.el_)}empty(){this.trigger("beforemodalempty"),We(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){const e=h.a.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),c.a.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(!c.a.isEventKey(e,"Tab"))return;const t=this.focusableEls_(),n=this.el_.querySelector(":focus");let r;for(let i=0;i<t.length;i++)if(n===t[i]){r=i;break}h.a.activeElement===this.el_&&(r=0),e.shiftKey&&0===r?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||r!==t.length-1||(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(e=>(e instanceof o.a.HTMLAnchorElement||e instanceof o.a.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof o.a.HTMLInputElement||e instanceof o.a.HTMLSelectElement||e instanceof o.a.HTMLTextAreaElement||e instanceof o.a.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof o.a.HTMLIFrameElement||e instanceof o.a.HTMLObjectElement||e instanceof o.a.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")))}}di.prototype.options_={pauseOnOpen:!0,temporary:!0},zt.registerComponent("ModalDialog",di);class ui extends Pt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let i=0;i<e.length;i++)this.addTrack(e[i])}addTrack(track){const e=this.tracks_.length;""+e in this||Object.defineProperty(this,e,{get(){return this.tracks_[e]}}),-1===this.tracks_.indexOf(track)&&(this.tracks_.push(track),this.trigger({track:track,type:"addtrack",target:this})),track.labelchange_=()=>{this.trigger({track:track,type:"labelchange",target:this})},Lt(track)&&track.addEventListener("labelchange",track.labelchange_)}removeTrack(e){let track;for(let i=0,t=this.length;i<t;i++)if(this[i]===e){track=this[i],track.off&&track.off(),this.tracks_.splice(i,1);break}track&&this.trigger({track:track,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const track=this[i];if(track.id===e){t=track;break}}return t}}ui.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const e in ui.prototype.allowedEvents_)ui.prototype["on"+e]=null;const ci=function(e,track){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&track.id!==e[i].id&&(e[i].enabled=!1)};const pi=function(e,track){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&track.id!==e[i].id&&(e[i].selected=!1)};class mi extends ui{addTrack(track){super.addTrack(track),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),track.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(track.kind)&&track.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 gi{constructor(e){gi.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const n=e.length;this.cues_=e,this.length_=e.length;const r=function(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)}getCueById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}const fi={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},_i={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},yi={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},vi={disabled:"disabled",hidden:"hidden",showing:"showing"};class Ti extends Pt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+ct(),kind:e.kind||"",language:e.language||""};let label=e.label||"";for(const e in t)Object.defineProperty(this,e,{get:()=>t[e],set(){}});Object.defineProperty(this,"label",{get:()=>label,set(e){e!==label&&(label=e,this.trigger("labelchange"))}})}}const bi=function(e){const t=["protocol","hostname","port","pathname","search","hash","host"],a=h.a.createElement("a");a.href=e;const details={};for(let i=0;i<t.length;i++)details[t[i]]=a[t[i]];return"http:"===details.protocol&&(details.host=details.host.replace(/:80$/,"")),"https:"===details.protocol&&(details.host=details.host.replace(/:443$/,"")),details.protocol||(details.protocol=o.a.location.protocol),details.host||(details.host=o.a.location.host),details},Si=function(e){if(!e.match(/^https?:\/\//)){const a=h.a.createElement("a");a.href=e,e=a.href}return e},ki=function(path){if("string"==typeof path){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(path);if(e)return e.pop().toLowerCase()}return""},Ci=function(e,t=o.a.location){const n=bi(e);return(":"===n.protocol?t.protocol:n.protocol)+n.host!==t.protocol+t.host};var Ei=Object.freeze({__proto__:null,parseUrl:bi,getAbsoluteURL:Si,getFileExtension:ki,isCrossOrigin:Ci});const wi=function(e,track){const t=new o.a.WebVTT.Parser(o.a,o.a.vttjs,o.a.WebVTT.StringDecoder()),n=[];t.oncue=function(e){track.addCue(e)},t.onparsingerror=function(e){n.push(e)},t.onflush=function(){track.trigger({type:"loadeddata",target:track})},t.parse(e),n.length>0&&(o.a.console&&o.a.console.groupCollapsed&&o.a.console.groupCollapsed(`Text Track parsing errors for ${track.src}`),n.forEach((e=>W.error(e))),o.a.console&&o.a.console.groupEnd&&o.a.console.groupEnd()),t.flush()},xi=function(e,track){const t={uri:e},n=Ci(e);n&&(t.cors=n);const r="use-credentials"===track.tech_.crossOrigin();r&&(t.withCredentials=r),y()(t,Ct(this,(function(e,t,n){if(e)return W.error(e,t);track.loaded_=!0,"function"!=typeof o.a.WebVTT?track.tech_&&track.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return wi(n,track);W.error(`vttjs failed to load, stopping trying to process ${track.src}`)})):wi(n,track)})))};class Ii extends Ti{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Z(e,{kind:yi[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=vi[t.mode]||"disabled";const r=t.default;"metadata"!==t.kind&&"chapters"!==t.kind||(n="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks;const o=new gi(this.cues_),l=new gi(this.activeCues_);let h=!1;this.timeupdateHandler=Ct(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,h&&(this.trigger("cuechange"),h=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));this.tech_.one("dispose",(()=>{this.stopTracking()})),"disabled"!==n&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>r,set(){}},mode:{get:()=>n,set(e){vi[e]&&n!==e&&(n=e,this.preload_||"disabled"===n||0!==this.cues.length||xi(this.src,this),this.stopTracking(),"disabled"!==n&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?o:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0===this.cues.length)return l;const e=this.tech_.currentTime(),t=[];for(let i=0,n=this.cues.length;i<n;i++){const n=this.cues[i];n.startTime<=e&&n.endTime>=e&&t.push(n)}if(h=!1,t.length!==this.activeCues_.length)h=!0;else for(let i=0;i<t.length;i++)-1===this.activeCues_.indexOf(t[i])&&(h=!0);return this.activeCues_=t,l.setCues_(this.activeCues_),l},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||"subtitles"!==t.kind&&"captions"!==t.kind)&&xi(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(o.a.vttjs&&!(e instanceof o.a.vttjs.VTTCue)){t=new o.a.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const n=this.tech_.textTracks();for(let i=0;i<n.length;i++)n[i]!==this&&n[i].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let i=this.cues_.length;for(;i--;){const t=this.cues_[i];if(t===e||t.originalCue_&&t.originalCue_===e){this.cues_.splice(i,1),this.cues.setCues_(this.cues_);break}}}}Ii.prototype.allowedEvents_={cuechange:"cuechange"};class Pi extends Ti{constructor(e={}){const t=Z(e,{kind:_i[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"enabled",{get:()=>n,set(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Ai extends Ti{constructor(e={}){const t=Z(e,{kind:fi[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"selected",{get:()=>n,set(e){"boolean"==typeof e&&e!==n&&(n=e,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Li extends Pt{constructor(e={}){let t;super();const track=new Ii(e);this.kind=track.kind,this.src=track.src,this.srclang=track.language,this.label=track.label,this.default=track.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>track}}),t=Li.NONE,track.addEventListener("loadeddata",(()=>{t=Li.LOADED,this.trigger({type:"load",target:this})}))}}Li.prototype.allowedEvents_={load:"load"},Li.NONE=0,Li.LOADING=1,Li.LOADED=2,Li.ERROR=3;const Oi={audio:{ListClass:class extends ui{constructor(e=[]){for(let i=e.length-1;i>=0;i--)if(e[i].enabled){ci(e,e[i]);break}super(e),this.changing_=!1}addTrack(track){track.enabled&&ci(this,track),super.addTrack(track),track.addEventListener&&(track.enabledChange_=()=>{this.changing_||(this.changing_=!0,ci(this,track),this.changing_=!1,this.trigger("change"))},track.addEventListener("enabledchange",track.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Pi,capitalName:"Audio"},video:{ListClass:class extends ui{constructor(e=[]){for(let i=e.length-1;i>=0;i--)if(e[i].selected){pi(e,e[i]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let i=0;i<this.length;i++)if(this[i].selected)return i;return-1},set(){}})}addTrack(track){track.selected&&pi(this,track),super.addTrack(track),track.addEventListener&&(track.selectedChange_=()=>{this.changing_||(this.changing_=!0,pi(this,track),this.changing_=!1,this.trigger("change"))},track.addEventListener("selectedchange",track.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Ai,capitalName:"Video"},text:{ListClass:mi,TrackClass:Ii,capitalName:"Text"}};Object.keys(Oi).forEach((function(e){Oi[e].getterName=`${e}Tracks`,Oi[e].privateName=`${e}Tracks_`}));const Di={remoteText:{ListClass:mi,TrackClass:Ii,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let i=0,t=e.length;i<t;i++)this.addTrackElement_(e[i])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}getTrackElementByTrack_(track){let e;for(let i=0,t=this.trackElements_.length;i<t;i++)if(track===this.trackElements_[i].track){e=this.trackElements_[i];break}return e}removeTrackElement_(e){for(let i=0,t=this.trackElements_.length;i<t;i++)if(e===this.trackElements_[i]){this.trackElements_[i].track&&"function"==typeof this.trackElements_[i].track.off&&this.trackElements_[i].track.off(),"function"==typeof this.trackElements_[i].off&&this.trackElements_[i].off(),this.trackElements_.splice(i,1);break}}},TrackClass:Li,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Mi=Object.assign({},Oi,Di);Di.names=Object.keys(Di),Oi.names=Object.keys(Oi),Mi.names=[].concat(Di.names).concat(Oi.names);class Ui extends zt{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",(function(){this.hasStarted_=!0})),this.on("loadstart",(function(){this.hasStarted_=!1})),Mi.names.forEach((t=>{const n=Mi[t];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])})),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((track=>{!1===e[`native${track}Tracks`]&&(this[`featuresNative${track}Tracks`]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new Mi.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(Ct(this,(function(){const e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Qt(0,0)}bufferedPercent(){return ii(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(Oi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach((e=>{const t=this[`${e}Tracks`]()||[];let i=t.length;for(;i--;){const track=t[i];"text"===e&&this.removeRemoteTextTrack(track),t.removeTrack(track)}}))}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let i=e.length;for(;i--;){const track=e[i];this.removeRemoteTextTrack(track)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new si(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Qt(0,0):Qt()}play(){}setScrubbing(){}scrubbing(){}setCurrentTime(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Oi.names.forEach((e=>{const t=Oi[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",(()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))}addWebVttScript_(){if(!o.a.WebVTT)if(h.a.body.contains(this.el())){if(!this.options_["vtt.js"]&&J(T.a)&&Object.keys(T.a).length>0)return void this.trigger("vttjsloaded");const script=h.a.createElement("script");script.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",script.onload=()=>{this.trigger("vttjsloaded")},script.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",(()=>{script.onload=null,script.onerror=null})),o.a.WebVTT=!0,this.el().parentNode.appendChild(script)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),n=t=>e.addTrack(t.track),r=t=>e.removeTrack(t.track);t.on("addtrack",n),t.on("removetrack",r),this.addWebVttScript_();const o=()=>this.trigger("texttrackchange"),l=()=>{o();for(let i=0;i<e.length;i++){const track=e[i];track.removeEventListener("cuechange",o),"showing"===track.mode&&track.addEventListener("cuechange",o)}};l(),e.addEventListener("change",l),e.addEventListener("addtrack",l),e.addEventListener("removetrack",l),this.on("dispose",(function(){t.off("addtrack",n),t.off("removetrack",r),e.removeEventListener("change",l),e.removeEventListener("addtrack",l),e.removeEventListener("removetrack",l);for(let i=0;i<e.length;i++){e[i].removeEventListener("cuechange",o)}}))}addTextTrack(e,label,t){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,label,n,r={}){const o=e.textTracks();r.kind=t,label&&(r.label=label),n&&(r.language=n),r.tech=e;const track=new Mi.text.TrackClass(r);return o.addTrack(track),track}(this,e,label,t)}createRemoteTextTrack(e){const track=Z(e,{tech:this});return new Di.remoteTextEl.TrackClass(track)}addRemoteTextTrack(e={},t){const n=this.createRemoteTextTrack(e);return"boolean"!=typeof t&&(t=!1),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!1===t&&this.ready((()=>this.autoRemoteTextTracks_.addTrack(n.track))),n}removeRemoteTextTrack(track){const e=this.remoteTextTrackEls().getTrackElementByTrack_(track);this.remoteTextTrackEls().removeTrackElement_(e),this.remoteTextTracks().removeTrack(track),this.autoRemoteTextTracks_.removeTrack(track)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=ct();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",(()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())}))):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(){}overrideNativeVideoTracks(){}canPlayType(){return""}static canPlayType(){return""}static canPlaySource(e,t){return Ui.canPlayType(e.type)}static isTech(component){return component.prototype instanceof Ui||component instanceof Ui||component===Ui}static registerTech(e,t){if(Ui.techs_||(Ui.techs_={}),!Ui.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Ui.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Ui.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qt(e),Ui.techs_[e]=t,Ui.techs_[Ht(e)]=t,"Tech"!==e&&Ui.defaultTechOrder_.push(e),t}static getTech(e){if(e)return Ui.techs_&&Ui.techs_[e]?Ui.techs_[e]:(e=qt(e),o.a&&o.a.videojs&&o.a.videojs[e]?(W.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),o.a.videojs[e]):void 0)}}Mi.names.forEach((function(e){const t=Mi[e];Ui.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Ui.prototype.featuresVolumeControl=!0,Ui.prototype.featuresMuteControl=!0,Ui.prototype.featuresFullscreenResize=!1,Ui.prototype.featuresPlaybackRate=!1,Ui.prototype.featuresProgressEvents=!1,Ui.prototype.featuresSourceset=!1,Ui.prototype.featuresTimeupdateEvents=!1,Ui.prototype.featuresNativeTextTracks=!1,Ui.prototype.featuresVideoFrameCallback=!1,Ui.withSourceHandlers=function(e){e.registerSourceHandler=function(t,n){let r=e.sourceHandlers;r||(r=e.sourceHandlers=[]),void 0===n&&(n=r.length),r.splice(n,0,t)},e.canPlayType=function(t){const n=e.sourceHandlers||[];let r;for(let i=0;i<n.length;i++)if(r=n[i].canPlayType(t),r)return r;return""},e.selectSourceHandler=function(source,t){const n=e.sourceHandlers||[];let r;for(let i=0;i<n.length;i++)if(r=n[i].canHandleSource(source,t),r)return n[i];return null},e.canPlaySource=function(t,n){const r=e.selectSourceHandler(t,n);return r?r.canHandleSource(t,n):""};["seekable","seeking","duration"].forEach((function(e){const t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(source){let t=e.selectSourceHandler(source,this.options_);t||(e.nativeSourceHandler?t=e.nativeSourceHandler:W.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==e.nativeSourceHandler&&(this.currentSource_=source),this.sourceHandler_=t.handleSource(source,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},zt.registerComponent("Tech",Ui),Ui.registerTech("Tech",Ui),Ui.defaultTechOrder_=[];const Ri={},Ni={},Bi={};function Fi(e,t,n){e.setTimeout((()=>Wi(t,Ri[t.type],n,e)),1)}function ji(e,t,n,r=null){const o="call"+qt(n),l=e.reduce(Vi(o),r),h=l===Bi,d=h?null:t[n](l);return function(e,t,n,r){for(let i=e.length-1;i>=0;i--){const o=e[i];o[t]&&o[t](r,n)}}(e,n,d,h),d}const $i={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Hi={setCurrentTime:1,setMuted:1,setVolume:1},qi={play:1,pause:1};function Vi(e){return(t,n)=>t===Bi?Bi:n[e]?n[e](t):t}function Wi(e={},t=[],n,r,o=[],l=!1){const[h,...d]=t;if("string"==typeof h)Wi(e,Ri[h],n,r,o,l);else if(h){const t=function(e,t){const n=Ni[e.id()];let r=null;if(null==n)return r=t(e),Ni[e.id()]=[[t,r]],r;for(let i=0;i<n.length;i++){const[e,o]=n[i];e===t&&(r=o)}return null===r&&(r=t(e),n.push([t,r])),r}(r,h);if(!t.setSource)return o.push(t),Wi(e,d,n,r,o,l);t.setSource(Object.assign({},e),(function(h,c){if(h)return Wi(e,d,n,r,o,l);o.push(t),Wi(c,e.type===c.type?d:Ri[c.type],n,r,o,l)}))}else d.length?Wi(e,d,n,r,o,l):l?n(e,o):Wi(e,Ri["*"],n,r,o,!0)}const zi={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Gi=function(e=""){const t=ki(e);return zi[t.toLowerCase()]||""},Ki=function(e){if(Array.isArray(e)){let t=[];e.forEach((function(e){e=Ki(e),Array.isArray(e)?t=t.concat(e):Y(e)&&t.push(e)})),e=t}else e="string"==typeof e&&e.trim()?[Qi({src:e})]:Y(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[Qi(e)]:[];return e};function Qi(e){if(!e.type){const t=Gi(e.src);t&&(e.type=t)}return e}zt.registerComponent("MediaLoader",class extends zt{constructor(e,t,n){if(super(e,Z({createEl:!1},t),n),t.playerOptions.sources&&0!==t.playerOptions.sources.length)e.src(t.playerOptions.sources);else for(let i=0,n=t.playerOptions.techOrder;i<n.length;i++){const t=qt(n[i]);let r=Ui.getTech(t);if(t||(r=zt.getComponent(t)),r&&r.isSupported()){e.loadTech_(t);break}}}});class Xi extends zt{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=e=>this.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},n={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&W.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_=t.tabIndex;const r=xe(e,t,n);return r.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=xe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(text,e=this.el()){if(void 0===text)return this.controlText_||"Need Text";const t=this.localize(text);this.controlText_=text,Ie(this.controlTextEl_,t),this.nonIconControl||this.player_.options_.noUITitleAttributes||e.setAttribute("title",t)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&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"),void 0!==this.tabIndex_&&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){c.a.isEventKey(e,"Space")||c.a.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}zt.registerComponent("ClickableComponent",Xi);class Yi extends Xi{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return xe("picture",{className:"vjs-poster",tabIndex:-1},{},xe("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))}crossOrigin(e){if(void 0===e)return this.el_?this.el_.querySelector("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null===e||"anonymous"===e||"use-credentials"===e?this.el_.querySelector("img").crossOrigin=e:this.player_.log.warn(`crossOrigin must be null,  "anonymous" or "use-credentials", given "${e}"`)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){this.el_.querySelector("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?ri(this.player_.play()):this.player_.pause())}}Yi.prototype.crossorigin=Yi.prototype.crossOrigin,zt.registerComponent("PosterImage",Yi);const Ji={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 Zi(e,t){let n;if(4===e.length)n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");n=e.slice(1)}return"rgba("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+","+t+")"}function es(e,style,t){try{e.style[style]=t}catch(e){return}}zt.registerComponent("TextTrackDisplay",class extends zt{constructor(e,t,n){super(e,t,n);const r=e=>this.updateDisplay(e);e.on("loadstart",(e=>this.toggleDisplay(e))),e.on("texttrackchange",r),e.on("loadedmetadata",(e=>this.preselectTrack(e))),e.ready(Ct(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)return void this.hide();e.on("fullscreenchange",r),e.on("playerresize",r);const t=o.a.screen.orientation||o.a,n=o.a.screen.orientation?"change":"orientationchange";t.addEventListener(n,r),e.on("dispose",(()=>t.removeEventListener(n,r)));const l=this.options_.playerOptions.tracks||[];for(let i=0;i<l.length;i++)this.player_.addRemoteTextTrack(l[i],!0);this.preselectTrack()})))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),n=this.player_.cache_.selectedLanguage;let r,o,l;for(let i=0;i<t.length;i++){const track=t[i];n&&n.enabled&&n.language&&n.language===track.language&&track.kind in e?track.kind===n.kind?l=track:l||(l=track):n&&!n.enabled?(l=null,r=null,o=null):track.default&&("descriptions"!==track.kind||r?track.kind in e&&!o&&(o=track):r=track)}l?l.mode="showing":o?o.mode="showing":r&&(r.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){"function"==typeof o.a.WebVTT&&o.a.WebVTT.processCues(o.a,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const t=[];for(let i=0;i<e.length;++i){const track=e[i];"showing"===track.mode&&t.push(track)}return void this.updateForTrack(t)}let n=null,r=null,i=e.length;for(;i--;){const track=e[i];"showing"===track.mode&&("descriptions"===track.kind?n=track:r=track)}r?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):n&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(n))}updateDisplayState(track){const e=this.player_.textTrackSettings.getValues(),t=track.activeCues;let i=t.length;for(;i--;){const n=t[i];if(!n)continue;const r=n.displayState;if(e.color&&(r.firstChild.style.color=e.color),e.textOpacity&&es(r.firstChild,"color",Zi(e.color||"#fff",e.textOpacity)),e.backgroundColor&&(r.firstChild.style.backgroundColor=e.backgroundColor),e.backgroundOpacity&&es(r.firstChild,"backgroundColor",Zi(e.backgroundColor||"#000",e.backgroundOpacity)),e.windowColor&&(e.windowOpacity?es(r,"backgroundColor",Zi(e.windowColor,e.windowOpacity)):r.style.backgroundColor=e.windowColor),e.edgeStyle&&("dropshadow"===e.edgeStyle?r.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===e.edgeStyle?r.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===e.edgeStyle?r.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===e.edgeStyle&&(r.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),e.fontPercent&&1!==e.fontPercent){const t=o.a.parseFloat(r.style.fontSize);r.style.fontSize=t*e.fontPercent+"px",r.style.height="auto",r.style.top="auto"}e.fontFamily&&"default"!==e.fontFamily&&("small-caps"===e.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=Ji[e.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"!=typeof o.a.WebVTT||e.every((track=>!track.activeCues)))return;const t=[];for(let i=0;i<e.length;++i){const track=e[i];for(let e=0;e<track.activeCues.length;++e)t.push(track.activeCues[e])}o.a.WebVTT.processCues(o.a,t,this.el_);for(let i=0;i<e.length;++i){const track=e[i];for(let e=0;e<track.activeCues.length;++e){const t=track.activeCues[e].displayState;Le(t,"vjs-text-track-cue","vjs-text-track-cue-"+(track.language?track.language:i)),track.language&&Ne(t,"lang",track.language)}this.player_.textTrackSettings&&this.updateDisplayState(track)}}});zt.registerComponent("LoadingSpinner",class extends zt{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),n=xe("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),r=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r}});class ts extends Xi{createEl(e,t={},n={}){const r=xe("button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n));return r.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const n=this.constructor.name;return W.warn(`Adding an actionable (user controllable) child to a Button (${n}) is not supported; use a ClickableComponent instead.`),zt.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){c.a.isEventKey(e,"Space")||c.a.isEventKey(e,"Enter")?e.stopPropagation():super.handleKeyDown(e)}}zt.registerComponent("Button",ts);class is extends ts{constructor(e,t){super(e,t),this.mouseused_=!1,this.on("mousedown",(e=>this.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)return ri(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r)return void this.player_.tech(!0).focus();const o=()=>r.focus();ni(t)?t.then(o,(()=>{})):this.setTimeout(o,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}is.prototype.controlText_="Play Video",zt.registerComponent("BigPlayButton",is);zt.registerComponent("CloseButton",class extends ts{constructor(e,t){super(e,t),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){c.a.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class ss extends ts{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.on(e,"play",(e=>this.handlePlay(e))),this.on(e,"pause",(e=>this.handlePause(e))),t.replay&&this.on(e,"ended",(e=>this.handleEnded(e)))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ri(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.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}ss.prototype.controlText_="Play",zt.registerComponent("PlayToggle",ss);class ns extends zt{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],(e=>this.updateContent(e))),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),span=xe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(span),this.contentEl_=xe("span",{className:`${e}-display`},{"aria-live":"off",role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(time=0){time=ei(time),this.formattedTime_!==time&&(this.formattedTime_=time,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(()=>{if(!this.contentEl_)return;let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,W.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.a.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))})))}updateContent(e){}}ns.prototype.labelText_="Time",ns.prototype.controlText_="Time",zt.registerComponent("TimeDisplay",ns);class rs extends ns{buildCSSClass(){return"vjs-current-time"}updateContent(e){let time;time=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(time)}}rs.prototype.labelText_="Current Time",rs.prototype.controlText_="Current Time",zt.registerComponent("CurrentTimeDisplay",rs);class as extends ns{constructor(e,t){super(e,t);const n=e=>this.updateContent(e);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}as.prototype.labelText_="Duration",as.prototype.controlText_="Duration",zt.registerComponent("DurationDisplay",as);zt.registerComponent("TimeDivider",class extends zt{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),div=super.createEl("div"),span=super.createEl("span",{textContent:"/"});return div.appendChild(span),e.appendChild(div),e}});class os extends ns{constructor(e,t){super(e,t),this.on(e,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(xe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"!=typeof this.player_.duration())return;let time;time=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(time)}}os.prototype.labelText_="Remaining Time",os.prototype.controlText_="Remaining Time",zt.registerComponent("RemainingTimeDisplay",os);zt.registerComponent("LiveDisplay",class extends zt{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=xe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(xe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(h.a.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()}});class ls extends ts{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=xe("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()}}function hs(e,t,n){return e=Number(e),Math.min(n,Math.max(t,isNaN(e)?t:e))}ls.prototype.controlText_="Seek to live, currently playing live",zt.registerComponent("SeekToLive",ls);var ds=Object.freeze({__proto__:null,clamp:hs});class us extends zt{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),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,t={},n={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,t,n)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||he||e.preventDefault(),Fe(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(){const e=this.bar.el_.ownerDocument;je(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),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.update()}update(){if(!this.el_||!this.bar)return;const progress=this.getProgress();return progress===this.progress_||(this.progress_=progress,this.requestNamedAnimationFrame("Slider#update",(()=>{const e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*progress).toFixed(2)+"%"}))),progress}getProgress(){return Number(hs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=qe(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){c.a.isEventKey(e,"Left")||c.a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):c.a.isEventKey(e,"Right")||c.a.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}zt.registerComponent("Slider",us);const cs=(time,e)=>hs(time/e*100,0,100).toFixed(2)+"%";zt.registerComponent("LoadProgressBar",class extends zt{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",(e=>this.update(e)))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=xe("span",{className:"vjs-control-text"}),n=xe("span",{textContent:this.localize("Loaded")}),r=h.a.createTextNode(": ");return this.percentageEl_=xe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(n),t.appendChild(r),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",(()=>{const e=this.player_.liveTracker,t=this.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),o=this.partEls_,l=cs(r,n);this.percent_!==l&&(this.el_.style.width=l,Ie(this.percentageEl_,l),this.percent_=l);for(let i=0;i<t.length;i++){const e=t.start(i),n=t.end(i);let l=o[i];l||(l=this.el_.appendChild(xe()),o[i]=l),l.dataset.start===e&&l.dataset.end===n||(l.dataset.start=e,l.dataset.end=n,l.style.left=cs(e,r),l.style.width=cs(n-e,r))}for(let i=o.length;i>t.length;i--)this.el_.removeChild(o[i-1]);o.length=t.length}))}});zt.registerComponent("TimeTooltip",class extends zt{constructor(e,t){super(e,t),this.update=Et(Ct(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,content){const n=He(this.el_),r=$e(this.player_.el()),o=e.width*t;if(!r||!n)return;const l=e.left-r.left+o,h=e.width-o+(r.right-e.right);let d=n.width/2;l<d?d+=d-l:h<d&&(d=h),d<0?d=0:d>n.width&&(d=n.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(content)}write(content){Ie(this.el_,content)}updateTime(e,t,time,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let content;const r=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const e=this.player_.liveTracker.liveWindow(),n=e-t*e;content=(n<1?"":"-")+ei(n,e)}else content=ei(time,r);this.update(e,t,content),n&&n()}))}});class ps extends zt{constructor(e,t){super(e,t),this.update=Et(Ct(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const n=this.getChild("timeTooltip");if(!n)return;const time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,time)}}ps.prototype.options_={children:[]},ve||re||ps.prototype.options_.children.push("timeTooltip"),zt.registerComponent("PlayProgressBar",ps);class ms extends zt{constructor(e,t){super(e,t),this.update=Et(Ct(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const time=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,time,(()=>{this.el_.style.left=e.width*t+"px"}))}}ms.prototype.options_={children:["timeTooltip"]},zt.registerComponent("MouseTimeDisplay",ms);class gs extends us{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=Ct(this,this.update),this.update=Et(this.update_,kt),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.a&&"visibilityState"in h.a&&this.on(h.a,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===h.a.visibilityState?(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,kt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||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("hidden"===h.a.visibilityState)return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{const e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let r=this.player_.duration();n&&n.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(100*t).toFixed(2)),this.percent_=t),this.currentTime_===e&&this.duration_===r||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[ei(e,r),ei(r,r)],"{1} of {2}")),this.currentTime_=e,this.duration_=r),this.bar&&this.bar.update($e(this.el()),this.getProgress())})),t}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 t;const n=this.player_.liveTracker;return n&&n.isLive()?(t=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Qe(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Qe(e))return;let n;t||this.player_.scrubbing()||this.player_.scrubbing(!0);const r=this.calculateDistance(e),o=this.player_.liveTracker;if(o&&o.isLive()){if(r>=.99)return void o.seekToLiveEdge();const e=o.seekableStart(),t=o.liveCurrentTime();if(n=e+r*o.liveWindow(),n>=t&&(n=t),n<=e&&(n=e+.1),n===1/0)return}else n=r*this.player_.duration(),n===this.player_.duration()&&(n-=.1);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?ri(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(c.a.isEventKey(e,"Space")||c.a.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(c.a.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(c.a.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(c()(e))){e.preventDefault(),e.stopPropagation();const n=10*(c.a.codes[c()(e)]-c.a.codes[0])/100;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else c.a.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):c.a.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):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.a&&"visibilityState"in h.a&&this.off(h.a,"visibilitychange",this.toggleVisibility_),super.dispose()}}gs.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ve||re||gs.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),zt.registerComponent("SeekBar",gs);class fs extends zt{constructor(e,t){super(e,t),this.handleMouseMove=Et(Ct(this,this.handleMouseMove),kt),this.throttledHandleMouseSeek=Et(Ct(this,this.handleMouseSeek),kt),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const n=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!n&&!r)return;const o=t.el(),l=He(o);let h=qe(o,e).x;h=hs(h,0,1),r&&r.update(l,h),n&&n.update(l,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.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&&ri(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 t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}fs.prototype.options_={children:["seekBar"]},zt.registerComponent("ProgressControl",fs);class _s extends ts{constructor(e,t){super(e,t),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>{"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),this.hide()):this.show()})),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control ${super.buildCSSClass()}`}handlePictureInPictureEnabledChange(){h.a.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}_s.prototype.controlText_="Picture-in-Picture",zt.registerComponent("PictureInPictureToggle",_s);class ys extends ts{constructor(e,t){super(e,t),this.on(e,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===h.a[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}ys.prototype.controlText_="Fullscreen",zt.registerComponent("FullscreenToggle",ys);zt.registerComponent("VolumeLevel",class extends zt{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}});zt.registerComponent("VolumeLevelTooltip",class extends zt{constructor(e,t){super(e,t),this.update=Et(Ct(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,n,content){if(!n){const n=$e(this.el_),r=$e(this.player_.el()),o=e.width*t;if(!r||!n)return;const l=e.left-r.left+o,h=e.width-o+(r.right-e.right);let d=n.width/2;l<d?d+=d-l:h<d&&(d=h),d<0?d=0:d>n.width&&(d=n.width),this.el_.style.right=`-${d}px`}this.write(`${content}%`)}write(content){Ie(this.el_,content)}updateVolume(e,t,n,r,o){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,n,r.toFixed(0)),o&&o()}))}});class vs extends zt{constructor(e,t){super(e,t),this.update=Et(Ct(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,n){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,(()=>{n?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}vs.prototype.options_={children:["volumeLevelTooltip"]},zt.registerComponent("MouseVolumeLevelDisplay",vs);class Ts extends us{constructor(e,t){super(e,t),this.on("slideractive",(e=>this.updateLastVolume_(e))),this.on(e,"volumechange",(e=>this.updateARIAAttributes(e))),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){Qe(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const n=this.el(),r=$e(n),o=this.vertical();let l=qe(n,e);l=o?l.y:l.x,l=hs(l,0,1),t.update(r,l,o)}Qe(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 t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}Ts.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},ve||re||Ts.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Ts.prototype.playerEvent="volumechange",zt.registerComponent("VolumeBar",Ts);class bs extends zt{constructor(e,t={}){t.vertical=t.vertical||!1,(void 0===t.volumeBar||J(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(this,e),this.throttledHandleMouseMove=Et(Ct(this,this.handleMouseMove),kt),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",(e=>this.handleMouseDown(e))),this.on("touchstart",(e=>this.handleMouseDown(e))),this.on("mousemove",(e=>this.handleMouseMove(e))),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 t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}bs.prototype.options_={children:["volumeBar"]},zt.registerComponent("VolumeControl",bs);class Ss extends ts{constructor(e,t){super(e,t),function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(this,e),this.on(e,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),n=this.player_.lastVolume_();if(0===t){const e=n<.1?.1:n;this.player_.volume(e),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;ve&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),Oe(this.el_,[0,1,2,3].reduce(((e,i)=>e+`${i?" ":""}vjs-vol-${i}`),"")),Le(this.el_,`vjs-vol-${t}`)}updateControlText_(){const text=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==text&&this.controlText(text)}}Ss.prototype.controlText_="Mute",zt.registerComponent("MuteToggle",Ss);class ks extends zt{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,(void 0===t.volumeControl||J(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],(e=>this.volumePanelState_(e))),this.on(this.muteToggle,"keyup",(e=>this.handleKeyPress(e))),this.on(this.volumeControl,"keyup",(e=>this.handleVolumeControlKeyUp(e))),this.on("keydown",(e=>this.handleKeyPress(e))),this.on("mouseover",(e=>this.handleMouseOver(e))),this.on("mouseout",(e=>this.handleMouseOut(e))),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){c.a.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),_t(h.a,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),yt(h.a,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){c.a.isEventKey(e,"Esc")&&this.handleMouseOut()}}ks.prototype.options_={children:["muteToggle","volumeControl"]},zt.registerComponent("VolumePanel",ks);class Cs extends zt{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",(e=>this.handleKeyDown(e))),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(component){component instanceof zt&&(this.on(component,"blur",this.boundHandleBlur_),this.on(component,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(component){component instanceof zt&&(this.off(component,"blur",this.boundHandleBlur_),this.off(component,["tap","click"],this.boundHandleTapClick_))}removeChild(component){"string"==typeof component&&(component=this.getChild(component)),this.removeEventListenerForItem(component),super.removeChild(component)}addItem(component){const e=this.addChild(component);e&&this.addEventListenerForItem(e)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=xe(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),_t(t,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||h.a.activeElement;if(!this.children().some((element=>element.el()===t))){const e=this.menuButton_;e&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const n=t.filter((component=>component.el()===e.target))[0];if(!n)return;"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus()}}handleKeyDown(e){c.a.isEventKey(e,"Left")||c.a.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(c.a.isEventKey(e,"Right")||c.a.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}zt.registerComponent("Menu",Cs);class Es extends zt{constructor(e,t={}){super(e,t),this.menuButton_=new ts(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const n=ts.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=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",(e=>this.handleKeyDown(e))),this.on(this.menuButton_,"mouseenter",(()=>{this.addClass("vjs-hover"),this.menu.show(),_t(h.a,"keyup",this.handleMenuKeyUp_)})),this.on("mouseleave",(e=>this.handleMouseLeave(e))),this.on("keydown",(e=>this.handleSubmenuKeyDown(e)))}update(){const menu=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=menu,this.addChild(menu),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 menu=new Cs(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const e=xe("li",{className:"vjs-menu-title",textContent:qt(this.options_.title),tabIndex:-1}),t=new zt(this.player_,{el:e});menu.addItem(t)}if(this.items=this.createItems(),this.items)for(let i=0;i<this.items.length;i++)menu.addItem(this.items[i]);return menu}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}buildWrapperCSSClass(){let e="vjs-menu-button";!0===this.options_.inline?e+="-inline":e+="-popup";return`vjs-menu-button ${e} ${ts.prototype.buildCSSClass()} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(text,e=this.menuButton_.el()){return this.menuButton_.controlText(text,e)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),yt(h.a,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){c.a.isEventKey(e,"Esc")||c.a.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),c.a.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(c.a.isEventKey(e,"Up")||c.a.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(c.a.isEventKey(e,"Esc")||c.a.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(c.a.isEventKey(e,"Esc")||c.a.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),c.a.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ve&&Ee())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}zt.registerComponent("MenuButton",Es);class ws extends Es{constructor(e,t){const n=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!n)return;const r=Ct(this,this.update);n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),n.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",(function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r),n.removeEventListener("labelchange",r)}))}}zt.registerComponent("TrackButton",ws);const xs=["Tab","Esc","Up","Down","Right","Left"];class Is extends Xi{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,n){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),n);return r.replaceChild(xe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),r.querySelector(".vjs-icon-placeholder")),r}handleKeyDown(e){xs.some((t=>c.a.isEventKey(e,t)))||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))}}zt.registerComponent("MenuItem",Is);class Ps extends Is{constructor(e,t){const track=t.track,n=e.textTracks();t.label=track.label||track.language||"Unknown",t.selected="showing"===track.mode,super(e,t),this.track=track,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const r=(...e)=>{this.handleTracksChange.apply(this,e)},l=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",l),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",l)})),void 0===n.onchange){let e;this.on(["tap","click"],(function(){if("object"!=typeof o.a.Event)try{e=new o.a.Event("change")}catch(e){}e||(e=h.a.createEvent("Event"),e.initEvent("change",!0,!0)),n.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){const t=this.track,n=this.player_.textTracks();if(super.handleClick(e),n)for(let i=0;i<n.length;i++){const track=n[i];-1!==this.kinds.indexOf(track.kind)&&(track===t?"showing"!==track.mode&&(track.mode="showing"):"disabled"!==track.mode&&(track.mode="disabled"))}}handleTracksChange(e){const t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if("showing"===this.track.mode){const e=this.player_.cache_.selectedLanguage;if(e&&e.enabled&&e.language===this.track.language&&e.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}zt.registerComponent("TextTrackMenuItem",Ps);class As extends Ps{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let n=!0;for(let i=0,e=t.length;i<e;i++){const track=t[i];if(this.options_.kinds.indexOf(track.kind)>-1&&"showing"===track.mode){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let n=!0;for(let i=0,e=t.length;i<e;i++){const track=t[i];if(["captions","descriptions","subtitles"].indexOf(track.kind)>-1&&"showing"===track.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}}zt.registerComponent("OffTextTrackMenuItem",As);class Ls extends ws{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ps){let label;this.label_&&(label=`${this.label_} off`),e.push(new As(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i<n.length;i++){const track=n[i];if(this.kinds_.indexOf(track.kind)>-1){const n=new t(this.player_,{track:track,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});n.addClass(`vjs-${track.kind}-menu-item`),e.push(n)}}return e}}zt.registerComponent("TextTrackButton",Ls);class Os extends Is{constructor(e,t){const track=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r<n.endTime,super(e,t),this.track=track,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}zt.registerComponent("ChaptersTrackMenuItem",Os);class Ds extends Ls{constructor(e,t,n){super(e,t,n),this.selectCurrentItem_=()=>{this.items.forEach((e=>{e.selected(this.track_.activeCues[0]===e.cue)}))}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&"chapters"!==e.track.kind)return;const track=this.findChaptersTrack();track!==this.track_?(this.setTrack(track),super.update()):(!this.items||track&&track.cues&&track.cues.length!==this.items.length)&&super.update()}setTrack(track){if(this.track_!==track){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=track,this.track_){this.track_.mode="hidden";const e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);e&&e.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 track=e[i];if(track.kind===this.kind_)return track}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(qt(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new Os(this.player_,{track:this.track_,cue:n});e.push(r)}return e}}Ds.prototype.kind_="chapters",Ds.prototype.controlText_="Chapters",zt.registerComponent("ChaptersButton",Ds);class Ms extends Ls{constructor(e,t,n){super(e,t,n);const r=e.textTracks(),o=Ct(this,this.handleTracksChange);r.addEventListener("change",o),this.on("dispose",(function(){r.removeEventListener("change",o)}))}handleTracksChange(e){const t=this.player().textTracks();let n=!1;for(let i=0,e=t.length;i<e;i++){const track=t[i];if(track.kind!==this.kind_&&"showing"===track.mode){n=!0;break}}n?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Ms.prototype.kind_="descriptions",Ms.prototype.controlText_="Descriptions",zt.registerComponent("DescriptionsButton",Ms);class Us extends Ls{constructor(e,t,n){super(e,t,n)}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Us.prototype.kind_="subtitles",Us.prototype.controlText_="Subtitles",zt.registerComponent("SubtitlesButton",Us);class Rs extends Ps{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}}zt.registerComponent("CaptionSettingsMenuItem",Rs);class Ns extends Ls{constructor(e,t,n){super(e,t,n)}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Rs(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Ns.prototype.kind_="captions",Ns.prototype.controlText_="Captions",zt.registerComponent("CaptionsButton",Ns);class Bs extends Ps{createEl(e,t,n){const r=super.createEl(e,t,n),o=r.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(o.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),o.appendChild(xe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}zt.registerComponent("SubsCapsMenuItem",Bs);class Fs extends Ls{constructor(e,t={}){super(e,t),this.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions"),this.menuButton_.controlText(qt(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 Rs(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Bs),e}}Fs.prototype.kinds_=["captions","subtitles"],Fs.prototype.controlText_="Subtitles",zt.registerComponent("SubsCapsButton",Fs);class js extends Is{constructor(e,t){const track=t.track,n=e.audioTracks();t.label=track.label||track.language||"Unknown",t.selected=track.enabled,super(e,t),this.track=track,this.addClass(`vjs-${track.kind}-menu-item`);const r=(...e)=>{this.handleTracksChange.apply(this,e)};n.addEventListener("change",r),this.on("dispose",(()=>{n.removeEventListener("change",r)}))}createEl(e,t,n){const r=super.createEl(e,t,n),o=r.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(o.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),o.appendChild(xe("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 e=this.player_.audioTracks();for(let i=0;i<e.length;i++){const track=e[i];track!==this.track&&(track.enabled=track===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}zt.registerComponent("AudioTrackMenuItem",js);class $s extends ws{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t)}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const track=t[i];e.push(new js(this.player_,{track:track,selectable:!0,multiSelectable:!1}))}return e}}$s.prototype.controlText_="Audio Track",zt.registerComponent("AudioTrackButton",$s);class Hs extends Is{constructor(e,t){const label=t.rate,n=parseFloat(label,10);t.label=label,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=label,this.rate=n,this.on(e,"ratechange",(e=>this.update(e)))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Hs.prototype.contentElType="button",zt.registerComponent("PlaybackRateMenuItem",Hs);class qs extends Es{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(e=>this.updateVisibility(e))),this.on(e,"ratechange",(e=>this.updateLabel(e))),this.on(e,"playbackrateschange",(e=>this.handlePlaybackRateschange(e)))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=xe("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(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new Hs(this.player(),{rate:e[i]+"x"}));return t}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")}}qs.prototype.controlText_="Playback Rate",zt.registerComponent("PlaybackRateMenuButton",qs);class Vs extends zt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},n={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,n)}}zt.registerComponent("Spacer",Vs);zt.registerComponent("CustomControlSpacer",class extends Vs{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class Ws extends zt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Ws.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in h.a&&Ws.prototype.options_.children.splice(Ws.prototype.options_.children.length-1,0,"pictureInPictureToggle"),zt.registerComponent("ControlBar",Ws);class zs extends di{constructor(e,t){super(e,t),this.on(e,"error",(e=>this.open(e)))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}zs.prototype.options_=Object.assign({},di.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),zt.registerComponent("ErrorDisplay",zs);const Gs="vjs-text-track-settings",Ks=["#000","Black"],Qs=["#00F","Blue"],Xs=["#0FF","Cyan"],Ys=["#0F0","Green"],Js=["#F0F","Magenta"],Zs=["#F00","Red"],en=["#FFF","White"],tn=["#FF0","Yellow"],sn=["1","Opaque"],nn=["0.5","Semi-Transparent"],rn=["0","Transparent"],an={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ks,en,Zs,Ys,Qs,tn,Js,Xs]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[sn,nn,rn]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[en,Ks,Zs,Ys,Qs,tn,Js,Xs]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},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:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[sn,nn]},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:"Transparency",options:[rn,nn,sn]}};function on(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}an.windowColor.options=an.backgroundColor.options;zt.registerComponent("TextTrackSettings",class extends di{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=xe("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",(()=>{this.saveSettings(),this.close()})),this.on(this.$(".vjs-default-button"),"click",(()=>{this.setDefaults(),this.updateDisplay()})),Q(an,(e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",n="label"){const r=an[e],o=r.id.replace("%s",this.id_),l=[t,o].join(" ").trim();return[`<${n} id="${o}" class="${"label"===n?"vjs-label":""}">`,this.localize(r.label),`</${n}>`,`<select aria-labelledby="${l}">`].concat(r.options.map((e=>{const t=o+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${l} ${t}">`,this.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['<fieldset class="vjs-fg-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['<fieldset class="vjs-bg-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['<fieldset class="vjs-window-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return xe("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return xe("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return xe("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].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 X(an,((e,t,n)=>{const r=(o=this.$(t.selector),l=t.parser,on(o.options[o.options.selectedIndex].value,l));var o,l;return void 0!==r&&(e[n]=r),e}),{})}setValues(e){Q(an,((t,n)=>{!function(e,t,n){if(t)for(let i=0;i<e.options.length;i++)if(on(e.options[i].value,n)===t){e.selectedIndex=i;break}}(this.$(t.selector),e[n],t.parser)}))}setDefaults(){Q(an,(e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(o.a.localStorage.getItem(Gs))}catch(e){W.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?o.a.localStorage.setItem(Gs,JSON.stringify(e)):o.a.localStorage.removeItem(Gs)}catch(e){W.warn(e)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,t=e&&e.subsCapsButton,n=e&&e.captionsButton;t?t.focus():n&&n.focus()}});zt.registerComponent("ResizeManager",class extends zt{constructor(e,t){let n=t.ResizeObserver||o.a.ResizeObserver;null===t.ResizeObserver&&(n=!1);super(e,Z({createEl:!n,reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||o.a.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=wt((()=>{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 e=this.debouncedHandler_;let t=this.unloadListener_=function(){yt(this,"resize",e),yt(this,"unload",t),t=null};_t(this.el_.contentWindow,"unload",t),_t(this.el_.contentWindow,"resize",e)},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()}});const ln={trackingThreshold:20,liveTolerance:15};zt.registerComponent("LiveTracker",class extends zt{constructor(e,t){super(e,Z(ln,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",(e=>this.handleDurationchange(e))),this.on(this.player_,"canplay",(()=>this.toggleTracking()))}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(o.a.performance.now().toFixed(4)),n=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),l=this.player_.currentTime();let h=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-l)>this.options_.liveTolerance;this.timeupdateSeen_&&r!==1/0||(h=!1),h!==this.behindLiveEdge_&&(this.behindLiveEdge_=h,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_,kt),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(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.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-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}});zt.registerComponent("TitleBar",class extends zt{constructor(e,t){super(e,t),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:xe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ct()}`}),description:xe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ct()}`})},xe("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{const r=this.state[e],o=this.els[e],l=n[e];We(o),r&&Ie(o,r),t&&(t.removeAttribute(l),r&&t.setAttribute(l,o.id))})),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}});const hn=e=>{const t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;const n=e.$$("source"),r=[];let o="";if(!n.length)return!1;for(let i=0;i<n.length;i++){const e=n[i].src;e&&-1===r.indexOf(e)&&r.push(e)}return!!r.length&&(1===r.length&&(o=r[0]),e.triggerSourceset(o),!0)},dn=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){const t=h.a.createElement(this.nodeName.toLowerCase());t.innerHTML=e;const n=h.a.createDocumentFragment();for(;t.childNodes.length;)n.appendChild(t.childNodes[0]);return this.innerText="",o.a.Element.prototype.appendChild.call(this,n),this.innerHTML}}),un=(e,t)=>{let n={};for(let i=0;i<e.length&&(n=Object.getOwnPropertyDescriptor(e[i],t),!(n&&n.set&&n.get));i++);return n.enumerable=!0,n.configurable=!0,n},cn=function(e){const t=e.el();if(t.resetSourceWatch_)return;const n={},r=(e=>un([e.el(),o.a.HTMLMediaElement.prototype,o.a.Element.prototype,dn],"innerHTML"))(e),l=n=>(...r)=>{const o=n.apply(t,r);return hn(e),o};["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(n[e]=t[e],t[e]=l(n[e]))})),Object.defineProperty(t,"innerHTML",Z(r,{set:l(r.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(n).forEach((e=>{t[e]=n[e]})),Object.defineProperty(t,"innerHTML",r)},e.one("sourceset",t.resetSourceWatch_)},pn=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Si(o.a.Element.prototype.getAttribute.call(this,"src")):""},set(e){return o.a.Element.prototype.setAttribute.call(this,"src",e),e}}),mn=function(e){if(!e.featuresSourceset)return;const t=e.el();if(t.resetSourceset_)return;const n=(e=>un([e.el(),o.a.HTMLMediaElement.prototype,pn],"src"))(e),r=t.setAttribute,l=t.load;Object.defineProperty(t,"src",Z(n,{set:r=>{const o=n.set.call(t,r);return e.triggerSourceset(t.src),o}})),t.setAttribute=(n,o)=>{const l=r.call(t,n,o);return/src/i.test(n)&&e.triggerSourceset(t.src),l},t.load=()=>{const n=l.call(t);return hn(e)||(e.triggerSourceset(""),cn(e)),n},t.currentSrc?e.triggerSourceset(t.currentSrc):hn(e)||cn(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=l,t.setAttribute=r,Object.defineProperty(t,"src",n),t.resetSourceWatch_&&t.resetSourceWatch_()}};class gn extends Ui{constructor(e,t){super(e,t);const source=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,source&&(this.el_.currentSrc!==source.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(source):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const e=this.el_.childNodes;let t=e.length;const r=[];for(;t--;){const o=e[t];"track"===o.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(o),this.remoteTextTracks().addTrack(o.track),this.textTracks().addTrack(o.track),n||this.el_.hasAttribute("crossorigin")||!Ci(o.src)||(n=!0)):r.push(o))}for(let i=0;i<r.length;i++)this.el_.removeChild(r[i])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&W.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),this.restoreMetadataTracksInIOSNativePlayer_(),(_e||fe)&&!0===e.nativeControlsForTouch&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),gn.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){mn(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const n=()=>{t=[];for(let i=0;i<e.length;i++){const track=e[i];"metadata"===track.kind&&t.push({track:track,storedMode:track.mode})}};n(),e.addEventListener("change",n),this.on("dispose",(()=>e.removeEventListener("change",n)));const r=()=>{for(let i=0;i<t.length;i++){const e=t[i];"disabled"===e.track.mode&&e.track.mode!==e.storedMode&&(e.track.mode=e.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",(()=>{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,t){if(t!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach((e=>{this.el()[`${n}Tracks`].removeEventListener(e,this[`${n}TracksListeners_`][e])})),this[`featuresNative${e}Tracks`]=!t,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Oi[e],n=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!n||!n.addEventListener)return;const o={change:t=>{const n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&this[Di.remoteText.getterName]().trigger(n)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},l=function(){const e=[];for(let i=0;i<r.length;i++){let t=!1;for(let e=0;e<n.length;e++)if(n[e]===r[i]){t=!0;break}t||e.push(r[i])}for(;e.length;)r.removeTrack(e.shift())};this[t.getterName+"Listeners_"]=o,Object.keys(o).forEach((e=>{const t=o[e];n.addEventListener(e,t),this.on("dispose",(r=>n.removeEventListener(e,t)))})),this.on("loadstart",l),this.on("dispose",(e=>this.off("loadstart",l)))}proxyNativeTracks_(){Oi.names.forEach((e=>{this.proxyNativeTracksForType_(e)}))}createEl(){let e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){const t=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(t,e),gn.disposeMediaElement(e),e=t}else{e=h.a.createElement("video");const t=Z({},this.options_.tag&&Ue(this.options_.tag));_e&&!0===this.options_.nativeControlsForTouch||delete t.controls,Me(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&Ne(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const n=t[i],r=this.options_[n];void 0!==r&&(r?Ne(e,n,n):Be(e,n),e[n]=r)}return e}handleLateInit_(e){if(0===e.networkState||3===e.networkState)return;if(0===e.readyState){let e=!1;const t=function(){e=!0};this.on("loadstart",t);const n=function(){e||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",t),this.off("loadedmetadata",n),e||this.trigger("loadstart")}))}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready((function(){t.forEach((function(e){this.trigger(e)}),this)}))}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Te?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){W(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&re&&he&&0===this.el_.currentTime){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)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",(()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)}))}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const video=this.el_;if(video.paused&&video.networkState<=video.HAVE_METADATA)ri(this.el_.play()),this.setTimeout((function(){video.pause();try{video.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{video.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}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(void 0===e)return this.el_.src;this.setSrc(e)}reset(){gn.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,label,t){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,label,t):super.addTextTrack(e,label,t)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=h.a.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const n=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(track){if(super.removeRemoteTextTrack(track),this.featuresNativeTextTracks){const e=this.$$("track");let i=e.length;for(;i--;)track!==e[i]&&track!==e[i].track||this.el().removeChild(e[i])}}getVideoPlaybackQuality(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();const e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),o.a.performance&&(e.creationTime=o.a.performance.now()),e}}ee(gn,"TEST_VID",(function(){if(!ke())return;const video=h.a.createElement("video"),track=h.a.createElement("track");return track.kind="captions",track.srclang="en",track.label="English",video.appendChild(track),video})),gn.isSupported=function(){try{gn.TEST_VID.volume=.5}catch(e){return!1}return!(!gn.TEST_VID||!gn.TEST_VID.canPlayType)},gn.canPlayType=function(e){return gn.TEST_VID.canPlayType(e)},gn.canPlaySource=function(e,t){return gn.canPlayType(e.type)},gn.canControlVolume=function(){try{const e=gn.TEST_VID.volume;gn.TEST_VID.volume=e/2+.1;const t=e!==gn.TEST_VID.volume;return t&&ve?(o.a.setTimeout((()=>{gn&&gn.prototype&&(gn.prototype.featuresVolumeControl=e!==gn.TEST_VID.volume)})),!1):t}catch(e){return!1}},gn.canMuteVolume=function(){try{const e=gn.TEST_VID.muted;return gn.TEST_VID.muted=!e,gn.TEST_VID.muted?Ne(gn.TEST_VID,"muted","muted"):Be(gn.TEST_VID,"muted"),e!==gn.TEST_VID.muted}catch(e){return!1}},gn.canControlPlaybackRate=function(){if(re&&he&&ue<58)return!1;try{const e=gn.TEST_VID.playbackRate;return gn.TEST_VID.playbackRate=e/2+.1,e!==gn.TEST_VID.playbackRate}catch(e){return!1}},gn.canOverrideAttributes=function(){try{const e=()=>{};Object.defineProperty(h.a.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(h.a.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(h.a.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(h.a.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},gn.supportsNativeTextTracks=function(){return Te||ve&&he},gn.supportsNativeVideoTracks=function(){return!(!gn.TEST_VID||!gn.TEST_VID.videoTracks)},gn.supportsNativeAudioTracks=function(){return!(!gn.TEST_VID||!gn.TEST_VID.audioTracks)},gn.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([e,t]){ee(gn.prototype,e,(()=>gn[t]()),!0)})),gn.prototype.featuresVolumeControl=gn.canControlVolume(),gn.prototype.movingMediaElementInDOM=!ve,gn.prototype.featuresFullscreenResize=!0,gn.prototype.featuresProgressEvents=!0,gn.prototype.featuresTimeupdateEvents=!0,gn.prototype.featuresVideoFrameCallback=!(!gn.TEST_VID||!gn.TEST_VID.requestVideoFrameCallback),gn.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},gn.resetMediaElement=function(e){if(!e)return;const t=e.querySelectorAll("source");let i=t.length;for(;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){gn.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){gn.prototype["set"+qt(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){gn.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){gn.prototype["set"+qt(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){gn.prototype[e]=function(){return this.el_[e]()}})),Ui.withSourceHandlers(gn),gn.nativeSourceHandler={},gn.nativeSourceHandler.canPlayType=function(e){try{return gn.TEST_VID.canPlayType(e)}catch(e){return""}},gn.nativeSourceHandler.canHandleSource=function(source,e){if(source.type)return gn.nativeSourceHandler.canPlayType(source.type);if(source.src){const e=ki(source.src);return gn.nativeSourceHandler.canPlayType(`video/${e}`)}return""},gn.nativeSourceHandler.handleSource=function(source,e,t){e.setSrc(source.src)},gn.nativeSourceHandler.dispose=function(){},gn.registerSourceHandler(gn.nativeSourceHandler),Ui.registerTech("Html5",gn);const fn=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],_n={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},yn=["tiny","xsmall","small","medium","large","xlarge","huge"],vn={};yn.forEach((e=>{const t="x"===e.charAt(0)?`x-${e.substring(1)}`:e;vn[e]=`vjs-layout-${t}`}));const Tn={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class bn extends zt{constructor(e,t,n){if(e.id=e.id||t.id||`vjs_video_${ct()}`,(t=Object.assign(bn.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const n=e.closest("[lang]");n&&(t.language=n.getAttribute("lang"))}if(super(null,t,n),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=z(this.id_),this.fsApi_=F,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&&Ue(e),this.language(this.options_.language),t.languages){const e={};Object.getOwnPropertyNames(t.languages).forEach((function(n){e[n.toLowerCase()]=t.languages[n]})),this.languages_=e}else this.languages_=bn.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.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),t.plugins&&Object.keys(t.plugins).forEach((e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)})),this.scrubbing_=!1,this.el_=this.createEl(),Ft(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(_t(h.a,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Z(this.options_);t.plugins&&Object.keys(t.plugins).forEach((e=>{this[e](t.plugins[e])})),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),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"),_e&&this.addClass("vjs-touch-enabled"),ve||this.addClass("vjs-workinghover"),bn.players[this.id_]=this;const o=U.split(".")[0];this.addClass(`vjs-v${o}`),this.userActive(!0),this.reportUserActivity(),this.one("play",(e=>this.listenForUserActivity_(e))),this.on("keydown",(e=>this.handleKeyDown(e))),this.on("languagechange",(e=>this.handleLanguagechange(e))),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"),yt(h.a,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),yt(h.a,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),bn.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),Ni[this.id()]=null,Mi.names.forEach((e=>{const t=this[Mi[e].getterName]();t&&t.off&&t.off()})),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,n=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const r="video-js"===this.tag.tagName.toLowerCase();n?e=this.el_=t.parentNode:r||(e=this.el_=super.createEl("div"));const l=Ue(t);if(r){for(e=this.el_=t,t=this.tag=h.a.createElement("video");e.children.length;)t.appendChild(e.firstChild);Ae(e,"video-js")||Le(e,"video-js"),e.appendChild(t),n=this.playerElIngest_=e,Object.keys(e).forEach((n=>{try{t[n]=e[n]}catch(e){}}))}if(t.setAttribute("tabindex","-1"),l.tabindex="-1",he&&me&&(t.setAttribute("role","application"),l.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in l&&delete l.width,"height"in l&&delete l.height,Object.getOwnPropertyNames(l).forEach((function(n){r&&"class"===n||e.setAttribute(n,l[n]),r&&t.setAttribute(n,l[n])})),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",t.player=e.player=this,this.addClass("vjs-paused"),!0!==o.a.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=at("vjs-styles-dimensions");const e=Xe(".vjs-styles-defaults"),head=Xe("head");head.insertBefore(this.styleEl_,e?e.nextSibling:head.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 d=t.getElementsByTagName("a");for(let i=0;i<d.length;i++){const e=d.item(i);Le(e,"vjs-hidden"),e.setAttribute("hidden","hidden")}return t.initNetworkState_=t.networkState,t.parentNode&&!n&&t.parentNode.insertBefore(e,t),Pe(t,e),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=e,e}crossOrigin(e){if(void 0===e)return this.techGet_("crossOrigin");null===e||"anonymous"===e||"use-credentials"===e?(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)):W.warn(`crossOrigin must be null,  "anonymous" or "use-credentials", given "${e}"`)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const n=e+"_";if(void 0===t)return this[n]||0;if(""===t||"auto"===t)return this[n]=void 0,void this.updateStyleEl_();const r=parseFloat(t);isNaN(r)?W.error(`Improper value "${t}" supplied for for ${e}`):(this[n]=r,this.updateStyleEl_())}fluid(e){if(void 0===e)return!!this.fluid_;var t,n;this.fluid_=!!e,Lt(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),n=()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},Lt(t=this)?n():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(n))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)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(!0===o.a.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height,n=this.tech_&&this.tech_.el();return void(n&&(e>=0&&(n.width=e),t>=0&&(n.height=t)))}let e,t,n,r;n=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";const l=n.split(":"),h=l[1]/l[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/h:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*h,r=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(r),ot(this.styleEl_,`\n      .${r} {\n        width: ${e}px;\n        height: ${t}px;\n      }\n\n      .${r}.vjs-fluid:not(.vjs-audio-only-mode) {\n        padding-top: ${100*h}%;\n      }\n    `)}loadTech_(e,source){this.tech_&&this.unloadTech_();const t=qt(e),n=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==t&&this.tag&&(Ui.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=t,this.isReady_=!1;let r=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(r=!1);const o={source:source,autoplay:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_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};Mi.names.forEach((e=>{const t=Mi[e];o[t.getterName]=this[t.privateName]})),Object.assign(o,this.options_[t]),Object.assign(o,this.options_[n]),Object.assign(o,this.options_[e.toLowerCase()]),this.tag&&(o.tag=this.tag),source&&source.src===this.cache_.src&&this.cache_.currentTime>0&&(o.startTime=this.cache_.currentTime);const l=Ui.getTech(e);if(!l)throw new Error(`No Tech named '${t}' exists! '${t}' should be registered using videojs.registerTech()'`);this.tech_=new l(o),this.tech_.ready(Ct(this,this.handleTechReady_),!0),hi(this.textTracksJson_||[],this.tech_),fn.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${qt(e)}_`](t)))})),Object.keys(_n).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${_n[e]}_`].bind(this),event:t}):this[`handleTech${_n[e]}_`](t)}))})),this.on(this.tech_,"loadstart",(e=>this.handleTechLoadStart_(e))),this.on(this.tech_,"sourceset",(e=>this.handleTechSourceset_(e))),this.on(this.tech_,"waiting",(e=>this.handleTechWaiting_(e))),this.on(this.tech_,"ended",(e=>this.handleTechEnded_(e))),this.on(this.tech_,"seeking",(e=>this.handleTechSeeking_(e))),this.on(this.tech_,"play",(e=>this.handleTechPlay_(e))),this.on(this.tech_,"pause",(e=>this.handleTechPause_(e))),this.on(this.tech_,"durationchange",(e=>this.handleTechDurationChange_(e))),this.on(this.tech_,"fullscreenchange",((e,data)=>this.handleTechFullscreenChange_(e,data))),this.on(this.tech_,"fullscreenerror",((e,t)=>this.handleTechFullscreenError_(e,t))),this.on(this.tech_,"enterpictureinpicture",(e=>this.handleTechEnterPictureInPicture_(e))),this.on(this.tech_,"leavepictureinpicture",(e=>this.handleTechLeavePictureInPicture_(e))),this.on(this.tech_,"error",(e=>this.handleTechError_(e))),this.on(this.tech_,"posterchange",(e=>this.handleTechPosterChange_(e))),this.on(this.tech_,"textdata",(e=>this.handleTechTextData_(e))),this.on(this.tech_,"ratechange",(e=>this.handleTechRateChange_(e))),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===t&&this.tag||Pe(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Mi.names.forEach((e=>{const t=Mi[e];this[t.privateName]=this[t.getterName]()})),this.textTracksJson_=oi(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&W.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),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_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||"string"!=typeof e)return;const t=()=>{const e=this.muted();this.muted(!0);const t=()=>{this.muted(e)};this.playTerminatedQueue_.push(t);const n=this.play();if(ni(n))return n.catch((e=>{throw t(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${e||""}`)}))};let n;return"any"!==e||this.muted()?n="muted"!==e||this.muted()?this.play():t():(n=this.play(),ni(n)&&(n=n.catch(t))),ni(n)?n.then((()=>{this.trigger({type:"autoplay-success",autoplay:e})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:e})})):void 0}updateSourceCaches_(e=""){let t=e,n="";"string"!=typeof t&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;const n=e.cache_.sources.filter((s=>s.src===t));if(n.length)return n[0].type;const r=e.$$("source");for(let i=0;i<r.length;i++){const s=r[i];if(s.type&&s.src&&s.src===t)return s.type}return Gi(t)})(this,t)),this.cache_.source=Z({},e,{src:t,type:n});const r=this.cache_.sources.filter((s=>s.src&&s.src===t)),o=[],l=this.$$("source"),h=[];for(let i=0;i<l.length;i++){const e=Ue(l[i]);o.push(e),e.src&&e.src===t&&h.push(e.src)}h.length&&!r.length?this.cache_.sources=o:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=e=>this.updateSourceCaches_(e);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)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],(e=>{if("sourceset"===e.type)return;const t=this.techGet("currentSrc");this.lastSource_.tech=t,this.updateSourceCaches_(t)}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)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&&0===this.cache_.lastPlaybackRate&&(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(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}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_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?ri(this.play()):this.pause()))}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(t=>t.contains(e.target)))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?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 t=e.target.player;if(t&&t!==this)return;const n=this.el();let r=h.a[this.fsApi_.fullscreenElement]===n;!r&&n.matches?r=n.matches(":"+this.fsApi_.fullscreen):!r&&n.msMatchesSelector&&(r=n.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}handleTechFullscreenChange_(e,data){data&&(data.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(()=>{this.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(data.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}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();this.error(e)}handleTechTextData_(){let data=null;arguments.length>1&&(data=arguments[1]),this.trigger("textdata",data)}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,t){this.ready((function(){if(e in Hi)return function(e,t,n,r){return t[n](e.reduce(Vi(n),r))}(this.middleware_,this.tech_,e,t);if(e in qi)return ji(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw W(e),e}}),!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in $i)return function(e,t,n){return e.reduceRight(Vi(n),t[n]())}(this.middleware_,this.tech_,e);if(e in qi)return ji(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw W(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t;if("TypeError"===t.name)throw W(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t;throw W(t),t}}}play(){return new Promise((e=>{this.play_(e)}))}play_(e=ri){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t)return this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(t||!Te&&!ve||this.load());const n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(q){q()}))}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Qt(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(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=Qt(0,0)),e}bufferedPercent(){return ii(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let n=e.end(e.length-1);return n>t&&(n=t),n}volume(e){let t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(void 0!==e){const t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise(((n,r)=>{function o(){t.off("fullscreenerror",h),t.off("fullscreenchange",l)}function l(){o(),n()}function h(e,t){o(),r(t)}t.one("fullscreenchange",l),t.one("fullscreenerror",h);const d=t.requestFullscreenHelper_(e);d&&(d.then(o,o),d.then(n,r))}))}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){const e=this.el_[this.fsApi_.requestFullscreen](t);return e&&e.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise(((t,n)=>{function r(){e.off("fullscreenerror",l),e.off("fullscreenchange",o)}function o(){r(),t()}function l(e,t){r(),n(t)}e.one("fullscreenchange",o),e.one("fullscreenerror",l);const h=e.exitFullscreenHelper_();h&&(h.then(r,r),h.then(t,n))}))}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=h.a[this.fsApi_.exitFullscreen]();return e&&ri(e.then((()=>this.isFullscreen(!1)))),e}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=h.a.documentElement.style.overflow,_t(h.a,"keydown",this.boundFullWindowOnEscKey_),h.a.documentElement.style.overflow="hidden",Le(h.a.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){c.a.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,yt(h.a,"keydown",this.boundFullWindowOnEscKey_),h.a.documentElement.style.overflow=this.docOrigOverflow,Oe(h.a.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}requestPictureInPicture(){if("pictureInPictureEnabled"in h.a&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")}exitPictureInPicture(){if("pictureInPictureEnabled"in h.a)return h.a.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;if(!t||!t.hotkeys)return;(e=>{const t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:n=(e=>c.a.isEventKey(e,"f")),muteKey:r=(e=>c.a.isEventKey(e,"m")),playPauseKey:o=(e=>c.a.isEventKey(e,"k")||c.a.isEventKey(e,"Space"))}=t;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const t=zt.getComponent("FullscreenToggle");!1!==h.a[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)}else if(r.call(this,e)){e.preventDefault(),e.stopPropagation();zt.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation();zt.getComponent("PlayToggle").prototype.handleClick.call(this,e)}}canPlayType(e){let t;for(let i=0,n=this.options_.techOrder;i<n.length;i++){const r=n[i];let o=Ui.getTech(r);if(o||(o=zt.getComponent(r)),o){if(o.isSupported()&&(t=o.canPlayType(e),t))return t}else W.error(`The "${r}" tech is undefined. Skipped browser support check for that tech.`)}return""}selectSource(e){const t=this.options_.techOrder.map((e=>[e,Ui.getTech(e)])).filter((([e,t])=>t?t.isSupported():(W.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1))),n=function(e,t,n){let r;return e.some((e=>t.some((t=>{if(r=n(e,t),r)return!0})))),r};let r;const o=([e,t],source)=>{if(t.canPlaySource(source,this.options_[e.toLowerCase()]))return{source:source,tech:e}};var l;return r=this.options_.sourceOrder?n(e,t,(l=o,(a,b)=>l(b,a))):n(t,e,o),r||!1}handleSrc_(source,e){if(void 0===source)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const t=Ki(source);if(t.length){if(this.changingSrc_=!0,e||(this.cache_.sources=t),this.updateSourceCaches_(t[0]),Fi(this,t[0],((n,r)=>{this.middleware_=r,e||(this.cache_.sources=t),this.updateSourceCaches_(n);if(this.src_(n))return t.length>1?this.handleSrc_(t.slice(1)):(this.changingSrc_=!1,this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void this.triggerReady());var o,l;o=r,l=this.tech_,o.forEach((e=>e.setTech&&e.setTech(l)))})),t.length>1){const e=()=>{this.error(null),this.handleSrc_(t.slice(1),!0)},n=()=>{this.off("error",e)};this.one("error",e),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",n)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(source){return this.handleSrc_(source,!1)}src_(source){const e=this.selectSource([source]);return!e||(Vt(e.tech,this.techName_)?(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",source):this.techCall_("src",source.src),this.changingSrc_=!1}),!0),!1):(this.changingSrc_=!0,this.loadTech_(e.tech,e.source),this.tech_.ready((()=>{this.changingSrc_=!1})),!1))}load(){this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{ri(this.play().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_(),Lt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{durationDisplay:e,remainingTimeDisplay:t}=this.controlBar||{};e&&e.updateContent(),t&&t.updateContent()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const source=this.currentSource(),e=[];return 0!==Object.keys(source).length&&e.push(source),this.cache_.sources||e}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")}loop(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")}poster(e){if(void 0===e)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(void 0===e)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(void 0===e)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(void 0===e)return this.error_||null;if(N("beforeerror").forEach((t=>{const n=t(this,e);Y(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){const t=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),void this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new si(e),this.addClass("vjs-error"),W.error(`(CODE:${this.error_.code} ${si.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),N("error").forEach((e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,n;const r=Ct(this,this.reportUserActivity),o=function(t){r(),this.clearInterval(e)};this.on("mousedown",(function(){r(),this.clearInterval(e),e=this.setInterval(r,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===n||(t=e.screenX,n=e.screenY,r())})),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");let h;!l||ve||re||(l.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),l.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",r),this.on("keyup",r),this.setInterval((function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(h);const e=this.options_.inactivityTimeout;e<=0||(h=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}),250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),n=t&&t.currentHeight();e.forEach((e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))})),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("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const e=[];return this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).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){if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;if(this.audioPosterMode_=e,e){if(this.audioOnlyMode()){return this.audioOnlyMode(!1).then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.enablePosterModeUI_()}))}return Promise.resolve().then((()=>{this.disablePosterModeUI_()}))}addTextTrack(e,label,t){if(this.tech_)return this.tech_.addTextTrack(e,label,t)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:track}=e;if(track||(track=e),this.tech_)return this.tech_.removeRemoteTextTrack(track)}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(code){if(void 0===code)return this.language_;this.language_!==String(code).toLowerCase()&&(this.language_=String(code).toLowerCase(),Lt(this)&&this.trigger("languagechange"))}languages(){return Z(bn.prototype.options_.languages,this.languages_)}toJSON(){const e=Z(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let track=t[i];track=Z(track),track.player=void 0,e.tracks[i]=track}return e}createModal(content,e){(e=e||{}).content=content||"";const t=new di(this,e);return this.addChild(t),t.on("dispose",(()=>{this.removeChild(t)})),t.open(),t}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<yn.length;i++){const n=yn[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(vn[e]),this.addClass(vn[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Object.assign({},Tn,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){if(void 0===e)return this.responsive_;return(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return vn[this.breakpoint_]||""}loadMedia(e,t){if(!e||"object"!=typeof e)return;this.reset(),this.cache_.media=Z(e);const{artist:n,artwork:r,description:o,poster:l,src:h,textTracks:d,title:title}=this.cache_.media;!r&&l&&(this.cache_.media.artwork=[{src:l,type:Gi(l)}]),h&&this.src(h),l&&this.poster(l),Array.isArray(d)&&d.forEach((e=>this.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:title,description:o||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(e=>({kind:e.kind,label:e.label,language:e.language,src:e.src})))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Gi(t.poster)}]),t}return Z(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},n=Ue(e),r=n["data-setup"];if(Ae(e,"vjs-fill")&&(n.fill=!0),Ae(e,"vjs-fluid")&&(n.fluid=!0),null!==r){const[e,data]=f()(r||"{}");e&&W.error(e),Object.assign(n,data)}if(Object.assign(t,n),e.hasChildNodes()){const n=e.childNodes;for(let i=0,e=n.length;i<e;i++){const e=n[i],r=e.nodeName.toLowerCase();"source"===r?t.sources.push(Ue(e)):"track"===r&&t.tracks.push(Ue(e))}}return t}debug(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((e=>"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}Mi.names.forEach((function(e){const t=Mi[e];bn.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),bn.prototype.crossorigin=bn.prototype.crossOrigin,bn.players={};const Sn=o.a.navigator;bn.prototype.options_={techOrder:Ui.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Sn&&(Sn.languages&&Sn.languages[0]||Sn.userLanguage||Sn.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(e){bn.prototype[e]=function(){return this.techGet_(e)}})),fn.forEach((function(e){bn.prototype[`handleTech${qt(e)}_`]=function(){return this.trigger(e)}})),zt.registerComponent("Player",bn);const kn="plugin",Cn={},En=e=>Cn.hasOwnProperty(e),wn=e=>En(e)?Cn[e]:void 0,xn=(e,t)=>{e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},In=(e,t,n)=>{const r=(n?"before":"")+"pluginsetup";e.trigger(r,t),e.trigger(r+":"+t.name,t)},Pn=(e,t)=>(t.prototype.name=e,function(...n){In(this,{name:e,plugin:t,instance:null},!0);const r=new t(...[this,...n]);return this[e]=()=>r,In(this,r.getEventHash()),r});class An{constructor(e){if(this.constructor===An)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ft(this),delete this.trigger,$t(this,this.constructor.defaultState),xn(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,t={}){return vt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=Pn(e,Cn[e])}static isBasic(e){const p="string"==typeof e?wn(e):e;return"function"==typeof p&&!An.prototype.isPrototypeOf(p.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(En(e))W.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(bn.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Cn[e]=t,e!==kn&&(An.isBasic(t)?bn.prototype[e]=function(e,t){const n=function(){In(this,{name:e,plugin:t,instance:null},!0);const n=t.apply(this,arguments);return xn(this,e),In(this,{name:e,plugin:t,instance:n}),n};return Object.keys(t).forEach((function(e){n[e]=t[e]})),n}(e,t):bn.prototype[e]=Pn(e,t)),t}static deregisterPlugin(e){if(e===kn)throw new Error("Cannot de-register base plugin.");En(e)&&(delete Cn[e],delete bn.prototype[e])}static getPlugins(e=Object.keys(Cn)){let t;return e.forEach((e=>{const n=wn(e);n&&(t=t||{},t[e]=n)})),t}static getPluginVersion(e){const t=wn(e);return t&&t.VERSION||""}}function Ln(e,t,n,r){return function(e,t){let n=!1;return function(...r){return n||W.warn(e),n=!0,t.apply(this,r)}}(`${t} is deprecated and will be removed in ${e}.0; please use ${n} instead.`,r)}An.getPlugin=wn,An.BASE_PLUGIN_NAME=kn,An.registerPlugin(kn,An),bn.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},bn.prototype.hasPlugin=function(e){return!!En(e)};const On=e=>0===e.indexOf("#")?e.slice(1):e;function Dn(e,t,n){let r=Dn.getPlayer(e);if(r)return t&&W.warn(`Player "${e}" is already initialised. Options will not be applied.`),n&&r.ready(n),r;const o="string"==typeof e?Xe("#"+On(e)):e;if(!Ce(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");o.ownerDocument.defaultView&&o.ownerDocument.body.contains(o)||W.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(o.parentNode&&o.parentNode.hasAttribute("data-vjs-player")?o.parentNode:o).cloneNode(!0)),N("beforesetup").forEach((e=>{const n=e(o,Z(t));Y(n)&&!Array.isArray(n)?t=Z(t,n):W.error("please return an object in beforesetup hooks")}));const l=zt.getComponent("Player");return r=new l(o,t,n),N("setup").forEach((e=>e(r))),r}if(Dn.hooks_=R,Dn.hooks=N,Dn.hook=function(e,t){N(e,t)},Dn.hookOnce=function(e,t){N(e,[].concat(t).map((t=>{const n=(...r)=>(B(e,n),t(...r));return n})))},Dn.removeHook=B,!0!==o.a.VIDEOJS_NO_DYNAMIC_STYLE&&ke()){let style=Xe(".vjs-styles-defaults");if(!style){style=at("vjs-styles-defaults");const head=Xe("head");head&&head.insertBefore(style,head.firstChild),ot(style,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid:not(.vjs-audio-only-mode) {\n        padding-top: 56.25%\n      }\n    ")}}st(1,Dn),Dn.VERSION=U,Dn.options=bn.prototype.options_,Dn.getPlayers=()=>bn.players,Dn.getPlayer=e=>{const t=bn.players;let n;if("string"==typeof e){const r=On(e),o=t[r];if(o)return o;n=Xe("#"+r)}else n=e;if(Ce(n)){const{player:e,playerId:r}=n;if(e||t[r])return e||t[r]}},Dn.getAllPlayers=()=>Object.keys(bn.players).map((e=>bn.players[e])).filter(Boolean),Dn.players=bn.players,Dn.getComponent=zt.getComponent,Dn.registerComponent=(e,t)=>{Ui.isTech(t)&&W.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),zt.registerComponent.call(zt,e,t)},Dn.getTech=Ui.getTech,Dn.registerTech=Ui.registerTech,Dn.use=function(e,t){Ri[e]=Ri[e]||[],Ri[e].push(t)},Object.defineProperty(Dn,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(Dn.middleware,"TERMINATOR",{value:Bi,writeable:!1,enumerable:!0}),Dn.browser=be,Dn.obj=te,Dn.mergeOptions=Ln(9,"videojs.mergeOptions","videojs.obj.merge",Z),Dn.defineLazyProperty=Ln(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",ee),Dn.bind=Ln(9,"videojs.bind","native Function.prototype.bind",Ct),Dn.registerPlugin=An.registerPlugin,Dn.deregisterPlugin=An.deregisterPlugin,Dn.plugin=(e,t)=>(W.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),An.registerPlugin(e,t)),Dn.getPlugins=An.getPlugins,Dn.getPlugin=An.getPlugin,Dn.getPluginVersion=An.getPluginVersion,Dn.addLanguage=function(code,data){return code=(""+code).toLowerCase(),Dn.options.languages=Z(Dn.options.languages,{[code]:data}),Dn.options.languages[code]},Dn.log=W,Dn.createLogger=z,Dn.time=ti,Dn.createTimeRange=Ln(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Qt),Dn.createTimeRanges=Ln(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Qt),Dn.formatTime=Ln(9,"videojs.formatTime","videojs.time.formatTime",ei),Dn.setFormatTime=Ln(9,"videojs.setFormatTime","videojs.time.setFormatTime",Jt),Dn.resetFormatTime=Ln(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Zt),Dn.parseUrl=Ln(9,"videojs.parseUrl","videojs.url.parseUrl",bi),Dn.isCrossOrigin=Ln(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Ci),Dn.EventTarget=Pt,Dn.any=bt,Dn.on=_t,Dn.one=Tt,Dn.off=yt,Dn.trigger=vt,Dn.xhr=y.a,Dn.TextTrack=Ii,Dn.AudioTrack=Pi,Dn.VideoTrack=Ai,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{Dn[e]=function(){return W.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ze[e].apply(null,arguments)}})),Dn.computedStyle=Ln(9,"videojs.computedStyle","videojs.dom.computedStyle",Je),Dn.dom=Ze,Dn.fn=xt,Dn.num=ds,Dn.str=Wt,Dn.url=Ei;class Mn{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class Un extends Dn.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const n=this.levels_.length;return t=new Mn(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let i=0,t=this.length;i<t;i++){const t=this[i];if(t.id===e)return t}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Un.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const e in Un.prototype.allowedEvents_)Un.prototype["on"+e]=null;var Rn="3.0.0";const Nn=Dn.registerPlugin||Dn.plugin,Bn=function(e){return function(e,t){const n=e.qualityLevels,r=new Un,o=function(){r.dispose(),e.qualityLevels=n,e.off("dispose",o)};return e.on("dispose",o),e.qualityLevels=()=>r,e.qualityLevels.VERSION=Rn,r}(this,Dn.mergeOptions({},e))};Nn("qualityLevels",Bn),Bn.VERSION=Rn;const Fn=S.a,jn=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,$n=source=>Dn.log.debug?Dn.log.debug.bind(Dn,"VHS:",`${source} >`):function(){};function Hn(...e){const t=Dn.obj||Dn;return(t.merge||t.mergeOptions).apply(t,e)}function qn(...e){const t=Dn.time||Dn;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}const Vn=1/30,Wn=.1,zn=function(e,t){const n=[];let i;if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return qn(n)},Gn=function(e,time){return zn(e,(function(e,t){return e-Wn<=time&&t+Wn>=time}))},Kn=function(e,time){return zn(e,(function(e){return e-Vn>=time}))},Qn=e=>{const t=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},Xn=e=>{const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},Yn=function(a){if(a&&a.length&&a.end)return a.end(a.length-1)},Jn=function(e,t){let time=0;if(!e||!e.length)return time;for(let i=0;i<e.length;i++){const n=e.start(i),r=e.end(i);t>r||(time+=t>n&&t<=r?r-t:r-n)}return time},Zn=(e,t)=>{if(!t.preload)return t.duration;let n=0;return(t.parts||[]).forEach((function(p){n+=p.duration})),(t.preloadHints||[]).forEach((function(p){"PART"===p.type&&(n+=e.partTargetDuration)})),n},er=e=>(e.segments||[]).reduce(((e,t,n)=>(t.parts?t.parts.forEach((function(r,o){e.push({duration:r.duration,segmentIndex:n,partIndex:o,part:r,segment:t})})):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e)),[]),ir=e=>{const t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},sr=({preloadSegment:e})=>{if(!e)return;const{parts:t,preloadHints:n}=e;let r=(n||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0);return r+=t&&t.length?t.length:0,r},nr=(main,e)=>{if(e.endList)return 0;if(main&&main.suggestedPresentationDelay)return main.suggestedPresentationDelay;const t=ir(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?3*e.partTargetDuration:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?3*e.targetDuration:0},rr=function(e,t,n){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;const r=function(e,t){let n=0,i=t-e.mediaSequence,r=e.segments[i];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;i--;){if(r=e.segments[i],void 0!==r.end)return{result:n+r.end,precise:!0};if(n+=Zn(e,r),void 0!==r.start)return{result:n+r.start,precise:!0}}return{result:n,precise:!1}}(e,t);if(r.precise)return r.result;const o=function(e,t){let n,r=0,i=t-e.mediaSequence;for(;i<e.segments.length;i++){if(n=e.segments[i],void 0!==n.start)return{result:n.start-r,precise:!0};if(r+=Zn(e,n),void 0!==n.end)return{result:n.end-r,precise:!0}}return{result:-1,precise:!1}}(e,t);return o.precise?o.result:r.result+n},ar=function(e,t,n){if(!e)return 0;if("number"!=typeof n&&(n=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return o.a.Infinity}return rr(e,t,n)},or=function({defaultDuration:e,durationList:t,startIndex:n,endIndex:r}){let o=0;if(n>r&&([n,r]=[r,n]),n<0){for(let i=n;i<Math.min(0,r);i++)o+=e;n=0}for(let i=n;i<r;i++)o+=t[i].duration;return o},lr=function(e,t,n,r){if(!e||!e.segments)return null;if(e.endList)return ar(e);if(null===t)return null;t=t||0;let o=rr(e,e.mediaSequence+e.segments.length,t);return n&&(o-=r="number"==typeof r?r:nr(null,e)),Math.max(0,o)},dr=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},ur=function(e){return e.excludeUntil&&e.excludeUntil===1/0},cr=function(e){const t=dr(e);return!e.disabled&&!t},pr=function(e,t){return t.attributes&&t.attributes[e]},mr=(main,e)=>{if(1===main.playlists.length)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===main.playlists.filter((e=>!!cr(e)&&(e.attributes.BANDWIDTH||0)<t)).length},gr=(a,b)=>!(!a&&!b||!a&&b||a&&!b)&&(a===b||(!(!a.id||!b.id||a.id!==b.id)||(!(!a.resolvedUri||!b.resolvedUri||a.resolvedUri!==b.resolvedUri)||!(!a.uri||!b.uri||a.uri!==b.uri)))),fr=function(main,e){const t=main&&main.mediaGroups&&main.mediaGroups.AUDIO||{};let n=!1;for(const r in t){for(const label in t[r])if(n=e(t[r][label]),n)break;if(n)break}return!!n},_r=main=>{if(!main||!main.playlists||!main.playlists.length){return fr(main,(e=>e.playlists&&e.playlists.length||e.uri))}for(let i=0;i<main.playlists.length;i++){const e=main.playlists[i],t=e.attributes&&e.attributes.CODECS;if(t&&t.split(",").every((e=>Object(w.f)(e))))continue;if(!fr(main,(t=>gr(e,t))))return!1}return!0};var yr={liveEdgeDelay:nr,duration:ar,seekable:function(e,t,n){const r=t||0,o=lr(e,t,!0,n);return null===o?qn():qn(r,o)},getMediaInfoForTime:function({playlist:e,currentTime:t,startingSegmentIndex:n,startingPartIndex:r,startTime:o,exactManifestTimings:l}){let time=t-o;const h=er(e);let d=0;for(let i=0;i<h.length;i++){const e=h[i];if(n===e.segmentIndex&&("number"!=typeof r||"number"!=typeof e.partIndex||r===e.partIndex)){d=i;break}}if(time<0){if(d>0)for(let i=d-1;i>=0;i--){const t=h[i];if(time+=t.duration,l){if(time<0)continue}else if(time+Vn<=0)continue;return{partIndex:t.partIndex,segmentIndex:t.segmentIndex,startTime:o-or({defaultDuration:e.targetDuration,durationList:h,startIndex:d,endIndex:i})}}return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:t}}if(d<0){for(let i=d;i<0;i++)if(time-=e.targetDuration,time<0)return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:t};d=0}for(let i=d;i<h.length;i++){const t=h[i];if(time-=t.duration,l){if(time>0)continue}else if(time-Vn>=0)continue;return{partIndex:t.partIndex,segmentIndex:t.segmentIndex,startTime:o+or({defaultDuration:e.targetDuration,durationList:h,startIndex:d,endIndex:i})}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:t}},isEnabled:cr,isDisabled:function(e){return e.disabled},isExcluded:dr,isIncompatible:ur,playlistEnd:lr,isAes:function(e){for(let i=0;i<e.segments.length;i++)if(e.segments[i].key)return!0;return!1},hasAttribute:pr,estimateSegmentRequestTime:function(e,t,n,r=0){if(!pr("BANDWIDTH",n))return NaN;return(e*n.attributes.BANDWIDTH-8*r)/t},isLowestEnabledRendition:mr,isAudioOnly:_r,playlistMatch:gr,segmentDurationWithParts:Zn};const{log:vr}=Dn,Tr=(e,t)=>`${e}-${t}`,Sr=(main,e)=>{main.mediaGroups&&["AUDIO","SUBTITLES"].forEach((t=>{if(main.mediaGroups[t])for(const n in main.mediaGroups[t])for(const r in main.mediaGroups[t][n]){const o=main.mediaGroups[t][n][r];e(o,t,n,r)}}))},kr=({playlist:e,uri:t,id:n})=>{e.id=n,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Cr=(main,e)=>{main.uri=e;for(let i=0;i<main.playlists.length;i++)if(!main.playlists[i].uri){const e=`placeholder-uri-${i}`;main.playlists[i].uri=e}const t=_r(main);Sr(main,((e,n,r,o)=>{const l=`placeholder-uri-${n}-${r}-${o}`;if(!e.playlists||!e.playlists.length){if(t&&"AUDIO"===n&&!e.uri)for(let i=0;i<main.playlists.length;i++){const p=main.playlists[i];if(p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===r)return}e.playlists=[C()({},e)]}e.playlists.forEach((function(p,i){const e=Tr(i,l);p.uri?p.resolvedUri=p.resolvedUri||Fn(main.uri,p.uri):(p.uri=0===i?l:e,p.resolvedUri=p.uri),p.id=p.id||e,p.attributes=p.attributes||{},main.playlists[p.id]=p,main.playlists[p.uri]=p}))})),(main=>{let i=main.playlists.length;for(;i--;){const e=main.playlists[i];kr({playlist:e,id:Tr(i,e.uri)}),e.resolvedUri=Fn(main.uri,e.uri),main.playlists[e.id]=e,main.playlists[e.uri]=e,e.attributes.BANDWIDTH||vr.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(main),(main=>{Sr(main,(e=>{e.uri&&(e.resolvedUri=Fn(main.uri,e.uri))}))})(main)},{EventTarget:Er}=Dn,wr=(a,b)=>{if(!a)return b;const e=Hn(a,b);if(a.preloadHints&&!b.preloadHints&&delete e.preloadHints,a.parts&&!b.parts)delete e.parts;else if(a.parts&&b.parts)for(let i=0;i<b.parts.length;i++)a.parts&&a.parts[i]&&(e.parts[i]=Hn(a.parts[i],b.parts[i]));return!a.skipped&&b.skipped&&(e.skipped=!1),a.preload&&!b.preload&&(e.preload=!1),e},xr=(e,t)=>{!e.resolvedUri&&e.uri&&(e.resolvedUri=Fn(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Fn(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Fn(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Fn(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((p=>{p.resolvedUri||(p.resolvedUri=Fn(t,p.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((p=>{p.resolvedUri||(p.resolvedUri=Fn(t,p.uri))}))},Ir=function(e){const t=e.segments||[],n=e.preloadSegment;if(n&&n.parts&&n.parts.length){if(n.preloadHints)for(let i=0;i<n.preloadHints.length;i++)if("MAP"===n.preloadHints[i].type)return t;n.duration=e.targetDuration,n.preload=!0,t.push(n)}return t},Pr=(a,b)=>a===b||a.segments&&b.segments&&a.segments.length===b.segments.length&&a.endList===b.endList&&a.mediaSequence===b.mediaSequence&&a.preloadSegment===b.preloadSegment,Ar=(main,e,t=Pr)=>{const n=Hn(main,{}),r=n.playlists[e.id];if(!r)return null;if(t(r,e))return null;e.segments=Ir(e);const o=Hn(r,e);if(o.preloadSegment&&!e.preloadSegment&&delete o.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let i=0;i<e.skip.skippedSegments;i++)e.segments.unshift({skipped:!0})}o.segments=((e,t,n)=>{const r=e.slice(),o=t.slice();n=n||0;const l=[];let h;for(let e=0;e<o.length;e++){const t=r[e+n],d=o[e];t?(h=t.map||h,l.push(wr(t,d))):(h&&!d.map&&(d.map=h),l.push(d))}return l})(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}o.segments.forEach((e=>{xr(e,o.resolvedUri)}));for(let i=0;i<n.playlists.length;i++)n.playlists[i].id===e.id&&(n.playlists[i]=o);return n.playlists[e.id]=o,n.playlists[e.uri]=o,Sr(main,((t,n,r,l)=>{if(t.playlists)for(let i=0;i<t.playlists.length;i++)e.id===t.playlists[i].id&&(t.playlists[i]=o)})),n},Lr=(e,t)=>{const n=e.segments||[],r=n[n.length-1],o=r&&r.parts&&r.parts[r.parts.length-1],l=o&&o.duration||r&&r.duration;return t&&l?1e3*l:500*(e.partTargetDuration||e.targetDuration||10)};class Or extends Er{constructor(e,t,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$n("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=t,this.withCredentials=r;const o=t.options_;this.customTagParsers=o&&o.customTagParsers||[],this.customTagMappers=o&&o.customTagMappers||[],this.llhls=o&&o.llhls,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_)}handleMediaupdatetimeout_(){if("HAVE_METADATA"!==this.state)return;const e=this.media();let t=Fn(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(t.endList||!t.serverControl)return e;const n={};if(t.serverControl.canBlockReload){const{preloadSegment:e}=t;let r=t.mediaSequence+t.segments.length;if(e){const o=e.parts||[],l=sr(t)-1;l>-1&&l!==o.length-1&&(n._HLS_part=l),(l>-1||o.length)&&r--}n._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(n._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(n).length){const t=new o.a.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){n.hasOwnProperty(e)&&t.searchParams.set(e,n[e])})),e=t.toString()}return e})(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}playlistRequestError(e,t,n){const{uri:r,id:o}=t;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[o],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:t}){return(({onwarn:e,oninfo:t,manifestString:n,customTagParsers:r=[],customTagMappers:o=[],llhls:l})=>{const h=new E.a;e&&h.on("warn",e),t&&h.on("info",t),r.forEach((e=>h.addParser(e))),o.forEach((e=>h.addTagMapper(e))),h.push(n),h.end();const d=h.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){d.hasOwnProperty(e)&&delete d[e]})),d.segments&&d.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!d.targetDuration){let t=10;d.segments&&d.segments.length&&(t=d.segments.reduce(((e,s)=>Math.max(e,s.duration)),0)),e&&e(`manifest has no targetDuration defaulting to ${t}`),d.targetDuration=t}const c=ir(d);if(c.length&&!d.partTargetDuration){const t=c.reduce(((e,p)=>Math.max(e,p.duration)),0);e&&(e(`manifest has no partTargetDuration defaulting to ${t}`),vr.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.")),d.partTargetDuration=t}return d})({onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: ${t}`),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: ${t}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const o=t||this.parseManifest_({url:n,manifestString:e});o.lastRequest=Date.now(),kr({playlist:o,uri:n,id:r});const l=Ar(this.main,o);this.targetDuration=o.partTargetDuration||o.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Lr(this.media(),!!l)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),o.a.clearTimeout(this.mediaUpdateTimeout),o.a.clearTimeout(this.finalRenditionTimeout),this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(o.a.clearTimeout(this.finalRenditionTimeout),t){const t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;return void(this.finalRenditionTimeout=o.a.setTimeout(this.media.bind(this,e,!1),t))}const n=this.state,r=!this.media_||e.id!==this.media_.id,l=this.main.playlists[e.id];if(l&&l.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(r&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===n?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Lr(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},((t,r)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=jn(e.resolvedUri,r),t)return this.playlistRequestError(this.request,e,n);this.haveMetadata({playlistString:r.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===n?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}pause(){this.mediaUpdateTimeout&&(o.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(o.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=o.a.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)}else this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(o.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=o.a.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=o.a.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=jn(this.src,t);const n=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(n)}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,Cr(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=Ir(e),e.segments.forEach((t=>{xr(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));const t=this.srcUri()||o.a.location.href;this.main=((e,t)=>{const n=Tr(0,t),main={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:o.a.location.href,resolvedUri:o.a.location.href,playlists:[{uri:t,id:n,resolvedUri:t,attributes:{}}]};return main.playlists[n]=main.playlists[0],main.playlists[t]=main.playlists[0],main})(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:Dr}=Dn,Mr=function(e,t,n,r){const o="arraybuffer"===e.responseType?e.response:e.responseText;!t&&o&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=o.byteLength||o.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),n.headers&&(e.responseHeaders=n.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===n.statusCode||206===n.statusCode||0===n.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(o||e.responseText)))),r(t,e)},Ur=function(){const e=function e(t,n){t=Hn({timeout:45e3},t);const r=e.beforeRequest||Dn.Vhs.xhr.beforeRequest;if(r&&"function"==typeof r){const e=r(t);e&&(t=e)}const o=(!0===Dn.Vhs.xhr.original?Dr:Dn.Vhs.xhr)(t,(function(e,t){return Mr(o,e,t,n)})),l=o.abort;return o.abort=function(){return o.aborted=!0,l.apply(o,arguments)},o.uri=t.uri,o.requestTime=Date.now(),o};return e.original=!0,e},Rr=function(e){const t={};return e.byterange&&(t.Range=function(e){let t;const n=e.offset;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?o.a.BigInt(e.offset)+o.a.BigInt(e.length)-o.a.BigInt(1):e.offset+e.length-1,"bytes="+n+"-"+t}(e.byterange)),t},Nr=function(e,i){return e.start(i)+"-"+e.end(i)},Br=function(e,i){const t=e.toString(16);return"00".substring(0,2-t.length)+t+(i%2?" ":"")},Fr=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},jr=function(e){const t={};return Object.keys(e).forEach((n=>{const r=e[n];Object(I.e)(r)?t[n]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[n]=r})),t},$r=function(e){const t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Hr=function(e){return e.resolvedUri},qr=data=>{const e=Array.prototype.slice.call(data),t=16;let n,r,o="";for(let l=0;l<e.length/t;l++)n=e.slice(l*t,l*t+t).map(Br).join(""),r=e.slice(l*t,l*t+t).map(Fr).join(""),o+=n+" "+r+"\n";return o};var Vr=Object.freeze({__proto__:null,createTransferableMessage:jr,initSegmentId:$r,segmentKeyId:Hr,hexDump:qr,tagDump:({bytes:e})=>qr(e),textRanges:e=>{let i,t="";for(i=0;i<e.length;i++)t+=Nr(e,i)+" ";return t}});const Wr=({playlist:e,time:time,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!e||void 0===time)return t({message:"getProgramTime: playlist and time must be provided"});const n=((time,e)=>{if(!e||!e.segments||0===e.segments.length)return null;let t,n=0;for(let i=0;i<e.segments.length&&(t=e.segments[i],n=t.videoTimingInfo?t.videoTimingInfo.transmuxedPresentationEnd:n+t.duration,!(time<=n));i++);const r=e.segments[e.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<time)return null;if(time>n){if(time>n+.25*r.duration)return null;t=r}return{segment:t,estimatedStart:t.videoTimingInfo?t.videoTimingInfo.transmuxedPresentationStart:n-t.duration,type:t.videoTimingInfo?"accurate":"estimate"}})(time,e);if(!n)return t({message:"valid programTime was not found"});if("estimate"===n.type)return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:time},o=((e,t)=>{if(!t.dateTimeObject)return null;const n=t.videoTimingInfo.transmuxerPrependedSeconds,r=e-(t.videoTimingInfo.transmuxedPresentationStart+n);return new Date(t.dateTimeObject.getTime()+1e3*r)})(time,n.segment);return o&&(r.programDateTime=o.toISOString()),t(null,r)},zr=({programTime:e,playlist:t,retryCount:n=2,seekTo:r,pauseAfterSeek:o=!0,tech:l,callback:h})=>{if(!h)throw new Error("seekToProgramTime: callback must be provided");if(void 0===e||!t||!r)return h({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!t.endList&&!l.hasStarted_)return h({message:"player must be playing a live stream to start buffering"});if(!(e=>{if(!e.segments||0===e.segments.length)return!1;for(let i=0;i<e.segments.length;i++)if(!e.segments[i].dateTimeObject)return!1;return!0})(t))return h({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri});const d=((e,t)=>{let n;try{n=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let r=t.segments[0];if(n<r.dateTimeObject)return null;for(let i=0;i<t.segments.length-1&&(r=t.segments[i],!(n<t.segments[i+1].dateTimeObject));i++);const o=t.segments[t.segments.length-1],l=o.dateTimeObject,h=o.videoTimingInfo?(d=o.videoTimingInfo).transmuxedPresentationEnd-d.transmuxedPresentationStart-d.transmuxerPrependedSeconds:o.duration+.25*o.duration;var d;return n>new Date(l.getTime()+1e3*h)?null:(n>l&&(r=o),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:yr.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})})(e,t);if(!d)return h({message:`${e} was not found in the stream`});const c=d.segment,m=((e,t)=>{let n,r;try{n=new Date(e),r=new Date(t)}catch(e){}const o=n.getTime();return(r.getTime()-o)/1e3})(c.dateTimeObject,e);if("estimate"===d.type)return 0===n?h({message:`${e} is not buffered yet. Try again`}):(r(d.estimatedStart+m),void l.one("seeked",(()=>{zr({programTime:e,playlist:t,retryCount:n-1,seekTo:r,pauseAfterSeek:o,tech:l,callback:h})})));const f=c.start+m;l.one("seeked",(()=>h(null,l.currentTime()))),o&&l.pause(),r(f)},Gr=(e,t)=>{if(4===e.readyState)return t()},{EventTarget:Kr}=Dn,Qr=function(a,b){if(!Pr(a,b))return!1;if(a.sidx&&b.sidx&&(a.sidx.offset!==b.sidx.offset||a.sidx.length!==b.sidx.length))return!1;if(!a.sidx&&b.sidx||a.sidx&&!b.sidx)return!1;if(a.segments&&!b.segments||!a.segments&&b.segments)return!1;if(!a.segments&&!b.segments)return!0;for(let i=0;i<a.segments.length;i++){const e=a.segments[i],t=b.segments[i];if(e.uri!==t.uri)return!1;if(!e.byterange&&!t.byterange)continue;const n=e.byterange,r=t.byterange;if(n&&!r||!n&&r)return!1;if(n.offset!==r.offset||n.length!==r.length)return!1}return!0},Xr=(e,t)=>{const n={};for(const r in e){const o=e[r].sidx;if(o){const e=Object(P.b)(o);if(!t[e])break;const r=t[e].sidxInfo;a=r,b=o,(Boolean(!a.map&&!b.map)||Boolean(a.map&&b.map&&a.map.byterange.offset===b.map.byterange.offset&&a.map.byterange.length===b.map.byterange.length))&&a.uri===b.uri&&a.byterange.offset===b.byterange.offset&&a.byterange.length===b.byterange.length&&(n[e]=t[e])}}var a,b;return n};class Yr extends Kr{constructor(e,t,n={},r){super(),this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:o=!1}=n;if(this.vhs_=t,this.withCredentials=o,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",(()=>{this.refreshXml_()})),this.on("mediaupdatetimeout",(()=>{this.refreshMedia_(this.media().id)})),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=$n("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,n){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,n&&(this.state=n),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,n){const r=e.sidx&&Object(P.b)(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r])return void(this.mediaRequest_=o.a.setTimeout((()=>n(!1)),0));const l=jn(e.sidx.resolvedUri),h=(o,l)=>{if(this.requestErrored_(o,l,t))return;const h=this.mainPlaylistLoader_.sidxMapping_;let d;try{d=L()(Object(I.k)(l.response).subarray(8))}catch(e){return void this.requestErrored_(e,l,t)}return h[r]={sidxInfo:e.sidx,sidx:d},Object(P.a)(e,d,e.sidx.resolvedUri),n(!0)};this.request=((e,t,n)=>{let r,o=[],l=!1;const h=function(e,t,r,o){return t.abort(),l=!0,n(e,t,r,o)},d=function(e,t){if(l)return;if(e)return h(e,t,"",o);const n=t.responseText.substring(o&&o.byteLength||0,t.responseText.length);if(o=Object(I.d)(o,Object(I.h)(n,!0)),r=r||Object(O.a)(o),o.length<10||r&&o.length<r+2)return Gr(t,(()=>h(e,t,"",o)));const d=Object(D.a)(o);return"ts"===d&&o.length<188||!d&&o.length<376?Gr(t,(()=>h(e,t,"",o))):h(null,t,d,o)},c=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({total:t,loaded:n}){return Mr(e,null,{statusCode:e.status},d)}))}},(function(e,t){return Mr(c,e,t,d)}));return c})(l,this.vhs_.xhr,((t,n,r,o)=>{if(t)return h(t,n);if(!r||"mp4"!==r)return h({status:n.status,message:`Unsupported ${r||"unknown"} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},n);const{offset:d,length:c}=e.sidx.byterange;if(o.length>=c+d)return h(t,{response:o.subarray(d,d+c),status:n.status,uri:n.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",headers:Rr({byterange:e.sidx.byterange})},h)}))}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},o.a.clearTimeout(this.minimumUpdatePeriodTimeout_),o.a.clearTimeout(this.mediaRequest_),o.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("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){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)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(n=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),o.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(o.a.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){o.a.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const e=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=o.a.setTimeout((()=>this.load()),e)}else this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=o.a.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,n)=>{if(this.requestErrored_(t,n))return void("HAVE_NOTHING"===this.state&&(this.started=!1));const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;return this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=jn(this.mainPlaylistLoader_.srcUrl,n),r?(this.handleMain_(),void this.syncClientServerClock_((()=>e(n,r)))):e(n,r)}))}syncClientServerClock_(e){const t=Object(P.d)(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:Fn(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((n,r)=>{if(!this.request)return;if(n)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let o;o="HEAD"===t.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):this.mainLoaded_:Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=o-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 t=(({mainXml:e,srcUrl:t,clientOffset:n,sidxMapping:r,previousManifest:o})=>{const l=Object(P.c)(e,{manifestUri:t,clientOffset:n,sidxMapping:r,previousManifest:o});return Cr(l,t),l})({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=((e,t,n)=>{let r=!0,o=Hn(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let i=0;i<t.playlists.length;i++){const e=t.playlists[i];if(e.sidx){const t=Object(P.b)(e.sidx);n&&n[t]&&n[t].sidx&&Object(P.a)(e,n[t].sidx,e.sidx.resolvedUri)}const l=Ar(o,e,Qr);l&&(o=l,r=!1)}return Sr(t,((e,t,n,label)=>{if(e.playlists&&e.playlists.length){const l=e.playlists[0].id,h=Ar(o,e.playlists[0],Qr);h&&(o=h,o.mediaGroups[t][n][label].playlists[0]=o.playlists[l],r=!1)}})),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(r=!1),r?null:o})(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(o.a.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=o.a.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((main,e)=>{let t=Xr(main.playlists,e);return Sr(main,((n,r,o,l)=>{if(n.playlists&&n.playlists.length){const r=n.playlists;t=Hn(t,Xr(r,e))}})),t})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{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 t=this.mainPlaylistLoader_.main.playlists,n=!this.media_||this.media_!==t[e];if(n?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=o.a.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),Lr(this.media(),Boolean(n))))};e()}this.trigger("loadedplaylist")}}var Jr={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 Zr=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},ea=function(code){return function(){const e=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(t){const n=new BlobBuilder;return n.append(e),URL.createObjectURL(n.getBlob())}}(code),t=Zr(new Worker(e));t.objURL=e;const n=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),n.call(this)},t}},ta=function(code){return`var browserWorkerPolyFill = ${Zr.toString()};\nbrowserWorkerPolyFill(self);\n`+code},ia=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)};var sa=ea(ta(ia((function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},n=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var r;return!!e[t]&&(r=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(r,1),r>-1)},this.trigger=function(t){var n,i,r,o;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(o=[],i=arguments.length,i=1;i<arguments.length;++i)o.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].apply(this,o)}},this.dispose=function(){e={}}}};n.prototype.pipe=function(e){return this.on("data",(function(data){e.push(data)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},n.prototype.push=function(data){this.trigger("data",data)},n.prototype.flush=function(e){this.trigger("done",e)},n.prototype.partialFlush=function(e){this.trigger("partialdone",e)},n.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},n.prototype.reset=function(e){this.trigger("reset",e)};var r,o,l,h,d,c,m,f,_,y,v,T,S,k,C,E,w,x,I,P,A,L,O,D,M,U,R,N,B,F,j,$,H,V,W,z,G,K,Q,X,Y=n,J=Math.pow(2,32),Z={getUint64:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getBigUint64?(t=n.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:n.getUint32(0)*J+n.getUint32(4)},MAX_UINT32:J},ee=Z.MAX_UINT32;!function(){var i;if(L={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(i in L)L.hasOwnProperty(i)&&(L[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]);O=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),M=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),D=new Uint8Array([0,0,0,1]),U=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]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),N={video:U,audio:R},j=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),F=new Uint8Array([0,0,0,0,0,0,0,0]),$=new Uint8Array([0,0,0,0,0,0,0,0]),H=$,V=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),W=$,B=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),r=function(e){var i,t,n=[],r=0;for(i=1;i<arguments.length;i++)n.push(arguments[i]);for(i=n.length;i--;)r+=n[i].byteLength;for(t=new Uint8Array(r+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),i=0,r=8;i<n.length;i++)t.set(n[i],r),r+=n[i].byteLength;return t},o=function(){return r(L.dinf,r(L.dref,j))},l=function(track){return r(L.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,track.audioobjecttype<<3|track.samplingfrequencyindex>>>1,track.samplingfrequencyindex<<7|track.channelcount<<3,6,1,2]))},C=function(e){return r(L.hdlr,N[e])},k=function(track){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,track.duration>>>24&255,track.duration>>>16&255,track.duration>>>8&255,255&track.duration,85,196,0,0]);return track.samplerate&&(e[12]=track.samplerate>>>24&255,e[13]=track.samplerate>>>16&255,e[14]=track.samplerate>>>8&255,e[15]=255&track.samplerate),r(L.mdhd,e)},S=function(track){return r(L.mdia,k(track),C(track.type),c(track))},d=function(e){return r(L.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},c=function(track){return r(L.minf,"video"===track.type?r(L.vmhd,B):r(L.smhd,F),o(),w(track))},m=function(e,t){for(var n=[],i=t.length;i--;)n[i]=I(t[i]);return r.apply(null,[L.moof,d(e)].concat(n))},f=function(e){for(var i=e.length,t=[];i--;)t[i]=v(e[i]);return r.apply(null,[L.moov,y(4294967295)].concat(t).concat(_(e)))},_=function(e){for(var i=e.length,t=[];i--;)t[i]=P(e[i]);return r.apply(null,[L.mvex].concat(t))},y=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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 r(L.mvhd,t)},E=function(track){var e,i,t=track.samples||[],n=new Uint8Array(4+t.length);for(i=0;i<t.length;i++)e=t[i].flags,n[i+4]=e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy;return r(L.sdtp,n)},w=function(track){return r(L.stbl,x(track),r(L.stts,W),r(L.stsc,H),r(L.stsz,V),r(L.stco,$))},x=function(track){return r(L.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===track.type?z(track):G(track))},z=function(track){var i,e,t=track.sps||[],n=track.pps||[],o=[],l=[];for(i=0;i<t.length;i++)o.push((65280&t[i].byteLength)>>>8),o.push(255&t[i].byteLength),o=o.concat(Array.prototype.slice.call(t[i]));for(i=0;i<n.length;i++)l.push((65280&n[i].byteLength)>>>8),l.push(255&n[i].byteLength),l=l.concat(Array.prototype.slice.call(n[i]));if(e=[L.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,(65280&track.width)>>8,255&track.width,(65280&track.height)>>8,255&track.height,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]),r(L.avcC,new Uint8Array([1,track.profileIdc,track.profileCompatibility,track.levelIdc,255].concat([t.length],o,[n.length],l))),r(L.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],track.sarRatio){var h=track.sarRatio[0],d=track.sarRatio[1];e.push(r(L.pasp,new Uint8Array([(4278190080&h)>>24,(16711680&h)>>16,(65280&h)>>8,255&h,(4278190080&d)>>24,(16711680&d)>>16,(65280&d)>>8,255&d])))}return r.apply(null,e)},G=function(track){return r(L.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&track.channelcount)>>8,255&track.channelcount,(65280&track.samplesize)>>8,255&track.samplesize,0,0,0,0,(65280&track.samplerate)>>8,255&track.samplerate,0,0]),l(track))},T=function(track){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,0,(4278190080&track.duration)>>24,(16711680&track.duration)>>16,(65280&track.duration)>>8,255&track.duration,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,(65280&track.width)>>8,255&track.width,0,0,(65280&track.height)>>8,255&track.height,0,0]);return r(L.tkhd,e)},I=function(track){var e,t,n,o,l,h;return e=r(L.tfhd,new Uint8Array([0,0,0,58,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),l=Math.floor(track.baseMediaDecodeTime/ee),h=Math.floor(track.baseMediaDecodeTime%ee),t=r(L.tfdt,new Uint8Array([1,0,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l,h>>>24&255,h>>>16&255,h>>>8&255,255&h])),92,"audio"===track.type?(n=A(track,92),r(L.traf,e,t,n)):(o=E(track),n=A(track,o.length+92),r(L.traf,e,t,n,o))},v=function(track){return track.duration=track.duration||4294967295,r(L.trak,T(track),S(track))},P=function(track){var e=new Uint8Array([0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==track.type&&(e[e.length-1]=0),r(L.trex,e)},X=function(e,t){var n=0,r=0,o=0,l=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(r=2),void 0!==e[0].flags&&(o=4),void 0!==e[0].compositionTimeOffset&&(l=8)),[0,0,n|r|o|l,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},Q=function(track,e){var t,n,header,o,l,i;for(e+=20+16*(o=track.samples||[]).length,header=X(o,e),(n=new Uint8Array(header.length+16*o.length)).set(header),t=header.length,i=0;i<o.length;i++)l=o[i],n[t++]=(4278190080&l.duration)>>>24,n[t++]=(16711680&l.duration)>>>16,n[t++]=(65280&l.duration)>>>8,n[t++]=255&l.duration,n[t++]=(4278190080&l.size)>>>24,n[t++]=(16711680&l.size)>>>16,n[t++]=(65280&l.size)>>>8,n[t++]=255&l.size,n[t++]=l.flags.isLeading<<2|l.flags.dependsOn,n[t++]=l.flags.isDependedOn<<6|l.flags.hasRedundancy<<4|l.flags.paddingValue<<1|l.flags.isNonSyncSample,n[t++]=61440&l.flags.degradationPriority,n[t++]=15&l.flags.degradationPriority,n[t++]=(4278190080&l.compositionTimeOffset)>>>24,n[t++]=(16711680&l.compositionTimeOffset)>>>16,n[t++]=(65280&l.compositionTimeOffset)>>>8,n[t++]=255&l.compositionTimeOffset;return r(L.trun,n)},K=function(track,e){var t,n,header,o,l,i;for(e+=20+8*(o=track.samples||[]).length,header=X(o,e),(t=new Uint8Array(header.length+8*o.length)).set(header),n=header.length,i=0;i<o.length;i++)l=o[i],t[n++]=(4278190080&l.duration)>>>24,t[n++]=(16711680&l.duration)>>>16,t[n++]=(65280&l.duration)>>>8,t[n++]=255&l.duration,t[n++]=(4278190080&l.size)>>>24,t[n++]=(16711680&l.size)>>>16,t[n++]=(65280&l.size)>>>8,t[n++]=255&l.size;return r(L.trun,t)},A=function(track,e){return"audio"===track.type?K(track,e):Q(track,e)};var te,ie,se,ne,re,ae,oe,le,he={ftyp:h=function(){return r(L.ftyp,O,D,O,M)},mdat:function(data){return r(L.mdat,data)},moof:m,moov:f,initSegment:function(e){var t,n=h(),r=f(e);return(t=new Uint8Array(n.byteLength+r.byteLength)).set(n),t.set(r,n.byteLength),t}},de=function(e,t){var n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},ue={groupNalsIntoFrames:function(e){var i,t,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,i=0;i<e.length;i++)"access_unit_delimiter_rbsp"===(t=e[i]).nalUnitType?(n.length&&(n.duration=t.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[t]).byteLength=t.data.byteLength,n.pts=t.pts,n.dts=t.dts):("slice_layer_without_partitioning_rbsp_idr"===t.nalUnitType&&(n.keyFrame=!0),n.duration=t.dts-n.dts,n.byteLength+=t.data.byteLength,n.push(t));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},groupFramesIntoGops:function(e){var i,t,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,i=0;i<e.length;i++)(t=e[i]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[t]).nalCount=t.length,n.byteLength=t.byteLength,n.pts=t.pts,n.dts=t.dts,n.duration=t.duration):(n.duration+=t.duration,n.nalCount+=t.length,n.byteLength+=t.byteLength,n.push(t));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var n,i,r,o,l,h=t||0,d=[];for(n=0;n<e.length;n++)for(o=e[n],i=0;i<o.length;i++)l=o[i],h+=(r=de(l,h)).size,d.push(r);return d},concatenateNalData:function(e){var t,i,n,r,o,l,h=0,d=e.byteLength,c=e.nalCount,data=new Uint8Array(d+4*c),view=new DataView(data.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(o=r[i],n=0;n<o.length;n++)l=o[n],view.setUint32(h,l.data.byteLength),h+=4,data.set(l.data,h),h+=l.data.byteLength;return data},generateSampleTableForFrame:function(e,t){var n,r=[];return n=de(e,t||0),r.push(n),r},concatenateNalDataForFrame:function(e){var i,t,n=0,r=e.byteLength,o=e.length,data=new Uint8Array(r+4*o),view=new DataView(data.buffer);for(i=0;i<e.length;i++)t=e[i],view.setUint32(n,t.data.byteLength),n+=4,data.set(t.data,n),n+=t.data.byteLength;return data}},ce=[33,16,5,32,164,27],pe=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],me=function(e){for(var a=[];e--;)a.push(0);return a},ge=9e4;ae=function(e,t){return ie(re(e,t))},oe=function(e,t){return se(ne(e),t)},le=function(e,t,n){return ne(n?e:e-t)};var fe={ONE_SECOND_IN_TS:ge,secondsToVideoTs:ie=function(e){return e*ge},secondsToAudioTs:se=function(e,t){return e*t},videoTsToSeconds:ne=function(e){return e/ge},audioTsToSeconds:re=function(e,t){return e/t},audioTsToVideoTs:ae,videoTsToAudioTs:oe,metadataTsToSeconds:le},_e=function(){if(!te){var e={96e3:[ce,[227,64],me(154),[56]],88200:[ce,[231],me(170),[56]],64e3:[ce,[248,192],me(240),[56]],48e3:[ce,[255,192],me(268),[55,148,128],me(54),[112]],44100:[ce,[255,192],me(268),[55,163,128],me(84),[112]],32e3:[ce,[255,192],me(268),[55,234],me(226),[112]],24e3:[ce,[255,192],me(268),[55,255,128],me(268),[111,112],me(126),[224]],16e3:[ce,[255,192],me(268),[55,255,128],me(268),[111,255],me(269),[223,108],me(195),[1,192]],12e3:[pe,me(268),[3,127,248],me(268),[6,255,240],me(268),[13,255,224],me(268),[27,253,128],me(259),[56]],11025:[pe,me(268),[3,127,248],me(268),[6,255,240],me(268),[13,255,224],me(268),[27,255,192],me(268),[55,175,128],me(108),[112]],8e3:[pe,me(268),[3,121,16],me(47),[7]]};t=e,te=Object.keys(t).reduce((function(e,n){return e[n]=new Uint8Array(t[n].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return te},ye=fe,ve={prefixWithSilence:function(track,e,t,n){var r,o,l,i,h,d=0,c=0,m=0;if(e.length&&(r=ye.audioTsToVideoTs(track.baseMediaDecodeTime,track.samplerate),o=Math.ceil(ye.ONE_SECOND_IN_TS/(track.samplerate/1024)),t&&n&&(d=r-Math.max(t,n),m=(c=Math.floor(d/o))*o),!(c<1||m>ye.ONE_SECOND_IN_TS/2))){for((l=_e()[track.samplerate])||(l=e[0].data),i=0;i<c;i++)h=e[0],e.splice(0,0,{data:l,dts:h.dts-o,pts:h.pts-o});return track.baseMediaDecodeTime-=Math.floor(ye.videoTsToAudioTs(m,track.samplerate)),m}},trimAdtsFramesByEarliestDts:function(e,track,t){return track.minSegmentDts>=t?e:(track.minSegmentDts=1/0,e.filter((function(e){return e.dts>=t&&(track.minSegmentDts=Math.min(track.minSegmentDts,e.dts),track.minSegmentPts=track.minSegmentDts,!0)})))},generateSampleTable:function(e){var i,t,n=[];for(i=0;i<e.length;i++)t=e[i],n.push({size:t.data.byteLength,duration:1024});return n},concatenateFrameData:function(e){var i,t,n=0,data=new Uint8Array(function(e){var i,t=0;for(i=0;i<e.length;i++)t+=e[i].data.byteLength;return t}(e));for(i=0;i<e.length;i++)t=e[i],data.set(t.data,n),n+=t.data.byteLength;return data}},Te=fe.ONE_SECOND_IN_TS,be={clearDtsInfo:function(track){delete track.minSegmentDts,delete track.maxSegmentDts,delete track.minSegmentPts,delete track.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(track,e){var t,n=track.minSegmentDts;return e||(n-=track.timelineStartInfo.dts),t=track.timelineStartInfo.baseMediaDecodeTime,t+=n,t=Math.max(0,t),"audio"===track.type&&(t*=track.samplerate/Te,t=Math.floor(t)),t},collectDtsInfo:function(track,data){"number"==typeof data.pts&&(void 0===track.timelineStartInfo.pts&&(track.timelineStartInfo.pts=data.pts),void 0===track.minSegmentPts?track.minSegmentPts=data.pts:track.minSegmentPts=Math.min(track.minSegmentPts,data.pts),void 0===track.maxSegmentPts?track.maxSegmentPts=data.pts:track.maxSegmentPts=Math.max(track.maxSegmentPts,data.pts)),"number"==typeof data.dts&&(void 0===track.timelineStartInfo.dts&&(track.timelineStartInfo.dts=data.dts),void 0===track.minSegmentDts?track.minSegmentDts=data.dts:track.minSegmentDts=Math.min(track.minSegmentDts,data.dts),void 0===track.maxSegmentDts?track.maxSegmentDts=data.dts:track.maxSegmentDts=Math.max(track.maxSegmentDts,data.dts))}},Se={parseSei:function(e){for(var i=0,t={payloadType:-1,payloadSize:0},n=0,r=0;i<e.byteLength&&128!==e[i];){for(;255===e[i];)n+=255,i++;for(n+=e[i++];255===e[i];)r+=255,i++;if(r+=e[i++],!t.payload&&4===n){if("GA94"===String.fromCharCode(e[i+3],e[i+4],e[i+5],e[i+6])){t.payloadType=n,t.payloadSize=r,t.payload=e.subarray(i,i+r);break}t.payload=void 0}i+=r,n=0,r=0}return t},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var i,n,r,data,o=[];if(!(64&t[0]))return o;for(n=31&t[0],i=0;i<n;i++)data={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(data.ccData=t[r+3]<<8|t[r+4],o.push(data));return o},discardEmulationPreventionBytes:function(data){for(var e,t,n=data.byteLength,r=[],i=1;i<n-2;)0===data[i]&&0===data[i+1]&&3===data[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return data;e=n-r.length,t=new Uint8Array(e);var o=0;for(i=0;i<e;o++,i++)o===r[0]&&(o++,r.shift()),t[i]=data[o];return t},USER_DATA_REGISTERED_ITU_T_T35:4},ke=Y,Ce=Se,Ee=function(e){e=e||{},Ee.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Ue(0,0),new Ue(0,1),new Ue(1,0),new Ue(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ae({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Ee.prototype=new ke,Ee.prototype.push=function(e){var t,n,r;if("sei_rbsp"===e.nalUnitType&&(t=Ce.parseSei(e.escapedRBSP)).payload&&t.payloadType===Ce.USER_DATA_REGISTERED_ITU_T_T35&&(n=Ce.parseUserData(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));r=Ce.parseCaptionPackets(e.pts,n),this.captionPackets_=this.captionPackets_.concat(r),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ee.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Ee.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(a,b){return a.pts===b.pts?a.presortIndex-b.presortIndex:a.pts-b.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Ee.prototype.flush=function(){return this.flushStream("flush")},Ee.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ee.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Ee.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Ee.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ee.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ee.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Ee.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var we={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},xe=function(b){return 32<=b&&b<=127||160<=b&&b<=255},Ie=function(e){this.windowNum=e,this.reset()};Ie.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Ie.prototype.getText=function(){return this.rows.join("\n")},Ie.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ie.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Ie.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Ie.prototype.addText=function(text){this.rows[this.rowIdx]+=text},Ie.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Pe=function(e,t,n){this.serviceNum=e,this.text="",this.currentWindow=new Ie(-1),this.windows=[],this.stream=n,"string"==typeof t&&this.createTextDecoder(t)};Pe.prototype.init=function(e,t){this.startPts=e;for(var n=0;n<8;n++)this.windows[n]=new Ie(n),"function"==typeof t&&(this.windows[n].beforeRowOverflow=t)},Pe.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Pe.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ae=function(e){e=e||{},Ae.prototype.init.call(this);var t,n=this,r=e.captionServices||{},o={};Object.keys(r).forEach((e=>{t=r[e],/^SERVICE/.test(e)&&(o[e]=t.encoding)})),this.serviceEncodings=o,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Ae.prototype=new ke,Ae.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ae.prototype.add708Bytes=function(e){var data=e.ccData,t=data>>>8,n=255&data;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t),this.current708Packet.data.push(n)},Ae.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,n=null,r=null,i=0,b=t[i++];for(e.seq=b>>6,e.sizeCode=63&b;i<t.length;i++)r=31&(b=t[i++]),7===(n=b>>5)&&r>0&&(n=b=t[i++]),this.pushServiceBlock(n,i,r),r>0&&(i+=r-1)},Ae.prototype.pushServiceBlock=function(e,t,n){var b,i=t,r=this.current708Packet.data,o=this.services[e];for(o||(o=this.initService(e,i));i<t+n&&i<r.length;i++)b=r[i],xe(b)?i=this.handleText(i,o):24===b?i=this.multiByteCharacter(i,o):16===b?i=this.extendedCommands(i,o):128<=b&&b<=135?i=this.setCurrentWindow(i,o):152<=b&&b<=159?i=this.defineWindow(i,o):136===b?i=this.clearWindows(i,o):140===b?i=this.deleteWindows(i,o):137===b?i=this.displayWindows(i,o):138===b?i=this.hideWindows(i,o):139===b?i=this.toggleWindows(i,o):151===b?i=this.setWindowAttributes(i,o):144===b?i=this.setPenAttributes(i,o):145===b?i=this.setPenColor(i,o):146===b?i=this.setPenLocation(i,o):143===b?o=this.reset(i,o):8===b?o.currentWindow.backspace():12===b?o.currentWindow.clearText():13===b?o.currentWindow.pendingNewLine=!0:14===b?o.currentWindow.clearText():141===b&&i++},Ae.prototype.extendedCommands=function(i,e){var b=this.current708Packet.data[++i];return xe(b)&&(i=this.handleText(i,e,{isExtended:!0})),i},Ae.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ae.prototype.initService=function(e,i){var t,n,r=this;return(t="SERVICE"+e)in this.serviceEncodings&&(n=this.serviceEncodings[t]),this.services[e]=new Pe(e,n,r),this.services[e].init(this.getPts(i),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},Ae.prototype.handleText=function(i,e,t){var n,r,code,o,l=t&&t.isExtended,h=t&&t.isMultiByte,d=this.current708Packet.data,c=l?4096:0,m=d[i],f=d[i+1],_=e.currentWindow;return e.textDecoder_&&!l?(h?(r=[m,f],i++):r=[m],n=e.textDecoder_.decode(new Uint8Array(r))):(o=we[code=c|m]||code,n=4096&code&&code===o?"":String.fromCharCode(o)),_.pendingNewLine&&!_.isEmpty()&&_.newLine(this.getPts(i)),_.pendingNewLine=!1,_.addText(n),i},Ae.prototype.multiByteCharacter=function(i,e){var t=this.current708Packet.data,n=t[i+1],r=t[i+2];return xe(n)&&xe(r)&&(i=this.handleText(++i,e,{isMultiByte:!0})),i},Ae.prototype.setCurrentWindow=function(i,e){var t=7&this.current708Packet.data[i];return e.setCurrentWindow(t),i},Ae.prototype.defineWindow=function(i,e){var t=this.current708Packet.data,b=t[i],n=7&b;e.setCurrentWindow(n);var r=e.currentWindow;return b=t[++i],r.visible=(32&b)>>5,r.rowLock=(16&b)>>4,r.columnLock=(8&b)>>3,r.priority=7&b,b=t[++i],r.relativePositioning=(128&b)>>7,r.anchorVertical=127&b,b=t[++i],r.anchorHorizontal=b,b=t[++i],r.anchorPoint=(240&b)>>4,r.rowCount=15&b,b=t[++i],r.columnCount=63&b,b=t[++i],r.windowStyle=(56&b)>>3,r.penStyle=7&b,r.virtualRowCount=r.rowCount+1,i},Ae.prototype.setWindowAttributes=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.winAttr;return b=t[++i],n.fillOpacity=(192&b)>>6,n.fillRed=(48&b)>>4,n.fillGreen=(12&b)>>2,n.fillBlue=3&b,b=t[++i],n.borderType=(192&b)>>6,n.borderRed=(48&b)>>4,n.borderGreen=(12&b)>>2,n.borderBlue=3&b,b=t[++i],n.borderType+=(128&b)>>5,n.wordWrap=(64&b)>>6,n.printDirection=(48&b)>>4,n.scrollDirection=(12&b)>>2,n.justify=3&b,b=t[++i],n.effectSpeed=(240&b)>>4,n.effectDirection=(12&b)>>2,n.displayEffect=3&b,i},Ae.prototype.flushDisplayed=function(e,t){for(var n=[],r=0;r<8;r++)t.windows[r].visible&&!t.windows[r].isEmpty()&&n.push(t.windows[r].getText());t.endPts=e,t.text=n.join("\n\n"),this.pushCaption(t),t.startPts=e},Ae.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ae.prototype.displayWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<<n&&(e.windows[n].visible=1);return i},Ae.prototype.hideWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<<n&&(e.windows[n].visible=0);return i},Ae.prototype.toggleWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<<n&&(e.windows[n].visible^=1);return i},Ae.prototype.clearWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<<n&&e.windows[n].clearText();return i},Ae.prototype.deleteWindows=function(i,e){var b=this.current708Packet.data[++i],t=this.getPts(i);this.flushDisplayed(t,e);for(var n=0;n<8;n++)b&1<<n&&e.windows[n].reset();return i},Ae.prototype.setPenAttributes=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.penAttr;return b=t[++i],n.textTag=(240&b)>>4,n.offset=(12&b)>>2,n.penSize=3&b,b=t[++i],n.italics=(128&b)>>7,n.underline=(64&b)>>6,n.edgeType=(56&b)>>3,n.fontStyle=7&b,i},Ae.prototype.setPenColor=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.penColor;return b=t[++i],n.fgOpacity=(192&b)>>6,n.fgRed=(48&b)>>4,n.fgGreen=(12&b)>>2,n.fgBlue=3&b,b=t[++i],n.bgOpacity=(192&b)>>6,n.bgRed=(48&b)>>4,n.bgGreen=(12&b)>>2,n.bgBlue=3&b,b=t[++i],n.edgeRed=(48&b)>>4,n.edgeGreen=(12&b)>>2,n.edgeBlue=3&b,i},Ae.prototype.setPenLocation=function(i,e){var t=this.current708Packet.data,b=t[i],n=e.currentWindow.penLoc;return e.currentWindow.pendingNewLine=!0,b=t[++i],n.row=15&b,b=t[++i],n.column=63&b,i},Ae.prototype.reset=function(i,e){var t=this.getPts(i);return this.flushDisplayed(t,e),this.initService(e.serviceNum,i)};var Le={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},Oe=function(code){return null===code?"":(code=Le[code]||code,String.fromCharCode(code))},De=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Me=function(){for(var e=[],i=15;i--;)e.push("");return e},Ue=function(e,t){Ue.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var data,t,n,r,text;if((data=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&data)?this.lastControlCode_=data:data!==this.PADDING_&&(this.lastControlCode_=null),n=data>>>8,r=255&data,data!==this.PADDING_)if(data===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(data===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),t=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=t,this.startPts_=e.pts;else if(data===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(data===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(data===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(data===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(data===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(data===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Me();else if(data===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Me();else if(data===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Me()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))text=Oe((n=(3&n)<<8)|r),this[this.mode_](e.pts,text),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),text=Oe((n=(3&n)<<8)|r),this[this.mode_](e.pts,text),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var o=De.indexOf(7968&data);"rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(e.pts,o)),o!==this.row_&&(this.clearFormatting(e.pts),this.row_=o),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&data)&&(this.column_=4*((14&data)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),text=Oe(n),text+=Oe(r),this[this.mode_](e.pts,text),this.column_+=text.length)}else this.lastControlCode_=null}};Ue.prototype=new ke,Ue.prototype.flushDisplayed=function(e){var content=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");content.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:content,stream:this.name_})},Ue.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Me(),this.nonDisplayed_=Me(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ue.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ue.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ue.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ue.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ue.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ue.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Ue.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ue.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ue.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Me(),this.displayed_=Me()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Ue.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var text=t.reduce((function(text,e){return text+"<"+e+">"}),"");this[this.mode_](e,text)},Ue.prototype.clearFormatting=function(e){if(this.formatting_.length){var text=this.formatting_.reverse().reduce((function(text,e){return text+"</"+e+">"}),"");this.formatting_=[],this[this.mode_](e,text)}},Ue.prototype.popOn=function(e,text){var t=this.nonDisplayed_[this.row_];t+=text,this.nonDisplayed_[this.row_]=t},Ue.prototype.rollUp=function(e,text){var t=this.displayed_[this.row_];t+=text,this.displayed_[this.row_]=t},Ue.prototype.shiftRowsUp_=function(){var i;for(i=0;i<this.topRow_;i++)this.displayed_[i]="";for(i=this.row_+1;i<15;i++)this.displayed_[i]="";for(i=this.topRow_;i<this.row_;i++)this.displayed_[i]=this.displayed_[i+1];this.displayed_[this.row_]=""},Ue.prototype.paintOn=function(e,text){var t=this.displayed_[this.row_];t+=text,this.displayed_[this.row_]=t};var Re={CaptionStream:Ee,Cea608Stream:Ue,Cea708Stream:Ae},Ne={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Be=Y,Fe="shared",je=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},$e=function(e){var t,n;$e.prototype.init.call(this),this.type_=e||Fe,this.push=function(data){this.type_!==Fe&&data.type!==this.type_||(void 0===n&&(n=data.dts),data.dts=je(data.dts,n),data.pts=je(data.pts,n),t=data.dts,this.trigger("data",data))},this.flush=function(){n=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};$e.prototype=new Be;var He,qe={TimestampRolloverStream:$e,handleRollover:je},Ve=Ne,We=(e,element,t)=>{if(!e)return-1;for(var n=t;n<e.length;n++)if(e[n]===element)return n;return-1},ze=3,Ge=function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r},Ke=function(e,t,n){return decodeURIComponent(Ge(e,t,n))},Qe=function(e,t,n){return unescape(Ge(e,t,n))},Xe=function(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},Ye={APIC:function(e){var t,n,i=1;e.data[0]===ze&&((t=We(e.data,0,i))<0||(e.mimeType=Qe(e.data,i,t),i=t+1,e.pictureType=e.data[i],i++,(n=We(e.data,0,i))<0||(e.description=Ke(e.data,i,n),i=n+1,"--\x3e"===e.mimeType?e.url=Qe(e.data,i,e.data.length):e.pictureData=e.data.subarray(i,e.data.length))))},"T*":function(e){e.data[0]===ze&&(e.value=Ke(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===ze&&-1!==(t=We(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.value=Ke(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=Qe(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===ze&&-1!==(t=We(e.data,0,1))&&(e.description=Ke(e.data,1,t),e.url=Qe(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var i;for(i=0;i<e.data.length;i++)if(0===e.data[i]){e.owner=Qe(e.data,0,i);break}e.privateData=e.data.subarray(i+1),e.data=e.privateData}};(He=function(e){var i,t={descriptor:e&&e.descriptor},n=0,r=[],o=0;if(He.prototype.init.call(this),this.dispatchType=Ve.METADATA_STREAM_TYPE.toString(16),t.descriptor)for(i=0;i<t.descriptor.length;i++)this.dispatchType+=("00"+t.descriptor[i].toString(16)).slice(-2);this.push=function(e){var t,l,h,d,i;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(o=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),o+=e.data.byteLength,1===r.length&&(n=Xe(e.data.subarray(6,10)),n+=10),!(o<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},i=0;i<n;)t.data.set(r[0].data.subarray(0,n-i),i),i+=r[0].data.byteLength,o-=r[0].data.byteLength,r.shift();l=10,64&t.data[5]&&(l+=4,l+=Xe(t.data.subarray(10,14)),n-=Xe(t.data.subarray(16,20)));do{if((h=Xe(t.data.subarray(l+4,l+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if((d={id:String.fromCharCode(t.data[l],t.data[l+1],t.data[l+2],t.data[l+3]),data:t.data.subarray(l+10,l+h+10)}).key=d.id,Ye[d.id]?Ye[d.id](d):"T"===d.id[0]?Ye["T*"](d):"W"===d.id[0]&&Ye["W*"](d),"com.apple.streaming.transportStreamTimestamp"===d.owner){var c=d.data,m=(1&c[3])<<30|c[4]<<22|c[5]<<14|c[6]<<6|c[7]>>>2;m*=4,m+=3&c[7],d.timeStamp=m,void 0===t.pts&&void 0===t.dts&&(t.pts=d.timeStamp,t.dts=d.timeStamp),this.trigger("timestamp",d)}t.frames.push(d),l+=10,l+=h}while(l<n);this.trigger("data",t)}}}).prototype=new Y;var Je,Ze,et,tt=He,it=Y,st=Re,nt=Ne,at=qe.TimestampRolloverStream,ot=188;(Je=function(){var e=new Uint8Array(ot),t=0;Je.prototype.init.call(this),this.push=function(n){var r,o=0,l=ot;for(t?((r=new Uint8Array(n.byteLength+t)).set(e.subarray(0,t)),r.set(n,t),t=0):r=n;l<r.byteLength;)71!==r[o]||71!==r[l]?(o++,l++):(this.trigger("data",r.subarray(o,l)),o+=ot,l+=ot);o<r.byteLength&&(e.set(r.subarray(o),0),t=r.byteLength-o)},this.flush=function(){t===ot&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new it,(Ze=function(){var e,t,n,r;Ze.prototype.init.call(this),r=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,r){var o=0;r.payloadUnitStartIndicator&&(o+=e[o]+1),"pat"===r.type?t(e.subarray(o),r):n(e.subarray(o),r)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],r.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=r.pmtPid},n=function(e,t){var n,o;if(1&e[5]){for(r.programMapTable={video:null,audio:null,"timed-metadata":{}},n=3+((15&e[1])<<8|e[2])-4,o=12+((15&e[10])<<8|e[11]);o<n;){var l=e[o],h=(31&e[o+1])<<8|e[o+2];l===nt.H264_STREAM_TYPE&&null===r.programMapTable.video?r.programMapTable.video=h:l===nt.ADTS_STREAM_TYPE&&null===r.programMapTable.audio?r.programMapTable.audio=h:l===nt.METADATA_STREAM_TYPE&&(r.programMapTable["timed-metadata"][h]=l),o+=5+((15&e[o+3])<<8|e[o+4])}t.programMapTable=r.programMapTable}},this.push=function(t){var n={},r=4;if(n.payloadUnitStartIndicator=!!(64&t[1]),n.pid=31&t[1],n.pid<<=8,n.pid|=t[2],(48&t[3])>>>4>1&&(r+=t[r]+1),0===n.pid)n.type="pat",e(t.subarray(r),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(r),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,r,n]):this.processPes_(t,r,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=nt.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=nt.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}}).prototype=new it,Ze.STREAM_TYPES={h264:27,adts:15},(et=function(){var e,t=this,n=!1,video={data:[],size:0},audio={data:[],size:0},r={data:[],size:0},o=function(e,n,r){var o,l,h=new Uint8Array(e.size),d={type:n},i=0,c=0;if(e.data.length&&!(e.size<9)){for(d.trackId=e.data[0].pid,i=0;i<e.data.length;i++)l=e.data[i],h.set(l.data,c),c+=l.data.byteLength;!function(e,t){var n;const r=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1===r&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(n=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&n&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1)),t.data=e.subarray(9+e[8]))}(h,d),o="video"===n||d.packetLength<=e.size,(r||o)&&(e.size=0,e.data.length=0),o&&t.trigger("data",d)}};et.prototype.init.call(this),this.push=function(data){({pat:function(){},pes:function(){var e,t;switch(data.streamType){case nt.H264_STREAM_TYPE:e=video,t="video";break;case nt.ADTS_STREAM_TYPE:e=audio,t="audio";break;case nt.METADATA_STREAM_TYPE:e=r,t="timed-metadata";break;default:return}data.payloadUnitStartIndicator&&o(e,t,!0),e.data.push(data),e.size+=data.data.byteLength},pmt:function(){var r={type:"metadata",tracks:[]};null!==(e=data.programMapTable).video&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),n=!0,t.trigger("data",r)}})[data.type]()},this.reset=function(){video.size=0,video.data.length=0,audio.size=0,audio.data.length=0,this.trigger("reset")},this.flushStreams_=function(){o(video,"video"),o(audio,"audio"),o(r,"timed-metadata")},this.flush=function(){if(!n&&e){var r={type:"metadata",tracks:[]};null!==e.video&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&r.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",r)}n=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new it;var lt={PAT_PID:0,MP2T_PACKET_LENGTH:ot,TransportPacketStream:Je,TransportParseStream:Ze,ElementaryStream:et,TimestampRolloverStream:at,CaptionStream:st.CaptionStream,Cea608Stream:st.Cea608Stream,Cea708Stream:st.Cea708Stream,MetadataStream:tt};for(var ht in nt)nt.hasOwnProperty(ht)&&(lt[ht]=nt[ht]);var ut,ct=lt,pt=fe.ONE_SECOND_IN_TS,mt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(ut=function(e){var t,n=0;ut.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${n} outside syncword`})},this.push=function(r){var o,l,h,d,c,i=0;if(e||(n=0),"audio"===r.type){var m;for(t&&t.length?(h=t,(t=new Uint8Array(h.byteLength+r.data.byteLength)).set(h),t.set(r.data,h.byteLength)):t=r.data;i+7<t.length;)if(255===t[i]&&240==(246&t[i+1])){if("number"==typeof m&&(this.skipWarn_(m,i),m=null),l=2*(1&~t[i+1]),o=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5,c=(d=1024*(1+(3&t[i+6])))*pt/mt[(60&t[i+2])>>>2],t.byteLength-i<o)break;this.trigger("data",{pts:r.pts+n*c,dts:r.dts+n*c,sampleCount:d,audioobjecttype:1+(t[i+2]>>>6&3),channelcount:(1&t[i+2])<<2|(192&t[i+3])>>>6,samplerate:mt[(60&t[i+2])>>>2],samplingfrequencyindex:(60&t[i+2])>>>2,samplesize:16,data:t.subarray(i+7+l,i+o)}),n++,i+=o}else"number"!=typeof m&&(m=i),i++;"number"==typeof m&&(this.skipWarn_(m,i),m=null),t=t.subarray(i)}},this.flush=function(){n=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new Y;var gt,ft,_t,yt=ut,vt=Y,Tt=function(e){var t=e.byteLength,n=0,r=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+r},this.loadWord=function(){var o=e.byteLength-t,l=new Uint8Array(4),h=Math.min(4,t);if(0===h)throw new Error("no bytes available");l.set(e.subarray(o,o+h)),n=new DataView(l.buffer).getUint32(0),r=8*h,t-=h},this.skipBits=function(e){var o;r>e?(n<<=e,r-=e):(e-=r,e-=8*(o=Math.floor(e/8)),t-=o,this.loadWord(),n<<=e,r-=e)},this.readBits=function(e){var o=Math.min(r,e),l=n>>>32-o;return(r-=o)>0?n<<=o:t>0&&this.loadWord(),(o=e-o)>0?l<<o|this.readBits(o):l},this.skipLeadingZeros=function(){var e;for(e=0;e<r;++e)if(0!=(n&2147483648>>>e))return n<<=e,r-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(ft=function(){var i,e,t=0;ft.prototype.init.call(this),this.push=function(data){var n;e?((n=new Uint8Array(e.byteLength+data.data.byteLength)).set(e),n.set(data.data,e.byteLength),e=n):e=data.data;for(var r=e.byteLength;t<r-3;t++)if(1===e[t+2]){i=t+5;break}for(;i<r;)switch(e[i]){case 0:if(0!==e[i-1]){i+=2;break}if(0!==e[i-2]){i++;break}t+3!==i-2&&this.trigger("data",e.subarray(t+3,i-2));do{i++}while(1!==e[i]&&i<r);t=i-2,i+=3;break;case 1:if(0!==e[i-1]||0!==e[i-2]){i+=3;break}this.trigger("data",e.subarray(t+3,i-2)),t=i-2,i+=3;break;default:i+=3}e=e.subarray(t),i-=t,t=0},this.reset=function(){e=null,t=0,this.trigger("reset")},this.flush=function(){e&&e.byteLength>3&&this.trigger("data",e.subarray(t+3)),e=null,t=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new vt,_t={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(gt=function(){var e,t,n,r,o,l,h,d=new ft;gt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,r=e.dts,d.push(e))},d.on("data",(function(data){var h={trackId:t,pts:n,dts:r,data:data,nalUnitTypeCode:31&data[0]};switch(h.nalUnitTypeCode){case 5:h.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:h.nalUnitType="sei_rbsp",h.escapedRBSP=o(data.subarray(1));break;case 7:h.nalUnitType="seq_parameter_set_rbsp",h.escapedRBSP=o(data.subarray(1)),h.config=l(h.escapedRBSP);break;case 8:h.nalUnitType="pic_parameter_set_rbsp";break;case 9:h.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",h)})),d.on("done",(function(){e.trigger("done")})),d.on("partialdone",(function(){e.trigger("partialdone")})),d.on("reset",(function(){e.trigger("reset")})),d.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){d.flush()},this.partialFlush=function(){d.partialFlush()},this.reset=function(){d.reset()},this.endTimeline=function(){d.endTimeline()},h=function(e,t){var n,r=8,o=8;for(n=0;n<e;n++)0!==o&&(o=(r+t.readExpGolomb()+256)%256),r=0===o?r:o},o=function(data){for(var e,t,n=data.byteLength,r=[],i=1;i<n-2;)0===data[i]&&0===data[i+1]&&3===data[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return data;e=n-r.length,t=new Uint8Array(e);var o=0;for(i=0;i<e;o++,i++)o===r[0]&&(o++,r.shift()),t[i]=data[o];return t},l=function(data){var e,t,n,r,o,l,d,c,m,f,_,i,y=0,v=0,T=0,S=0,k=[1,1];if(t=(e=new Tt(data)).readUnsignedByte(),r=e.readUnsignedByte(),n=e.readUnsignedByte(),e.skipUnsignedExpGolomb(),_t[t]&&(3===(o=e.readUnsignedExpGolomb())&&e.skipBits(1),e.skipUnsignedExpGolomb(),e.skipUnsignedExpGolomb(),e.skipBits(1),e.readBoolean()))for(_=3!==o?8:12,i=0;i<_;i++)e.readBoolean()&&h(i<6?16:64,e);if(e.skipUnsignedExpGolomb(),0===(l=e.readUnsignedExpGolomb()))e.readUnsignedExpGolomb();else if(1===l)for(e.skipBits(1),e.skipExpGolomb(),e.skipExpGolomb(),d=e.readUnsignedExpGolomb(),i=0;i<d;i++)e.skipExpGolomb();if(e.skipUnsignedExpGolomb(),e.skipBits(1),c=e.readUnsignedExpGolomb(),m=e.readUnsignedExpGolomb(),0===(f=e.readBits(1))&&e.skipBits(1),e.skipBits(1),e.readBoolean()&&(y=e.readUnsignedExpGolomb(),v=e.readUnsignedExpGolomb(),T=e.readUnsignedExpGolomb(),S=e.readUnsignedExpGolomb()),e.readBoolean()&&e.readBoolean()){switch(e.readUnsignedByte()){case 1:k=[1,1];break;case 2:k=[12,11];break;case 3:k=[10,11];break;case 4:k=[16,11];break;case 5:k=[40,33];break;case 6:k=[24,11];break;case 7:k=[20,11];break;case 8:k=[32,11];break;case 9:k=[80,33];break;case 10:k=[18,11];break;case 11:k=[15,11];break;case 12:k=[64,33];break;case 13:k=[160,99];break;case 14:k=[4,3];break;case 15:k=[3,2];break;case 16:k=[2,1];break;case 255:k=[e.readUnsignedByte()<<8|e.readUnsignedByte(),e.readUnsignedByte()<<8|e.readUnsignedByte()]}k&&(k[0],k[1])}return{profileIdc:t,levelIdc:n,profileCompatibility:r,width:16*(c+1)-2*y-2*v,height:(2-f)*(m+1)*16-2*T-2*S,sarRatio:k}}}).prototype=new vt;var bt,St={H264Stream:gt,NalByteStream:ft},kt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ct=function(header,e){var t=header[e+6]<<21|header[e+7]<<14|header[e+8]<<7|header[e+9];return t=t>=0?t:0,(16&header[e+5])>>4?t+20:t+10},Et=function(data,e){return data.length-e<10||data[e]!=="I".charCodeAt(0)||data[e+1]!=="D".charCodeAt(0)||data[e+2]!=="3".charCodeAt(0)?e:(e+=Ct(data,e),Et(data,e))},wt=function(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},xt={isLikelyAacData:function(data){var e=Et(data,0);return data.length>=e+2&&255==(255&data[e])&&240==(240&data[e+1])&&16==(22&data[e+1])},parseId3TagSize:Ct,parseAdtsSize:function(header,e){var t=(224&header[e+5])>>5,n=header[e+4]<<3;return 6144&header[e+3]|n|t},parseType:function(header,e){return header[e]==="I".charCodeAt(0)&&header[e+1]==="D".charCodeAt(0)&&header[e+2]==="3".charCodeAt(0)?"timed-metadata":!0&header[e]&&240==(240&header[e+1])?"audio":null},parseSampleRate:function(e){for(var i=0;i+5<e.length;){if(255===e[i]&&240==(246&e[i+1]))return kt[(60&e[i+2])>>>2];i++}return null},parseAacTimestamp:function(e){var t,n,r;t=10,64&e[5]&&(t+=4,t+=wt(e.subarray(10,14)));do{if((n=wt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){r=e.subarray(t+10,t+n+10);for(var i=0;i<r.byteLength;i++)if(0===r[i]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r}(r,0,i))){var o=r.subarray(i+1),l=(1&o[3])<<30|o[4]<<22|o[5]<<14|o[6]<<6|o[7]>>>2;return l*=4,l+=3&o[7]}break}}t+=10,t+=n}while(t<e.byteLength);return null}},It=xt;(bt=function(){var e=new Uint8Array,t=0;bt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(n){var r,o,l,h,d=0,c=0;for(e.length?(h=e.length,(e=new Uint8Array(n.byteLength+h)).set(e.subarray(0,h)),e.set(n,h)):e=n;e.length-c>=3;)if(e[c]!=="I".charCodeAt(0)||e[c+1]!=="D".charCodeAt(0)||e[c+2]!=="3".charCodeAt(0))if(255!=(255&e[c])||240!=(240&e[c+1]))c++;else{if(e.length-c<7)break;if(c+(d=It.parseAdtsSize(e,c))>e.length)break;l={type:"audio",data:e.subarray(c,c+d),pts:t,dts:t},this.trigger("data",l),c+=d}else{if(e.length-c<10)break;if(c+(d=It.parseId3TagSize(e,c))>e.length)break;o={type:"timed-metadata",data:e.subarray(c,c+d)},this.trigger("data",o),c+=d}r=e.length-c,e=r>0?e.subarray(c):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new Y;var Pt,At,Lt,Ot,Dt=Y,Mt=he,Ut=ue,Rt=ve,Nt=be,Bt=ct,Ft=fe,jt=yt,$t=St.H264Stream,Ht=bt,qt=xt.isLikelyAacData,Vt=fe.ONE_SECOND_IN_TS,Wt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],zt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Gt=function(e,t){t.stream=e,this.trigger("log",t)},Kt=function(e,t){for(var n=Object.keys(t),i=0;i<n.length;i++){var r=n[i];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Gt.bind(e,r))}},Qt=function(a,b){var i;if(a.length!==b.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==b[i])return!1;return!0},Xt=function(e,t,n,r,o,l){return{start:{dts:e,pts:e+(n-t)},end:{dts:e+(r-t),pts:e+(o-n)},prependedContentDuration:l,baseMediaDecodeTime:e}};(At=function(track,e){var t,n=[],r=0,o=0,l=1/0;t=(e=e||{}).firstSequenceNumber||0,At.prototype.init.call(this),this.push=function(data){Nt.collectDtsInfo(track,data),track&&Wt.forEach((function(e){track[e]=data[e]})),n.push(data)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){l=e},this.setAudioAppendStart=function(e){o=e},this.flush=function(){var h,d,c,m,f,_,y;0!==n.length?(h=Rt.trimAdtsFramesByEarliestDts(n,track,r),track.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(track,e.keepOriginalTimestamps),y=Rt.prefixWithSilence(track,h,o,l),track.samples=Rt.generateSampleTable(h),c=Mt.mdat(Rt.concatenateFrameData(h)),n=[],d=Mt.moof(t,[track]),m=new Uint8Array(d.byteLength+c.byteLength),t++,m.set(d),m.set(c,d.byteLength),Nt.clearDtsInfo(track),f=Math.ceil(1024*Vt/track.samplerate),h.length&&(_=h.length*f,this.trigger("segmentTimingInfo",Xt(Ft.audioTsToVideoTs(track.baseMediaDecodeTime,track.samplerate),h[0].dts,h[0].pts,h[0].dts+_,h[0].pts+_,y||0)),this.trigger("timingInfo",{start:h[0].pts,end:h[0].pts+_})),this.trigger("data",{track:track,boxes:m}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Nt.clearDtsInfo(track),n=[],this.trigger("reset")}}).prototype=new Dt,(Pt=function(track,e){var t,n,r,o=[],l=[];t=(e=e||{}).firstSequenceNumber||0,Pt.prototype.init.call(this),delete track.minPTS,this.gopCache_=[],this.push=function(e){Nt.collectDtsInfo(track,e),"seq_parameter_set_rbsp"!==e.nalUnitType||n||(n=e.config,track.sps=[e.data],zt.forEach((function(e){track[e]=n[e]}),this)),"pic_parameter_set_rbsp"!==e.nalUnitType||r||(r=e.data,track.pps=[e.data]),o.push(e)},this.flush=function(){for(var n,r,h,d,c,m,f,_,y=0;o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0===o.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(n=Ut.groupNalsIntoFrames(o),(h=Ut.groupFramesIntoGops(n))[0][0].keyFrame||((r=this.getGopForFusion_(o[0],track))?(y=r.duration,h.unshift(r),h.byteLength+=r.byteLength,h.nalCount+=r.nalCount,h.pts=r.pts,h.dts=r.dts,h.duration+=r.duration):h=Ut.extendFirstKeyFrame(h)),l.length){var v;if(!(v=e.alignGopsAtEnd?this.alignGopsAtEnd_(h):this.alignGopsAtStart_(h)))return this.gopCache_.unshift({gop:h.pop(),pps:track.pps,sps:track.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Nt.clearDtsInfo(track),h=v}Nt.collectDtsInfo(track,h),track.samples=Ut.generateSampleTable(h),c=Mt.mdat(Ut.concatenateNalData(h)),track.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(track,e.keepOriginalTimestamps),this.trigger("processedGopsInfo",h.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),f=h[0],_=h[h.length-1],this.trigger("segmentTimingInfo",Xt(track.baseMediaDecodeTime,f.dts,f.pts,_.dts+_.duration,_.pts+_.duration,y)),this.trigger("timingInfo",{start:h[0].pts,end:h[h.length-1].pts+h[h.length-1].duration}),this.gopCache_.unshift({gop:h.pop(),pps:track.pps,sps:track.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.trigger("baseMediaDecodeTime",track.baseMediaDecodeTime),this.trigger("timelineStartInfo",track.timelineStartInfo),d=Mt.moof(t,[track]),m=new Uint8Array(d.byteLength+c.byteLength),t++,m.set(d),m.set(c,d.byteLength),this.trigger("data",{track:track,boxes:m}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),o=[],this.gopCache_.length=0,l.length=0,this.trigger("reset")},this.resetStream_=function(){Nt.clearDtsInfo(track),n=void 0,r=void 0},this.getGopForFusion_=function(e){var t,n,r,o,i,l=1/0;for(i=0;i<this.gopCache_.length;i++)r=(o=this.gopCache_[i]).gop,track.pps&&Qt(track.pps[0],o.pps[0])&&track.sps&&Qt(track.sps[0],o.sps[0])&&(r.dts<track.timelineStartInfo.dts||(t=e.dts-r.dts-r.duration)>=-1e4&&t<=45e3&&(!n||l>t)&&(n=o,l=t));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,n,r,o,h,d,c,m;for(h=e.byteLength,d=e.nalCount,c=e.duration,t=n=0;t<l.length&&n<e.length&&(r=l[t],o=e[n],r.pts!==o.pts);)o.pts>r.pts?t++:(n++,h-=o.byteLength,d-=o.nalCount,c-=o.duration);return 0===n?e:n===e.length?null:((m=e.slice(n)).byteLength=h,m.duration=c,m.nalCount=d,m.pts=m[0].pts,m.dts=m[0].dts,m)},this.alignGopsAtEnd_=function(e){var t,n,r,o,h,d,c;for(t=l.length-1,n=e.length-1,h=null,d=!1;t>=0&&n>=0;){if(r=l[t],o=e[n],r.pts===o.pts){d=!0;break}r.pts>o.pts?t--:(t===l.length-1&&(h=n),n--)}if(!d&&null===h)return null;if(0===(c=d?n:h))return e;var m=e.slice(c),f=m.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return m.byteLength=f.byteLength,m.duration=f.duration,m.nalCount=f.nalCount,m.pts=m[0].pts,m.dts=m[0].dts,m},this.alignGopsWith=function(e){l=e}}).prototype=new Dt,(Ot=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ot.prototype.init.call(this),this.push=function(output){return output.text?this.pendingCaptions.push(output):output.frames?this.pendingMetadata.push(output):(this.pendingTracks.push(output.track),this.pendingBytes+=output.boxes.byteLength,"video"===output.track.type&&(this.videoTrack=output.track,this.pendingBoxes.push(output.boxes)),void("audio"===output.track.type&&(this.audioTrack=output.track,this.pendingBoxes.unshift(output.boxes))))}}).prototype=new Dt,Ot.prototype.flush=function(e){var caption,t,n,i,r=0,o={captions:[],captionStreams:{},metadata:[],info:{}},l=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(l=this.videoTrack.timelineStartInfo.pts,zt.forEach((function(e){o.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(l=this.audioTrack.timelineStartInfo.pts,Wt.forEach((function(e){o.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Mt.initSegment(this.pendingTracks),o.initSegment=new Uint8Array(n.byteLength),o.initSegment.set(n),o.data=new Uint8Array(this.pendingBytes),i=0;i<this.pendingBoxes.length;i++)o.data.set(this.pendingBoxes[i],r),r+=this.pendingBoxes[i].byteLength;for(i=0;i<this.pendingCaptions.length;i++)(caption=this.pendingCaptions[i]).startTime=Ft.metadataTsToSeconds(caption.startPts,l,this.keepOriginalTimestamps),caption.endTime=Ft.metadataTsToSeconds(caption.endPts,l,this.keepOriginalTimestamps),o.captionStreams[caption.stream]=!0,o.captions.push(caption);for(i=0;i<this.pendingMetadata.length;i++)(t=this.pendingMetadata[i]).cueTime=Ft.metadataTsToSeconds(t.pts,l,this.keepOriginalTimestamps),o.metadata.push(t);for(o.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",o),i=0;i<o.captions.length;i++)caption=o.captions[i],this.trigger("caption",caption);for(i=0;i<o.metadata.length;i++)t=o.metadata[i],this.trigger("id3Frame",t)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ot.prototype.setRemux=function(e){this.remuxTracks=e},(Lt=function(e){var t,n,r=this,o=!0;Lt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var o={};this.transmuxPipeline_=o,o.type="aac",o.metadataStream=new Bt.MetadataStream,o.aacStream=new Ht,o.audioTimestampRolloverStream=new Bt.TimestampRolloverStream("audio"),o.timedMetadataTimestampRolloverStream=new Bt.TimestampRolloverStream("timed-metadata"),o.adtsStream=new jt,o.coalesceStream=new Ot(e,o.metadataStream),o.headOfPipeline=o.aacStream,o.aacStream.pipe(o.audioTimestampRolloverStream).pipe(o.adtsStream),o.aacStream.pipe(o.timedMetadataTimestampRolloverStream).pipe(o.metadataStream).pipe(o.coalesceStream),o.metadataStream.on("timestamp",(function(e){o.aacStream.setTimestamp(e.timeStamp)})),o.aacStream.on("data",(function(data){"timed-metadata"!==data.type&&"audio"!==data.type||o.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:r.baseMediaDecodeTime},codec:"adts",type:"audio"},o.coalesceStream.numberOfTracks++,o.audioSegmentStream=new At(n,e),o.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),o.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),o.adtsStream.pipe(o.audioSegmentStream).pipe(o.coalesceStream),r.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t}))})),o.coalesceStream.on("data",this.trigger.bind(this,"data")),o.coalesceStream.on("done",this.trigger.bind(this,"done")),Kt(this,o)},this.setupTsPipeline=function(){var o={};this.transmuxPipeline_=o,o.type="ts",o.metadataStream=new Bt.MetadataStream,o.packetStream=new Bt.TransportPacketStream,o.parseStream=new Bt.TransportParseStream,o.elementaryStream=new Bt.ElementaryStream,o.timestampRolloverStream=new Bt.TimestampRolloverStream,o.adtsStream=new jt,o.h264Stream=new $t,o.captionStream=new Bt.CaptionStream(e),o.coalesceStream=new Ot(e,o.metadataStream),o.headOfPipeline=o.packetStream,o.packetStream.pipe(o.parseStream).pipe(o.elementaryStream).pipe(o.timestampRolloverStream),o.timestampRolloverStream.pipe(o.h264Stream),o.timestampRolloverStream.pipe(o.adtsStream),o.timestampRolloverStream.pipe(o.metadataStream).pipe(o.coalesceStream),o.h264Stream.pipe(o.captionStream).pipe(o.coalesceStream),o.elementaryStream.on("data",(function(data){var i;if("metadata"===data.type){for(i=data.tracks.length;i--;)t||"video"!==data.tracks[i].type?n||"audio"!==data.tracks[i].type||((n=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime):(t=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=r.baseMediaDecodeTime;t&&!o.videoSegmentStream&&(o.coalesceStream.numberOfTracks++,o.videoSegmentStream=new Pt(t,e),o.videoSegmentStream.on("log",r.getLogTrigger_("videoSegmentStream")),o.videoSegmentStream.on("timelineStartInfo",(function(t){n&&!e.keepOriginalTimestamps&&(n.timelineStartInfo=t,o.audioSegmentStream.setEarliestDts(t.dts-r.baseMediaDecodeTime))})),o.videoSegmentStream.on("processedGopsInfo",r.trigger.bind(r,"gopInfo")),o.videoSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"videoSegmentTimingInfo")),o.videoSegmentStream.on("baseMediaDecodeTime",(function(e){n&&o.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),o.videoSegmentStream.on("timingInfo",r.trigger.bind(r,"videoTimingInfo")),o.h264Stream.pipe(o.videoSegmentStream).pipe(o.coalesceStream)),n&&!o.audioSegmentStream&&(o.coalesceStream.numberOfTracks++,o.audioSegmentStream=new At(n,e),o.audioSegmentStream.on("log",r.getLogTrigger_("audioSegmentStream")),o.audioSegmentStream.on("timingInfo",r.trigger.bind(r,"audioTimingInfo")),o.audioSegmentStream.on("segmentTimingInfo",r.trigger.bind(r,"audioSegmentTimingInfo")),o.adtsStream.pipe(o.audioSegmentStream).pipe(o.coalesceStream)),r.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t})}})),o.coalesceStream.on("data",this.trigger.bind(this,"data")),o.coalesceStream.on("id3Frame",(function(e){e.dispatchType=o.metadataStream.dispatchType,r.trigger("id3Frame",e)})),o.coalesceStream.on("caption",this.trigger.bind(this,"caption")),o.coalesceStream.on("done",this.trigger.bind(this,"done")),Kt(this,o)},this.setBaseMediaDecodeTime=function(r){var o=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=r),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(n),o.audioTimestampRolloverStream&&o.audioTimestampRolloverStream.discontinuity()),t&&(o.videoSegmentStream&&(o.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(t),o.captionStream.reset()),o.timestampRolloverStream&&o.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var n=this.transmuxPipeline_;e.remux=t,n&&n.coalesceStream&&n.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(n){n.stream=e,t.trigger("log",n)}},this.push=function(data){if(o){var e=qt(data);e&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():e||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),o=!1}this.transmuxPipeline_.headOfPipeline.push(data)},this.flush=function(){o=!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()}}).prototype=new Dt;var Yt,Jt,Zt,ei,ti={Transmuxer:Lt,VideoSegmentStream:Pt,AudioSegmentStream:At,AUDIO_PROPERTIES:Wt,VIDEO_PROPERTIES:zt,generateSegmentTimingInfo:Xt},ii=function(e){return e>>>0},si=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},ni=ii,ri=si,ai=function(data,path){var i,e,t,n,r,o=[];if(!path.length)return null;for(i=0;i<data.byteLength;)e=ni(data[i]<<24|data[i+1]<<16|data[i+2]<<8|data[i+3]),t=ri(data.subarray(i+4,i+8)),n=e>1?i+e:data.byteLength,t===path[0]&&(1===path.length?o.push(data.subarray(i+8,n)):(r=ai(data.subarray(i+8,n),path.slice(1))).length&&(o=o.concat(r))),i=n;return o},oi=ii,hi=Z.getUint64,di=function(data){var e={version:data[0],flags:new Uint8Array(data.subarray(1,4))};return 1===e.version?e.baseMediaDecodeTime=hi(data.subarray(4)):e.baseMediaDecodeTime=oi(data[4]<<24|data[5]<<16|data[6]<<8|data[7]),e},ui=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},ci=function(data){var e,t={version:data[0],flags:new Uint8Array(data.subarray(1,4)),samples:[]},view=new DataView(data.buffer,data.byteOffset,data.byteLength),n=1&t.flags[2],r=4&t.flags[2],o=1&t.flags[1],l=2&t.flags[1],h=4&t.flags[1],d=8&t.flags[1],c=view.getUint32(4),m=8;for(n&&(t.dataOffset=view.getInt32(m),m+=4),r&&c&&(e={flags:ui(data.subarray(m,m+4))},m+=4,o&&(e.duration=view.getUint32(m),m+=4),l&&(e.size=view.getUint32(m),m+=4),d&&(1===t.version?e.compositionTimeOffset=view.getInt32(m):e.compositionTimeOffset=view.getUint32(m),m+=4),t.samples.push(e),c--);c--;)e={},o&&(e.duration=view.getUint32(m),m+=4),l&&(e.size=view.getUint32(m),m+=4),h&&(e.flags=ui(data.subarray(m,m+4)),m+=4),d&&(1===t.version?e.compositionTimeOffset=view.getInt32(m):e.compositionTimeOffset=view.getUint32(m),m+=4),t.samples.push(e);return t},pi=function(data){var i,view=new DataView(data.buffer,data.byteOffset,data.byteLength),e={version:data[0],flags:new Uint8Array(data.subarray(1,4)),trackId:view.getUint32(4)},t=1&e.flags[2],n=2&e.flags[2],r=8&e.flags[2],o=16&e.flags[2],l=32&e.flags[2],h=65536&e.flags[0],d=131072&e.flags[0];return i=8,t&&(i+=4,e.baseDataOffset=view.getUint32(12),i+=4),n&&(e.sampleDescriptionIndex=view.getUint32(i),i+=4),r&&(e.defaultSampleDuration=view.getUint32(i),i+=4),o&&(e.defaultSampleSize=view.getUint32(i),i+=4),l&&(e.defaultSampleFlags=view.getUint32(i)),h&&(e.durationIsEmpty=!0),!t&&d&&(e.baseDataOffsetIsMoof=!0),e},mi=(Yt="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},Se.discardEmulationPreventionBytes),gi=Re.CaptionStream,fi=ai,_i=di,yi=ci,vi=pi,Ti=Yt,bi=function(e,t){for(var n=e,i=0;i<t.length;i++){var r=t[i];if(n<r.size)return r;n-=r.size}return null},Si=function(e,t){var n=fi(e,["moof","traf"]),r=fi(e,["mdat"]),o={},l=[];return r.forEach((function(e,t){var r=n[t];l.push({mdat:e,traf:r})})),l.forEach((function(e){var n,r=e.mdat,l=e.traf,h=fi(l,["tfhd"]),d=vi(h[0]),c=d.trackId,m=fi(l,["tfdt"]),f=m.length>0?_i(m[0]).baseMediaDecodeTime:0,_=fi(l,["trun"]);t===c&&_.length>0&&(n=function(e,t,n){var r,i,o,l,h=new DataView(e.buffer,e.byteOffset,e.byteLength),d={logs:[],seiNals:[]};for(i=0;i+4<e.length;i+=o)if(o=h.getUint32(i),i+=4,!(o<=0))switch(31&e[i]){case 6:var data=e.subarray(i+1,i+1+o),c=bi(i,t);if(r={nalUnitType:"sei_rbsp",size:o,data:data,escapedRBSP:mi(data),trackId:n},c)r.pts=c.pts,r.dts=c.dts,l=c;else{if(!l){d.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+i+" for trackId "+n+". See mux.js#223."});break}r.pts=l.pts,r.dts=l.dts}d.seiNals.push(r)}return d}(r,function(e,t,n){var r=t,o=n.defaultSampleDuration||0,l=n.defaultSampleSize||0,h=n.trackId,d=[];return e.forEach((function(e){var t=yi(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=o),void 0===e.size&&(e.size=l),e.trackId=h,e.dts=r,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof r?(e.pts=r+Ti.BigInt(e.compositionTimeOffset),r+=Ti.BigInt(e.duration)):(e.pts=r+e.compositionTimeOffset,r+=e.duration)})),d=d.concat(t)})),d}(_,f,d),c),o[c]||(o[c]={seiNals:[],logs:[]}),o[c].seiNals=o[c].seiNals.concat(n.seiNals),o[c].logs=o[c].logs.concat(n.logs))})),o},ki=function(){var e,t,n,r,o,l,h=!1;this.isInitialized=function(){return h},this.init=function(t){e=new gi,h=!0,l=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/r,e.endTime=e.endPts/r,o.captions.push(e),o.captionStreams[e.stream]=!0})),e.on("log",(function(e){o.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(n!==e[0]||r!==t[n])},this.parse=function(e,l,h){var d;if(!this.isInitialized())return null;if(!l||!h)return null;if(this.isNewInit(l,h))n=l[0],r=h[n];else if(null===n||!r)return t.push(e),null;for(;t.length>0;){var c=t.shift();this.parse(c,l,h)}return(d=function(e,t,n){if(null===t)return null;var r=Si(e,t)[t]||{};return{seiNals:r.seiNals,logs:r.logs,timescale:n}}(e,n,r))&&d.logs&&(o.logs=o.logs.concat(d.logs)),null!==d&&d.seiNals?(this.pushNals(d.seiNals),this.flushStream(),o):o.logs.length?{logs:o.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;l?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){o.captions=[],o.captionStreams={},o.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=null,r=null,o?this.clearParsedCaptions():o={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ci=ii,Ei=function(e){return("00"+e.toString(16)).slice(-2)},wi=ai,xi=si,Ii=pi,Pi=ci,Ai=di,Li=Z.getUint64,Oi=Yt;Jt=function(e,t){var n=wi(t,["moof","traf"]).reduce((function(t,n){var r,o=wi(n,["tfhd"])[0],l=Ci(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),h=e[l]||9e4,d=wi(n,["tfdt"])[0],c=new DataView(d.buffer,d.byteOffset,d.byteLength);let m;return"bigint"==typeof(r=1===d[0]?Li(d.subarray(4,12)):c.getUint32(4))?m=r/Oi.BigInt(h):"number"!=typeof r||isNaN(r)||(m=r/h),m<Number.MAX_SAFE_INTEGER&&(m=Number(m)),m<t&&(t=m),t}),1/0);return"bigint"==typeof n||isFinite(n)?n:0},Zt=function(e){var t=wi(e,["moov","trak"]),n=[];return t.forEach((function(e){var view,t,track={},r=wi(e,["tkhd"])[0];r&&(t=(view=new DataView(r.buffer,r.byteOffset,r.byteLength)).getUint8(0),track.id=0===t?view.getUint32(12):view.getUint32(20));var o=wi(e,["mdia","hdlr"])[0];if(o){var l=xi(o.subarray(8,12));track.type="vide"===l?"video":"soun"===l?"audio":l}var h=wi(e,["mdia","minf","stbl","stsd"])[0];if(h){var d=h.subarray(8);track.codec=xi(d.subarray(4,8));var c,m=wi(d,[track.codec])[0];m&&(/^[asm]vc[1-9]$/i.test(track.codec)?(c=m.subarray(78),"avcC"===xi(c.subarray(4,8))&&c.length>11?(track.codec+=".",track.codec+=Ei(c[9]),track.codec+=Ei(c[10]),track.codec+=Ei(c[11])):track.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(track.codec)?(c=m.subarray(28),"esds"===xi(c.subarray(4,8))&&c.length>20&&0!==c[19]?(track.codec+="."+Ei(c[19]),track.codec+="."+Ei(c[20]>>>2&63).replace(/^0/,"")):track.codec="mp4a.40.2"):track.codec=track.codec.toLowerCase())}var f=wi(e,["mdia","mdhd"])[0];f&&(track.timescale=ei(f)),n.push(track)})),n};var Di=Jt,Mi=Zt,Ui=(ei=function(e){var t=0===e[0]?12:20;return Ci(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},Ne),Ri=function(e){var t=31&e[1];return t<<=8,t|=e[2]},Ni=function(e){return!!(64&e[1])},Bi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},Fi=function(e){switch(e){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}},ji={parseType:function(e,t){var n=Ri(e);return 0===n?"pat":n===t?"pmt":t?"pes":null},parsePat:function(e){var t=Ni(e),n=4+Bi(e);return t&&(n+=e[n]+1),(31&e[n+10])<<8|e[n+11]},parsePmt:function(e){var t={},n=Ni(e),r=4+Bi(e);if(n&&(r+=e[r]+1),1&e[r+5]){var o;o=3+((15&e[r+1])<<8|e[r+2])-4;for(var l=12+((15&e[r+10])<<8|e[r+11]);l<o;){var i=r+l;t[(31&e[i+1])<<8|e[i+2]]=e[i],l+=5+((15&e[i+3])<<8|e[i+4])}return t}},parsePayloadUnitStartIndicator:Ni,parsePesType:function(e,t){switch(t[Ri(e)]){case Ui.H264_STREAM_TYPE:return"video";case Ui.ADTS_STREAM_TYPE:return"audio";case Ui.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!Ni(e))return null;var t=4+Bi(e);if(t>=e.byteLength)return null;var n,r=null;return 192&(n=e[t+7])&&((r={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,r.pts*=4,r.pts+=(6&e[t+13])>>>1,r.dts=r.pts,64&n&&(r.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,r.dts*=4,r.dts+=(6&e[t+18])>>>1)),r},videoPacketContainsKeyFrame:function(e){for(var t=4+Bi(e),n=e.subarray(t),r=0,o=0,l=!1;o<n.byteLength-3;o++)if(1===n[o+2]){r=o+5;break}for(;r<n.byteLength;)switch(n[r]){case 0:if(0!==n[r-1]){r+=2;break}if(0!==n[r-2]){r++;break}o+3!==r-2&&"slice_layer_without_partitioning_rbsp_idr"===Fi(31&n[o+3])&&(l=!0);do{r++}while(1!==n[r]&&r<n.length);o=r-2,r+=3;break;case 1:if(0!==n[r-1]||0!==n[r-2]){r+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Fi(31&n[o+3])&&(l=!0),o=r-2,r+=3;break;default:r+=3}return n=n.subarray(o),r-=o,o=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===Fi(31&n[o+3])&&(l=!0),l}},$i=Ne,Hi=qe.handleRollover,qi={};qi.ts=ji,qi.aac=xt;var Vi=fe.ONE_SECOND_IN_TS,Wi=188,zi=71,Gi=function(e,t,n){for(var r,o,l,h,d=0,c=Wi,m=!1;c<=e.byteLength;)if(e[d]!==zi||e[c]!==zi&&c!==e.byteLength)d++,c++;else{switch(r=e.subarray(d,c),qi.ts.parseType(r,t.pid)){case"pes":o=qi.ts.parsePesType(r,t.table),l=qi.ts.parsePayloadUnitStartIndicator(r),"audio"===o&&l&&(h=qi.ts.parsePesTime(r))&&(h.type="audio",n.audio.push(h),m=!0)}if(m)break;d+=Wi,c+=Wi}for(d=(c=e.byteLength)-Wi,m=!1;d>=0;)if(e[d]!==zi||e[c]!==zi&&c!==e.byteLength)d--,c--;else{switch(r=e.subarray(d,c),qi.ts.parseType(r,t.pid)){case"pes":o=qi.ts.parsePesType(r,t.table),l=qi.ts.parsePayloadUnitStartIndicator(r),"audio"===o&&l&&(h=qi.ts.parsePesTime(r))&&(h.type="audio",n.audio.push(h),m=!0)}if(m)break;d-=Wi,c-=Wi}},Ki=function(e,t,n){for(var r,o,l,h,d,i,c,m=0,f=Wi,_=!1,y={data:[],size:0};f<e.byteLength;)if(e[m]!==zi||e[f]!==zi)m++,f++;else{switch(r=e.subarray(m,f),qi.ts.parseType(r,t.pid)){case"pes":if(o=qi.ts.parsePesType(r,t.table),l=qi.ts.parsePayloadUnitStartIndicator(r),"video"===o&&(l&&!_&&(h=qi.ts.parsePesTime(r))&&(h.type="video",n.video.push(h),_=!0),!n.firstKeyFrame)){if(l&&0!==y.size){for(d=new Uint8Array(y.size),i=0;y.data.length;)c=y.data.shift(),d.set(c,i),i+=c.byteLength;if(qi.ts.videoPacketContainsKeyFrame(d)){var v=qi.ts.parsePesTime(d);v?(n.firstKeyFrame=v,n.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}y.size=0}y.data.push(r),y.size+=r.byteLength}}if(_&&n.firstKeyFrame)break;m+=Wi,f+=Wi}for(m=(f=e.byteLength)-Wi,_=!1;m>=0;)if(e[m]!==zi||e[f]!==zi)m--,f--;else{switch(r=e.subarray(m,f),qi.ts.parseType(r,t.pid)){case"pes":o=qi.ts.parsePesType(r,t.table),l=qi.ts.parsePayloadUnitStartIndicator(r),"video"===o&&l&&(h=qi.ts.parsePesTime(r))&&(h.type="video",n.video.push(h),_=!0)}if(_)break;m-=Wi,f-=Wi}},Qi=function(e){var t={pid:null,table:null},n={};for(var r in function(e,t){for(var n,r=0,o=Wi;o<e.byteLength;)if(e[r]!==zi||e[o]!==zi)r++,o++;else{switch(n=e.subarray(r,o),qi.ts.parseType(n,t.pid)){case"pat":t.pid=qi.ts.parsePat(n);break;case"pmt":var table=qi.ts.parsePmt(n);t.table=t.table||{},Object.keys(table).forEach((function(e){t.table[e]=table[e]}))}r+=Wi,o+=Wi}}(e,t),t.table){if(t.table.hasOwnProperty(r))switch(t.table[r]){case $i.H264_STREAM_TYPE:n.video=[],Ki(e,t,n),0===n.video.length&&delete n.video;break;case $i.ADTS_STREAM_TYPE:n.audio=[],Gi(e,t,n),0===n.audio.length&&delete n.audio}}return n},Xi=function(e,t){var n;return(n=qi.aac.isLikelyAacData(e)?function(e){for(var t,n=!1,r=0,o=null,l=null,h=0,d=0;e.length-d>=3;){switch(qi.aac.parseType(e,d)){case"timed-metadata":if(e.length-d<10){n=!0;break}if((h=qi.aac.parseId3TagSize(e,d))>e.length){n=!0;break}null===l&&(t=e.subarray(d,d+h),l=qi.aac.parseAacTimestamp(t)),d+=h;break;case"audio":if(e.length-d<7){n=!0;break}if((h=qi.aac.parseAdtsSize(e,d))>e.length){n=!0;break}null===o&&(t=e.subarray(d,d+h),o=qi.aac.parseSampleRate(t)),r++,d+=h;break;default:d++}if(n)return null}if(null===o||null===l)return null;var c=Vi/o;return{audio:[{type:"audio",dts:l,pts:l},{type:"audio",dts:l+1024*r*c,pts:l+1024*r*c}]}}(e):Qi(e))&&(n.audio||n.video)?(function(e,t){if(e.audio&&e.audio.length){var n=t;(void 0===n||isNaN(n))&&(n=e.audio[0].dts),e.audio.forEach((function(e){e.dts=Hi(e.dts,n),e.pts=Hi(e.pts,n),e.dtsTime=e.dts/Vi,e.ptsTime=e.pts/Vi}))}if(e.video&&e.video.length){var r=t;if((void 0===r||isNaN(r))&&(r=e.video[0].dts),e.video.forEach((function(e){e.dts=Hi(e.dts,r),e.pts=Hi(e.pts,r),e.dtsTime=e.dts/Vi,e.ptsTime=e.pts/Vi})),e.firstKeyFrame){var o=e.firstKeyFrame;o.dts=Hi(o.dts,r),o.pts=Hi(o.pts,r),o.dtsTime=o.dts/Vi,o.ptsTime=o.pts/Vi}}}(n,t),n):null};class Yi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new ti.Transmuxer(this.options),function(e,t){t.on("data",(function(t){const n=t.initSegment;t.initSegment={data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength};const r=t.data;t.data=r.buffer,e.postMessage({action:"data",segment:t,byteOffset:r.byteOffset,byteLength:r.byteLength},[t.data])})),t.on("done",(function(data){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){const n={start:{decode:fe.videoTsToSeconds(t.start.dts),presentation:fe.videoTsToSeconds(t.start.pts)},end:{decode:fe.videoTsToSeconds(t.end.dts),presentation:fe.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:fe.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=fe.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:n})})),t.on("audioSegmentTimingInfo",(function(t){const n={start:{decode:fe.videoTsToSeconds(t.start.dts),presentation:fe.videoTsToSeconds(t.start.pts)},end:{decode:fe.videoTsToSeconds(t.end.dts),presentation:fe.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:fe.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=fe.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:n})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(caption){e.postMessage({action:"caption",caption:caption})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:fe.videoTsToSeconds(t.start),end:fe.videoTsToSeconds(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:fe.videoTsToSeconds(t.start),end:fe.videoTsToSeconds(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}(this.self,this.transmuxer)}pushMp4Captions(data){this.captionParser||(this.captionParser=new ki,this.captionParser.init());const e=new Uint8Array(data.data,data.byteOffset,data.byteLength),t=this.captionParser.parse(e,data.trackIds,data.timescales);this.self.postMessage({action:"mp4Captions",captions:t&&t.captions||[],logs:t&&t.logs||[],data:e.buffer},[e.buffer])}probeMp4StartTime({timescales:e,data:data}){const t=Di(e,data);this.self.postMessage({action:"probeMp4StartTime",startTime:t,data:data},[data.buffer])}probeMp4Tracks({data:data}){const e=Mi(data);this.self.postMessage({action:"probeMp4Tracks",tracks:e,data:data},[data.buffer])}probeTs({data:data,baseStartTime:e}){const t="number"!=typeof e||isNaN(e)?void 0:e*fe.ONE_SECOND_IN_TS,n=Xi(data,t);let r=null;n&&(r={hasVideo:n.video&&2===n.video.length||!1,hasAudio:n.audio&&2===n.audio.length||!1},r.hasVideo&&(r.videoStart=n.video[0].ptsTime),r.hasAudio&&(r.audioStart=n.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:r,data:data},[data.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(data){const e=new Uint8Array(data.data,data.byteOffset,data.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(data){const e=data.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(fe.secondsToVideoTs(e)))}setAudioAppendStart(data){this.transmuxer.setAudioAppendStart(Math.ceil(fe.secondsToVideoTs(data.appendStart)))}setRemux(data){this.transmuxer.setRemux(data.remux)}flush(data){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(data){this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Yi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Yi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}}))));const na=e=>{const{transmuxer:t,bytes:n,audioAppendStart:r,gopsToAlignWith:o,remux:l,onData:h,onTrackInfo:d,onAudioTimingInfo:c,onVideoTimingInfo:m,onVideoSegmentTimingInfo:f,onAudioSegmentTimingInfo:_,onId3:y,onCaptions:v,onDone:T,onEndedTimeline:S,onTransmuxerLog:k,isEndOfTimeline:C}=e,E={buffer:[]};let w=C;if(t.onmessage=n=>{t.currentTransmux===e&&("data"===n.data.action&&((e,t,n)=>{const{type:r,initSegment:o,captions:l,captionStreams:h,metadata:d,videoFrameDtsTime:c,videoFramePtsTime:m}=e.data.segment;t.buffer.push({captions:l,captionStreams:h,metadata:d});const f=e.data.segment.boxes||{data:e.data.segment.data},_={type:r,data:new Uint8Array(f.data,f.data.byteOffset,f.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};void 0!==c&&(_.videoFrameDtsTime=c),void 0!==m&&(_.videoFramePtsTime=m),n(_)})(n,E,h),"trackinfo"===n.data.action&&d(n.data.trackInfo),"gopInfo"===n.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(n,E),"audioTimingInfo"===n.data.action&&c(n.data.audioTimingInfo),"videoTimingInfo"===n.data.action&&m(n.data.videoTimingInfo),"videoSegmentTimingInfo"===n.data.action&&f(n.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===n.data.action&&_(n.data.audioSegmentTimingInfo),"id3Frame"===n.data.action&&y([n.data.id3Frame],n.data.id3Frame.dispatchType),"caption"===n.data.action&&v(n.data.caption),"endedtimeline"===n.data.action&&(w=!1,S()),"log"===n.data.action&&k(n.data.log),"transmuxed"===n.data.type&&(w||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:E,callback:T}),ra(t))))},r&&t.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),void 0!==l&&t.postMessage({action:"setRemux",remux:l}),n.byteLength){const e=n instanceof ArrayBuffer?n:n.buffer,r=n instanceof ArrayBuffer?0:n.byteOffset;t.postMessage({action:"push",data:e,byteOffset:r,byteLength:n.byteLength},[e])}C&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},ra=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():na(e.currentTransmux))},aa=(e,t)=>{e.postMessage({action:t}),ra(e)},oa=(e,t)=>{if(!t.currentTransmux)return t.currentTransmux=e,void aa(t,e);t.transmuxQueue.push(aa.bind(null,t,e))},la=e=>{if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void na(e);e.transmuxer.transmuxQueue.push(e)};var ha=e=>{oa("reset",e)},da=e=>{const t=new sa;t.currentTransmux=null,t.transmuxQueue=[];const n=t.terminate;return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,n.call(t)),t.postMessage({action:"init",options:e}),t};const ua=function(e){const t=e.transmuxer,n=e.endAction||e.action,r=e.callback,o=C()({},e,{endAction:null,transmuxer:null,callback:null}),l=o=>{o.data.action===n&&(t.removeEventListener("message",l),o.data.data&&(o.data.data=new Uint8Array(o.data.data,e.byteOffset||0,e.byteLength||o.data.data.byteLength),e.data&&(e.data=o.data.data)),r(o.data))};if(t.addEventListener("message",l),e.data){const n=e.data instanceof ArrayBuffer;o.byteOffset=n?0:e.data.byteOffset,o.byteLength=e.data.byteLength;const r=[n?e.data:e.data.buffer];t.postMessage(o,r)}else t.postMessage(o)},ca=2,pa=-101,ma=-102,ga=e=>{e.forEach((e=>{e.abort()}))},fa=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:pa,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:ma,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:ca,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:ca,xhr:t}:null,_a=(e,t,n)=>(r,o)=>{const l=o.response,h=fa(r,o);if(h)return n(h,e);if(16!==l.byteLength)return n({status:o.status,message:"Invalid HLS key at URL: "+o.uri,code:ca,xhr:o},e);const view=new DataView(l),d=new Uint32Array([view.getUint32(0),view.getUint32(4),view.getUint32(8),view.getUint32(12)]);for(let i=0;i<t.length;i++)t[i].bytes=d;return n(null,e)},ya=(e,t)=>{const n=Object(D.a)(e.map.bytes);if("mp4"!==n){const r=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:`Found unsupported ${n||"unknown"} container for initialization segment at URL: ${r}`,code:ca})}ua({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:n,data:data})=>(e.map.bytes=data,n.forEach((function(track){e.map.tracks=e.map.tracks||{},e.map.tracks[track.type]||(e.map.tracks[track.type]=track,"number"==typeof track.id&&track.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[track.id]=track.timescale))})),t(null))})},va=({segment:e,finishProcessingFn:t,responseType:n})=>(r,o)=>{const l=fa(r,o);if(l)return t(l,e);const h="arraybuffer"!==n&&o.responseText?(e=>{const view=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)view[i]=e.charCodeAt(i);return view.buffer})(o.responseText.substring(e.lastReachedChar||0)):o.response;return e.stats=(e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(o),e.key?e.encryptedBytes=new Uint8Array(h):e.bytes=new Uint8Array(h),t(null,e)},Ta=({segment:e,bytes:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})=>{const v=e.map&&e.map.tracks||{},T=Boolean(v.audio&&v.video);let S=r.bind(null,e,"audio","start");const k=r.bind(null,e,"audio","end");let C=r.bind(null,e,"video","start");const E=r.bind(null,e,"video","end");ua({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:data=>{e.bytes=t=data.data;const r=data.result;r&&(n(e,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:T}),n=null,r.hasAudio&&!T&&S(r.audioStart),r.hasVideo&&C(r.videoStart),S=null,C=null),la({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:T,onData:t=>{t.type="combined"===t.type?"video":t.type,f(e,t)},onTrackInfo:t=>{n&&(T&&(t.isMuxed=!0),n(e,t))},onAudioTimingInfo:e=>{S&&void 0!==e.start&&(S(e.start),S=null),k&&void 0!==e.end&&k(e.end)},onVideoTimingInfo:e=>{C&&void 0!==e.start&&(C(e.start),C=null),E&&void 0!==e.end&&E(e.end)},onVideoSegmentTimingInfo:e=>{o(e)},onAudioSegmentTimingInfo:e=>{l(e)},onId3:(t,n)=>{h(e,t,n)},onCaptions:t=>{d(e,[t])},isEndOfTimeline:c,onEndedTimeline:()=>{m()},onTransmuxerLog:y,onDone:t=>{_&&(t.type="combined"===t.type?"video":t.type,_(null,e,t))}})}})},ba=({segment:e,bytes:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})=>{let v=new Uint8Array(t);if(Object(D.b)(v)){e.isFmp4=!0;const{tracks:o}=e.map,l={isFmp4:!0,hasVideo:!!o.video,hasAudio:!!o.audio};o.audio&&o.audio.codec&&"enca"!==o.audio.codec&&(l.audioCodec=o.audio.codec),o.video&&o.video.codec&&"encv"!==o.video.codec&&(l.videoCodec=o.video.codec),o.video&&o.audio&&(l.isMuxed=!0),n(e,l);const h=t=>{f(e,{data:v,type:l.hasAudio&&!l.isMuxed?"audio":"video"}),t&&t.length&&d(e,t),_(null,e,{})};ua({action:"probeMp4StartTime",timescales:e.map.timescales,data:v,transmuxer:e.transmuxer,callback:({data:data,startTime:n})=>{t=data.buffer,e.bytes=v=data,l.hasAudio&&!l.isMuxed&&r(e,"audio","start",n),l.hasVideo&&r(e,"video","start",n),o.video&&data.byteLength&&e.transmuxer?ua({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:v,timescales:e.map.timescales,trackIds:[o.video.id],callback:n=>{t=n.data.buffer,e.bytes=v=n.data,n.logs.forEach((function(e){y(Hn(e,{stream:"mp4CaptionParser"}))})),h(n.captions)}}):h()}})}else if(e.transmuxer){if(void 0===e.container&&(e.container=Object(D.a)(v)),"ts"!==e.container&&"aac"!==e.container)return n(e,{hasAudio:!1,hasVideo:!1}),void _(null,e,{});Ta({segment:e,bytes:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})}else _(null,e,{})},Sa=function({id:e,key:t,encryptedBytes:n,decryptionWorker:r},o){const l=t=>{if(t.data.source===e){r.removeEventListener("message",l);const e=t.data.decrypted;o(new Uint8Array(e.bytes,e.byteOffset,e.byteLength))}};let h;r.addEventListener("message",l),h=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),r.postMessage(jr({source:e,encrypted:n,key:h,iv:t.iv}),[n.buffer,h.buffer])},ka=({activeXhrs:e,decryptionWorker:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})=>{let v=0,T=!1;return(S,k)=>{if(!T){if(S)return T=!0,ga(e),_(S,k);if(v+=1,v===e.length){const v=function(){if(k.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})=>{Sa({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,ba({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})}))})({decryptionWorker:t,segment:k,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y});ba({segment:k,bytes:k.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f,doneFn:_,onTransmuxerLog:y})};if(k.endOfAllRequests=Date.now(),k.map&&k.map.encryptedBytes&&!k.map.bytes)return Sa({decryptionWorker:t,id:k.requestId+"-init",encryptedBytes:k.map.encryptedBytes,key:k.map.key},(t=>{k.map.bytes=t,ya(k,(t=>{if(t)return ga(e),_(t,k);v()}))}));v()}}}},Ca=({segment:e,progressFn:t,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:h,captionsFn:d,isEndOfTimeline:c,endedTimelineFn:m,dataFn:f})=>n=>{if(!n.target.aborted)return e.stats=Hn(e.stats,(e=>{const t=e.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return n.bytesReceived=e.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n})(n)),!e.stats.firstBytesReceivedAt&&e.stats.bytesReceived&&(e.stats.firstBytesReceivedAt=Date.now()),t(n,e)},Ea=({xhr:e,xhrOptions:t,decryptionWorker:n,segment:r,abortFn:o,progressFn:l,trackInfoFn:h,timingInfoFn:d,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:m,id3Fn:f,captionsFn:_,isEndOfTimeline:y,endedTimelineFn:v,dataFn:T,doneFn:S,onTransmuxerLog:k})=>{const C=[],E=ka({activeXhrs:C,decryptionWorker:n,trackInfoFn:h,timingInfoFn:d,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:m,id3Fn:f,captionsFn:_,isEndOfTimeline:y,endedTimelineFn:v,dataFn:T,doneFn:S,onTransmuxerLog:k});if(r.key&&!r.key.bytes){const n=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&n.push(r.map.key);const o=e(Hn(t,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),_a(r,n,E));C.push(o)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const n=e(Hn(t,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),_a(r,[r.map.key],E));C.push(n)}const n=e(Hn(t,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Rr(r.map)}),(({segment:e,finishProcessingFn:t})=>(n,r)=>{const o=fa(n,r);if(o)return t(o,e);const l=new Uint8Array(r.response);if(e.map.key)return e.map.encryptedBytes=l,t(null,e);e.map.bytes=l,ya(e,(function(n){if(n)return n.xhr=r,n.status=r.status,t(n,e);t(null,e)}))})({segment:r,finishProcessingFn:E}));C.push(n)}const w=Hn(t,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Rr(r)}),x=e(w,va({segment:r,finishProcessingFn:E,responseType:w.responseType}));x.addEventListener("progress",Ca({segment:r,progressFn:l,trackInfoFn:h,timingInfoFn:d,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:m,id3Fn:f,captionsFn:_,isEndOfTimeline:y,endedTimelineFn:v,dataFn:T})),C.push(x);const I={};return C.forEach((e=>{e.addEventListener("loadend",(({loadendState:e,abortFn:t})=>n=>{n.target.aborted&&t&&!e.calledAbortFn&&(t(),e.calledAbortFn=!0)})({loadendState:I,abortFn:o}))})),()=>ga(C)},wa=$n("CodecUtils"),xa=(main,e)=>{const t=e.attributes||{};return main&&main.mediaGroups&&main.mediaGroups.AUDIO&&t.AUDIO&&main.mediaGroups.AUDIO[t.AUDIO]},Ia=function(e){const t={};return e.forEach((({mediaType:e,type:n,details:details})=>{t[e]=t[e]||[],t[e].push(Object(w.i)(`${n}${details}`))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return wa(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),void(t[e]=null);t[e]=t[e][0]})),t},Pa=function(e){let t=0;return e.audio&&t++,e.video&&t++,t},Aa=function(main,e){const t=e.attributes||{},n=Ia(function(e){const t=e.attributes||{};if(t.CODECS)return Object(w.h)(t.CODECS)}(e)||[]);if(xa(main,e)&&!n.audio&&!((main,e)=>{if(!xa(main,e))return!0;const t=e.attributes||{},n=main.mediaGroups.AUDIO[t.AUDIO];for(const e in n)if(!n[e].uri&&!n[e].playlists)return!0;return!1})(main,e)){const e=Ia(Object(w.d)(main,t.AUDIO)||[]);e.audio&&(n.audio=e.audio)}return n},La=$n("PlaylistSelector"),Oa=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Da=function(e,t){if(!e)return"";const n=o.a.getComputedStyle(e);return n?n[t]:""},Ma=function(e,t){const n=e.slice();e.sort((function(e,r){const o=t(e,r);return 0===o?n.indexOf(e)-n.indexOf(r):o}))},Ua=function(e,t){let n,r;return e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||o.a.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),r=r||o.a.Number.MAX_VALUE,n-r};let Ra=function(main,e,t,n,r,l){if(!main)return;const h={bandwidth:e,width:t,height:n,limitRenditionByPlayerDimensions:r};let d=main.playlists;yr.isAudioOnly(main)&&(d=l.getAudioTrackPlaylists_(),h.audioOnly=!0);let c=d.map((e=>{let t;const n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,r=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||o.a.Number.MAX_VALUE,{bandwidth:t,width:n,height:r,playlist:e}}));Ma(c,((e,t)=>e.bandwidth-t.bandwidth)),c=c.filter((e=>!yr.isIncompatible(e.playlist)));let m=c.filter((e=>yr.isEnabled(e.playlist)));m.length||(m=c.filter((e=>!yr.isDisabled(e.playlist))));const f=m.filter((t=>t.bandwidth*Jr.BANDWIDTH_VARIANCE<e));let _=f[f.length-1];const y=f.filter((e=>e.bandwidth===_.bandwidth))[0];if(!1===r){const e=y||m[0]||c[0];if(e&&e.playlist){let t="sortedPlaylistReps";return y&&(t="bandwidthBestRep"),m[0]&&(t="enabledPlaylistReps"),La(`choosing ${Oa(e)} using ${t} with options`,h),e.playlist}return La("could not choose a playlist with options",h),null}const v=f.filter((e=>e.width&&e.height));Ma(v,((e,t)=>e.width-t.width));const T=v.filter((e=>e.width===t&&e.height===n));_=T[T.length-1];const S=T.filter((e=>e.bandwidth===_.bandwidth))[0];let k,C,E,w;if(S||(k=v.filter((e=>e.width>t||e.height>n)),C=k.filter((e=>e.width===k[0].width&&e.height===k[0].height)),_=C[C.length-1],E=C.filter((e=>e.bandwidth===_.bandwidth))[0]),l.leastPixelDiffSelector){const e=v.map((e=>(e.pixelDiff=Math.abs(e.width-t)+Math.abs(e.height-n),e)));Ma(e,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),w=e[0]}const x=w||E||S||y||m[0]||c[0];if(x&&x.playlist){let e="sortedPlaylistReps";return w?e="leastPixelDiffRep":E?e="resolutionPlusOneRep":S?e="resolutionBestRep":y?e="bandwidthBestRep":m[0]&&(e="enabledPlaylistReps"),La(`choosing ${Oa(x)} using ${e} with options`,h),x.playlist}return La("could not choose a playlist with options",h),null};const Na=function(){const e=this.useDevicePixelRatio&&o.a.devicePixelRatio||1;return Ra(this.playlists.main,this.systemBandwidth,parseInt(Da(this.tech_.el(),"width"),10)*e,parseInt(Da(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)},Ba=({inbandTextTracks:e,metadataArray:t,timestampOffset:n,videoDuration:r})=>{if(!t)return;const l=o.a.WebKitDataCue||o.a.VTTCue,h=e.metadataTrack_;if(!h)return;if(t.forEach((e=>{const time=e.cueTime+n;!("number"!=typeof time||o.a.isNaN(time)||time<0)&&time<1/0&&e.frames.forEach((e=>{const t=new l(time,time,e.value||e.url||e.data||"");t.frame=e,t.value=e,function(e){Object.defineProperties(e.frame,{id:{get:()=>(Dn.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key)},value:{get:()=>(Dn.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data)},privateData:{get:()=>(Dn.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data)}})}(t),h.addCue(t)}))})),!h.cues||!h.cues.length)return;const d=h.cues,c=[];for(let i=0;i<d.length;i++)d[i]&&c.push(d[i]);const m=c.reduce(((e,t)=>{const n=e[t.startTime]||[];return n.push(t),e[t.startTime]=n,e}),{}),f=Object.keys(m).sort(((a,b)=>Number(a)-Number(b)));f.forEach(((e,t)=>{const n=m[e],o=Number(f[t+1])||r;n.forEach((e=>{e.endTime=o}))}))},Fa=function(e,t,track){let i,n;if(track&&track.cues)for(i=track.cues.length;i--;)n=track.cues[i],n.startTime>=e&&n.endTime<=t&&track.removeCue(n)},ja=e=>"number"==typeof e&&isFinite(e),$a=1/60,Ha=e=>{const{startOfSegment:t,duration:n,segment:r,part:o,playlist:{mediaSequence:l,id:h,segments:d=[]},mediaIndex:c,partIndex:m,timeline:f}=e,_=d.length-1;let y="mediaIndex/partIndex increment";e.getMediaInfoForTime?y=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(y="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(y+=` with independent ${e.independent}`);const v="number"==typeof m,T=e.segment.uri?"segment":"pre-segment",S=v?sr({preloadSegment:r})-1:0;return`${T} [${l+c}/${l+_}]`+(v?` part [${m}/${S}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(v?` part start/end [${o.start} => ${o.end}]`:"")+` startOfSegment [${t}]`+` duration [${n}]`+` timeline [${f}]`+` selected by [${y}]`+` playlist [${h}]`},qa=e=>`${e}TimingInfo`,Va=({timelineChangeController:e,currentTimeline:t,segmentTimeline:n,loaderType:r,audioDisabled:o})=>{if(t===n)return!1;if("audio"===r){const t=e.lastTimelineChange({type:"main"});return!t||t.to!==n}if("main"===r&&o){const t=e.pendingTimelineChange({type:"audio"});return!t||t.to!==n}return!1},Wa=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Vn,za=(e,t)=>{if("hls"!==t)return null;const n=(e=>{let t=0;return["video","audio"].forEach((function(n){const r=e[`${n}TimingInfo`];if(!r)return;const{start:l,end:h}=r;let d;"bigint"==typeof l||"bigint"==typeof h?d=o.a.BigInt(h)-o.a.BigInt(l):"number"==typeof l&&"number"==typeof h&&(d=h-l),void 0!==d&&d>t&&(t=d)})),"bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER&&(t=Number(t)),t})({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo});if(!n)return null;const r=e.playlist.targetDuration,l=Wa({segmentDuration:n,maxDuration:2*r}),h=Wa({segmentDuration:n,maxDuration:r}),d=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${n} when the reported duration is ${e.duration} and the target duration is ${r}. 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 l||h?{severity:l?"warn":"info",message:d}:null};class Ga extends Dn.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)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.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,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_=Dn.browser.IE_VERSION>=11,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.logger_=$n(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(`${this.state_} -> ${e}`),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return da({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_&&o.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(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}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,o.a.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&ha(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return qn();if("main"===this.loaderType_){const{hasAudio:t,hasVideo:n,isMuxed:r}=e;if(n&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(map,e=!1){if(!map)return null;const t=$r(map);let n=this.initSegments_[t];return e&&!n&&map.bytes&&(this.initSegments_[t]=n={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:map.bytes,tracks:map.tracks,timescales:map.timescales}),n||map}segmentKey(e,t=!1){if(!e)return null;const n=Hr(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const o={resolvedUri:(r||e).resolvedUri};return r&&(o.bytes=r.bytes),o}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));let o=null;if(n&&(n.id?o=n.id:n.uri&&(o=n.uri)),this.logger_(`playlist update [${o} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");const l=e.mediaSequence-n.mediaSequence;if(this.logger_(`live window shift [${l}]`),null!==this.mediaIndex)if(this.mediaIndex-=l,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const e=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!e.parts||!e.parts.length||!e.parts[this.partIndex])){const e=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=e}}r&&(r.mediaIndex-=l,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_&&(o.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},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_&&ha(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,t,n=(()=>{}),r=!1){if(t===1/0&&(t=this.duration_()),t<=e)return void this.logger_("skipping remove because end ${end} is <= start ${start}");if(!this.sourceUpdater_||!this.getMediaInfo_())return void this.logger_("skipping remove because no source updater or starting media info");let o=1;const l=()=>{o--,0===o&&n()};!r&&this.audioDisabled_||(o++,this.sourceUpdater_.removeAudio(e,t,l)),(r||"main"===this.loaderType_)&&(this.gopBuffer_=((e,t,n,r)=>{const o=Math.ceil((t-r)*M.ONE_SECOND_IN_TS),l=Math.ceil((n-r)*M.ONE_SECOND_IN_TS),h=e.slice();let i=e.length;for(;i--&&!(e[i].pts<=l););if(-1===i)return h;let d=i+1;for(;d--&&!(e[d].pts<=o););return d=Math.max(d,0),h.splice(d,i-d+1),h})(this.gopBuffer_,e,t,this.timeMapping_),o++,this.sourceUpdater_.removeVideo(e,t,l));for(const track in this.inbandTextTracks_)Fa(e,t,this.inbandTextTracks_[track]);Fa(e,t,this.segmentMetadataTrack_),l()}monitorBuffer_(){this.checkBufferTimeout_&&o.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=o.a.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&o.a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=o.a.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,n=this.partIndex){if(!t||!this.mediaSource_)return!1;const r="number"==typeof e&&t.segments[e],o=e+1===t.segments.length,l=!r||!r.parts||n+1===r.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&o&&l}chooseNextRequest_(){const e=this.buffered_(),t=Yn(e)||0,n=Jn(e,this.currentTime_()),r=!this.hasPlayed_()&&n>=1,o=n>=this.goalBufferLength_(),l=this.playlist_.segments;if(!l.length||r||o)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const h={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(h.isSyncRequest)h.mediaIndex=function(e,t,n){t=t||[];const r=[];let time=0;for(let i=0;i<t.length;i++){const o=t[i];if(e===o.timeline&&(r.push(i),time+=o.duration,time>n))return i}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,l,t);else if(null!==this.mediaIndex){const e=l[this.mediaIndex],n="number"==typeof this.partIndex?this.partIndex:-1;h.startOfSegment=e.end?e.end:t,e.parts&&e.parts[n+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=n+1):h.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:e,startTime:n,partIndex:r}=yr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,h.mediaIndex=e,h.startOfSegment=n,h.partIndex=r}const d=l[h.mediaIndex];let c=d&&"number"==typeof h.partIndex&&d.parts&&d.parts[h.partIndex];if(!d||"number"==typeof h.partIndex&&!c)return null;if("number"!=typeof h.partIndex&&d.parts&&(h.partIndex=0,c=d.parts[0]),!n&&c&&!c.independent)if(0===h.partIndex){const e=l[h.mediaIndex-1],t=e.parts&&e.parts.length&&e.parts[e.parts.length-1];t&&t.independent&&(h.mediaIndex-=1,h.partIndex=e.parts.length-1,h.independent="previous segment")}else d.parts[h.partIndex-1].independent&&(h.partIndex-=1,h.independent="previous part");const m=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return h.mediaIndex>=l.length-1&&m&&!this.seeking_()?null:this.generateSegmentInfo_(h)}generateSegmentInfo_(e){const{independent:t,playlist:n,mediaIndex:r,startOfSegment:o,isSyncRequest:l,partIndex:h,forceTimestampOffset:d,getMediaInfoForTime:c}=e,m=n.segments[r],f="number"==typeof h&&m.parts[h],_={requestId:"segment-loader-"+Math.random(),uri:f&&f.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:f?h:null,isSyncRequest:l,startOfSegment:o,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:f&&f.duration||m.duration,segment:m,part:f,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:c,independent:t},y=void 0!==d?d:this.isPendingTimestampOffset_;_.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:o,buffered:this.buffered_(),overrideCheck:y});const v=Yn(this.sourceUpdater_.audioBuffered());return"number"==typeof v&&(_.audioAppendStart=v-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(_.gopsToAlignWith=((e,t,n)=>{if(null==t||!e.length)return[];const r=Math.ceil((t-n+3)*M.ONE_SECOND_IN_TS);let i;for(i=0;i<e.length&&!(e[i].pts>r);i++);return e.slice(i)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),_}timestampOffsetForSegment_(e){return(({segmentTimeline:e,currentTimeline:t,startOfSegment:n,buffered:r,overrideCheck:o})=>o||e!==t?e<t?n:r.length?r.end(r.length-1):n:null)(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return;if(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),n=e.bandwidth,r=this.pendingSegment_.duration,o=yr.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),l=function(e,t,n=1){return((e.length?e.end(e.length-1):0)-t)/n}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(o<=l)return;const h=function(e){const{main:main,currentTime:t,bandwidth:n,duration:r,segmentDuration:o,timeUntilRebuffer:l,currentTimeline:h,syncController:d}=e,c=main.playlists.filter((e=>!yr.isIncompatible(e)));let m=c.filter(yr.isEnabled);m.length||(m=c.filter((e=>!yr.isDisabled(e))));const f=m.filter(yr.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{const c=d.getSyncPoint(e,r,h,t)?1:2;return{playlist:e,rebufferingImpact:yr.estimateSegmentRequestTime(o,n,e)*c-l}})),_=f.filter((e=>e.rebufferingImpact<=0));return Ma(_,((a,b)=>Ua(b.playlist,a.playlist))),_.length?_[0]:(Ma(f,((a,b)=>a.rebufferingImpact-b.rebufferingImpact)),f[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:l,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!h)return;const d=o-l-h.rebufferingImpact;let c=.5;l<=Vn&&(c=1),!h.playlist||h.playlist.uri===this.playlist_.uri||d<c||(this.bandwidth=h.playlist.attributes.BANDWIDTH*Jr.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Ha(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}handleTrackInfo_(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(a,b){if(!a&&!b||!a&&b||a&&!b)return!1;if(a===b)return!0;const e=Object.keys(a).sort(),t=Object.keys(b).sort();if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++){const n=e[i];if(n!==t[i])return!1;if(a[n]!==b[n])return!1}return!0}(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))}handleTimingInfo_(e,t,n,time){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const r=this.pendingSegment_,o=qa(t);r[o]=r[o]||{},r[o][n]=time,this.logger_(`timinginfo: ${t} - ${n} - ${time}`),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(0===t.length)return void this.logger_("SegmentLoader received no captions from a caption event");if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));const n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach((caption=>{r[caption.stream]=r[caption.stream]||{startTime:1/0,captions:[],endTime:0};const e=r[caption.stream];e.startTime=Math.min(e.startTime,caption.startTime+n),e.endTime=Math.max(e.endTime,caption.endTime+n),e.captions.push(caption)})),Object.keys(r).forEach((e=>{const{startTime:t,endTime:l,captions:h}=r[e],d=this.inbandTextTracks_;this.logger_(`adding cues from ${t} -> ${l} for ${e}`),function(e,t,n){if(!e[n]){t.trigger({type:"usage",name:"vhs-608"});let r=n;/^cc708_/.test(n)&&(r="SERVICE"+n.split("_")[1]);const track=t.textTracks().getTrackById(r);if(track)e[n]=track;else{let label=n,o=n,l=!1;const h=(t.options_.vhs&&t.options_.vhs.captionServices||{})[r];h&&(label=h.label,o=h.language,l=h.default),e[n]=t.addRemoteTextTrack({kind:"captions",id:r,default:l,label:label,language:o},!1).track}}}(d,this.vhs_.tech_,e),Fa(t,l,d[e]),function({inbandTextTracks:e,captionArray:t,timestampOffset:n}){if(!t)return;const r=o.a.WebKitDataCue||o.a.VTTCue;t.forEach((caption=>{const track=caption.stream;e[track].addCue(new r(caption.startTime+n,caption.endTime+n,caption.text))}))}({captionArray:h,inbandTextTracks:d,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_)return void this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n));const r=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();((e,t,n)=>{e.metadataTrack_||(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)})(this.inbandTextTracks_,n,this.vhs_.tech_),Ba({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration: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((e=>e()))}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){if("audio"!==this.loaderType_)return!0;const e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Va({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:n,hasVideo:r,isMuxed:o}=t;return!(r&&!e.videoTimingInfo)&&(!(n&&!this.audioDisabled_&&!o&&!e.audioTimingInfo)&&!Va({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return void this.callQueue_.push(this.handleData_.bind(this,e,t));const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){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[qa(t.type)].start;else{const e=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&e&&e.hasVideo;let r;t&&(r=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:r,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});const e=this.chooseNextRequest_();if(e.mediaIndex!==n.mediaIndex||e.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:map,playlist:n}){if(map){const e=$r(map);if(this.activeInitSegmentId_===e)return null;t=this.initSegmentForMap(map,!0).bytes,this.activeInitSegmentId_=e}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n},r){const l=this.sourceUpdater_.audioBuffered(),h=this.sourceUpdater_.videoBuffered();l.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Xn(l).join(", ")),h.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Xn(h).join(", "));const d=l.length?l.start(0):0,c=l.length?l.end(l.length-1):0,m=h.length?h.start(0):0,f=h.length?h.end(h.length-1):0;if(c-d<=1&&f-m<=1)return this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${Xn(l).join(", ")}, video buffer: ${Xn(h).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:n}));const _=this.currentTime_()-1;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=o.a.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3)}),!0)}handleAppendError_({segmentInfo:e,type:t,bytes:n},r){r&&(22!==r.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error(`${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n}))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:n,data:data,bytes:r}){if(!r){const e=[data];let t=data.byteLength;n&&(e.unshift(n),t+=n.byteLength),r=(e=>{let t,n=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,n),n+=e.byteLength}))),t})({bytes:t,segments:e})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,n){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,o=`${e}TimingInfo`;r[o]||(r[o]={}),r[o].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[o].transmuxedPresentationStart=n.start.presentation,r[o].transmuxedDecodeStart=n.start.decode,r[o].transmuxedPresentationEnd=n.end.presentation,r[o].transmuxedDecodeEnd=n.end.decode,r[o].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,t){const{type:n,data:data}=t;if(!data||!data.byteLength)return;if("audio"===n&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:r,data:data})}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{const t=C()({},e,{forceTimestampOffset:!0});C()(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,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 t=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,o=e.timeline!==this.currentTimeline_&&e.timeline>0,l=n||r&&o;this.logger_(`Requesting ${Ha(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ea({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,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:l,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:n,stream:r})=>{this.logger_(`${Ha(e)} logged from transmuxer stream ${r} as a ${n}: ${t}`)}})}trimBackBuffer_(e){const t=((e,t,n)=>{let r=t-Jr.BACK_BUFFER_LENGTH;e.length&&(r=Math.max(r,e.start(0)));const o=t-n;return Math.min(o,r)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,n=e.part,r={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?r.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(r.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(t.key),r.key.iv=n}return t.map&&(r.map=this.initSegmentForMap(t.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<$a?this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record 0.016666666666666666`):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,n){if(this.callQueue_.length)return void this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return;if(t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===ma)return;return this.pause(),e.code===pa?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),r.endOfAllRequests=t.endOfAllRequests,n.gopInfo&&(this.gopBuffer_=((e,t,n)=>{if(!t.length)return e;if(n)return t.slice();const r=t[0].pts;let i=0;for(;i<e.length&&!(e[i].pts>=r);i++);return e.slice(0,i).concat(t)})(this.gopBuffer_,n.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(r)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:n,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:o,useVideoTimingInfo:l,videoTimingInfo:h,audioTimingInfo:d}){if(void 0!==e)return e;if(!l)return d.start;const c=t.segments[n-1];return 0!==n&&c&&void 0!==c.start&&c.end===r+o?h.start:r}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");const{hasAudio:n,hasVideo:r,isMuxed:o}=t,l="main"===this.loaderType_&&r,h=!this.audioDisabled_&&n&&!o;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);l&&e.waitingOnAppends++,h&&e.waitingOnAppends++,l&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),h&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=((e,t,n)=>"main"===e&&t&&n?n.hasAudio||n.hasVideo?t.hasVideo&&!n.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.":!t.hasVideo&&n.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:"Neither audio nor video found in segment.":null)(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_)return;let t=!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),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:n}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end="number"==typeof n.end?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());const e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});const t=za(e,this.sourceType_);if(t&&("warn"===t.severity?Dn.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_))return void this.logger_(`Throwing away un-appended sync request ${Ha(e)}`);this.logger_(`Appended ${Ha(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||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,o=n.end&&this.currentTime_()-n.end>3*e.playlist.targetDuration,l=r&&r.end&&this.currentTime_()-r.end>3*e.playlist.partTargetDuration;if(o||l)return this.logger_(`bad ${o?"segment":"part"} ${Ha(e)}`),void this.resetEverything();null!==this.mediaIndex&&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.duration<$a)return void this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record 0.016666666666666666`);const t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,n=t.start,r=t.end;if(!ja(n)||!ja(r))return;Fa(n,r,this.segmentMetadataTrack_);const l=o.a.WebKitDataCue||o.a.VTTCue,h={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:n,end:r},d=new l(n,r,JSON.stringify(h));d.value=h,this.segmentMetadataTrack_.addCue(d)}}function Ka(){}const Qa=function(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))},Xa=["video","audio"],Ya=(e,t)=>{const n=t[`${e}Buffer`];return n&&n.updating||t.queuePending[e]},Ja=(e,t)=>{if(0===t.queue.length)return;let n=0,r=t.queue[n];if("mediaSource"!==r.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Ya(e,t)){if(r.type!==e){if(n=((e,t)=>{for(let i=0;i<t.length;i++){const n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null})(e,t.queue),null===n)return;r=t.queue[n]}return t.queue.splice(n,1),t.queuePending[e]=r,r.action(e,t),r.doneFn?void 0:(t.queuePending[e]=null,void Ja(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),r.action(t),r.doneFn&&r.doneFn(),Ja("audio",t),Ja("video",t))},Za=(e,t)=>{const n=t[`${e}Buffer`],r=Qa(e);n&&(n.removeEventListener("updateend",t[`on${r}UpdateEnd_`]),n.removeEventListener("error",t[`on${r}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},eo=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),to=(e,t,n)=>(r,o)=>{const l=o[`${r}Buffer`];if(eo(o.mediaSource,l)){o.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${r}Buffer`);try{l.appendBuffer(e)}catch(e){o.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${r}Buffer`),o.queuePending[r]=null,n(e)}}},io=(e,t)=>(n,r)=>{const o=r[`${n}Buffer`];if(eo(r.mediaSource,o)){r.logger_(`Removing ${e} to ${t} from ${n}Buffer`);try{o.remove(e,t)}catch(o){r.logger_(`Remove ${e} to ${t} from ${n}Buffer failed`)}}},so=e=>(t,n)=>{const r=n[`${t}Buffer`];eo(n.mediaSource,r)&&(n.logger_(`Setting ${t}timestampOffset to ${e}`),r.timestampOffset=e)},no=e=>(t,n)=>{e()},ro=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){Dn.log.warn("Failed to call media source endOfStream",e)}}},ao=e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){Dn.log.warn("Failed to set media source duration",e)}},oo=()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;const n=t[`${e}Buffer`];if(eo(t.mediaSource,n)){t.logger_(`calling abort on ${e}Buffer`);try{n.abort()}catch(t){Dn.log.warn(`Failed to abort on ${e}Buffer`,t)}}},lo=(e,t)=>n=>{const r=Qa(e),o=Object(w.e)(t);n.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);const l=n.mediaSource.addSourceBuffer(o);l.addEventListener("updateend",n[`on${r}UpdateEnd_`]),l.addEventListener("error",n[`on${r}Error_`]),n.codecs[e]=t,n[`${e}Buffer`]=l},ho=e=>t=>{const n=t[`${e}Buffer`];if(Za(e,t),eo(t.mediaSource,n)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(n)}catch(t){Dn.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},uo=e=>(t,n)=>{const r=n[`${t}Buffer`],o=Object(w.e)(e);eo(n.mediaSource,r)&&n.codecs[t]!==e&&(n.logger_(`changing ${t}Buffer codec from ${n.codecs[t]} to ${e}`),r.changeType(o),n.codecs[t]=e)},co=({type:e,sourceUpdater:t,action:n,doneFn:r,name:o})=>{t.queue.push({type:e,action:n,doneFn:r,name:o}),Ja(e,t)},po=(e,t)=>n=>{if(t.queuePending[e]){const n=t.queuePending[e].doneFn;t.queuePending[e]=null,n&&n(t[`${e}Error_`])}Ja(e,t)};class mo extends Dn.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Ja("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=$n("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=po("video",this),this.onAudioUpdateEnd_=po("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},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,t){co({type:"mediaSource",sourceUpdater:this,action:lo(e,t),name:"addSourceBuffer"})}abort(e){co({type:e,sourceUpdater:this,action:oo(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?co({type:"mediaSource",sourceUpdater:this,action:ho(e),name:"removeSourceBuffer"}):Dn.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!Dn.browser.IE_VERSION&&!Dn.browser.IS_FIREFOX&&o.a.MediaSource&&o.a.MediaSource.prototype&&"function"==typeof o.a.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return o.a.SourceBuffer&&o.a.SourceBuffer.prototype&&"function"==typeof o.a.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?co({type:e,sourceUpdater:this,action:uo(t),name:"changeType"}):Dn.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{const n=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,n);this.canChangeType()&&this.changeType(t,n)}))}appendBuffer(e,t){const{segmentInfo:n,type:r,bytes:o}=e;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_(`delayed audio append of ${o.length} until video append`);if(co({type:r,sourceUpdater:this,action:to(o,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach((e=>{this.appendBuffer.apply(this,e)}))}}audioBuffered(){return eo(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:qn()}videoBuffered(){return eo(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:qn()}buffered(){const video=eo(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,audio=eo(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return audio&&!video?this.audioBuffered():video&&!audio?this.videoBuffered():function(e,t){let n=null,r=null,o=0;const l=[],h=[];if(!(e&&e.length&&t&&t.length))return qn();let d=e.length;for(;d--;)l.push({time:e.start(d),type:"start"}),l.push({time:e.end(d),type:"end"});for(d=t.length;d--;)l.push({time:t.start(d),type:"start"}),l.push({time:t.end(d),type:"end"});for(l.sort((function(a,b){return a.time-b.time})),d=0;d<l.length;d++)"start"===l[d].type?(o++,2===o&&(n=l[d].time)):"end"===l[d].type&&(o--,1===o&&(r=l[d].time)),null!==n&&null!==r&&(h.push([n,r]),n=null,r=null);return qn(h)}(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ka){co({type:"mediaSource",sourceUpdater:this,action:ao(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ka){"string"!=typeof e&&(e=void 0),co({type:"mediaSource",sourceUpdater:this,action:ro(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,n=Ka){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?co({type:"audio",sourceUpdater:this,action:io(e,t),doneFn:n,name:"remove"}):n()}removeVideo(e,t,n=Ka){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?co({type:"video",sourceUpdater:this,action:io(e,t),doneFn:n,name:"remove"}):n()}updating(){return!(!Ya("audio",this)&&!Ya("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(co({type:"audio",sourceUpdater:this,action:so(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(co({type:"video",sourceUpdater:this,action:so(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&co({type:"audio",sourceUpdater:this,action:no(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&co({type:"video",sourceUpdater:this,action:no(e),name:"callback"})}dispose(){this.trigger("dispose"),Xa.forEach((e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`]((()=>Za(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const go=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),fo=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class _o extends Ga{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return qn();const e=this.subtitlesTrack_.cues;return qn([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(map,e=!1){if(!map)return null;const t=$r(map);let n=this.initSegments_[t];if(e&&!n&&map.bytes){const e=fo.byteLength+map.bytes.byteLength,r=new Uint8Array(e);r.set(map.bytes),r.set(fo,map.bytes.byteLength),this.initSegments_[t]=n={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:r}}return n||map}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(track){return void 0===track||(this.subtitlesTrack_=track,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){Fa(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){const e=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};return this.syncController_.one("timestampoffset",e),void(this.state="WAITING_ON_TIMELINE")}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,t,n){if(!this.subtitlesTrack_)return void(this.state="READY");if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===pa&&this.handleTimeout_(),e.code===ma?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const l=r.segment;if(l.map&&(l.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof o.a.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){let r;const o=()=>{this.subtitlesTrack_.tech_.off("vttjsloaded",r),this.stopForError({message:"Error loading vtt.js"})};return r=()=>{this.subtitlesTrack_.tech_.off("vttjserror",o),this.segmentRequestFinished_(e,t,n)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",r),void this.subtitlesTrack_.tech_.one("vttjserror",o)}l.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}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)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=l.duration,r.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new o.a.VTTCue(e.startTime,e.endTime,e.text):e)})),function(track){const e=track.cues;if(e)for(let i=0;i<e.length;i++){const t=[];let n=0;for(let r=0;r<e.length;r++)e[i].startTime===e[r].startTime&&e[i].endTime===e[r].endTime&&e[i].text===e[r].text&&(n++,n>1&&t.push(e[r]));t.length&&t.forEach((e=>track.removeCue(e)))}}(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,n=!1;"function"==typeof o.a.TextDecoder?t=new o.a.TextDecoder("utf8"):(t=o.a.WebVTT.StringDecoder(),n=!0);const r=new o.a.WebVTT.Parser(o.a,o.a.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=map=>{e.timestampmap=map},r.onparsingerror=e=>{Dn.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;n&&(t=go(t)),r.parse(t)}let l=e.bytes;n&&(l=go(l)),r.parse(l),r.flush()}updateTimeMapping_(e,t,n){const r=e.segment;if(!t)return;if(!e.cues.length)return void(r.empty=!0);const o=e.timestampmap,l=o.MPEGTS/M.ONE_SECOND_IN_TS-o.LOCAL+t.mapping;if(e.cues.forEach((e=>{e.startTime+=l,e.endTime+=l})),!n.syncInfo){const t=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(t,o-r.duration)}}}}const yo=function(track,e){const t=track.cues;for(let i=0;i<t.length;i++){const n=t[i];if(e>=n.adStartTime&&e<=n.adEndTime)return n}return null},vo=[{name:"VOD",run:(e,t,n,r,o)=>{if(n!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:(e,t,n,r,o)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let l=null,h=null;const d=er(t);o=o||0;for(let i=0;i<d.length;i++){const n=d[t.endList||0===o?i:d.length-(i+1)],r=n.segment,c=e.timelineToDatetimeMappings[r.timeline];if(!c||!r.dateTimeObject)continue;let m=r.dateTimeObject.getTime()/1e3+c;if(r.parts&&"number"==typeof n.partIndex)for(let e=0;e<n.partIndex;e++)m+=r.parts[e].duration;const f=Math.abs(o-m);if(null!==h&&(0===f||h<f))break;h=f,l={time:m,segmentIndex:n.segmentIndex,partIndex:n.partIndex}}return l}},{name:"Segment",run:(e,t,n,r,o)=>{let l=null,h=null;o=o||0;const d=er(t);for(let i=0;i<d.length;i++){const e=d[t.endList||0===o?i:d.length-(i+1)],n=e.segment,c=e.part&&e.part.start||n&&n.start;if(n.timeline===r&&void 0!==c){const t=Math.abs(o-c);if(null!==h&&h<t)break;(!l||null===h||h>=t)&&(h=t,l={time:c,segmentIndex:e.segmentIndex,partIndex:e.partIndex})}}return l}},{name:"Discontinuity",run:(e,t,n,r,o)=>{let l=null;if(o=o||0,t.discontinuityStarts&&t.discontinuityStarts.length){let n=null;for(let i=0;i<t.discontinuityStarts.length;i++){const r=t.discontinuityStarts[i],h=t.discontinuitySequence+i+1,d=e.discontinuities[h];if(d){const e=Math.abs(o-d.time);if(null!==n&&n<e)break;(!l||null===n||n>=e)&&(n=e,l={time:d.time,segmentIndex:r,partIndex:null})}}}return l}},{name:"Playlist",run:(e,t,n,r,o)=>{if(t.syncInfo){return{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}}return null}}];class To extends Dn.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=$n("SyncController")}getSyncPoint(e,t,n,r){const o=this.runStrategies_(e,t,n,r);return o.length?this.selectSyncPoint_(o,{key:"time",value:r}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const n=this.runStrategies_(e,t,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+or({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,n,r){const o=[];for(let i=0;i<vo.length;i++){const l=vo[i],h=l.run(this,e,t,n,r);h&&(h.strategy=l.name,o.push({strategy:l.name,syncPoint:h}))}return o}selectSyncPoint_(e,t){let n=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),o=e[0].strategy;for(let i=1;i<e.length;i++){const l=Math.abs(e[i].syncPoint[t.key]-t.value);l<r&&(r=l,n=e[i].syncPoint,o=e[i].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${o}]: [time:${n.time}, segmentIndex:${n.segmentIndex}`+("number"==typeof n.partIndex?`,partIndex:${n.partIndex}`:"")+"]"),n}saveExpiredSegmentInfo(e,t){const n=t.mediaSequence-e.mediaSequence;if(n>86400)Dn.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);else for(let i=n-1;i>=0;i--){const n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const o=r.dateTimeObject;r.discontinuity&&t&&o&&(this.timelineToDatetimeMappings[r.timeline]=-o.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,n){const r=e.segment,o=e.part;let l,h,d=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)d={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=d,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${d.time}] [mapping: ${d.mapping}]`)),l=e.startOfSegment,h=t.end+d.mapping;else{if(!d)return!1;l=t.start+d.mapping,h=t.end+d.mapping}return o&&(o.start=l,o.end=h),(!r.start||l<r.start)&&(r.start=l),r.end=h,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let i=0;i<t.discontinuityStarts.length;i++){const r=t.discontinuityStarts[i],o=t.discontinuitySequence+i+1,l=r-e.mediaIndex,h=Math.abs(l);if(!this.discontinuities[o]||this.discontinuities[o].accuracy>h){let time;time=l<0?n.start-or({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):n.end+or({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[o]={time:time,accuracy:h}}}}dispose(){this.trigger("dispose"),this.off()}}class bo extends Dn.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:n}){return"number"==typeof t&&"number"==typeof n&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:n}){return"number"==typeof t&&"number"==typeof n&&(this.lastTimelineChanges_[e]={type:e,from:t,to:n},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var So=ea(ta(ia((function(){var t=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var n=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),o=t.length,l=0;l<o;++l)t[l].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(data){e.push(data)}))},e}();let n=null;class r{constructor(e){let i,t,r;n||(n=function(){const e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],n=e[1],r=t[4],o=n[4];let i,l,h;const d=[],th=[];let c,m,f,s,_,y;for(i=0;i<256;i++)th[(d[i]=i<<1^283*(i>>7))^i]=i;for(l=h=0;!r[l];l^=c||1,h=th[h]||1)for(s=h^h<<1^h<<2^h<<3^h<<4,s=s>>8^255&s^99,r[l]=s,o[s]=l,f=d[m=d[c=d[l]]],y=16843009*f^65537*m^257*c^16843008*l,_=257*d[s]^16843008*s,i=0;i<4;i++)t[i][l]=_=_<<24^_>>>8,n[i][s]=y=y<<24^y>>>8;for(i=0;i<5;i++)t[i]=t[i].slice(0),n[i]=n[i].slice(0);return e}()),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()]];const o=this._tables[0][4],l=this._tables[1],h=e.length;let d=1;if(4!==h&&6!==h&&8!==h)throw new Error("Invalid aes key size");const c=e.slice(0),m=[];for(this._key=[c,m],i=h;i<4*h+28;i++)r=c[i-1],(i%h==0||8===h&&i%h==4)&&(r=o[r>>>24]<<24^o[r>>16&255]<<16^o[r>>8&255]<<8^o[255&r],i%h==0&&(r=r<<8^r>>>24^d<<24,d=d<<1^283*(d>>7))),c[i]=c[i-h]^r;for(t=0;i;t++,i--)r=c[3&t?i:i-4],m[t]=i<=4||t<4?r:l[0][o[r>>>24]]^l[1][o[r>>16&255]]^l[2][o[r>>8&255]]^l[3][o[255&r]]}decrypt(e,t,n,r,o,l){const h=this._key[1];let d,c,m,a=e^h[0],b=r^h[1],f=n^h[2],_=t^h[3];const y=h.length/4-2;let i,v=4;const table=this._tables[1],T=table[0],S=table[1],k=table[2],C=table[3],E=table[4];for(i=0;i<y;i++)d=T[a>>>24]^S[b>>16&255]^k[f>>8&255]^C[255&_]^h[v],c=T[b>>>24]^S[f>>16&255]^k[_>>8&255]^C[255&a]^h[v+1],m=T[f>>>24]^S[_>>16&255]^k[a>>8&255]^C[255&b]^h[v+2],_=T[_>>>24]^S[a>>16&255]^k[b>>8&255]^C[255&f]^h[v+3],v+=4,a=d,b=c,f=m;for(i=0;i<4;i++)o[(3&-i)+l]=E[a>>>24]<<24^E[b>>16&255]<<16^E[f>>8&255]<<8^E[255&_]^h[v++],d=a,a=b,b=f,f=_,_=d}}class o 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(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24};class h{constructor(e,t,n,r){const d=h.STEP,c=new Int32Array(e.buffer),m=new Uint8Array(e.byteLength);let i=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(c.subarray(i,i+d),t,n,m)),i=d;i<c.length;i+=d)n=new Uint32Array([l(c[i-4]),l(c[i-3]),l(c[i-2]),l(c[i-1])]),this.asyncStream_.push(this.decryptChunk_(c.subarray(i,i+d),t,n,m));this.asyncStream_.push((function(){var e;r(null,(e=m).subarray(0,e.byteLength-e[e.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(e,t,n,o){return function(){const h=function(e,t,n){const o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),h=new r(Array.prototype.slice.call(t)),d=new Uint8Array(e.byteLength),c=new Int32Array(d.buffer);let m,f,_,y,v,T,S,k,C;for(m=n[0],f=n[1],_=n[2],y=n[3],C=0;C<o.length;C+=4)v=l(o[C]),T=l(o[C+1]),S=l(o[C+2]),k=l(o[C+3]),h.decrypt(v,T,S,k,c,C),c[C]=l(c[C]^m),c[C+1]=l(c[C+1]^f),c[C+2]=l(c[C+2]^_),c[C+3]=l(c[C+3]^y),m=v,f=T,_=S,y=k;return d}(e,t,n);o.set(h,e.byteOffset)}}}var d,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};d="undefined"!=typeof window?window:void 0!==c?c:"undefined"!=typeof self?self:{};var a,b,m=d.BigInt||Number;m("0x1"),m("0x100"),m("0x10000"),m("0x1000000"),m("0x100000000"),m("0x10000000000"),m("0x1000000000000"),m("0x100000000000000"),m("0x10000000000000000"),a=new Uint16Array([65484]),255===(b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength))[0]||b[0];const f=function(e){const t={};return Object.keys(e).forEach((n=>{const r=e[n];var o;o=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(o):o&&o.buffer instanceof ArrayBuffer)?t[n]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[n]=r})),t};self.onmessage=function(e){const data=e.data,t=new Uint8Array(data.encrypted.bytes,data.encrypted.byteOffset,data.encrypted.byteLength),n=new Uint32Array(data.key.bytes,data.key.byteOffset,data.key.byteLength/4),r=new Uint32Array(data.iv.bytes,data.iv.byteOffset,data.iv.byteLength/4);new h(t,n,r,(function(e,t){self.postMessage(f({source:data.source,decrypted:t}),[t.buffer])}))}}))));const ko=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Co=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Eo=(e,t)=>{t.activePlaylistLoader=e,e.load()},wo={AUDIO:(e,t)=>()=>{const{segmentLoaders:{[e]:n},mediaTypes:{[e]:r},excludePlaylist:o}=t;Co(n,r);const l=r.activeTrack(),h=r.activeGroup(),d=(h.filter((e=>e.default))[0]||h[0]).id,c=r.tracks[d];if(l!==c){Dn.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in r.tracks)r.tracks[e].enabled=r.tracks[e]===c;r.onTrackChanged()}else o({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{segmentLoaders:{[e]:n},mediaTypes:{[e]:r}}=t;Dn.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Co(n,r);const track=r.activeTrack();track&&(track.mode="disabled"),r.onTrackChanged()}},xo={AUDIO:(e,t,n)=>{if(!t)return;const{tech:r,requestOptions:o,segmentLoaders:{[e]:l}}=n;t.on("loadedmetadata",(()=>{const e=t.media();l.playlist(e,o),(!r.paused()||e.endList&&"none"!==r.preload())&&l.load()})),t.on("loadedplaylist",(()=>{l.playlist(t.media(),o),r.paused()||l.load()})),t.on("error",wo[e](e,n))},SUBTITLES:(e,t,n)=>{const{tech:r,requestOptions:o,segmentLoaders:{[e]:l},mediaTypes:{[e]:h}}=n;t.on("loadedmetadata",(()=>{const e=t.media();l.playlist(e,o),l.track(h.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&l.load()})),t.on("loadedplaylist",(()=>{l.playlist(t.media(),o),r.paused()||l.load()})),t.on("error",wo[e](e,n))}},Io={AUDIO:(e,t)=>{const{vhs:n,sourceType:r,segmentLoaders:{[e]:o},requestOptions:l,main:{mediaGroups:h},mediaTypes:{[e]:{groups:d,tracks:c,logger_:m}},mainPlaylistLoader:f}=t,_=_r(f.main);h[e]&&0!==Object.keys(h[e]).length||(h[e]={main:{default:{default:!0}}},_&&(h[e].main.default.playlists=f.main.playlists));for(const o in h[e]){d[o]||(d[o]=[]);for(const y in h[e][o]){let v,T=h[e][o][y];if(_?(m(`AUDIO group '${o}' label '${y}' is a main playlist`),T.isMainPlaylist=!0,v=null):v="vhs-json"===r&&T.playlists?new Or(T.playlists[0],n,l):T.resolvedUri?new Or(T.resolvedUri,n,l):T.playlists&&"dash"===r?new Yr(T.playlists[0],n,l,f):null,T=Hn({id:y,playlistLoader:v},T),xo[e](e,T.playlistLoader,t),d[o].push(T),void 0===c[y]){const track=new Dn.AudioTrack({id:y,kind:ko(T),enabled:!1,language:T.language,default:T.default,label:y});c[y]=track}}}o.on("error",wo[e](e,t))},SUBTITLES:(e,t)=>{const{tech:n,vhs:r,sourceType:o,segmentLoaders:{[e]:l},requestOptions:h,main:{mediaGroups:d},mediaTypes:{[e]:{groups:c,tracks:m}},mainPlaylistLoader:f}=t;for(const l in d[e]){c[l]||(c[l]=[]);for(const _ in d[e][l]){if(d[e][l][_].forced)continue;let y,v=d[e][l][_];if("hls"===o)y=new Or(v.resolvedUri,r,h);else if("dash"===o){if(!v.playlists.filter((p=>p.excludeUntil!==1/0)).length)return;y=new Yr(v.playlists[0],r,h,f)}else"vhs-json"===o&&(y=new Or(v.playlists?v.playlists[0]:v.resolvedUri,r,h));if(v=Hn({id:_,playlistLoader:y},v),xo[e](e,v.playlistLoader,t),c[l].push(v),void 0===m[_]){const track=n.addRemoteTextTrack({id:_,kind:"subtitles",default:v.default&&v.autoselect,language:v.language,label:_},!1).track;m[_]=track}}}l.on("error",wo[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:n,main:{mediaGroups:r},mediaTypes:{[e]:{groups:o,tracks:l}}}=t;for(const t in r[e]){o[t]||(o[t]=[]);for(const h in r[e][t]){const d=r[e][t][h];if(!/^(?:CC|SERVICE)/.test(d.instreamId))continue;const c=n.options_.vhs&&n.options_.vhs.captionServices||{};let m={label:h,language:d.language,instreamId:d.instreamId,default:d.default&&d.autoselect};if(c[m.instreamId]&&(m=Hn(m,c[m.instreamId])),void 0===m.default&&delete m.default,o[t].push(Hn({id:h},d)),void 0===l[h]){const track=n.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;l[h]=track}}}}},Po=(e,t)=>{for(let i=0;i<e.length;i++){if(gr(t,e[i]))return!0;if(e[i].playlists&&Po(e[i].playlists,t))return!0}return!1},Ao={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const e in n)if(n[e].enabled)return n[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:n}}}=t;for(const e in n)if("showing"===n[e].mode||"hidden"===n[e].mode)return n[e];return null}},Lo=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{Io[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:n,tech:r,vhs:o,segmentLoaders:{AUDIO:l,main:h}}=e;["AUDIO","SUBTITLES"].forEach((n=>{t[n].activeGroup=((e,t)=>track=>{const{mainPlaylistLoader:n,mediaTypes:{[e]:{groups:r}}}=t,o=n.media();if(!o)return null;let l=null;o.attributes[e]&&(l=r[o.attributes[e]]);const h=Object.keys(r);if(!l)if("AUDIO"===e&&h.length>1&&_r(t.main))for(let i=0;i<h.length;i++){const e=r[h[i]];if(Po(e,o)){l=e;break}}else r.main?l=r.main:1===h.length&&(l=r[h[0]]);return void 0===track?l:null!==track&&l&&l.filter((e=>e.id===track.id))[0]||null})(n,e),t[n].activeTrack=Ao[n](n,e),t[n].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:n,main:r},mediaTypes:{[e]:o}}=t,l=o.activeTrack(),h=o.getActiveGroup(),d=o.activePlaylistLoader,c=o.lastGroup_;h&&c&&h.id===c.id||(o.lastGroup_=h,o.lastTrack_=l,Co(n,o),h&&!h.isMainPlaylist&&(h.playlistLoader?(n.resyncLoader(),Eo(h.playlistLoader,o)):d&&r.resetEverything()))})(n,e),t[n].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:n},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,n.abort(),n.pause()})(n,e),t[n].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:n,segmentLoaders:{[e]:r,main:o},mediaTypes:{[e]:l}}=t,h=l.activeTrack(),d=l.getActiveGroup(),c=l.activePlaylistLoader,m=l.lastTrack_;if((!m||!h||m.id!==h.id)&&(l.lastGroup_=d,l.lastTrack_=h,Co(r,l),d)){if(d.isMainPlaylist){if(!h||!m||h.id===m.id)return;const e=t.vhs.playlistController_,r=e.selectPlaylist();if(e.media()===r)return;return l.logger_(`track change. Switching main audio from ${m.id} to ${h.id}`),n.pause(),o.resetEverything(),void e.fastQualityChange_(r)}if("AUDIO"===e){if(!d.playlistLoader)return o.setAudio(!0),void o.resetEverything();r.setAudio(!0),o.setAudio(!1)}c!==d.playlistLoader?(r.track&&r.track(h),r.resetEverything(),Eo(d.playlistLoader,l)):Eo(d.playlistLoader,l)}})(n,e),t[n].getActiveGroup=((e,{mediaTypes:t})=>()=>{const n=t[e].activeTrack();return n?t[e].activeGroup(n):null})(n,e)}));const d=t.AUDIO.activeGroup();if(d){const e=(d.filter((e=>e.default))[0]||d[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged();t.AUDIO.getActiveGroup().playlistLoader?(h.setAudio(!1),l.setAudio(!0)):h.setAudio(!0)}n.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),n.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const c=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",c),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),o.on("dispose",(()=>{r.audioTracks().removeEventListener("change",c),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),r.clearTracks("audio");for(const e in t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[e])};let Oo;const Do=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Mo=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class Uo extends Dn.EventTarget{constructor(e){super();const{src:t,withCredentials:n,tech:r,bandwidth:l,externVhs:h,useCueTags:d,playlistExclusionDuration:c,enableLowInitialPlaylist:m,sourceType:f,cacheEncryptionKeys:_,bufferBasedABR:y,leastPixelDiffSelector:v,captionServices:T}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:S}=e;null==S&&(S=1/0),Oo=h,this.bufferBasedABR=Boolean(y),this.leastPixelDiffSelector=Boolean(v),this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=f,this.useCueTags_=d,this.playlistExclusionDuration=c,this.maxPlaylistRetries=S,this.enableLowInitialPlaylist=m,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_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ka,activeTrack:Ka,getActiveGroup:Ka,onGroupChanged:Ka,onTrackChanged:Ka,lastTrack_:null,logger_:$n(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new o.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_=qn(),this.hasPlayed_=!1,this.syncController_=new To(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new So,this.sourceUpdater_=new mo(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new bo;const k={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:T,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:l,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings};this.mainPlaylistLoader_="dash"===this.sourceType_?new Yr(t,this.vhs_,this.requestOptions_):new Or(t,this.vhs_,this.requestOptions_),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ga(Hn(k,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ga(Hn(k,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new _o(Hn(k,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),Do.forEach((e=>{this[e+"_"]=Mo.bind(this,e)})),this.logger_=$n("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const C="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(C,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const main=this.mainAppendsToLoadedData_(),audio=this.audioAppendsToLoadedData_();return-1===main||-1===audio?-1:main+audio}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,n){const r=this.media(),o=r&&(r.id||r.uri),l=e.id||e.uri;o&&o!==l&&(this.logger_(`switch media ${o} -> ${l} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,n)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=o.a.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(o.a.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const main=this.main(),e=main&&main.playlists||[];if(!main||!main.mediaGroups||!main.mediaGroups.AUDIO)return e;const t=main.mediaGroups.AUDIO,n=Object.keys(t);let track;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)track=this.mediaTypes_.AUDIO.activeTrack();else{const e=t.main||n.length&&t[n[0]];for(const label in e)if(e[label].default){track={label:label};break}}if(!track)return e;const r=[];for(const e in t)if(t[e][track.label]){const n=t[e][track.label];if(n.playlists&&n.playlists.length)r.push.apply(r,n.playlists);else if(n.uri)r.push(n);else if(main.playlists.length)for(let i=0;i<main.playlists.length;i++){const t=main.playlists[i];t.attributes&&t.attributes.AUDIO&&t.attributes.AUDIO===e&&r.push(t)}}return r.length?r:e}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;mr(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Lo({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){let t;if(this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t))return;this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial");if(!("vhs-json"===this.sourceType_&&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(),t=1.5*e.targetDuration*1e3;mr(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,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("playlist-unchanged"===e.lastExcludeReason_)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_(main,e){const t=main.mediaGroups||{};let n=!0;const r=Object.keys(t.AUDIO);for(const e in t.AUDIO)for(const label in t.AUDIO[e]){t.AUDIO[e][label].uri||(n=!1)}n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(t.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Oo.Playlist.isAes(e)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(t.AUDIO[r[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 t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),o=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:n,nextPlaylist:r,bufferLowWaterLine:o,bufferHighWaterLine:l,duration:h,bufferBasedABR:d,log:c}){if(!r)return Dn.log.warn("We received no playlist to switch to. Please check your stream."),!1;const m=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return c(`${m} as current playlist is not set`),!0;if(r.id===e.id)return!1;const f=Boolean(Gn(t,n).length);if(!e.endList)return f||"number"!=typeof e.partTargetDuration?(c(`${m} as current playlist is live`),!0):(c(`not ${m} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const _=Jn(t,n),y=d?Jr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Jr.MAX_BUFFER_LOW_WATER_LINE;if(h<y)return c(`${m} as duration < max low water line (${h} < ${y})`),!0;const v=r.attributes.BANDWIDTH,T=e.attributes.BANDWIDTH;if(v<T&&(!d||_<l)){let e=`${m} as next bandwidth < current bandwidth (${v} < ${T})`;return d&&(e+=` and forwardBuffer < bufferHighWaterLine (${_} < ${l})`),c(e),!0}if((!d||v>T)&&_>=o){let e=`${m} as forwardBuffer >= bufferLowWaterLine (${_} >= ${o})`;return d&&(e+=` and next bandwidth > current bandwidth (${v} > ${T})`),c(e),!0}return c(`not ${m} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:o,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{const e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),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",(e=>{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:120}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};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()){e!==this.mainPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((()=>{Dn.browser.IE_VERSION||Dn.browser.IS_EDGE?this.tech_.setCurrentTime(this.tech_.currentTime()+.04):this.tech_.setCurrentTime(this.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList){const e=this.seekable();if(!e.length)return!1;if(Dn.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(()=>{this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0)),this.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0))}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(e=>{}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const n=Oo.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),o=this.tech_.buffered();if(!o.length)return n-r<=Wn;const l=o.end(o.length-1);return l-r<=Wn&&n-l<=Wn}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,o=r.filter(cr),l=1===o.length&&o[0]===e;if(1===r.length&&n!==1/0)return Dn.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(l);if(l){let t=!1;r.forEach((n=>{if(n===e)return;const r=n.excludeUntil;void 0!==r&&r!==1/0&&(t=!0,delete n.excludeUntil)})),t&&(Dn.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let h;h=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*n,e.excludeUntil=h,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const d=this.selectPlaylist();if(!d)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const c=t.internal?this.logger_:Dn.log.warn,m=t.message?" "+t.message:"";c(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${d.id}.`),d.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),d.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const f=d.targetDuration/2*1e3||5e3,_="number"==typeof d.lastRequest&&Date.now()-d.lastRequest<=f;return this.switchMedia_(d,"exclude",l||_)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(filter,e){const t=[],n="all"===filter;(n||"main"===filter)&&t.push(this.mainPlaylistLoader_);const r=[];(n||"audio"===filter)&&r.push("AUDIO"),(n||"subtitle"===filter)&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach((e=>{const n=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;n&&t.push(n)})),["main","audio","subtitle"].forEach((e=>{const n=this[`${e}SegmentLoader_`];!n||filter!==e&&"all"!==filter||t.push(n)})),t.forEach((t=>e.forEach((e=>{"function"==typeof t[e]&&t[e]()}))))}setCurrentTime(e){const t=Gn(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Oo.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let n=this.syncController_.getExpiredTime(t,this.duration());if(null===n)return;const main=this.mainPlaylistLoader_.main,r=Oo.Playlist.seekable(t,n,Oo.Playlist.liveEdgeDelay(main,t));if(0===r.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),n=this.syncController_.getExpiredTime(t,this.duration()),null===n)return;if(e=Oo.Playlist.seekable(t,n,Oo.Playlist.liveEdgeDelay(main,t)),0===e.length)return}let o,l;this.seekable_&&this.seekable_.length&&(o=this.seekable_.end(0),l=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=qn([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===o&&this.seekable_.start(0)===l||(this.logger_(`seekable updated [${Qn(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){const e=this.seekable();if(!e.length)return;return void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1)))}const t=this.tech_.buffered();let n=Oo.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(n=Math.max(n,t.end(t.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{const t=this.mediaTypes_[e].groups;for(const e in t)t[e].forEach((e=>{e.playlistLoader&&e.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,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};e.video=e.main;const t=Aa(this.main(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=t.video||e.main.videoCodec||w.b),e.main.isMuxed&&(n.video+=`,${t.audio||e.main.audioCodec||w.a}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=t.audio||e.main.audioCodec||e.audio.audioCodec||w.a,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video)return void this.excludePlaylist({playlistToExclude:this.media(),error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const o={};let l;if(["video","audio"].forEach((function(t){if(n.hasOwnProperty(t)&&(r=e[t].isFmp4,h=n[t],!(r?Object(w.c)(h):Object(w.g)(h)))){const r=e[t].isFmp4?"browser":"muxer";o[r]=o[r]||[],o[r].push(n[t]),"audio"===t&&(l=r)}var r,h})),r&&l&&this.media().attributes.AUDIO){const e=this.media().attributes.AUDIO;this.main().playlists.forEach((t=>{(t.attributes&&t.attributes.AUDIO)===e&&t!==this.media()&&(t.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${l} does not support codec(s): "${n.audio}"`)}if(!Object.keys(o).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const r=(Object(w.h)(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,o=(Object(w.h)(n[t]||"")[0]||{}).type;r&&o&&r.toLowerCase()!==o.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${n[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:this.media(),error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}{const e=Object.keys(o).reduce(((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${o[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:this.media(),error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((n=>{const r=e[n];if(-1!==t.indexOf(r.id))return;t.push(r.id);const o=Aa(this.main,r),l=[];!o.audio||Object(w.g)(o.audio)||Object(w.c)(o.audio)||l.push(`audio codec ${o.audio}`),!o.video||Object(w.g)(o.video)||Object(w.c)(o.video)||l.push(`video codec ${o.video}`),o.text&&"stpp.ttml.im1t"===o.text&&l.push(`text codec ${o.text}`),l.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${l.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],n=this.main().playlists,r=Ia(Object(w.h)(e)),o=Pa(r),l=r.video&&Object(w.h)(r.video)[0]||null,h=r.audio&&Object(w.h)(r.audio)[0]||null;Object.keys(n).forEach((e=>{const r=n[e];if(-1!==t.indexOf(r.id)||r.excludeUntil===1/0)return;t.push(r.id);const d=[],c=Aa(this.mainPlaylistLoader_.main,r),m=Pa(c);if(c.audio||c.video){if(m!==o&&d.push(`codec count "${m}" !== "${o}"`),!this.sourceUpdater_.canChangeType()){const e=c.video&&Object(w.h)(c.video)[0]||null,t=c.audio&&Object(w.h)(c.audio)[0]||null;e&&l&&e.type.toLowerCase()!==l.type.toLowerCase()&&d.push(`video codec "${e.type}" !== "${l.type}"`),t&&h&&t.type.toLowerCase()!==h.type.toLowerCase()&&d.push(`audio codec "${t.type}" !== "${h.type}"`)}d.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id}: ${d.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const n=this.seekable();n.length&&(t=n.start(0)),function(e,track,t=0){if(!e.segments)return;let n,r=t;for(let i=0;i<e.segments.length;i++){const t=e.segments[i];if(n||(n=yo(track,r+t.duration/2)),n){if("cueIn"in t){n.endTime=r,n.adEndTime=r,r+=t.duration,n=null;continue}if(r<n.endTime){r+=t.duration;continue}n.endTime+=t.duration}else if("cueOut"in t&&(n=new o.a.VTTCue(r,r+t.duration,t.cueOut),n.adStartTime=r,n.adEndTime=r+parseFloat(t.cueOut),track.addCue(n)),"cueOutCont"in t){const[e,l]=t.cueOutCont.split("/").map(parseFloat);n=new o.a.VTTCue(r,r+t.duration,""),n.adStartTime=r-e,n.adEndTime=n.adStartTime+l,track.addCue(n)}r+=t.duration}}(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Jr.GOAL_BUFFER_LENGTH,n=Jr.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Jr.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Jr.BUFFER_LOW_WATER_LINE,n=Jr.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Jr.MAX_BUFFER_LOW_WATER_LINE),o=Math.max(t,Jr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?o:r)}bufferHighWaterLine(){return Jr.BUFFER_HIGH_WATER_LINE}}class Ro{constructor(e,t,n){const{playlistController_:r}=e,o=r.fastQualityChange_.bind(r);if(t.attributes){const e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}var l,h,d;this.codecs=Aa(r.main(),t),this.playlist=t,this.id=n,this.enabled=(l=e.playlists,h=t.id,d=o,e=>{const t=l.main.playlists[h],n=ur(t),r=cr(t);return void 0===e?r:(e?delete t.disabled:t.disabled=!0,e===r||n||(d(),e?l.trigger("renditionenabled"):l.trigger("renditiondisabled")),e)})}}const No=["seeking","seeked","pause","playing","error"];class Bo{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_=$n("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),l=()=>this.resetTimeUpdate_(),h=this.playlistController_,d=["main","subtitle","audio"],c={};d.forEach((e=>{c[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},h[`${e}SegmentLoader_`].on("appendsdone",c[e].updateend),h[`${e}SegmentLoader_`].on("playlistupdate",c[e].reset),this.tech_.on(["seeked","seeking"],c[e].reset)}));const m=e=>{["main","audio"].forEach((t=>{h[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),m("off"))},this.clearSeekingAppendCheck_=()=>m("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),m("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(No,l),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(No,l),this.tech_.off("canplay",n),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),d.forEach((e=>{h[`${e}SegmentLoader_`].off("appendsdone",c[e].updateend),h[`${e}SegmentLoader_`].off("playlistupdate",c[e].reset),this.tech_.off(["seeked","seeking"],c[e].reset)})),this.checkCurrentTimeTimeout_&&o.a.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&o.a.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=o.a.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=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_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,n=t[`${e}SegmentLoader_`],r=n.buffered_(),o=function(a,b){if(a===b)return!1;if(!a&&b||!b&&a)return!0;if(a.length!==b.length)return!0;for(let i=0;i<a.length;i++)if(a.start(i)!==b.start(i)||a.end(i)!==b.end(i))return!0;return!1}(this[`${e}Buffered_`],r);this[`${e}Buffered_`]=r,o?this.resetSegmentDownloads_(e):(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:Xn(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`}),"subtitle"!==e&&t.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(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Wn>=t.end(t.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 e=this.seekable(),t=this.tech_.currentTime();let n;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){n=e.end(e.length-1)}if(this.beforeSeekableWindow_(e,t)){const t=e.start(0);n=t+(t===e.end(0)?0:Wn)}if(void 0!==n)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Qn(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const r=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),l=r.audioBuffer?r.audioBuffered():null,h=r.videoBuffer?r.videoBuffered():null,d=this.media(),c=d.partTargetDuration?d.partTargetDuration:2*(d.targetDuration-Vn),m=[l,h];for(let i=0;i<m.length;i++){if(!m[i])continue;if(Jn(m[i],t)<c)return!1}const f=Kn(o,t);return 0!==f.length&&(n=f.start(0)+Wn,this.logger_(`Buffered region starts (${f.start(0)})  just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),n=Gn(t,e);return n.length&&e+3<=n.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${n.start(0)} -> ${n.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const n=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${n}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),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:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const o=Kn(r,t);return o.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${o.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,n,r=!1){if(!e.length)return!1;let o=e.end(e.length-1)+Wn;return!n.endList&&r&&(o=e.end(e.length-1)+3*n.targetDuration),t>o}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:n}){if(!e)return;let r;if(e.length&&t.length){const o=Gn(e,n-3),l=Gn(e,n),h=Gn(t,n);h.length&&!l.length&&o.length&&(r={start:o.end(0),end:h.end(0)})}else{Kn(e,n).length||(r=this.gapFromVideoUnderflow_(e,n))}return!!r&&(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${n}`),!0)}skipTheGap_(e){const t=this.tech_.buffered(),n=this.tech_.currentTime(),r=Kn(t,n);this.resetTimeUpdate_(),0!==r.length&&n===e&&(this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+Vn),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){const n=function(e){if(e.length<2)return qn();const t=[];for(let i=1;i<e.length;i++){const n=e.end(i-1),r=e.start(i);t.push([n,r])}return qn(t)}(e);for(let i=0;i<n.length;i++){const e=n.start(i),r=n.end(i);if(t-e<4&&t-e>2)return{start:e,end:r}}return null}}const Fo={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},jo=function(e,t){let n=0,r=0;const o=Hn(Fo,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const l=function(){r&&e.currentTime(r)},h=function(t){null!=t&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",l),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},d=function(){if(Date.now()-n<1e3*o.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(o.getSource&&"function"==typeof o.getSource)return n=Date.now(),o.getSource.call(e,h);Dn.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},c=function(){e.off("loadedmetadata",l),e.off("error",d),e.off("dispose",c)};e.on("error",d),e.on("dispose",c),e.reloadSourceOnError=function(t){c(),jo(e,t)}},$o=function(e){jo(this,e)};var Ho="3.0.0";const qo={PlaylistLoader:Or,Playlist:yr,utils:Vr,STANDARD_PLAYLIST_SELECTOR:Na,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(yr.isEnabled);Ma(e,((a,b)=>Ua(a,b)));return e.filter((e=>!!Aa(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:Na,movingAverageBandwidthSelector:function(e){let t=-1,n=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const r=this.useDevicePixelRatio&&o.a.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,n=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==n&&(t=e*this.systemBandwidth+(1-e)*t,n=this.systemBandwidth),Ra(this.playlists.main,t,parseInt(Da(this.tech_.el(),"width"),10)*r,parseInt(Da(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:Ua,comparePlaylistResolution:function(e,t){let n,r;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||o.a.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),r=r||o.a.Number.MAX_VALUE,n===r&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:n-r},xhr:Ur()};Object.keys(Jr).forEach((e=>{Object.defineProperty(qo,e,{get:()=>(Dn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Jr[e]),set(t){Dn.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?Dn.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Jr[e]=t}})}));const Vo="videojs-vhs",Wo=function(e,t){const n=t.media();let r=-1;for(let i=0;i<e.length;i++)if(e[i].id===n.id){r=i;break}e.selectedIndex_=r,e.trigger({selectedIndex:r,type:"change"})};qo.canPlaySource=function(){return Dn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const zo=({player:e,sourceKeySystems:t,audioMedia:n,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const o=((e,t)=>e.reduce(((e,n)=>{if(!n.contentProtection)return e;const r=t.reduce(((e,t)=>{const r=n.contentProtection[t];return r&&r.pssh&&(e[t]={pssh:r.pssh}),e}),{});return Object.keys(r).length&&e.push(r),e}),[]))(n?r.concat([n]):r,Object.keys(t)),l=[],h=[];return o.forEach((t=>{h.push(new Promise(((t,n)=>{e.tech_.one("keysessioncreated",t)}))),l.push(new Promise(((n,r)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?r(e):n()}))})))})),Promise.race([Promise.all(l),Promise.race(h)])},Go=({player:e,sourceKeySystems:t,media:n,audioMedia:r})=>{const o=((e,t,n)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=Ia(Object(w.h)(t.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(r.audio=n.attributes.CODECS);const o=Object(w.e)(r.video),l=Object(w.e)(r.audio),h={};for(const n in e)h[n]={},l&&(h[n].audioContentType=l),o&&(h[n].videoContentType=o),t.contentProtection&&t.contentProtection[n]&&t.contentProtection[n].pssh&&(h[n].pssh=t.contentProtection[n].pssh),"string"==typeof e[n]&&(h[n].url=e[n]);return Hn(e,h)})(t,n,r);return!!o&&(e.currentSource().keySystems=o,!(o&&!e.eme)||(Dn.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Ko=()=>{if(!o.a.localStorage)return null;const e=o.a.localStorage.getItem(Vo);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};qo.supportsNativeHls=function(){if(!h.a||!h.a.createElement)return!1;const video=h.a.createElement("video");if(!Dn.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(e){return/maybe|probably/i.test(video.canPlayType(e))}))}(),qo.supportsNativeDash=!!(h.a&&h.a.createElement&&Dn.getTech("Html5").isSupported())&&/maybe|probably/i.test(h.a.createElement("video").canPlayType("application/dash+xml")),qo.supportsTypeNatively=e=>"hls"===e?qo.supportsNativeHls:"dash"===e&&qo.supportsNativeDash,qo.isSupported=function(){return Dn.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Qo=Dn.getComponent("Component");class Xo extends Qo{constructor(source,e,t){if(super(e,t.vhs),"number"==typeof t.initialBandwidth&&(this.options_.bandwidth=t.initialBandwidth),this.logger_=$n("VhsHandler"),e.options_&&e.options_.playerId){const t=Dn.getPlayer(e.options_.playerId);this.player_=t}if(this.tech_=e,this.source_=source,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&e.overrideNativeAudioTracks&&e.overrideNativeVideoTracks)e.overrideNativeAudioTracks(!0),e.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(e.featuresNativeVideoTracks||e.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(h.a,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=h.a.fullscreenElement||h.a.webkitFullscreenElement||h.a.mozFullScreenElement||h.a.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1: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=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){const e=Ko();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"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Jr.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Jr.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((option=>{void 0!==this.source_[option]&&(this.options_[option]=this.source_[option])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;var n;this.setOptions_(),this.options_.src=0===(n=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(n.substring(n.indexOf(",")+1)):n,this.options_.tech=this.tech_,this.options_.externVhs=qo,this.options_.sourceType=Object(x.a)(t),this.options_.seekTo=time=>{this.tech_.setCurrentTime(time)},this.playlistController_=new Uo(this.options_);const r=Hn({liveRangeSafeTimeDelta:Wn},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Bo(r),this.playlistController_.on("error",(()=>{const e=Dn.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const l=this.options_.bufferBasedABR?qo.movingAverageBandwidthSelector(.55):qo.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):l.bind(this),this.playlistController_.selectInitialPlaylist=qo.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(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;const t=o.a.navigator.connection||o.a.navigator.mozConnection||o.a.navigator.webkitConnection,n=1e7;if(this.options_.useNetworkInformationApi&&t){const r=1e3*t.downlink*1e3;e=r>=n&&e>=n?Math.max(e,r):r}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;t=this.throughput>0?1/this.throughput:0;return Math.floor(1/(e+t))},set(){Dn.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:()=>Xn(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:()=>Xn(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&&(e=>{if(!o.a.localStorage)return!1;let t=Ko();t=t?Hn(t,e):e;try{o.a.localStorage.setItem(Vo,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const main=e.playlistController_.main(),t=_r(main)?e.playlistController_.getAudioTrackPlaylists_():main.playlists;return t?t.filter((e=>!ur(e))).map(((t,i)=>new Ro(e,t,t.id))):[]}})),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_=o.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"),zo({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((e=>{this.logger_("error while creating EME key session",e),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,t=Go({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"!==e.status)return;const t=this.playlistController_.main();if(!t||!t.playlists)return;const n=[];t.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,n.push(e))})),n.length&&(Dn.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.',...n),this.playlistController_.fastQualityChange_())})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==Dn.browser.IE_VERSION&&t?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=Dn.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{!function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Wo(e,t.playlists)}(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Wo(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":Ho,"mux.js":"6.2.0","mpd-parser":"1.0.1","m3u8-parser":"6.0.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return mo.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_&&o.a.URL.revokeObjectURL&&(o.a.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(time,e){return Wr({playlist:this.playlistController_.media(),time:time,callback:e})}seekToProgramTime(e,t,n=!0,r=2){return zr({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}const Yo={name:"videojs-http-streaming",VERSION:Ho,canHandleSource(e,t={}){const n=Hn(Dn.options,t);return Yo.canPlayType(e.type,n)},handleSource(source,e,t={}){const n=Hn(Dn.options,t);return e.vhs=new Xo(source,e,n),e.vhs.xhr=Ur(),e.vhs.src(source.src,source.type),e.vhs},canPlayType(e,t={}){const{vhs:{overrideNative:n=!Dn.browser.IS_ANY_SAFARI}={}}=Hn(Dn.options,t),r=Object(x.a)(e);return r&&(!qo.supportsTypeNatively(r)||n)?"maybe":""}};Object(w.c)("avc1.4d400d,mp4a.40.2")&&Dn.getTech("Html5").registerSourceHandler(Yo,0),Dn.VhsHandler=Xo,Dn.VhsSourceHandler=Yo,Dn.Vhs=qo,Dn.use||Dn.registerComponent("Vhs",qo),Dn.options.vhs=Dn.options.vhs||{},Dn.getPlugin&&Dn.getPlugin("reloadSourceOnError")||Dn.registerPlugin("reloadSourceOnError",$o)}.call(this,n(65))}}]);

NineSec Team - 2022